Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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>
share|improve this question
    
Are you using the worker or the prefork MPM for apache? –  DerfK Jan 18 '11 at 0:48

3 Answers 3

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).
share|improve this answer

Your config is far from optimal, however it should have absolutely no problem in serving the load you describe.

You've not given us much details on how the code works. There's nothing in your description of the code to suggest that it could cause a timeout - but it is conceivable that there could be deadlocks in the code. In this case, your logs should be full of errors. Indeed, that's the first place to look when your site doesn't behave as you expect. Your access log (apache is usually configured to use the combined log format) will show the times taken for each request. Are there any high values? Anything over 120 seconds should produce an error log entry as well.

You can't access a MySQL database from Apache- you need some application logic in between - but you've given no details. This should be logging errors if the requests really were taking that long.

However I'd place bets on the problem being at the client end or on the network - the request is never getting to the webserver. In order to prove this, I'd verify the duration of the last request from a client before it went client - it will be no longer than expected. As to how you isolate the root cause....that's more complicated. Maintaining detailled packet logs at all clients and the server is rather difficult. The most likely candidates are the network itself or "security" software.

It's probably a lot simpler to look at the mechanism by which the page is refreshed and construct something a lot more resillient with some basic diagnostics built in (i.e. written in javascript, displaying a sensible error message when stuff fails and checking site connectivity)

share|improve this answer

It sounds like your server is blocking for some reason. You might need to increase the apache settings or switch to fastcgi, but I suspect that there is a slowdown in PHP or MYSQL. Turn on the mysql slow query log to see if mysql might be the slowdown. See http://dev.mysql.com/doc/refman/5.5/en/slow-query-log.html

share|improve this answer
    
"around 1000 records" - this is extremely unlikely to be caused by poor performance - it's a deadlock or connectivity problem. –  symcbean Jan 5 '13 at 22:40

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.