Swap partition space is one way to ensure Linux system performance and stability. While modern systems with larger amounts of RAM rely on swap less often, having swap properly configured can provide additional flexibility and prevent out-of-memory issues. This knowledge base article provides general guidelines for configuring swap size for SmarterMail installations, along with considerations for different environments.
Why Swap Matters
- Acts as an overflow when RAM is fully utilized.
- Provides stability under heavy load or memory spikes.
- Is required if you plan to use hibernation on systems with lower RAM allocations.
General Recommendations
In most circumstances we recommend setting up swap when installing SmarterMail on bare metal machines or VMs running Linux. When using some cloud providers such as Google Cloud, swap is generally not recommended as it can quickly impact I/O limits. (See our Cloud Environments section for more info.)
These guidelines are based on both vendor documentation and community best practices, adjusted for SmarterMail environments.
Small Installations < 2 GB
- Recommended swap size: 2x the amount of RAM
- Recommended swap size for hibernation: 3x the amount of RAM
Medium Installations 2 GB - 8 GB
- Recommended swap size: Equal to the amount of RAM
- Recommended swap size for hibernation: 2x the amount of RAM
Large Installations 8 GB - 64 GB
- Recommended swap size: At least 4 GB of RAM
- Recommended swap size for hibernation: 1.5x the amount of RAM
X-Large Installations > 64 GB
- Recommended swap size: At least 4 GB
- Recommended swap size for hibernation: Hibernation not recommended
Note: Swap should not be seen as a replacement for adequate physical memory but as an insurance policy to improve stability.
Cloud Environments
Swap is discouraged on some cloud platforms, such as Google Cloud, because it can quickly consume I/O quotas and lead to degraded performance. Unlike physical or virtual machines where disk I/O is less restricted, many cloud providers impose limits on how much read and write activity can occur in a given period. When swap is heavily used in these environments, it can throttle performance, cause instability, and even increase costs if additional I/O resources are billed separately. In these cases, it’s generally better to provision additional RAM for the instance, rely on native memory, and monitor usage closely through the provider’s metrics and alerting tools. Check with your cloud provider on their swap recommendations, or contact them, if needed, if you feel you need swap enabled.
Additional Resources
For more information, RedHat has an article entitled Getting Started with Swap that is an excellent resource. In addition to providing recommendations for swap file size based on overall RAM, it includes information on creating a logical volume for swap in addition to how to create, extend, and remove both the logical volume and swap.
By following these guidelines, administrators can ensure their SmarterMail installations remain stable and responsive under a variety of workloads. The right configuration helps protect against memory spikes and supports specific cases like hibernation, and provides an added layer of reliability. While requirements vary by environment and hardware, setting up swap as recommended offers a simple safeguard that contributes to overall system health and performance.