> > Just changing if() to while() seems does not have a lot help.
> 
> It would of course only help for the case where you lower MAXCONNECTS in
> run-time to a value that is less than the current cache size and you're not
> doing that, are you?

Yes by doing this I can only make the connection number in cache lower than 
MAXCONNECTS

> > In my setup, Using libcurl-7.24.0, I can have about 20K ESTABLISHED
> > connections, no CLOSE_WAIT connections. Using 7.35.0 (after changing
> > if() to while()), the number will be 9K for ESTABLISHED and 11K for
> CLOSE_WAIT.
> 
> Are you adding 20K easy handles to the multi handle?

My application has 8 threads, each thread add 625 easy handles. The MAXCONNECTS 
will be default as 625*4=2500. And the system has a limit 20K for maximum open 
socket.  These handles request 330K URLS one by one repeatedly.

> > I am wondering if we need to close the connections for a easy_handle
> > when we removing it from a multi_handle?
> 
> Then they will be closed and will then avoid CLOSE_WAIT, but they will also
> not be possible to re-use and you'll get a serious performance impact. You'll
> get that effect if you set FORBID_REUSE on every connection.
> 
> I think the key to fixing this problem properly is to figure out why they end
> up in that state.

I think the CLOSE_WAIT state connections are waiting there for re-use in the 
connection cache pool till open one new socket when the cache is full, perhaps  
we need to check and kill the idle connections somewhere else when the cache is 
full, just guessing...



-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to