Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am wondering how I can set this up. I only have the two servers available to me, and I want to be able to deliver the same content from both, but have the load distributed so one server doesn't get bogged down. How would I go about doing this? Any kind of tutorials out there?

share|improve this question

migrated from stackoverflow.com Jun 13 '12 at 7:11

This question came from our site for professional and enthusiast programmers.

    
look at nginx or HA proxy –  user30597 Jun 12 '12 at 23:31
    
Does that require a third server? –  Bobby S Jun 12 '12 at 23:31
add comment

2 Answers

Here are a few ways to do it:

  1. DNS load balancing - RR or Weighted RR.
  2. Use a HAProxy on both, and let them LB between themselves.
  3. Write URLs on your page so that they load balance across both - if dynamic.
share|improve this answer
    
That HAProxy looks interesting, that doesn't require a third server? –  Bobby S Jun 12 '12 at 23:37
    
No, you can run it on both the servers, and route requests between both ... the deal is in handling network load vs. cpu load. If network load is huge, you won't get the ideal LB with only 2 servers. DNS is an option, but if you're using only 2 servers, you can forget it. For your case, you're better off using approach 3. –  Karthik Kumar Viswanathan Jun 12 '12 at 23:49
add comment

A further option would be to install a load balancer software on one of the two servers. You can configure the load balancer to listen on port 80 and your apache server to listen on another port. The load balancer then will distribute the requests between the apache server running on the same machine and the one on the other machine.

There are several software options for load balancers out there:

  1. Simple ones just distributing network connections between servers (Layer 4, the may work for other stuff than web too). For example pen.

  2. Software working on the http level. Like varnish a caching proxy that also allows lb or lightweight webservers like lighttp or nginx which come with proxy functionality to forward requests to other webservers.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.