I have a debian VPS with 2 GB RAM which is really good for handling big stuff. Recently, however, my website goes down often and I still can't target the exact reason.

At first I had 512MB RAM which was really too small to handle my website. As I saw in the logs, the site used at least 450MB. I upgraded it to 2GB hoping that would solve everything, but it hasn't done anything.

Then I thought it might be that my website code was running a huge process, because it actually was. So I rebuilt a simple system to reduce the huge process that was being done. Still, the same problem persisted.

Now I'm thinking it might be a number of visitors problem. But there aren't even 30 active visitors, even less, and 2 GB of RAM should good to handle them all. After looking at the RAM usage when the site goes down, it's about 400-500MB of the 2GB, so to me that confirmed it's not the RAM's problem.

So I'm really confused now. What else could it be?

Apache error logs are all about my PHP files notices and un-important stuff that has nothing to do with taking the Apache down, but I'm sure its only an Apache problem because SSH connects and works perfectly while the website is down.

What are expected problems or anything else to check? Could it be an Apache limitations for visitor usage?

  • 2
    So what do you mean by "My VPS apache goes down often"? Do visitors oten get a HTTP 500, a connection refused, connection timeout or what? Oct 12, 2012 at 20:17
  • it keeps loading forever, no respond.. and might take longer than expected
    – Osa
    Oct 12, 2012 at 20:22
  • So a connection timeout? Did you try tcpdump on the server? Do you actually see the requests? Does the TCP-handshake work out well? Oct 12, 2012 at 20:24
  • could u submit this as an answer with more details
    – Osa
    Oct 12, 2012 at 20:33
  • i checked server-status and some apache files, of them one that brought my attention : Max Clients : 10 .. i was like 10 ?!!! then i checked server-status and it says 10 requests currently being processed, do i have to change max clients ?
    – Osa
    Oct 12, 2012 at 21:17

1 Answer 1


While I have little information as to what happens in regard to TCP handshaking or other network issues, it appears (by your comment) that in apache.conf that you are having over 10 users trying to be processed concurrently, and your MaxClients directive is too low to handle your traffic. I would increase the number. Since I do not know what kind of traffic your server receives, I'd set the value to at least 50, and increase it if loadtesting incurs problems. You can run a loadtest with a free service such as Load Impact. [No affiliation]

From http://httpd.apache.org/docs/2.2/mod/mpm_common.html#maxclients:

The MaxClients directive sets the limit on the number of simultaneous requests that will be served. Any connection attempts over the MaxClients limit will normally be queued[emplasis mine], up to a number based on the ListenBacklog directive. Once a child process is freed at the end of a different request, the connection will then be serviced.

Your connections appear to be 'hanging' since they are being queued up for processing, although I do not doubt your server can handle a bit concurrently.

  • Yes i just increased the number to 50 and its working all fine now, so now, my question is.. what is the good number for maxclients for 2GB ram ?, what if i wrote 1000, will it matter ?
    – Osa
    Oct 12, 2012 at 21:48
  • 1
    @Osa There is no specific optimum for 2 GB RAM. It depends on whether you are using PHP or another server-side technology, how heavy the scripts are, how big each page is, and other factors. If you start to have issues, then increase the number. However, if system load averages or RAM usage spikes, then you may want to decrease the MaxClients setting. Remember that if you are using MySQL, you need to respect the MaxConnections setting on that server or you may get database connect failures.
    – nanofarad
    Oct 12, 2012 at 21:51
  • well, i mean .. if i used 1000 maxclients as example, doesn't that mean to handle the max clients ever, if it hit the regular max lets say 400 then 1000 will be ignored right?
    – Osa
    Oct 12, 2012 at 21:58
  • Not exactly. Even if you get little traffic, you will have more worker threads "ready" if the setting is 1000 than 400. There still won't be 1000 threads/child processes, but there may be more.
    – nanofarad
    Oct 12, 2012 at 22:12
  • 1
    You can also use ab for load testing to get an idea how to set your numbers up. This link has a good process for using ab to set the MaxClients number.
    – pjmorse
    Oct 15, 2012 at 13:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .