Hi - I'm running some tests on a server load balancer (foundry).

I have a virtual server IP that maps onto 6 possible "real" servers. The real servers have a simple html page that displays the hostname which allows me to view where the SLB has sent the http request.

I have put together a simple script using LWP::UserAgent to get the servername from the html returned.

I have this running in an endless while loop. I recreate the user-agent in each itteration of the loop but my results suggest that each new user-agent is re-using the previous user-agent's TCP connecion, consequently, the load balancer does not map me onto the next real server in the pool. If I kill and restart the script I do get mapped onto a new server (suggesting that the load balancer sees a new connection).

My question is:

How can I force LWP to initiate a new TCP connection every time I create a new useragent ?

Thanks

James


In reply to LWP::UserAgent - new connection for each new user-agent? by jrm

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.