Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
Linux Software

Simple DIY Linux/BSD based Network Balancers? 35

millisa asks: "I've been looking into options for inexpensive web based load balancing services for both Apache and IIS based web servers. There are plenty of commercial products out there that claim to do the job, but they are often too pricey, offer too many features, or are unreliable. I have lost the small amount of confidence I had in the MS based NLB services and do not like the idea of running multiple services on the same system anyways. I would like to build one (or more) simple front end load balancing Linux (or BSD) servers to direct traffic to the back-end systems if possible. I have seen mention of implementations based off of the Linux Router Project or the global load balancing oriented Eddie. What approaches are other geeks out there using for their LAN load balancing needs? I am especially interested in implementations that can maintain state (ie, handle sessions) as well as do some form of request inspection (so as to redirect those pesky web spiders to their own playground so a live user has the best web experience)." It's been long enough since the last time this came up, so lets revisit this question and touch upon the new solutions that have come up since 1999.
This discussion has been archived. No new comments can be posted.

Simple DIY Linux/BSD based Network Balancers?

Comments Filter:
  • A great site (Score:1, Informative)

    by afay ( 301708 )
    Check out the High-Availability Linux Project [linux-ha.org]. There's a lot of info in the site and links to much more.
    • Re:A great site (Score:5, Informative)

      by The Mayor ( 6048 ) on Thursday June 27, 2002 @11:36PM (#3784425)
      High availability should not be confused with handling load. High availability ensures uptime for a server. Load balancing distributes a load across multiple servers, allowing the handling of larger loads. Linux-HA is for the former.

      Here are some links to some load balancing projects I'm aware of:

      • lbnamed [stanford.edu] - A load balancer written in Perl
      • Super Sparrow [supersparrow.org] - A Linux-based load balancer
      • Ultra Monkey [ultramonkey.org] - A high-availability and load balancer solution based on Linux (it looks like Super Sparrow may be Ultra Monkey's load balancer)
      • LVS [linuxvirtualserver.org] - A high-availability and load balancer solution based on Linux
      I've never used any of these, so I can't give any first-person accounts as to their effectiveness. This list isn't meant to be exhaustive, either. It's just a starting point.
      • by SwellJoe ( 100612 ) on Friday June 28, 2002 @03:32AM (#3785141) Homepage
        Ultra Monkey is a package including LVS, prepared mostly by Horms.

        Super Sparrow is a distributed load balancing package also by Horms (formerly of VA Research|Linux|Software|Spacecraft|Doohickeys) that uses BGP route information to decide which server ought to service a request. Neat stuff. Super Sparrow is not ready for deployment, and appears to be on a back burner (due to VA's disinterest in such things these days, probably).

        LVS is the project to beat in this space, by a long ways. It is very very solid, and extremely efficient. Wensong is quite an impressive nerd.
    • Is there any product/solutions that will have balancing the load on a multihome internet setup? any help would be greatly appericated.
  • An expensive but, very good solution is the Cisco (ex Arrowpoint?) CSS 11000.
  • by Jason H. Smith ( 142884 ) <jhsNO@SPAMproven-corporation.com> on Thursday June 27, 2002 @11:34PM (#3784412) Homepage

    We have recently done just this using the Linux Virtual Server Project [linuxvirtualserver.org], and it has turned out very well. Just be prepared to read a lot of documentation.

    Basically, you patch a stock Linux kernel and use a tool similar to ipchains to establish virtual services. These services forward requests to your back-end real servers according to a flexible ruleset that you design.

    You can use NAT to hide the real servers from the Internet if you like. This allows you to use most any web server you like (such as IIS), but more fancy routing tricks can be done with Unix or Linux servers for even better results. We use NAT at our site (university EE department) and it can handle more load than we will ever receive -- our objective is high-availability. Also, you can use different methods for different server clusters on the same director (e.g. tunneling tricks for Linux apache servers, and less magic for IIS).

    And LVS can be set up such that once a user connects to a particular server, his subsequent connections go back to the same server.

    Also, you can use freely-available third-party tools like Mon [kernel.org] to watch your real servers for failure and dequeue them, page you, etc. etc. The bottom line is, since you are using Free tools to do this project, you are limited by your imagination as to what you can do with your cluster.

    I have been very happy with the result. And so have many others. If you want to hear big names, LVS is used by linux.com, Sourceforge, zope.org, VA Systems, and RealNetworks, according to their deployment page [linuxvirtualserver.org].

    • LVSP is one I hadn't run across, I definitely appreciate the references. These how-to's are going to make some great weekend reading (ie, I haven't read them yet), did you run across anything in them that had something that actually inspected the request coming in? (this is not the most important aspect, but I would love to be able to redirect either servers looking for robots.txt or a known set of spider IP's to a specific box).
      • LVS itself doesnt have the capability of looking into the contents of the packets it is directing. It is a layer 4 load balancer, hence it has no understanding of the http protocol. You will need to look into KTCPVS or DRWS for a layer 7 balancer that can inspect urls. This web page should give you all the details. [linuxvirtualserver.org]
  • have something similar, I remember reading something about slashdot's host setup
  • Try mod_backhand. (Score:2, Interesting)

    by Mordant ( 138460 )
    It just works:

    http://www.backhand.org/

    Or, failing that, go buy a Cisco CSS11500-series box for lots of $$$.

    ;>
  • I'm going out on a limb here, not knowing a lot about networking or Linux, or RAID for that matter.

    My understanding of (2-disk) RAID0 is that blocks are written alternating between drives. A simple shell script or very simple program should be able to simply alternate connections...However, as everyone knows, just because the number of connections are equal doesn't mean the loads are the same. There'd need to be checking for which one has more slots left, which has a higher workload, etc.

    Maybe SNMP would come into play here somewhere?
  • Pound (Score:2, Interesting)

    by mwr ( 12650 )

    Pound [apsis.ch] is a simple http/https load balancer that's been announced fairly frequently on the Zope mailing list. It appears to be very small, runs diskless and chrooted, and handles back-end servers dropping off and coming back.

  • You want to use lvs (Score:3, Informative)

    by malice95 ( 40013 ) < ... <at> <gmail.com>> on Friday June 28, 2002 @02:00AM (#3784923)
    Use Linux Virtual Server. [linuxvirtualserver.org] I have 15 ldap/webservers being load balanced in 3 sites (each site of consists of 2 LVS servers in a hot/standby config) with each HA pair of lvs systems load balancing 5 servers.. if 2 or more of one sites servers go down then the site's lvs system will begin to route 20% up to 100% of the traffic to the other 2 sites. You will need to read a ton of docs but its pretty easy to setup once you get the hang of it. Its rock solid so far. I am planning on implementing them all over our company network.
  • Comment removed (Score:5, Informative)

    by account_deleted ( 4530225 ) on Friday June 28, 2002 @02:52AM (#3785050)
    Comment removed based on user account deletion
  • If its just web, take a look at lbnamed [stanford.edu], a load balancing name server. They use it at Stanford with some sucess to redirect new connections to the machine with the lowst load (based on system load and users logged in).

    --
    Hey, atleast I don't wash your car windows while your at a stop light, then beg for karma.
  • A load-blanenced beowulf cluster of thes.... wait a minute.
  • If you are using PHP, you can keep session state across multiple servers two ways.

    1. If you are using file based session storage, in your php.ini set the session save path to a NFS share on one server.

    2. (recommended) PHP has support to use a MySQL database to store session information, you could run a single database server to store all session information.

  • there is a patch to iptables which does some load balancing ; it looks really cool : http://netfilter.samba.org/documentation/pomlist/p om-base.html#nth
  • We have a "front-page" server. That server randomizes links to

    server1.poop.ca
    server2.poop.ca
    server3.poop.c a

    etc... If we need to take a server down, we just reroute its traffic to another server (and we usually have a free one).

    I suppose this doesn't help if you've got too much front page traffic for one server, nor is it a perfect solution in any case. But it's really easy to implement, and works just fine for us.
  • Speed! DO you need load balancing or do you need redundacy. There are several, pretty good, Linux solutions that have already been mentioned. But, these solutions all have a significant limitation. Processing power is that limitation. They can provide the redirection necessary for redundancy but they will suffer if your goal is truely load balancing for performance reasons.

    While it is straight forward enough to perform layer 7 redirecting, if your load is such that it will crush IIS or Apache, then putting a single box with a single or dual CPU in front of the web servers won't help much as this box will then become the bottle neck.

    The "expensive" layer 4-7 switches that you mentioned are specifically designed for their function with multiple high bandwidth ports and, most importantly, one or more ASICs per port to handle the processing. This is something that Linux or any PC based load balancer cannot provide for you. Certainly if you are balancing more than a couple of ports.

    So, if you want redundancy and the load isn't all that high, Linux could be the answer. But if you have a truely high load you need to look at the real deal like Nortel/Alteon or Cisco/Arrowpoint. And if you're doing SSL a hardware SSL accelerator is the ONLY way to fly!
    • One of the projects I'm involved in is the JANET Web Cache Service [ja.net] which is a top level proxy service for the UK academic community.

      We use LVS [linuxvirtualserver.org] code to load balance our squid boxen at layer 4, and have successfully shifted some 120Mbps through one of our nodes using direct routing on the backends, rather than NATing the system - this configuration barely loaded the frontend (which was only a 500MHz machine) and load balanced some 15-16 backend machines.

      ISTR there is some early layer 5-7 code on the LVS site somewhere, but I've not used it, so I don't know how stable it is, or what the performance is like.

    • when I worked at a certain huge company that everyone hates... we had cisco localdirectors that had (1)PIII-450 CPU's in them.. we found that by opening up the box(thus breaking warranty), upgrading BIOS & CPU(to 600, this was back in '99), we got 30% more traffic thru the same box... processing power is the limitation, but, that's not to say that some of these commercial boxes from CISCO and the like are not PC based... They look just like any other box on the inside, except they had an ISA card with a flash rom that had their software on it.

      F5 BIG/IP's are BSDI boxen, etc.etc.
  • www.ipfilter.org
    Updated for 3.4

    New to this release (3.4) of IP Filter are the following:
    Round-robin redirection to spread traffic load over multple IP addresses

    Check it out..... Host-based firewalling _and_ load balancing! Joy! All as a LKM!

    --NBVB

One man's constant is another man's variable. -- A.J. Perlis

Working...