curl-library
Re: How to scale libcurl to several thousand https connections without blocking select ()
Date: Mon, 6 Jun 2011 22:39:30 +0200 (CEST)
On Mon, 6 Jun 2011, Jimish Shah wrote:
> I am trying to use libcurl to scale to several thousand https connections to
> an external web server.
Use the multi_socket API (and something like libev or libevent) and build
libcurl to use c-ares for resolving. We've had users do over 60K connections
on a single host.
> If i use multi-handle and add say 1000 easy handles to it. If each of the
> thousand easy handles need to connect simultaneously , i noticed that there
> is a blocking "select ()" during the connect phase as explained below.
That's not quite accurate. See below.
> Curl_multi_perform() --> multi_runsingle() --> Curl_connect() ....... -->
> Singleipconnect --> waitconnect() --> Curl_socket_ready()* --> select ()*
> every one second until error or success or timeout
Curl_connecthost() calls singleipconnect() on lib/connect.c:1084 (in current
git)
There you can see how it changes the timeout argument to 0 (zero) if the multi
interface is used. Therefore, within the singleipconnect() function where it
calls waitconnect() the timeout argument is zero and thus it will not wait, it
will just check the status of the socket instantly and then move on.
If you can see any other flow, please tell me.
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2011-06-06