cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl and Perl's WWW::Curl::Easy slower than LWP on small HTTP POSTs

From: Tim Bannister <isoma_at_jellybaby.net>
Date: Wed, 14 Sep 2011 11:10:08 +0100

On 14 Sep 2011, at 10:44, Martin J. Evans wrote:

> Through experimentation I have discovered setting either CURLOPT_TCP_NODELAY or CURLOPT_FORBID_REUSE speeds up the POSTs so Curl is faster than LWP. I was a little surprised setting CURLOPT_TCP_NOLDELAY made a difference but as it does it sort of suggested to me that maybe the POST headers are sent first then followed up by the form data (i.e., at least 2 writes to the socket). Also, if CURLOPT_FORBID_REUSE is set I suppose it is possible libcurl does a shutdown(write) on the socket after the last write which would also expedite any unset data.

Unless TCP_NODELAY is set, the OS kernel is likely to delay sending the packets for a short while, to see if any more turn up. Closing the socket would flush the kernel's TCP buffers and shortcut the Nagle delay.

It's likely that you'll see different behaviours with a different OS / kernel.

-- 
Tim Bannister - +44 7980408788 - isoma_at_jellybaby.net

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

  • application/pkcs7-signature attachment: smime.p7s
Received on 2011-09-14