Rails Performance Report (0.13.1 vs. 0.14)

Rails version 0.14 contains a large number of performance oriented implementation changes, contributed by the author of railsbench. This report compares the previous release Rails 0.13.1 against Rails 0.14.

Short Summary for the Impatient

Rails 0.14 runs the tested application much faster than 0.13.1. I suspect that most apps will see gains similar to the ones reported here.

Environment

Each test was run using railsbench on an Athlon64 3000+ with 1G of memory using Suse9.3, ruby 1.8.2 and Mysql 4.1, with RAILS_PERF_RUNS=5. For session storage, Mysql using mysql-ruby-2.7 was employed and Rails logging was disabled.

Configuration options

A number of configuration options were tested:

out of the box
This is of course the most natural thing to test
gc100
Manual garbage collection control: garbage collection was disabled and a collect was forced after 100 requests
patched_gc
Test with the garbage collector patch applied to ruby 1.8.2 with the following settings:
RUBY_GC_STATS=0
RUBY_HEAP_MIN_SLOTS=600000
RUBY_GC_MALLOC_LIMIT=60000000
RUBY_HEAP_FREE_MIN=20000
mysql_session
A Mysql native session class implementation
sql_bypass
A session class implementation derived from CGI::Session::ActiveRecordStore::SqlBypass
fast_routes
A hand coded routing implementation using only URLs of the form controller/action/id
routing_cache
the default routing implementation enhanced by a cache for recognized URLs
links
use link_to calls instead of specifying URLs directly

Test Data

For the tests, I selected a number of pages from my recipe database application:

/empty/index a simple render_text
/welcome/index a welcome page, action cached
/rezept/index application front page, user dependent, action cached
/rezept/myknzlpzl my recipes, user dependent, action cached
/rezept/show/713 show recipe 713
/rezept/cat/Hauptspeise show all recipes of category Hauptspeise, paginated
/rezept/cat/Hauptspeise?page=5 page 5 of category Hauptspeise
/rezept/letter/G all recipes with a title starting with G

Performance data for each configuration can be found here.

One on one comparisons produced by script perf_comp for each configuration are listed in this file.

Logs of the the test runs:

Detailed Summary

Out of the box 0.13.1 vs. 0.14

This one shows how well 0.14 does against 0.13.1, with no options, gc100 and patched GC. The numbers are requests per second.

Out of the box 0.13.1 vs. fully optimized 0.14

This one shows how well a fully optimized 0.14 does against 0.13.1, with no options, gc100 and patched GC.

Out of the box 0.14 vs. fully optimized 0.14

This one shows the speedup of all tuning options applied to 0.14, for the different GC options.

Tuning effects on 0.14 with patched GC

This one shows the speedup obtained by applying different tuning options to 0.14, all running with patched GC.