Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

My hosting provider specifies how many simultaneous connections the hosting account can handle. The question is how do I know if my site reached this limit and drops connnections?

I have a PHP site which have proper error reporting and sends me a message if an error occurs, but in this case it does not apply, because if there are too many concurrent connections then Apache does not even call my PHP scripts.

How can I be notified if this error occurs, so that I know it's time to upgrade my account to a bigger hosting package which can handle more simultaneous connections?

share|improve this question
add comment

2 Answers

Your site shouldn't immediately drop connections when the maximum number of concurrent connections has been reached, unless your host has something in place specifically to handle this case (see below). In Apache, the MaxClients directive is used to set the maximum number of concurrent connections. Anything beyond this limit will go into a queue to be processed after a pending request is finished, the size of which is determined by the ListenBacklog directive and the operating system.

To keep the queue moving along as fast as possible, is generally recommended to ensure that the KeepAlive directive is set to "On," allowing multiple HTTP requests in succession (for instance scripts, CSS, images, etc) to be served over the same TCP connection without the overhead of recycling it every time. Often you can check for KeepAlive being used in the response headers, though not all servers will respond with KeepAlive headers even after establishing a persistent connection. You could, however, ask if your host uses KeepAlive if you don't see these headers coming back.

All that being said, ab can be used to benchmark performance on higher-than-average load conditions, to see how your server will behave. If your current load results in unacceptably high page load times, it may be time to relocate. In most cases, you should notice this well before requests actually start to timeout.

share|improve this answer
add comment

Edit: To more directly answer your question..

First, I would configure some sort of external monitoring so you can receive notifications of issues. There are many methods of doing this, from simple scripts run remotely, open source tools like Nagios (not for the feint at heat), or you could use an online service like pingdom.com.

Pingdom (there are many others out there) allows you to monitor one url for free and it is very easy to setup. Have the check search for text on one of your PHP url's so you know your site is serving actual data. Have the script run every 5 minutes and alert you when there is a problem. Off topic, but you may also want to look into serving your static content (images, videos, etc) from somewhere else.. Amazon S3 maybe. This would be especially relevant if your VPS provider has KeepAlive disabled.. it might be cheaper than starting another VPS instance.

Good luck!

share|improve this answer
    
He's talking about shared hosting where one usually does not have access to Apache settings. –  Tom Mar 4 '12 at 9:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.