web server load balancing

Discussion in 'Site & Server Administration' started by monosodium, Mar 8, 2008.

  1. #1
    anyone know anything about load balancing? i have a heavily overloaded server, already using the fastest chipset my web host offers.

    current situation
    single server, web server + a single filesystem, no mysql database but lots of dynamic pages served via perl scripts.

    desired configuration
    multiple web servers, all connected to the same single file system.

    assuming that my dynamic pages do not write and only read from the file system, what would i install to balance the web server load between two or more web servers? anyone know?

    when someone goes to www.mydomain.com, the load balancer should choose which web server (server1 or server2 or server3) to send the request to... that is the part that i don't know how to do. and it should all look the same at the front end.

    i use 64bit centos and apache.
     
    monosodium, Mar 8, 2008 IP
  2. Camay123

    Camay123 Well-Known Member

    Messages:
    3,423
    Likes Received:
    86
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Cant you ask your server provider to implement this for you ? Many are very competent, and some will do it for free (managed server config)
     
    Camay123, Mar 8, 2008 IP
  3. Travis

    Travis Peon

    Messages:
    539
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think a technical "load" balancer would be a separate machine, or an actual piece of hardware...an easier way to do it would be to simply use a round-robin DNS which will even out server loads and will basically rotate the server that it sends people to...Ideally it's not as effective, but it's easier to implement and can have a large impact if you can mirror all the content.
     
    Travis, Mar 8, 2008 IP
    Camay123 likes this.
  4. monosodium

    monosodium Well-Known Member

    Messages:
    1,028
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    100
    #4
    I guess, but I'd rather have control over how it is done. I'd rather not pass this one along to my webhost.

    Thanks for the advice. Yes I guess it should be a separate piece of hardware, playing a gatekeeper role. But if I involve DNS, it would change the URL wouldn't it? I want this whole backend system remaining invisible to the user, so that URL's stay the same irrespective of which machine is serving.

    Also I want to use just the one file system, as opposed to mirroring content. This is very important.

    I think I need to grab the incoming HTTP requests before they go to apache... and then script something. Any idea how to go about this?
     
    monosodium, Mar 9, 2008 IP
  5. monosodium

    monosodium Well-Known Member

    Messages:
    1,028
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    100
    #5
    ok... i just got some advice... I need to install haproxy on my gatekeeper machine, then getting the server machines to share the filesystem using GlusterFS. This is pretty much what I need I think.
     
    monosodium, Mar 9, 2008 IP
  6. James M

    James M Peon

    Messages:
    36
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    To do it without redundancy (high availability) you'd need 3 machines. two mirrored web servers and a re-director machine.

    Or, ask your web host if they have an option. It's usually not cheap, and payable monthly as a service.
     
    James M, Mar 9, 2008 IP
  7. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #7
    I think before considering a load balancer you might want to re-work the website itself (application). The bottleneck is most likely the high IO / Perl.. have you checked what's bogging down the machine? CPU, RAM, IO? What's cuasing this bottleneck? Perl, IO?

    Etc.
     
    CodyRo, Mar 10, 2008 IP
  8. Ladadadada

    Ladadadada Peon

    Messages:
    382
    Likes Received:
    36
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I have had success using Squid and Apache (mod_proxy) as HTTP load balancers. As a nice side effect they can both cache static content (mod_cache for Apache) to reduce the number of requests hitting your web servers.

    For the DocumentRoot, I used rsync at one place I worked to keep all file systems the same and NFS at another place. Keeping your website in Subversion and doing updates on each webserver in a post-commit hook might be another way of keeping them all in sync. As you said, however, you don't want to sync content but rather have one canonical copy of it. NFS is the only system here that meets that requirement.

    I haven't worked with haproxy or GlusterFS but they both look like interesting technologies. GlusterFS doesn't look like a replacement for NFS either (as I suspected it might be by its name). It looks more like a distributed filesystem that can be spread over several boxes but will look like one single filesystem to any box in the cluster.

    If you decide to use either of them, let us know how you got on with configuring them and how they handle your workload. I'm always interested in seeing what alternatives there are to the choices we have made in our setup.
     
    Ladadadada, Mar 11, 2008 IP
  9. boltok

    boltok Active Member

    Messages:
    257
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #9
    Unless it's a REALLY HUGE site, a simple round-robin DNS and a single NFS-exported backend should be enough.

    No, your URL will not change, but the IP addresses the user sees (if they ever check them) will be different. That really shouldn't matter since a lot of the big guys are using this.

    Another option is to use Lighttpd or Nginx as a round-robin reverse proxy, with multiple Apache servers serving the dynamic content.
     
    boltok, Mar 11, 2008 IP
  10. Rob T

    Rob T Well-Known Member

    Messages:
    171
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    153
    #10
    I'd look into a faster httpd daemon before committing to a complex load balanced setup - try http://www.litespeedtech.com

    We host several forums and other sites that are top-500 alexa ranked using LiteSpeed as the httpd daemon on a single web server with a separate db server. It's an incredibly powerful piece of software.

    LiteSpeed also develops a software load balancer system which might be worth your time to look into if updating your httpd daemon alone won't do it.
     
    Rob T, Mar 11, 2008 IP
    monosodium likes this.
  11. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #11
    That's also an idea.. though I would recommend a free alternative to LiteSpeedTech's paid solution.. theres been several benchmarks comparing both and they've both been roughly the same.

    LightHTTPD - I love it :)
     
    CodyRo, Mar 12, 2008 IP
  12. monosodium

    monosodium Well-Known Member

    Messages:
    1,028
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    100
    #12
    The engine was expertly coded by me. :) The cause of the bottleneck is traffic. LOTS of traffic.
     
    monosodium, Mar 12, 2008 IP
  13. monosodium

    monosodium Well-Known Member

    Messages:
    1,028
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    100
    #13
    Sweet, thanks for the info! I will need load balancing either way but this will help too if I can get it to work.

    Nothing beats free :) Thanks!
     
    monosodium, Mar 12, 2008 IP
  14. monosodium

    monosodium Well-Known Member

    Messages:
    1,028
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    100
    #14
    We're getting there :) But actually the solution you mention would probably work for the time being. I'll look into it. Thank you!
     
    monosodium, Mar 12, 2008 IP
  15. monosodium

    monosodium Well-Known Member

    Messages:
    1,028
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    100
    #15
    OH YES NFS! How come I didn't think of that? Thanks!
     
    monosodium, Mar 12, 2008 IP