We have some heavy file (about 100k).

sometime response time is very slow (100s)..

why ?

I'm a poor server administrator.

so could you help me?

information is following:

  1. httpd one process has 10MB
  2. RAM is 4G
<IfModule mpm_prefork_module>
        StartServers             300
        MinSpareServers          10
        MaxSpareServers          300
        ServerLimit            1000
        MaxClients             1000
        MaxRequestsPerChild    9999

What is the best configurations? MaxClients are too many?

  • What is your traffic like? Surely you don't think 100K is "heavy"? – hobodave Feb 8 '11 at 6:40

There isn't nearly enough information in your question for me to be fully helpful. However I can give you some pointers for your prefork configuration.

First, are you sure your httpd processes weigh in at 10MB across the board? If so, that's great, but that is much lower than what I have often seen in practice, which is anywhere from 25MB to hundreds (mod_php).

Assuming your httpd processes really are 10MB, your ServerLimit and MaxClients settings will permit Apache to spin up 1000x10MB workers. That's 10GB of RAM. Your machine does not have this, and it will swap. If your machine is swapping then you are essentially dead in the water, and this could be the explanation for the slowness you see.

(Use top, free, and vmstat commands to view swap usage)

Now your other settings StartServers means you are spinning up 3GB worth of apache workers just when you start Apache. On a 4GB machine, this is very likely not what you want. Depending on the footprint of your operating system you could easily be making the box swap just with this.

Knowing absolutely nothing else about your application I would suggest trying the following settings instead:

<IfModule mpm_prefork_module>
    StartServers             10
    MinSpareServers          10
    MaxSpareServers          50
    ServerLimit             200
    MaxClients              200
    MaxRequestsPerChild    9999

If this is insufficient and you see requests start to get dropped due to apache hitting the ServerLimit you can try increasing this a bit, but I would not go over 300. If this is still insufficient, then you need to scale either horizontally (more web servers) or vertically (more RAM).

| improve this answer | |
  • Thank you for huge answering . it will make help me . did you mean our machine is not able to have 1000 MaxClients? and How to measure a httpd memory usage . I used ps -aux | grep httpd – freddiefujiwra Feb 8 '11 at 8:12
  • @fff ps aux is sufficient. Yes I meant exactly that. Do the math 1,000 x 10 = 10,000. 10,000 MB = 10 GB. You only have 4 GB of RAM. – hobodave Feb 8 '11 at 16:53

The question is very confused.

The right values for the number of servers varies massively depending on configuration and usage as well as system resources.

Start logging the number of httpd processes and the free memory on the system (you didn't what OS this is running on - if it were Linux, you'd be looking at the second line of out put from the 'free' command). Draw a graph - note that if you get to the point where the free memory is all used up - that means all the disk cache is used up - and as you near that point the performance will degrade rapidly.

Learning how to tune a webserver would fill several large books - and that's before you start looking at the OS - people here are willing to help - but if its important to you, then you're probably going to have to pay for someone's time to look at this in more detail. At least consider buying a good book on the topic and taking time to learn yourself.

This config looks like its intended to cope with a relatively high volume of traffic - but you should really consider lowering the maxRequestsPerChild.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.