cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Problems with multi-threaded client and curl easy interface

From: Kamil Dudka <kdudka_at_redhat.com>
Date: Thu, 07 May 2015 10:15:02 +0200

On Wednesday 06 May 2015 18:06:13 Stephen Hawkins wrote:
> Hello,
>
> I am developing a Windows application that utilizes multiple threads to
> upload chunks of data to a receiver. For this purpose we have utilized the
> easy interface since it was very easy to get started and works well with
> the synchronous nature of what we are trying to accomplish with this.
> Basically, we want each thread to read a chunk of data from disk, upload it
> to our “receiver” (which is a Debian linux box with apache pre-fork) which
> does some integrity check stuff to verify that what we uploaded did indeed
> arrive in-tact, writes it to disk, and then sends a 200 back to our
> application to notify it that the selected chunk we uploaded was successful
> and we can move onto the next one.
>
> The problem I am having is that when I run this application with multiple
> threads, my transfer speed grinds to a near halt, with sporadic bursts
> being sent every 30 seconds. I can look at the logs on the receiver and
> consistently see periods of inactivity that last for 30 seconds. Then I
> see a burst of transfers, which quickly dies back down. The debugger shows
> that all of the threads are blocked on a call to select() inside of
> curl_poll(). It seems like select() continuously returns 0, which causes
> curl_poll() to be called until select() finally does return something other
> than 0.

If the threads are blocked on select(), it usually means that libcurl is
waiting for data to be sent/received to/from the server. It looks to me
like something hangs on your server when there are multiple connections
being served at a time.

Kamil

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-07