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

curl-and-php

Re: Multi-threaded connection re-use

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 9 Oct 2014 16:33:21 +0200 (CEST)

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.

> 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? =)

-- 
  / daniel.haxx.se
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2014-10-09