DeveloperSide.NET Forums

DeveloperSide.NET => Building a Web Server, for Linux => Topic started by: ittec on May 08, 2008, 04:07:53 PM



Title: Apache Devside.net Tutorial
Post by: ittec on May 08, 2008, 04:07:53 PM
Hi everybody and congratulations by site, very helpfult. First of all, i don't know if this is the properly forum to my question. Is about a tutorial about "Tunning and performance Apache":

http://www.devside.net/articles/apache-performance-tuning (http://www.devside.net/articles/apache-performance-tuning) I found your web through MySQL Performance Blog (http://www.mysqlperformanceblog.com/2007/02/05/why-do-you-need-many-apache-children/).

Quote
MaxClients ≈ (RAM - size_all_other_processes)/(size_apache_process)

Use 'ps -ylC httpd --sort:rss' to find process size. Divide number by 1024 to get megabytes. Also try 'top'.

Use 'free -m' for a general overview. The key figure to look at is the buffers/cache used value.

Use 'vmstat 2 5' to display the number of runnable, blocked, and waiting processes; and swap in and swap out.

Example:

    * System: VPS (Virtual Private Server), CentOS 4.4, with 128MB RAM
    * Apache: v2.0, mpm_prefork, mod_php, mod_rewrite, mod_ssl, and other modules
    * Other Services: MySQL, Bind, SendMail
    * Reported System Memory: 120MB
    * Reported httpd process size: 7-13MB
    * Assumed memory available to Apache: 90MB

Optimal settings:

    * StartServers 5
    * MinSpareServers 5
    * MaxSpareServers 10
    * ServerLimit 15
    * MaxClients 15
    * MaxRequestsPerChild 2000

I don't understand how author of tutorial find the exaclty number to MaxClients. We know the total amount of RAM, and the total amount used by APACHE.

APACHE = 7-13 MB (totally?)
RAM      =  128 MB
REST OF SO= ???

Max Clients = 15

How you discover the exactly or properly value for Max Clients? My first doubt is how to find the total amount in memory of all process that are not httpd childs, to make the correct formula.

Great tutorial! Thanks.


Title: Re: Apache Devside.net Tutorial
Post by: admin on May 08, 2008, 05:11:26 PM
Quote
Reported httpd process size: 7-13MB

One point to consider is that out of that 7-13MB reported process size, half of that could potentially be "shared memory" that is part of all the given Apache processes running on that system...

In example: If you have 20 Apache processes and each is being reported as 15MB, there is a very good possibility that what you really have is 20 10MB processes that are also sharing common libraries that are another 5MB.

The point is its very difficult to get an accurate picture and do the correct math. The best solution is to estimate what your system can handle, set the maxclients value, and keep track of system resources.


Title: Re: Apache Devside.net Tutorial
Post by: ittec on May 09, 2008, 08:51:34 AM
Quote
In example: If you have 20 Apache processes and each is being reported as 15MB, there is a very good possibility that what you really have is 20 10MB processes that are also sharing common libraries that are another 5MB.

So when we did:

Code:
ps -ylC httpd --sort:rss

the last value of RSS is the total value that Apache is using in this moment? Or only the memory to one process of apache? I think that is the total value of memory loaded by one process child of apache, not the total RAM used by apache, isn't it?


Title: Re: Apache Devside.net Tutorial
Post by: admin on May 09, 2008, 02:17:21 PM
'ps' does not accurately represent memory usage.

Use this script to do that...
http://www.pixelbeat.org/scripts/ps_mem.py

Also read...
http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html
http://elinux.org/Runtime_Memory_Measurement


Title: Re: Apache Devside.net Tutorial
Post by: ittec on May 09, 2008, 04:17:20 PM
Very interesting links admin, Thank you very much!