curl-library
Fwd: Sharing connection pool amongst different handles
Date: Fri, 20 Oct 2017 11:57:47 +0200
Hi,
I would like to implement something like a "HTTP worker pool", into which I
can throw different operations, like:
- upload this file there
- download that URL to this file
- delete that URL
etc.
It's quite easy to do this with a multithread worker pool, where each
worker has a curl handle open.
The problem with this approach is that each handle will has its own
connection pool, so this will open (and close) much more connections than
needed.
It would be nice if there would be a way to share one connection pool
between multiple curl handles. The share interface would be the natural way
for doing this, but this isn't yet implemented.
I see the following alternatives:
- try to implement a handle-pool and direct the same destination URLs to
the same handle(s). While this may offer benefits compared to just blindly
share load between handles, it's not really that better.
- use the multi interface, which caches connections in its multi handle,
but I don't see an easy and nice way to implement the above situation with
it (I don't want to start two operations in the same time in parallel, I
want to start operations when they arrive and return them when the response
is available)
A lot of HTTP clients implement this (shared connection pool between
threads/workers/handles), so I think it would be great if curl could also
support this.
Any ideas on this?
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-10-20