Howto: Linux understanding and tuning Virtual Memory

I was trying to tune shared memory for Linux. However, tuning the virtual memory manager is dependent on expected Linux server/system workloads.

Wikipedia defines VM as, “Virtual memory or virtual memory addressing is a memory management technique, used by multitasking computer operating systems wherein non-contiguous memory is presented to a software (aka process) as contiguous memory. This contiguous memory is referred to as the virtual address space.

One of the most important aspects of an operating system is the Virtual Memory Management system. Virtual Memory (VM) allows an operating system to perform many of its advanced functions, such as
=> process isolation
=> file caching
=> and swapping.

As such, it is imperative that an administrator understand the functions and tunable parameters of an operating system’s Virtual Memory Manager so that optimal performance for a given workload may be achieved.

Linux understanding and tuning Virtual Memory
(Picture source: wikipedia article)

During my search I found this article it explains or shows some general shared memory tuning tips for Red Hat Enterprise Linux (technically it should work with any Linux distro as settings are kernel specific)

From the article:
After reading this article, the reader should have a rudimentary understanding of the data the Red Hat Enterprise Linux (RHEL3) VM controls and the algorithms it uses. Further, the reader should have a fairly good understanding of general Linux VM tuning techniques. It is important to note that Linux as an operating system has a proud legacy of overhaul. Items which no longer serve useful purposes or which have better implementations as technology advances are phased out. This implies that the tuning parameters described in this article may be out of date if you are using a newer or older kernel. Fear not however! With a well grounded understanding of the general mechanics of a VM, it is fairly easy to convert knowledge of VM tuning to another VM.

=> Read more at RedHat Magazine

=> Also see Linux kernel documentation file Documentation/sysctl/vm.txt

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Allotment Mar 23, 2007 @ 13:34

    I have been researching that topic just a little, and from what I found so far, the major factor of interest to people
    is vm.swappiness which is not listed on that redhat link. At least worth adding to the topic maybe

  • tuxhat Mar 17, 2010 @ 13:40

    vm.swappiness sets affinity for a process to get swapped to swap space. Set to 100 you will find a high swap activity on a busy machine, go with 0 swapping will be less or no. For a production web server / Virtual machine host I will go with zero 🙂

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum