Skip to content

Instantly share code, notes, and snippets.

@trentm
Last active March 2, 2018 22:24
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 trentm/04a229a102b485141e3b35c58366c913 to your computer and use it in GitHub Desktop.
Save trentm/04a229a102b485141e3b35c58366c913 to your computer and use it in GitHub Desktop.
node-whyyoulittle sample run of examples/server.js
$ for i in `seq 1 10`; do sleep 0.3; (curl -i localhost:8080/slow &) ; done
HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 64
x-request-id: 629905ae-83a0-407c-b055-52efc57e6430
Date: Fri, 02 Mar 2018 22:23:07 GMT
Connection: keep-alive
{"code":"ServiceUnavailableError","message":"request throttled"}HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 64
x-request-id: d79bb313-7ae1-4c72-9756-60e33da6d242
Date: Fri, 02 Mar 2018 22:23:08 GMT
Connection: keep-alive
{"code":"ServiceUnavailableError","message":"request throttled"}HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 64
x-request-id: e6d7a67a-496f-494c-b218-053e1bffe204
Date: Fri, 02 Mar 2018 22:23:08 GMT
Connection: keep-alive
{"code":"ServiceUnavailableError","message":"request throttled"}HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 64
x-request-id: a5fe190d-7fe2-489d-aee5-c12666756b64
Date: Fri, 02 Mar 2018 22:23:08 GMT
Connection: keep-alive
{"code":"ServiceUnavailableError","message":"request throttled"}HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 64
x-request-id: 1f44ab40-1ccd-49e2-95fb-6567a309cda6
Date: Fri, 02 Mar 2018 22:23:08 GMT
Connection: keep-alive
{"code":"ServiceUnavailableError","message":"request throttled"}[14:23:09 trentm@bluesteel:~]
$ HTTP/1.1 503 Service Unavailable
Content-Type: application/json
Content-Length: 64
x-request-id: 5e853ed1-3674-480a-a20b-ff731bc29cf0
Date: Fri, 02 Mar 2018 22:23:09 GMT
Connection: keep-alive
{"code":"ServiceUnavailableError","message":"request throttled"}HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 42
x-request-id: 9e1843d3-b1a5-46b1-8e0c-d83ef4ac66fc
Date: Fri, 02 Mar 2018 22:23:11 GMT
Connection: keep-alive
slow response at 2018-03-02T22:23:11.500Z
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 42
x-request-id: 525846ea-58ac-49f3-9feb-026486d89685
Date: Fri, 02 Mar 2018 22:23:11 GMT
Connection: keep-alive
slow response at 2018-03-02T22:23:11.801Z
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 42
x-request-id: 0edb1c0c-b077-4efa-af4b-5523b060d2d7
Date: Fri, 02 Mar 2018 22:23:16 GMT
Connection: keep-alive
slow response at 2018-03-02T22:23:16.504Z
HTTP/1.1 200 OK
Content-Type: text/plain
Content-Length: 42
x-request-id: f1c121ed-3ea4-4aa2-be40-9c678d76c642
Date: Fri, 02 Mar 2018 22:23:16 GMT
Connection: keep-alive
slow response at 2018-03-02T22:23:16.806Z
$ node examples/server.js > >(bunyan -c this.throttle -o short)
restify listening at http://[::]:8080
22:23:06.493Z TRACE example-server: queue_enter (req_id=9e1843d3-b1a5-46b1-8e0c-d83ef4ac66fc, throttle=true, wylReqId=30bf6d1b-d32c-49f5-a8be-cfb31c148bc2, inflight=0, nqueued=0)
22:23:06.494Z TRACE example-server: queue_leave (req_id=9e1843d3-b1a5-46b1-8e0c-d83ef4ac66fc, throttle=true, wylReqId=30bf6d1b-d32c-49f5-a8be-cfb31c148bc2, inflight=1, nqueued=0)
22:23:06.795Z TRACE example-server: queue_enter (req_id=525846ea-58ac-49f3-9feb-026486d89685, throttle=true, wylReqId=b8997235-f85b-41e9-ac37-2e7d49f06768, inflight=1, nqueued=0)
22:23:06.795Z TRACE example-server: queue_leave (req_id=525846ea-58ac-49f3-9feb-026486d89685, throttle=true, wylReqId=b8997235-f85b-41e9-ac37-2e7d49f06768, inflight=2, nqueued=0)
22:23:07.098Z TRACE example-server: queue_enter (req_id=0edb1c0c-b077-4efa-af4b-5523b060d2d7, throttle=true, wylReqId=58ef1da9-43e5-4502-8b8f-f75c1713e0f3, inflight=2, nqueued=0)
22:23:07.405Z TRACE example-server: queue_enter (req_id=f1c121ed-3ea4-4aa2-be40-9c678d76c642, throttle=true, wylReqId=c1e3ce7d-bfe3-4c57-941c-23e95d5ab57f, inflight=2, nqueued=1)
22:23:07.712Z TRACE example-server: request_throttled (req_id=629905ae-83a0-407c-b055-52efc57e6430, throttle=true, wylReqId=40496150-c910-4717-9f56-fd9c30ca1f7f, inflight=2, nqueued=2)
22:23:08.020Z TRACE example-server: request_throttled (req_id=d79bb313-7ae1-4c72-9756-60e33da6d242, throttle=true, wylReqId=664c0e0d-7494-4b1b-8b9d-8223f03ae55e, inflight=2, nqueued=2)
22:23:08.327Z TRACE example-server: request_throttled (req_id=e6d7a67a-496f-494c-b218-053e1bffe204, throttle=true, wylReqId=86fcb53c-0375-490f-9d26-0ef1c99289bb, inflight=2, nqueued=2)
22:23:08.635Z TRACE example-server: request_throttled (req_id=a5fe190d-7fe2-489d-aee5-c12666756b64, throttle=true, wylReqId=937c9a3c-a1be-4bb0-8102-38c975c1a4aa, inflight=2, nqueued=2)
22:23:08.944Z TRACE example-server: request_throttled (req_id=1f44ab40-1ccd-49e2-95fb-6567a309cda6, throttle=true, wylReqId=97ef4d44-ea2f-42eb-9173-7ff7b13b5361, inflight=2, nqueued=2)
22:23:09.254Z TRACE example-server: request_throttled (req_id=5e853ed1-3674-480a-a20b-ff731bc29cf0, throttle=true, wylReqId=5cac7709-91ab-422d-b6b0-0fe9f799fea1, inflight=2, nqueued=2)
22:23:11.502Z TRACE example-server: request_handled (req_id=9e1843d3-b1a5-46b1-8e0c-d83ef4ac66fc, throttle=true, wylReqId=30bf6d1b-d32c-49f5-a8be-cfb31c148bc2, inflight=2, nqueued=2)
22:23:11.503Z TRACE example-server: queue_leave (req_id=0edb1c0c-b077-4efa-af4b-5523b060d2d7, throttle=true, wylReqId=58ef1da9-43e5-4502-8b8f-f75c1713e0f3, inflight=2, nqueued=1)
22:23:11.802Z TRACE example-server: request_handled (req_id=525846ea-58ac-49f3-9feb-026486d89685, throttle=true, wylReqId=b8997235-f85b-41e9-ac37-2e7d49f06768, inflight=2, nqueued=1)
22:23:11.802Z TRACE example-server: queue_leave (req_id=f1c121ed-3ea4-4aa2-be40-9c678d76c642, throttle=true, wylReqId=c1e3ce7d-bfe3-4c57-941c-23e95d5ab57f, inflight=2, nqueued=0)
22:23:16.504Z TRACE example-server: request_handled (req_id=0edb1c0c-b077-4efa-af4b-5523b060d2d7, throttle=true, wylReqId=58ef1da9-43e5-4502-8b8f-f75c1713e0f3, inflight=2, nqueued=0)
22:23:16.807Z TRACE example-server: request_handled (req_id=f1c121ed-3ea4-4aa2-be40-9c678d76c642, throttle=true, wylReqId=c1e3ce7d-bfe3-4c57-941c-23e95d5ab57f, inflight=1, nqueued=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment