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

curl-and-php

Multi-threaded connection re-use

From: Peter Kakoma <kakomap_at_gmail.com>
Date: Wed, 8 Oct 2014 10:07:47 +0300

Hi all,
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?

Multi's use-case is slightly different from this from my tests. What
are my options?

-- 
http://kakoma.ug
http:somanystories.ug


_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php

in_app_implementation.jpg
Received on 2014-10-08