Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Apache Optimization

Posted on 2006-06-21
Medium Priority
Last Modified: 2008-02-01
I need help optimizing a server w/ 15Gigs of RAM.  The load is currently stable now, however it's slow.  It's for a very popular & busy forum server.  Below are the current values.  Any Apache experts here that can help me possibly fix the following values or explain them?  At certain times, I see the following error below.  Thank you.

[Wed Jun 21 11:43:08 2006] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 23 idle, and 370 total children

[Wed Jun 21 11:43:09 2006] [info] server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 32 children, there are 24 idle, and 386 total children

<IfModule prefork.c>
StartServers      500
MinSpareServers   40
MaxSpareServers   90
ServerLimit      2048
MaxClients       2048
MaxRequestsPerChild  0

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule worker.c>
StartServers       1000
MaxClients         2500
MinSpareThreads     450
MaxSpareThreads    2500
ThreadsPerChild     350
MaxRequestsPerChild 0
Question by:techie411
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 17004532
LVL 27

Accepted Solution

Nopius earned 2000 total points
ID: 17006869
Did you read: http://httpd.apache.org/docs/2.2/mod/prefork.html and http://httpd.apache.org/docs/2.2/misc/perf-tuning.html ?

> At certain times, I see the following error below.
that's are not errors, just 'info' messages ...

MaxClients - this variable is very importent.
1) Determine memory size, consumed by a single apache process (top command), suppose we have:

71264 www         1  96    0 20024K 11572K select   0:00  0.51% httpd

I see 20M RAM size and about 12M resident memory size.

Now you have 12G RAM, suppose 10G is ok to use for Apache processes (other 2G for system and whatever.
Then, your limit is about 833 apache processes (that can fit to memory without swapping). You should never exceed this value of childrens.

Now (of even first of all) check what MPM are you using:
httpd -V
it's either prefork (-D APACHE_MPM_DIR="server/mpm/prefork") or worker, but NOT both

Don't use so much value of StartServers:
StartServers      500
most of them will be killed in a second after apache start (it's an extra work to spawn then to kill) because most of them will be idle at start time and every idle child above MaxSpareServers will be killed.

# These lines will manage how often apache will spawn and kill new idle servers.
MinSpareServers   40
MaxSpareServers   90

These error logs "spawning 16 children, there are 23 idle" shows that your have high enough connection rate (about 80 connections per second).
Why 64? Because you have 370 spare apache servers with 2048 maximum clients, suppose the load is distributed equally, it's about 5 connections per 1 server process (yes, it's very low). Spare servers are checked for spawn once a second, so 16 servers need to be spawn to handle these new connections, we have 16*5=80 connections per second.

What is wrong in your configuration?  High value of StartServers. Probably it's a low value of MaxClients. May be someone is doing DoS against your server, you may limit connection rate then.


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question