zanchin/node-http-perf — pull request #4 by gmauricio (2013-11-25 00:37:30+00:00)
Title: avoid leaving http request connections open

Since the request is not consuming the data, the http request connection is left open.

Check http://nodejs.org/docs/latest/api/http.html#http_class_http_agent, and the config value "agent.maxSockets"

"By default set to 5. Determines how many concurrent sockets the agent can have open per host."

What happens is that being all those connections open, there's a moment when no more requests will be made and the application just hangs. You could just change the maxSockets value, but that's not the real solution.

By listening to the "data" event, we allow the connection to finish. I also moved all the timing logic inside the "end" event.