• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Script Request

eugeneo

New Member
Hello I own, wisexchange.com and need a script that automatically redirects users to the server with the less load. Preferably the code should be php because I donno anyother scripts that will work on Linux servers. I have a budget of $2-$10
 
here is the most simple redirect code i could think of. you don't need a wait or anything, it will redirect very quick where it isn't even noticeable. :D
PHP:
<?="<meta http-equiv='refresh' content='0;URL=REDIRECT PAGE NAME HERE.php'>"?>
just put that at the top of the page that you want to redirect the person to. and if you want, give them a link to click in case it doesn't redirect them automatically. that should do it for you. if that isn't what you are looking for, please be more specific in the details. :p hope that helps. PS, if it does, please help with my rep points. :p No payment necessary. :D
 
How many Server do you have?
I think you would need to use remote access Key to get to: /scripts/servup.
You'll need that for every server. and from there you'll have to send the person to the one that is less.

Best Regards,
Pat
 
automatically redirects users to the server with the less load.

Not what they're looking for, Justin ;)

I'm not entirely sure on how to do this. You'd have to connect to another server, remotely login, and then exec('uptime'). Never done that, not sure it's possible with PHP.
 
I would say it is, but his index page will have to manipulate the 2-3 servers that his site is hosted on.
 
^^this is the biggest problem, it will put a load of pressure on the servers : connectin everytime that page loads, unless you ran a cron job, dump data into a database every 15 30, 60 minutes or so, and used that to redirect pages, that wud be faster....but a load of work .....and maybe not as accurate .... but I would say that connecting to three servers everytime someone tries to access your site is a crap idea ... even running the cron job every 5 minutes would be better than that ....

couple of things. .... do you have ssh access to every server ?
does every server allow you to run cron jobs ?
do all these servers use the same database ?
and urm .... no that's it for now........
 
In my case we use a Cisco router with a serverfarm setup to load balance...

If that is not possible I'd do as he said...I'd just write a script that would dump server load every 2-4 minutes into a flat file database so you don't have to worry about extra sql processes. Then I'd call a script to immediately set var = whichever server has the least load.

Then when someone hits your index it redirects to $var.

That is the most minimal resourced plan I can come up with....There are some smart folks on this board...Maybe a simpler way. =) Good luck
 
Last edited:
sorry, i was thinking to redirect to a new page. my bad. didnt read correctly. hmmmm, i am not sure that what you are doing is really a good idea, and wouldnt really kknow how to do something like that. sorry i cant help more.
 
Last edited:
Wouldn't it be easier, as not as effective spreading the order per load, to send each visitor to the next server. 1st visitor goes to server 1, 2nd visitor to server 2, etc etc.
 
Back
Top