detecting server 'over'load

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sam4free
Forum Newbie
Posts: 18
Joined: Fri Oct 10, 2008 6:02 pm

detecting server 'over'load

Post 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.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: detecting server 'over'load

Post 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".
sam4free
Forum Newbie
Posts: 18
Joined: Fri Oct 10, 2008 6:02 pm

Re: detecting server 'over'load

Post 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.
Post Reply