Server taking too long to respond error

apache-2.2

This is my first post on serverFault and my first entry in to web server configuration.

The hardware and software.

CPU: GenuineIntel, Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz
OS: Linux 2.6.18-128.el5
Memory: 2Gb

Background.

I am running a small database (MySQL), around 1000 records with each record containing 44 fields. At the start of each day “00:01” the tables are cleared and populated with fresh data.

The are 10 remote PCs all running Winodws XP and Firefox internet browser. All remote PC’s are connected to the internet using a min 4Gb broadband connection.

Each remote PC runs a URL which displays a dynamic page of data which is refreshed every 20 seconds. This is a continual process 24 hours a day.

I problem I am having is on odd occasions throughout the day the PC browser error with “Server taking too long to respond error”. What I am trying to find our is if I have the correct setting in the httpd.conf file on the server. Any help or advice anyone can provide would be very helpful.

Best regards

Dereck

Server config file:

httpd.conf

ServerRoot "/etc/httpd"

PidFile run/httpd.pid

Timeout 120

KeepAlive On

MaxKeepAliveRequests 200

KeepAliveTimeout 5

<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
ServerLimit      256
MaxClients       254
MaxRequestsPerChild  4000
</IfModule>

<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     150 
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

Best Answer

A few things you can check:

  • Are you sure it is your site that is not available and not a local Intranet or Internet issue? Is it always the same computer that has the access problem or do all of them have it randomly? If it is the former I would suspect a local connection issue.
  • Check the logs (Apache, MySQL, system, etc...) around the time when you see the issue for any relevant error messages.
  • If possible check the load on the server when you encounter an issue (top, netstat, df, etc...). You can also setup some form of simple monitoring service that will notify you of any significant system issues.
  • The issue is not necessarily the Apache settings but anything in the stack that your app uses, so MySQL and whatever language (PHP/PERL/...) you're using.
  • You can try benchmarking/stress testing your site using ab/siege to see if you forcibly duplicate the issue rather than waiting for it to appear. The issue could simply be that at certain times in the day all 10 computers submit a request at the same time which your server can't handle. Benchmarking would help tell you if this is an issue or not.
  • Once you get closer to identifying the cause you can try writing short test cases to try and isolate/duplicate it. Once you fix the problem you can re-run the tests to confirm that the issue is indeed fixed (as opposed to the good ole 'well it didn't crash today' test).
Related Topic