Forum Moderators: phranque

Message Too Old, No Replies

Running one website from two apache servers

2 Win 2003 server running apache 2

         

hydn79

4:23 pm on Apr 28, 2007 (gmt 0)

10+ Year Member



I've mirrored the htdocs to the 2nd server. And they file sync every 15 mins.

Problem:
server 1 is www.mysite.com with ip 123.123.123.1
server 2 is simply a different ip eg 123.123.123.2

What is the best method to share the load across the two apache servers?

I notice in the apache console there's a button "Connect" where you can "connect to a remote server". Can that be used to access the htdocs on Server 1 by apache web service on server 2?

Thanks,

Slade

5:03 pm on Apr 28, 2007 (gmt 0)

10+ Year Member



What is the best method to share the load across the two apache servers?

If they are both on the same network, you can use a load balancer appliance(or application on a third served) to monitor the availability and load of both servers and send new traffic to the least loaded server.

To avoid adding hardware, you can add both IPs to the www record of your domain like google does:

C:\Documents and Settings\athompson>nslookup www.google.com
Server: vnsc-pri.sys.gtei.net
Address: 4.2.2.1

Non-authoritative answer:
Name: www.l.google.com
Addresses: 64.233.161.99, 64.233.161.103, 64.233.161.104, 64.233.161.147
Aliases: www.google.com

There are other ways of doing this, try Load balancing Web server methods [en.wikipedia.org] (Wikipedia)

hydn79

6:03 pm on Apr 28, 2007 (gmt 0)

10+ Year Member



Thanks for the fast response! I just sent a request to my host to add the IP of the second server to our domain as you described.

The wiki link led me to this. Can this be a good solution?:
[fastream.com...]

Slade

8:48 pm on Apr 28, 2007 (gmt 0)

10+ Year Member



That falls in the category of "load balancer appliance(or application on a third server)" that I mentioned before. I have no familiarity with that product, so I can't speak to it's effectiveness.

All the other features it describes(pointing different url requests to different slave servers, etc) are nice, but it just moves your single point of failure from your one web server to your one web load balancer(unless it is itself failoverable, which I did not research enough to confirm or deny).

You didn't mention why you were moving to two servers, which is somewhat important in determining how you should move forward. Is your site using so much bandwidth/processor time that you need to spread the load, or are you looking for general increased availability?

Also, be aware that cookies and sessions don't always play well with multiple servers.

hydn79

1:49 am on Apr 29, 2007 (gmt 0)

10+ Year Member



Yes moving because of cpu load. It at about 20 - 30% most of the time but iratically every it will jump to 100% for 1 - 30 or even 60 seconds.

I saw the problem in a past post. And seems the user posted the solution but it was deleted by moderator:

apache hangs cpu 100% utilization many http requests

my apache uses 100% cpu after a while.
How could I help myself?

please see PROBLEM HERE

<snip>

thanks!

[edited by: jdMorgan at 3:50 am (utc) on Nov. 29, 2006]
[edit reason] No URLs, please. See TOS. [/edit]

Any idea what this user did to fix?