On Aug 28, 2014, at 3:35 AM, James Coglan <[email protected]> wrote:
>  
>> but w.r.t http.Agent and keep-alives, you might find Issue 4769 an 
>> interesting read (and my own comments, perhaps: 
>> https://github.com/joyent/node/issues/4769#issuecomment-53116476). In your 
>> case you are sending your third request when the response to the first ends, 
>> which means (most likely) that after you fired the first and second request, 
>> there was no request pending, which IIUC causes http.Agent to close open 
>> keep-alive sockets.
> 
> That's what I suspected, but if it can't reuse a connection for concurrent 
> requests, and won't reuse them for immediately sequential requests (which is 
> the scenario I have in production), then when *does* it reuse connections? 


Indeed!

I suppose it will reuse a connection (unfortunately called a 'socket') when 
both conditions are true: the pool max (for that target host) has been reached 
and all connections are in use. In this case, the new request will be queued 
and when a response arrives on a connection, the new request will be dequeued 
and sent down that open connection.

The above is my understanding, but I could be wrong.

        --ravi

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/01889AFA-4FB8-4DDD-8405-E96D8367727A%40g8o.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to