|
| Re: apache-optimize should be removed until better thought out. [message #93920 is a reply to message #93919] |
Tue, 10 January 2012 11:18   |
|
I mainly want to get a consensus on who agrees with what I am saying. Once we agree, I will put in a bug report.
Also another point is this script doesn't take into account what the httpd processes even use for memory. This can vary greatly and in a shared environment, can be much higher than the 30MB that is assumed in this script. *As far as I can tell it looks like it is assuming 30 MB anyway*
https://www.mercuryvps.com
HyperVM Xen VPS hosting
|
|
|
|
|
|
|
|
|
| Re: apache-optimize should be removed until better thought out. [message #93987 is a reply to message #93986] |
Wed, 11 January 2012 13:09   |
|
When he replies I will tell him how to properly configure his server so it doesn't run into out of memory issues. The explanation of each directive is very clear on the Apache website and here is how I would explain each:
StartServers - This is the number of initial forked processes.
MinSpareServers - This is the minimum amount of spare IDLE forked processes that it keeps running.
MaxSpareServers - This is the maximum amount of spare IDLE forked processes.
ServerLimit - This essentially mimics MaxClients
MaxClients - This is the maximum amount of forked process that will run simultaneously. This is the key directive to limiting the amount of memory that Apache uses as a whole.
MaxRequestsPerChild - This is the number of requests a forked process will handle before the process ends.
http://httpd.apache.org/docs/2.2/mod/prefork.html
Let me know if you fully understand this and then I can give you an example.
https://www.mercuryvps.com
HyperVM Xen VPS hosting
|
|
|
|
| Re: apache-optimize should be removed until better thought out. [message #93990 is a reply to message #93988] |
Wed, 11 January 2012 13:28   |
|
This is default setting by httpd (inside httpd.conf):
<IfModule prefork.c>
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
</IfModule>
and this is after optimize (inside ~lxcenter.conf; will be overrite value inside httpd.conf):
<IfModule prefork.c>
StartServers 2
MinSpareServers 10
MaxSpareServers 21
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
MaxMemFree 2
</IfModule>
[Updated on: Wed, 11 January 2012 13:29] Report message to a moderator
|
|
|
|
| Re: apache-optimize should be removed until better thought out. [message #94011 is a reply to message #93919] |
Wed, 11 January 2012 16:29   |
com2  Messages: 1119 Registered: August 2007 Location: Spain |
Senior Master Developer |
|
|
I contribute to this discussion a spreadsheet I once made that should help me to find sensible figures for this dilemma. May be it helps to find a better formula.
I agree with the critique of this thread that to limit memory use you should be finding right values for Serverlimit and Maxclients. In the Apache documentation I quote:
Apache MPM preforkSites which need to serve more than 256 simultaneous requests may need to increase MaxClients, while sites with limited memory may need to decrease MaxClients to keep the server from thrashing (swapping memory to disk and back).
In my understanding there is little difference between Serverlimit and Maxclients. The only difference as far as I can tell is that you can vary the limit of Maxclients and graceful restart will read it. To make changes in Serverlimit will need a full restart. Serverlimit needs to be higher or equal to Maxclients.
I quote from Apache documentation again:
Apache MPM Common Directives - ServerLimit DirectiveAny attempts to change this directive during a restart will be ignored, but MaxClients can be modified during a restart.
Special care must be taken when using this directive. If ServerLimit is set to a value much higher than necessary, extra, unused shared memory will be allocated. If both ServerLimit and MaxClients are set to values higher than the system can handle, Apache may not start or the system may become unstable.
With the prefork MPM, use this directive only if you need to set MaxClients higher than 256 (default). Do not set the value of this directive any higher than what you might want to set MaxClients to.
[Updated on: Wed, 11 January 2012 16:36] Report message to a moderator
|
|
|
|
|
|
| Re: apache-optimize should be removed until better thought out. [message #106032 is a reply to message #105924] |
Fri, 29 March 2013 14:37  |
|
This is the auto Optimized settings for my Centos 5.9 php53 on a 1GB RAM L5420 4x2.50GHz VPS, Apache mod_ruid2, mod_pagespeed, php-xcache.
Timeout 150
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
<IfModule prefork.c>
StartServers 2
MinSpareServers 13
MaxSpareServers 26
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
MaxMemFree 2
</IfModule>
<IfModule itk.c>
StartServers 2
MinSpareServers 13
MaxSpareServers 26
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000
MaxMemFree 2
</IfModule>
<IfModule worker.c>
StartServers 2
MaxClients 150
MinSpareThreads 11
MaxSpareThreads 22
ThreadsPerChild 25
MaxRequestsPerChild 0
ThreadStackSize 8196
MaxMemFree 2
</IfModule>
<IfModule event.c>
StartServers 2
MaxClients 150
MinSpareThreads 11
MaxSpareThreads 22
ThreadsPerChild 25
MaxRequestsPerChild 0
ThreadStackSize 8196
MaxMemFree 2
</IfModule>
Include /home/apache/conf/exclusive/*.conf
Include /home/apache/conf/defaults/*.conf
Include /home/apache/conf/domains/*.conf
Include /home/apache/conf/redirects/*.conf
Include /home/apache/conf/webmails/*.conf
Include /home/apache/conf/wildcards/*.conf
###version0-7###
When Mr. GoogleBot, BingBot, Baidu, MsnBot and other seoBots reach my websites in that server at the same time, in just 15 minutes I ran out of memory and the server died.
Then I chaged the settings to Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
<IfModule prefork.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 7
ServerLimit 64
MaxClients 64
MaxRequestsPerChild 1500
MaxMemFree 2
</IfModule>
<IfModule itk.c>
StartServers 2
MinSpareServers 2
MaxSpareServers 7
ServerLimit 64
MaxClients 64
MaxRequestsPerChild 1500
MaxMemFree 2
</IfModule>
<IfModule worker.c>
StartServers 2
MaxClients 64
MinSpareThreads 5
MaxSpareThreads 11
ThreadsPerChild 25
MaxRequestsPerChild 0
ThreadStackSize 8196
MaxMemFree 2
</IfModule>
<IfModule event.c>
StartServers 2
MaxClients 64
MinSpareThreads 5
MaxSpareThreads 11
ThreadsPerChild 25
MaxRequestsPerChild 0
ThreadStackSize 8196
MaxMemFree 2
</IfModule>
Include /home/apache/conf/exclusive/*.conf
Include /home/apache/conf/defaults/*.conf
Include /home/apache/conf/domains/*.conf
Include /home/apache/conf/redirects/*.conf
Include /home/apache/conf/webmails/*.conf
Include /home/apache/conf/wildcards/*.conf
###version0-7###
Then it can survive the incoming rush. In my opinion, the mod_pagespeed takes quite a lot of resource, and I guess the auto optimized feature is only the base calculation, as in practice it depends on many things, such as your server configuration, xcache configuration, mod_pagespeed configuration and more.
|
|
|