SUSE Support

Here When You Need Us

Is a swap partition required for SLES?

This document (7010157) is provided subject to the disclaimer at the end of this document.

Environment

SUSE Linux Enterprise Server 11
SUSE Linux Enterprise Server 10

Situation

With the increased RAM on modern hardware, is a dedicated swap partition (or swap file) still required?

Resolution

Is swap space required?
Strictly speaking, a swap partition is not required for SLES. However, swap space is recommended. The general explanation for this is that swap space allows for infrequently used memory to be swapped to disk, thereby freeing up physical RAM for active processes.

In addition to swap space being used to free RAM, having available swap space also changes the behavior of the oom-killer (Out of Memory Killer) in low memory situations. When swap space is available, under low memory conditions, the oom-killer first tries to swap out as many pages as possible.

Swapping out pages is done in two passes. The first pass discards stale pages, to reduce the amount of I/O during the actual swap process. The second pass swaps out pages to disk. This swapping process slows the system, reducing the chances of more processes being run/started. More importantly, the oom-killer will only start killing processes after the paging process has completed, and the system is still out of memory. Hence, a delay has been added between determining that the system is low on memory, and actually killing active processes. This delay may provide enough time for the offending process to terminate itself, or for memory to be freed to prevent any processes from being killed.

Without a swap space available, the oom-killer starts killing processes immediately in a low memory situation.

How much swap space is recommended?
Every server environment is different, and swap space requirements vary greatly depending upon the software environment. As a general recommendation, a swap space size of 2GB is typically sufficient. (Some large database environments may require much larger swap spaces.)

In order to determine if a server has sufficient swap space, monitor the 'Swap' line in the output of the `free` command. If the amount of free swap space approaches zero, you may have insufficient swap space - or insufficient RAM. Some swap space usage is good, but too much usage may indicate the server has insufficient resources for all running processes.

Disclaimer

This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.

  • Document ID:7010157
  • Creation Date: 14-Feb-2012
  • Modified Date:03-Mar-2020
    • SUSE Linux Enterprise Server

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.