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