Esteemed Monks,

I am using WWW:Curl::Easy to send a very small update message. Because of the way the service works, I need to do a load of individual performs, in some cases running into the hundreds to send all the required updates. A user is sitting staring at a screen while this is happening and waiting for a result.

Running my client program on, let's call it Machine A, I'm seeing 'verbose' output like this:

* About to connect() to blah.blah.com port 8080 * Trying xxx.xxx.xxx.xxx... * connected * Connected to blah.blah.com (xxx.xxx.xxx.xxx) port 8080 > POST /submit.sp HTTP/1.1 Host: blah.blah.com:8080 Accept: */* Content-Length: 5 Content-Type: application/x-www-form-urlencoded blah < HTTP/1.0 200 ITAS Ltd SOAP Server v1.3.53 < Content-length: 343 < Server: ITAS Ltd SOAP Server v1.3.53 < Connection: close * Closing connection #0

This works, well, not exactly quickly, but easily fast enough for my purposes. On, let's call it Machine B, I see this:

* About to connect() to blah.blah.com port 8080 (#0) * Trying xxx.xxx.xxx.xxx... * connected * Connected to blah.blah.com (xxx.xxx.xxx.xxx) port 8080 (#0) > POST /submit.sp HTTP/1.1 Host: blah.blah.com:8080 Accept: */* Content-Length: 1523 Content-Type: application/x-www-form-urlencoded Expect: 100-continue * Done waiting for 100-continue * HTTP 1.0, assume close after body < HTTP/1.0 200 ITAS Ltd SOAP Server v1.3.53 < Content-length: 277 < Server: ITAS Ltd SOAP Server v1.3.53 < Connection: close < * Closing connection #0

On Machine B it takes about a second to execute. You'll notice that there was 'Expect: 100-contine' which wasn't present on Machine A, and indeed, the delay on Machine B is between 'Expect: 100-continue' and '* Done waiting for 100-continue'.

To me, this suggests that, on Machine B, the socket has been created with an SO_KEEPALIVE option. Presumably in response to some default socket options. I know that the keepalive is set up differently on the two machines. Frankly the updates I am doing are not the most crucial things in the world. It is far more important to me that they are done quickly rather than 100% reliably, so I'm looking at ways of speeding it up.

Do you think I'm right in my ramblings about keepalives?

If so, do you think there's any way that I can force curl to create it's socket without keepalives?


In reply to Curling slowly by mungohill

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.