0

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

Alex
  • 6,603
  • 1
  • 24
  • 32
Brob
  • 123
  • 2
  • @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 Answers3

1

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.

stefgosselin
  • 257
  • 1
  • 4
  • 14
  • is there a good way to share the conf file on here? –  May 27 '11 at 09:54
  • Sure, either append it to your post, or maybe better post a copy of it [here](http://pastebin.ca/) and post a link to it at the bottom of your post. –  May 27 '11 at 10:09
  • The .conf file is located here http://pastebin.ca/2070217 –  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. –  May 27 '11 at 11:02
  • what should I change? –  May 27 '11 at 11:05
  • lines 151 and 178 are comments, which lines are you referring to in the patebin link? thanks –  May 27 '11 at 11:11
  • Yes, uncomment those two lines, and restart apache, + past the content of the uncommented files on pastebin. You will be able to overide the default settings this way. –  May 27 '11 at 11:26
  • httpd-default - (http://pastebin.ca/2070250) httpd-mpm - (http://pastebin.ca/2070251) thanks for your help –  May 27 '11 at 11:33
  • All in all, your settings ain t so bad you could lower the MaxKeepAliveRequests 100 to 80, but it will help a tiny bit, but that probably won't be enough ... Maybe disable unused modules and enable mod_deflate. See [this page](http://www.serverwatch.com/tutorials/article.php/10825_3436911_1/Apache-Server-Performance-Optimization.htm) for other common optimisations. –  May 27 '11 at 11:47
  • again thanks for the help. If there is anything else you can think of that would be great –  May 27 '11 at 12:18
0

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.

  • 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. –  May 27 '11 at 09:20
  • @Brob and the answers to the rest of my questions? Never mind, you edit your response. –  May 27 '11 at 09:21
  • You still haven't told me if you've benchmarked your app on this platform, with this configuration. –  May 27 '11 at 09:23
0

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).

rightstuff
  • 630
  • 1
  • 5
  • 6