cURL / Mailing Lists / curl-and-php / Single Mail

curl-and-php

Re: Multi-threaded connection re-use

From: Peter Kakoma <kakomap_at_gmail.com>
Date: Sat, 11 Oct 2014 10:41:35 +0300

On Thu, Oct 9, 2014 at 5:33 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Wed, 8 Oct 2014, Peter Kakoma wrote:
>
>> I've read the rules and worked with them fairly extensively "The first
>> basic rule is that you must never simultaneously share a libcurl handle (be
>> it easy or multi or whatever) between multiple threads. Only use one handle
>> in one thread at any time. You can pass the handles around among threads,
>> but you must never use a single handle from more than one thread at any
>> given time."
>>
>> However, currently 60% of my application's processing time comes down to
>> interacting with one remote server on the LAN. A single request will
>> initiate a thread that'll send 5 chained requests to a single external
>> server. The response from the first request will determine whether the next
>> request is necessary and so on. In that thread, all these requests will be
>> performed on the same handle. Attached is an illustration
>>
>> New requests though open new threads that open their own connections, all
>> to the same server. Is it remotely possible to have a connection pool of
>> sorts?
>
>
> The idea isn't new and we (in the curl project) have thought about before
> how it could or should be done, but there's not yet any code in libcurl that
> enables it.

Cool. Thanks for the clarification.
>
>> Multi's use-case is slightly different from this from my tests. What are
>> my options?
>
>
> Do it another way or help us implement support for it? =)

I'd love to jump in on implementing support; I need the feature enough
to take the steps through what in my head is a steep learning curve.
Off to look through
the code. Any pointers are more than welcome
>
> --
>
> / daniel.haxx.se
> _______________________________________________
> http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

-- 
http://kakoma.ug
http:somanystories.ug
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2014-10-11