http://www.perlmonks.org?node_id=41473


in reply to Re: using Net::Telnet to test Apache
in thread using Net::Telnet to test Apache

I'm not following. Presumably the only httpd daemon is the one listening on port 80. If you want a different daemon listening on a different port, LWP can handle http://example.com:8080 just as easily.

Replies are listed 'Best First'.
Load Balancing
by meonkeys (Chaplain) on Nov 14, 2000 at 07:05 UTC
    I'm talking about different hosts. Sorry for not being clearer. What I meant is that a URL does not necessarily specify which host a http daemon is active on. For instance, you could have 20 boxes that all correspond to one URL--http://foobar.com for example--that alternately serve pages to balance the load. I'm sure you already know all this.

    So, now the question is, what is the best way to test how each individual host's http daemon is doing? The only way I know how is by telnetting into that host's port 80 and doing a HTTP get. IO::Socket::INET sounds interesting, although I don't quite understand how it differs and I haven't successfully implemented it yet.
      No matter what you use, be it Net::Telnet or IO::Socket or the LWP modules, if you connect to 'example.com' and that hostname is load balanced, you're going to get different servers handling the request, sure. Sorry, I didn't realize that was going to be an issue (it's the first time you brought it up). If you can access each server individually by IP, perhaps you can simply pass that URL to the LWP modules: e.g. http://192.0.0.1/page.html. If you're using virtual hosting such that the Host: header makes a difference, I guess you're better off using IO::Socket and speaking HTTP yourself. If there isn't a way you can reach an arbitrary server directly, I don't see how any of the methods presented can help you, as they'd all be influenced by the load-balancing setup.
        Thank you. You have much knowledge in this area and your help is truly appreciated. I will give IO::Socket a go, and, of course, read more and more and more....
      I don't quite understand why you don't use LWP::Simple. In order to best simulate a real web browser, you should be downloading all of the web page anyway, so complicating your code with Net::Telnet just isn't worth it- unless you have a counter argument, I just don't see the point...
      AgentM Systems nor Nasca Enterprises nor Bone::Easy nor Macperl is responsible for the comments made by AgentM. Remember, you can build any logical system with NOR.
        How would you find out that one of your load-balanced boxes' httpd was working more slowly than the others? I'm open to suggestions.