Hello all!

I came here through Google searching for PHP load balancing... and got to this thread: http://www.daniweb.com/forums/thread171839.html

I am trying to do something similar, but what I'm trying to do is a one time, one day, quick and cheap load balancing solution using PHP.

The idea is to use a simple php script to randomly redirect users to several other servers with one static page. I am just wondering if this would be sufficient if I were to expect an influx of users for only one day (may reach up to 50,000 users within a one hour period). Below is what I have come up with using only limited php knowledge. The server running this script will be a basic dedicated virtual server by MediaTemple which should suffice as a temporary load balancer, and will be redirected to multiple GridServer accounts from MediaTemple. Do you see any problems with this?

$servers = array("www.foo1.com", 
$server = $servers[array_rand($servers)]; 
header("Location: http://$server"); 

Thank you for taking your time to look at this! I really appreciate it!

Edited by icon512: n/a

7 Years
Discussion Span
Last Post by Froger93

That looks fine although if this is just one static page then it's not shortening the load infact you are doubling it as they are going through two servers.


Well, the point is to make sure that one server is not overloaded and fails...

So even though the load time is taking a little bit longer, it's better than overloading the server and having it take minutes to load or even worse, nothing...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.