Установка, настройка и тестирования Refinery CMS (Ruby on Rails)
В этом посте я расскажу, как я ставил Refinery cms. Это первая CMS, которую мне удалось опробовать из тех, что доступны на Ruby on Rails, да и количество гемов для неё подкупает.
Установка
gem install refinerycms
refinerycms path/to/my_new_app –database=mysql
Когда на экране будет этап создания базы делаем Ctrl+C и прерываем установку, т.к. пароля мы ещё не задали. Хотя если есть доступ root без пароля к базе, то она сама всё поставил. Пишем пароль в configuration/enviroment.rb и запускаем
rake db:create
rake db:setup
rails server
Заходим на http://localhost:3000/ и любуемся сайтом. А вот как выглядит админка:
Нагрузочное тестирование
andrey@vaio:~$ ab -c 5 -n 10 http://localhost:3000/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/Benchmarking localhost (be patient)…..done
Server Software: WEBrick/1.3.1
Server Hostname: localhost
Server Port: 3000Document Path: /
Document Length: 1843 bytesConcurrency Level: 5
Time taken for tests: 6.226 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 24510 bytes
HTML transferred: 18430 bytes
Requests per second: 1.61 [#/sec] (mean)
Time per request: 3113.164 [ms] (mean)
Time per request: 622.633 [ms] (mean, across all concurrent requests)
Transfer rate: 3.84 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 0
Processing: 680 2519 877.4 3061 3150
Waiting: 680 2514 883.3 3061 3145
Total: 680 2519 877.3 3061 3151Percentage of the requests served within a certain time (ms)
50% 3061
66% 3075
75% 3104
80% 3109
90% 3151
95% 3151
98% 3151
99% 3151
100% 3151 (longest request)
andrey@vaio:~$
Три секунды на одну страницу. Результат прямо скажем не очень. Теперь попробуем запустить Refinery в production режиме:
rake db:setup RAILS_ENV=’production’
rails server -e production
Опять заходим на http://localhost:3000/ и настраиваем CMS’ку. Далее запускаем тот же тест:
andrey@vaio:~$ ab -c 5 -n 10 http://localhost:3000/
Benchmarking localhost (be patient)…..done
Server Software: WEBrick/1.3.1
Server Hostname: localhost
Server Port: 3000Document Path: /
Document Length: 1830 bytesConcurrency Level: 5
Time taken for tests: 0.240 seconds
Complete requests: 10
Failed requests: 0
Write errors: 0
Total transferred: 22112 bytes
HTML transferred: 18300 bytes
Requests per second: 41.65 [#/sec] (mean)
Time per request: 120.044 [ms] (mean)
Time per request: 24.009 [ms] (mean, across all concurrent requests)
Transfer rate: 89.94 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 1.2 1 3
Processing: 31 109 46.3 136 162
Waiting: 31 108 45.4 135 161
Total: 31 110 47.2 139 164Percentage of the requests served within a certain time (ms)
50% 139
66% 146
75% 156
80% 157
90% 164
95% 164
98% 164
99% 164
100% 164 (longest request)
andrey@vaio:~$
Почувствуете разницу. А теперь запустим тесты посерьезней 🙂
andrey@vaio:~$ ab -c 50 -n 200 http://localhost:3000/
Benchmarking localhost (be patient)
Completed 100 requests
Completed 200 requests
Finished 200 requests
Server Software: WEBrick/1.3.1
Server Hostname: localhost
Server Port: 3000
Document Path: /
Document Length: 1830 bytes
Concurrency Level: 50
Time taken for tests: 2.377 seconds
Complete requests: 200
Failed requests: 0
Write errors: 0
Total transferred: 437262 bytes
HTML transferred: 366000 bytes
Requests per second: 84.13 [#/sec] (mean)
Time per request: 594.312 [ms] (mean)
Time per request: 11.886 [ms] (mean, across all concurrent requests)
Transfer rate: 179.63 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.3 0 8
Processing: 9 160 113.2 141 599
Waiting: 8 158 113.4 128 599
Total: 9 160 114.1 141 601
Percentage of the requests served within a certain time (ms)
50% 141
66% 158
75% 162
80% 165
90% 181
95% 542
98% 579
99% 593
100% 601 (longest request)
andrey@vaio:~$
Отлично, время обработки запроса не превысило 150 мс для половины запросов при конкурентности 50 при 200 запросах. Хороший показатель.
Здравствуйте, Андрей! Подскажите, что делать с такой ошибкой:
C:\Users\Alexander\ror>refinerycms cms -database=mysql
C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:274:in
activate'
activate’: can't activate activesupport (= 3.0.3, runtime) for ["rails-3.0.3", "refineryc
ms-0.9.9"], already activated activesupport-3.0.4 for ["activerecord-3.0.4", "gl
obalize3-0.1.0.beta", "refinerycms-0.9.9"] (Gem::LoadError)
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:290:
in
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:289:
in
each'
activate’from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:289:
in
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:290:
in
activate'
each’from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:289:
in
from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:289:
in
activate'
gem’from C:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems.rb:1204
:in
from C:/RailsInstaller/Ruby1.8.7/bin/refinerycms:18
Гем установлен.
да, оба активсуппорта установлены, если оставить один любой — всё равно ошибка
Александр, вы пробовали только отключить его или полностью удаляли?
Попробуйте полностью удалить 3.0.3 (sudo gem uninstall activesupport -v 3.0.3) и убрать зависимость от него в enviroment.rb
http://stackoverflow.com/questions/1199421/cant-activate-activesupport-2-3-2-runtime-already-activated-activesupport
http://stackoverflow.com/questions/4309867/gem-using-wrong-activesupport-version-3-0-3-and-should-use-2-3-9-when-deployed
эти темы нагугливал, пробовал удалять и ставить по одному — ругается, что нет другого 🙁