Apache Performance Tuning: Swap Memory

October 8, 2020 Liquid Web

This video is part of a series of articles on Apache Performance Tuning.

Before we get into the nitty-gritty of Apache tuning, we need to understand what happens when a VPS server or Dedicated server goes unresponsive due to a poorly optimized configuration. An over-tuned server is one that is configured to allow more simultaneous requests (ServerLimit) than the server’s hardware can manage.

Servers set in this manner have a tipping point, and once reached, the server will become stuck in a perpetual swapping scenario. Meaning the Kernel is stuck rapidly reading and writing data to and from the system swap file.

Swap files have read/write access speeds vastly slower than standard memory space. The swap files’ latency causes a bottleneck on the server as the Kernel attempts to read and write data faster than is physically possible or more commonly known as thrashing. If not caught immediately, thrashing spirals the system out of control leading to a system crash.

If thrashing is left running for too long, it has the potential of physically harming the hard drive itself by simulating decades of read/write activity over a short period. When optimizing Apache, we must be cautious not to create a thrashing scenario. We can accomplish this by calculating the thrashing point of the server based on several factors.

In this video, we will demonstrate how to preform fine tuning on an Apache server to avoid thrashing.

Commands used:

ps o rss= -C httpd|awk '{n+=$1}END{print n/NR}'
ps o rss -C httpd

Video by: Justin Palmer

About the Author

Liquid Web

Liquid Web powers online content, commerce, and potential for SMB entrepreneurs and the designers, developers and digital agencies who create for them. Sign up for our <a href="https://www.liquidweb.com/blog">newsletter</a> to stay up to date with our latest content.

More Content by Liquid Web
Previous Video
How to Enable Piped Logging in Apache
How to Enable Piped Logging in Apache

In this video, we demonstrate how to enable piped logging in Apache.

Next Video
How to Install Apache on a Windows Server
How to Install Apache on a Windows Server

In this video, we demonstrate how to install Apache on a Windows server.

Learn What Qualities to Look for in Your Next Host in Our New Guide!

Download Now