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.

we have apache 2.2.18 running on windows server 2003 and when we get a high number of visitors apache seems to slow and slow and slow then grind to a complete stand still.

Anyone know why this would be?

The server is cloud based with 4gb ram

The .conf file is located here pastebin.ca/2070217

share|improve this question

migrated from stackoverflow.com May 27 '11 at 17:20

This question came from our site for professional and enthusiast programmers.

    
@brob - you need to specify more data about what a "high number of visitors" is, more information about how many sites you're running, more information about what web apps are running, are they PHP, Perl etc. What processor, do you use MySQL, is that running on the same box and so on. As it stands this question is liable to be closed. –  Kev May 27 '11 at 17:19

3 Answers 3

Apache is a beast. Out of the box with default settings, it is an ugly beast. Post the httpd.conf and someone here will be better able to give you relevant optimisation tip.

share|improve this answer
    
is there a good way to share the conf file on here? –  Anonymous May 27 '11 at 9:54
    
Sure, either append it to your post, or maybe better post a copy of it here and post a link to it at the bottom of your post. –  Anonymous May 27 '11 at 10:09
    
The .conf file is located here pastebin.ca/2070217 –  Anonymous May 27 '11 at 10:40
    
Ok, first thing your installation is using all default configuration. Please remove the # in front of line 151 and 178 and post the associated conf file content to pastebin, we can then tweak the default configuration and setup a small benchmark comparison test. –  Anonymous May 27 '11 at 11:02
    
what should I change? –  Anonymous May 27 '11 at 11:05

Define "high number of visitors"?

Have you checked the logs?

Benchmarked your server?

Are you sure it's Apache that's the cause of the hanging and not just a web based application your run on top of apache?

IMHO your question lacks appropriate info to give a solid answer.

share|improve this answer
    
The apache logs aren't displaying any errors apart from AcceptEx which has been resolved. 20k hits an hour. It appears to be apache and not the app itself as we have ran the app on other platforms without issue. –  Anonymous May 27 '11 at 9:20
    
@Brob and the answers to the rest of my questions? Never mind, you edit your response. –  Anonymous May 27 '11 at 9:21
    
You still haven't told me if you've benchmarked your app on this platform, with this configuration. –  Anonymous May 27 '11 at 9:23

Apache on Windows uses a thread based model that defaults to 64 threads unless you update those values. Each thread handles 1 connection.

My WampDeveloper Pro configuration is set like this:

(C:\WampDeveloper\Config\Apache\extra\httpd-mpm.conf)

ThreadsPerChild 256
ThreadLimit 384

Then make sure that KeepAlives are set, but set low...

(C:\WampDeveloper\Config\Apache\extra\httpd-default.conf)

KeepAlive On
KeepAliveTimeout 1

Make your changes and restart Apache.

Check your "/server-status" and "/server-info" URLs (you might need to uncomment some lines in httpd.conf to enable these if you are using some other wamp package).

The first URL will show you all the connections and their states. The second one will display the loaded config values.

Then edit php.ini and set sensible output buffering values:

output_buffering = 4096

A value of "On" could potentially not send anything to the client until the end of the script is reached, and will make it seem as if your pages are taking a long time to load.

Also try:

  1. Using mod_php instead of CGI
  2. Using PHP opcode cache such as eAccelerator or APC.
  3. Commenting out your changes in httpd.conf for:

EnableMMAP off

EnableSendfile off

Win32DisableAcceptEx

Note that the slowdown could be due to poorly written / developed PHP code that is slow to process, or grows each Apache thread in size (downloadable files being read/passed via PHP will do that).

share|improve this answer

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.