Pre-Flight Check
This article covers all Apache-based servers including but is not limited to, both traditional Dedicated servers and Cloud VPS servers running a variety of Linux distributions. We will include the primary locations where stored Apache configurations on the following Liquid Web system types:
Calculating the estimated thrashing point or ServerLimit of a server uses a simple equation:

- buff/cache: The total memory used by the Kernel for buffers and cache.
- Reserved: The amount of memory reserved for non-Apache processes.
- Available: The difference between buff/cache and Reserved memory.
- Avg.Apache: The average of all running Apache children during peak operational hours.
Important
Calculating the thrashing point/ServerLimit should be done during peak operational hours and periodically reassessed for optimal performance.
Buff/Cache Memory
On modern Linux systems, the buffer/cache can be derived using the /proc/meminfo file by adding the Buffers, Cached and Slab statistics. Using the free command, we can quickly grab this information, as in the example below:free
Output:

Reserved Memory
Reserved memory is a portion of memory held for other services aside from Apache. Some of the biggest contenders for additional memory outside of Apache are MySQL, Tomcat, Memcache, Varnish, and Nginx. It is necessary to examine these services configs to determine a valid reserved memory. These configs are outside the purview of this article. However, MySQL is the most commonly encountered service running with Apache. You can find tools online to help analyze and configure MySQL separate from this article. Rule-of-Thumb:
Save 25% of the total buff/cache memory for any extra services ran on the server. Examples:
- A standard cPanel server runs several services along with Apache and MySQL. A server with these services runs on the heavier side, needing 25% reserved for non-Apache services.
- A pure Apache web node in a high capacity load balanced configuration does not need to reserve any additional ram for other services.
Average Apache Memory
Finding the average size of Apache processes is relatively simple using the ps command to list the RSS (Resident Set Size) of all running httpd processes. Note: some distributions use “apache” instead of “httpd” for process name. This example uses a short awk script to print out the average instead of listing the sizes.ps o rss= -C httpd|awk '{n+=$1}END{print n/NR}'
Output:
22200.6
This example is easy to average by hand, but larger servers will require more calculation.
ps o rss -C httpd
Output:
RSS
5092
27940
28196
27572
Calculate the Thrashing Point
Once collected divided the Available memory by Avg. Apache, rounding down to the nearest whole number. Available memory is the buff/cache memory minus the Reserved memory. Below is a summary of the calculation process in table form.
