Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im running a webserver where I'm hosting about 6-7 websites. Most of these websites get their content from MySQL which is hosted on the same server. Traffic average per day is about 500-600 unique visitors, about 150K hits per week.

But for some reason sometimes websites send a timeout, OR sometimes websites dont load all images. I know that I should perhaps separate static content from dynamic content, but for now I think that's not a possibility.

I would appreciate any suggestions on how could I improve the performance of apache, so it doesn't keep timing out.

Server is running on Sempron LE 1300; 2.3GHz,512K Cache 2GB RAM 10Mbps/1Mbps

Services: MySQL, ProFTPD, Apache.

 Private  +   Shared  =  RAM used       Program
  1.2 MiB +  54.0 KiB =   1.2 MiB       proftpd
  4.1 MiB +  23.0 KiB =   4.1 MiB       munin-node
 20.8 MiB + 120.5 KiB =  20.9 MiB       mysqld
 47.3 MiB +   9.9 MiB =  57.3 MiB       apache2 (22)

top: Mem:   2075356k total,  1826196k used,   249160k free,

Timeout 35
KeepAlive On
MaxKeepAliveRequests 300
KeepAliveTimeout 5
<IfModule mpm_prefork_module>
    StartServers         10
    MinSpareServers      20
    MaxSpareServers      20
    MaxClients           60
    MaxRequestsPerChild 1000
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
share|improve this question

Sounds as if there might not be enough servers/threads. Have you checked your apache error log or syslog? If I don't recall completely wrong it should tell you what resource you need to increase.

Also, I see you give us both your prefork and you worker mpm settings. Take a look at the answer to the question How do I tell if apache is running as prefork or worker? regarding how to find out which mpm you are using.

share|improve this answer

Whilst it's difficult to say for certain without glancing at the Apache error_log I would be concerned that you are hosting six or seven web sites on an Internet connection with only 1Mbit of upload bandwidth. I presume this is either in a very small office or in your own home. Whilst 1Mbit may be adequate for your traffic expectations it sounds fairly plausible that the 1Mbit connection is the cause of intermittent web site loading problems.

I would suggest either outsourcing your sites to a professional web host or perhaps purchasing a low-cost Xen based VPS from a provider like Linode or Slicehost.

At the very least, ensure your DNS is hosted professionally and externally.

If the problem is not with your internet then my second thought would be Apache running out of memory. Apache, with mod_php is fairly memory heavy, each process consuming up to 50MB of ram. Combine that with Apache's default KeepAlive setting of 15 seconds and you could potentially run out of memory, depending on how much SWAP space you have allocated.

Personally I would go with a lighttpd or nginx fastcgi asynchronous event driven model, which can handle many more connections whilst using a fraction of the memory.

Hope this helps.

share|improve this answer

Your Answer


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