Skip to content

Instantly share code, notes, and snippets.

@djones
Created May 10, 2012 01:55
Show Gist options
  • Save djones/2650430 to your computer and use it in GitHub Desktop.
Save djones/2650430 to your computer and use it in GitHub Desktop.
Basic API app performance comparison: Rails + Thin VS Grape + Goliath
# Standard Grape API setup on a user model which uses ActiveRecord like the Rails example above.
# Goliath running in production mode.
# MySQL used for the database.
# Result: 1203.6 avg replies/s (with stddev 5.2)
$ httperf --server=localhost --port=9000 --uri=/users/1.json --num-conns=20 --num-calls=2000
httperf --client=0/1 --server=localhost --port=9000 --uri=/users/1.json --send-buffer=4096 --recv-buffer=16384 --num-conns=20 --num-calls=2000
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1
Total: connections 20 requests 40000 replies 40000 test-duration 33.216 s
Connection rate: 0.6 conn/s (1660.8 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 1646.5 avg 1660.8 max 1681.9 median 1658.5 stddev 10.5
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 2000.000
Request rate: 1204.2 req/s (0.8 ms/req)
Request size [B]: 74.0
Reply rate [replies/s]: min 1198.3 avg 1203.6 max 1210.3 stddev 5.2 (6 samples)
Reply time [ms]: response 0.8 transfer 0.0
Reply size [B]: header 112.0 content 78.0 footer 0.0 (total 190.0)
Reply status: 1xx=0 2xx=0 3xx=0 4xx=0 5xx=40000
CPU time [s]: user 4.72 system 28.49 (user 14.2% system 85.8% total 100.0%)
Net I/O: 310.5 KB/s (2.5*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
# Standard Rails app setup using standard respond_with call on users controller.
# Thin running in production mode
# MySQL used for the database
# Result: 428.7 avg replies/s (with stddev 14.8)
$ httperf --server=localhost --port=3000 --uri=/users/1.json --num-conns=20 --num-calls=2000
httperf --client=0/1 --server=localhost --port=3000 --uri=/users/1.json --send-buffer=4096 --recv-buffer=16384 --num-conns=20 --num-calls=2000
httperf: warning: open file limit > FD_SETSIZE; limiting max. # of open files to FD_SETSIZE
Maximum connect burst length: 1
Total: connections 20 requests 40000 replies 40000 test-duration 93.209 s
Connection rate: 0.2 conn/s (4660.4 ms/conn, <=1 concurrent connections)
Connection time [ms]: min 4532.3 avg 4660.4 max 5025.6 median 4574.5 stddev 163.2
Connection time [ms]: connect 0.1
Connection length [replies/conn]: 2000.000
Request rate: 429.1 req/s (2.3 ms/req)
Request size [B]: 74.0
Reply rate [replies/s]: min 397.4 avg 428.7 max 440.8 stddev 14.8 (18 samples)
Reply time [ms]: response 2.3 transfer 0.0
Reply size [B]: header 411.0 content 122.0 footer 0.0 (total 533.0)
Reply status: 1xx=0 2xx=40000 3xx=0 4xx=0 5xx=0
CPU time [s]: user 13.57 system 79.64 (user 14.6% system 85.4% total 100.0%)
Net I/O: 254.4 KB/s (2.1*10^6 bps)
Errors: total 0 client-timo 0 socket-timo 0 connrefused 0 connreset 0
Errors: fd-unavail 0 addrunavail 0 ftab-full 0 other 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment