Testing Rails vs. Sinatra vs. Rack
Ruby JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
rack
rails
sinatra
web
.gitignore
README.rdoc

README.rdoc

Here is the server config scripts I used to setup the Amazon EC2 instance. These tests were run on a Medium-sized, High CPU Instance of EC2 running a bare bones Ubuntu 8.10 install: ami-0372946a

You can copy the “EC2 Instance Config” section into a script and run it right on the server to get everything set up.

Test Procedure

After all packages were install and various servers were started and found to work the instance was rebooted to start fresh. Apache and nginx were stopped:

/etc/init.d/nginx stop
/etc/init.d/apache2 stop

When switching to a new framework/server a test was run once to make sure everything was loaded into memory before recording any results.

The following script was run with slight variations for each server type. It rans each test 11 times (the first was discarded to make sure everything was loaded into memory and ready to go at full speed). Only the requests per second number for each test was returned to the command line:

ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per' && \
ab -n 10000 -c 50 -q http://127.0.0.1:3000/ | grep 'Requests per'

Servers

Each server was the only one running at the time of the tests. Two ssh sessions were running. One to start the server and the other to run Apache Bench.

Rack

ruby /mnt/performace/rack/erb.rb
ab -n 1000 -c 10 -q http://127.0.0.1:3000/

Sinatra

ruby /mnt/performance/sinatra/erb.rb -e production -p 3000
ab -n 1000 -c 10 -q http://127.0.0.1:3000/

Rails (served by Thin)

thin start -c /mnt/performance/rails -e production -p 3000
ab -n 1000 -c 10 -q http://127.0.0.1:3000/go/erb

Rails (served by Passenger)

/etc/init.d/apache2 start
ab -n 1000 -c 10 -q http://127.0.0.1:3000/go/erb

Nginx

/etc/init.d/nginx start
ab -n 1000 -c 10 -q http://127.0.0.1/

Apache

/etc/init.d/apache2 start
ab -n 1000 -c 10 -q http://127.0.0.1/