bench some web microframeworks (Ruby)
Because we don't have enough drama, let's bench some hello world apps!
As part of some research, collected some benchmark around Ruby web microframeworks.
The idea is bench the performance from Rack, throught the stack of the framework to the minimum representation of an application (Hello World apps).
It is not the goal to bechmark hits to the database or external services, nor to do a silly fibonacci-as-a-service, ok?
The following microframeworks were considered when doing this research:
- Brooklyn - brooklyn.ru
- Cuba - cuba.ru
- Hobbit - hobbit.ru
- Lotus (Router) - lotus-router.ru
- Nancy - nancy.ru
- NYNY - nyny.ru
- Rack - rack.ru
- Rails - rails.ru
- Ramaze - ramaze.ru
- Rambutan - rambutan.ru
- Scorched - scorched.ru
- Sinatra - sinatra.ru
Please note that while Rails has been added to the list, it is just a minimalistic representation (using Metal, no full middleware stack, etc). You shouldn't take the performance numbers mentioned here about Rails (or any other) as scientific and decision-taking references.
Used wrk to benchmark, locally, a burst of requests (in 2 threads) over 10 seconds. The command line used was:
$ wrk -t 2 http://localhost:port/
All the frameworks were run using Puma on Ruby 2.1, in production mode and using 16 threads:
$ puma -e production -t 16:16 <framework.ru>
Have some numbers around?
Yup, I do:
Rack: 8777 req/sec (1.0x) Cuba: 7559 req/sec (0.86x) Lotus(Router): 7449 req/sec (0.85x) Hobbit: 7318 req/sec (0.83x) Rack: 6783 req/sec (0.77x) (using Rack::Response) Brooklyn: 6477 req/sec (0.74x) Rambutan: 6025 req/sec (0.67x) Nancy: 5775 req/sec (0.66x) NYNY: 5206 req/sec (0.59x) Sinatra: 2900 req/sec (0.33x) Rails: 1619 req/sec (0.18x) Scorched: 1581 req/sec (0.18x) Ramaze: 1319 req/sec (0.15x)
These numbers were collected on:
- OSX, 10.8.5, MacBook Pro i5 (2.5GHz), 8GB 1600 MHz DDR3.
- Ruby 2.1.0p0 (GCC 4.7.3)