Rails (Redmine) speedup without touching Ruby code
Our customer experienced very long response time in his Easy Redmine (RoR) application. Easy Redmine was running on customer's Debian virtual server.
Easy Software Ltd. has completed an internal "how-to" for speeding up Ruby On Rails applications just by fine-tuning individual components of Easy Redmine (RoR) production environment consisting of a web server, an application server and a database server.
This was tested only on Linux servers running CentOS and Ubuntu / Debian
This "how-to" requires an advanced Linux knowledge.
Easy recommendations for faster RoR applications
Use Nginx for web server with Unix sockets
upstream unicorn {
server unix:/tmp/easysredmine.sock fail_timeout=0;
}
server {
listen 80;
server_name easysredmine;
error_log /var/log/nginx/easysredmine_error.log;
access_log /srv/log/nginx/easysredmine_access.log;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
}
}
Use Unicorn for Ruby application server with the following settings in unicorn.rb
worker_processes 4
listen '/tmp/easyredmine.sock'
Timeout 300
Use ruby 2.1.5 with railsexpress patch
rvm install ruby-2.1.5 --patch railsexpress
Tune environment Ruby settings
export RUBY_GC_HEAP_INIT_SLOTS=1800000;
export RUBY_HEAP_FREE_MIN=18000;
export RUBY_GC_MALLOC_LIMIT=120000000;
export RUBY_HEAP_SLOTS_INCREMENT=144000;
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1;
Use MariaDB or MySQL 5.5 database with the following settings
[mysqld]
bulk_insert_buffer_size = 64M
tmp_table_size = 512M
max_heap_table_size = 512M
query_cache_limit = 512K
query_cache_size = 512M
In this particular case it led to speed up response 7 times compared to customers default settings.
Redmine Speed Optimization Results
