Skip to content

Instantly share code, notes, and snippets.

@paxan
Last active December 21, 2015 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paxan/6303774 to your computer and use it in GitHub Desktop.
Save paxan/6303774 to your computer and use it in GitHub Desktop.
Putting a simple one-dyno Node.js app under pressure on Heroku

What the app does

It receives certain JSON events as HTTP POSTs, parses them, and writes received JSON with along with some extra metadata to stdout using console.log(). POST-ed data does not usually exceed ~800 bytes per request.

It runs with node 0.10.15 engine on Heroku with just one web dyno. Also it uses Express 3.3.4 web service library.

Under pressure

I've subjected the app to some traffic by means of blitz.io:

$ blitz curl -T 100 -p 1-300:25,300-300:35 -v:foo number[100,999] \
  -X POST -d '{"a": "blob of well-formed JSON, several hundred bytes long... using #{foo} variable for extra points"}' \
  -H 'Content-Type:application/json' \
  http://super-secret-app-yeah.herokuapp.com/event

This command initiates a rush of POST requests from a group of clients that ramp from 1 to 300 over 25 seconds, and it continues to hammer the app with 300 concurrent clients for another 35 seconds.

rushing from virginia...

  Time  Users Response     Hits Timeouts   Errors   Hits/s Mbps
  2.5s     29   0.024s       22        0        0
  5.0s     60   0.017s      116        1        0    37.44 0.02
  7.5s     90   0.017s      290        1        0    69.43 0.05
 10.0s    121   0.018s      533        1        0    96.88 0.06
 12.5s    151   0.019s      848        1        0   125.59 0.08
 15.1s    180   0.019s     1240        1        1   154.96 0.10
 17.6s    211   0.023s     1695       15        1   180.01 0.12
 20.1s    241   0.024s     2213       39        1   206.51 0.14
 22.6s    271   0.023s     2817       46        1   240.81 0.16
 25.1s    300   0.023s     3492       60        1   269.16 0.18
 27.6s    300   0.020s     4184       96        1   276.00 0.19
 30.1s    300   0.017s     4918      101        1   292.65 0.19
 32.8s    300   0.020s     5688      117        1   289.28 0.19
 35.3s    300   0.018s     6420      121        1   292.13 0.19
 37.8s    300   0.019s     7148      130        1   288.51 0.19
 40.3s    300   0.020s     7875      143        1   289.88 0.19
 42.8s    300   0.019s     8593      164        1   286.47 0.19
 45.3s    300   0.020s     9303      187        1   283.20 0.19
 47.9s    300   0.019s    10032      200        1   288.14 0.19
 50.4s    300   0.020s    10758      213        1   289.44 0.19
 52.9s    300   0.019s    11491      215        1   291.11 0.19
 55.4s    300   0.021s    12239      215        1   298.23 0.19
 57.9s    300   0.019s    12954      223        1   283.72 0.19

I took a screen shot of what log2viz was showing during the performance peak:

P50:3ms P95:14ms 13832 rpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment