Page 1 of 1

detecting server 'over'load

Posted: Fri Oct 16, 2009 4:47 pm
by sam4free
Is there a way to detect when a server is overloaded?
It's easy to get the server average load .. but this number means almost nothing to a php script because its very dependent on the number of CPUs the server has.

What I'm looking for is a way to add a condition to a page that requires a lot of resources like a db search page, this condition will stop the page and display some error message if the server load is high.

Re: detecting server 'over'load

Posted: Fri Oct 16, 2009 6:47 pm
by requinix
Couldn't you measure server load by the number of connections to the database? Lower the number of allowed connections far enough and the mysql_connect call will fail if the server is "overloaded".

Re: detecting server 'over'load

Posted: Sat Oct 17, 2009 4:34 am
by sam4free
It's a very good idea, tasairis. i'll research it.
But i guess it's a little difficult to implement in a shared hosting environment, and with a commercial script that will run on different types of configurations.