Thanks Ben and Michael for getting back to me. Michael - yes that seems to be the behavior we're seeing, though it's possible I'm misinterpreting the symptoms. The timing of when requests begin resolving after reaching the max number of open connections could be due to a holdup elsewhere.
Ben - that's an interesting point about server response headers. I'll verify that we're not implying a closed connection by omitting Content-Length or Transfer-Encoding headers. That seems like a likely culprit. Also - looks like you and Mike responded to my colleague David (https://groups.google.com/forum/?fromgroups=#!topic/nodejs/0psXf6pcZSk) -- we're working through the same issue, so will also look into the keep-alive-agent Voxer published. Thanks for your help! On Sunday, December 16, 2012 10:08:30 PM UTC-6, Michael Hart wrote: > > Jonathon - are you saying that you're seeing behaviour where you're trying > to make > 10 requests simultaneously, and Request #11 is only started after > Request #1-10 have completed? > > I don't see this behaviour. For example: > > var http = require('http') > > function httpCall(i) { > http.get('http://www.apple.com', function(res) { > if (res.statusCode === 200) > console.log("Completed " + i + " at " + Date.now()) > }) > } > > for (var i = 0; i < 100; i++) { > httpCall(i) > } > > > On Saturday, 15 December 2012 09:20:33 UTC+11, Jonathon Morgan wrote: >> >> We make a high volume of requests over http between components in our >> system, and running into what seems to be a connection pooling issue that's >> difficult to track down. >> >> As far as I can tell, connection pools in Node are managed by a >> globalAgent (global to the Node process). The underlying TCP connections >> are established by the net module, which is used by the http module. I >> would expect that as soon as each request is resolved, the TCP connection >> that handled the request is available and can be reused. >> >> Instead however, the request handled by each connection up to the max # >> of connections (set on globalAgent.maxSockets) is resolved before any >> queued requests are handled. >> >> So if we set maxSockets to 10, we see 10 requests resolve >> successfully. Then there is a pause, while new tcp connections are >> established. Then 10 more requests resolve. Then a pause while connections >> are closed/re-established. Etc. >> >> This feels wrong. Node is supposed to excel at handling a high volume of >> concurrent requests. If request 1000 cannot be handled until 1-999 resolve, >> everyone who has ever used Node for anything would run into this >> bottleneck. Yet I can't work out what we're doing incorrectly. >> >> Any suggestions? >> >> Thanks! >> > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en
