Slow performance for Node.js running on AWS
It's probably ab issue (see also this question). There is nothing wrong in your server code. I suggest to try to benchmark using wrk load testing tool. Your example on my t1.micro:
wrk git:master ❯ ./wrk -t12 -c400 -d30s http://some-amazon-hostname.com/rest/users/10 ✭Running 30s test @ http://some-amazon-hostname.com/rest/users/10 12 threads and 400 connections Thread Stats Avg Stdev Max +/- Stdev Latency 333.42ms 322.01ms 3.20s 91.33% Req/Sec 135.02 59.20 283.00 65.32% 48965 requests in 30.00s, 11.95MB readRequests/sec: 1631.98Transfer/sec: 407.99KB