cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to reuse connection using curl multi handle

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Mon, 1 Dec 2014 20:48:04 +0100

On Mon, Dec 01, 2014 at 12:05:46PM +0530, Mohanraj V wrote:
> Hi,
>
> I have following questions regarding lib-curl. Please answer my questions.
>
> 1. How to reuse connections using multi-handle and multi-perform API ?
> I tried with easy handle by continuous calling of
> curl_easy_perform. So it re uses the tcp connection established. How
> it is
> possible if easy handle is added to a multi handle ?. Repeated
> calling of curl_multi_perform is not working for my target ?

You should be able to just call curl_multi_add_handle then
curl_multi_add_handle.

> 2. What is the maximum connections/second possible using multi-handle
> ? . Is any other to achive maximum connections/second ?

How fast is your computer? How fast is your network? The curl_multi approach
is about the most efficient you can expect, since there is no overhead in
thread switching. There's always room for improvement (e.g. the zero copy
proposals that have been made over the years but never implemented because
no-one could prove they would make a significant improvement) but libcurl is
generally pretty efficient already.

> 3. What is the maximum number of http get requests/second possible
> using singe connection ?

See the previous answer!

> 4. Is it possible to achieve lacks/millions connections/requests per
> second using lib-curl ?

On a sufficiently speedy computer, why not? You can see the mailing list archives
for a few examples of what people have achieved using libcurl. I don't remember
seeing numbers quite so large, but most people on the list are limited to CPUs
with core numbered merely in the double digits :^)

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-12-01