How To Install oomd on CentOS 8

oomd is Userspace Out-Of-Memory (OOM) killer

Introduction

In this tutorial we learn how to install oomd on CentOS 8.

What is oomd

Out of memory killing has historically happened inside kernel space. On a memory overcommitted linux system, malloc(2) and friends usually never fail. However, if an application dereferences the returned pointer and the system has run out of physical memory, the linux kernel is forced take extreme measures, up to and including killing processes. This is sometimes a slow and painful process because the kernel can spend an unbounded amount of time swapping in and out pages and evicting the page cache. Furthermore, configuring policy is not very flexible while being somewhat complicated. oomd aims to solve this problem in userspace. oomd leverages PSI and cgroupv2 to monitor a system holistically. oomd then takes corrective action in userspace before an OOM occurs in kernel space. Corrective action is configured via a flexible plugin system, in which custom code can be written. By default, this involves killing offending processes. This enables an unparalleled level of flexibility where each workload can have custom protection rules. Furthermore, time spent livedlocked in kernelspace is minimized.

We can use yum or dnf to install oomd on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install oomd.

Install oomd on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install oomd using dnf by running the following command:

sudo dnf -y install oomd

Install oomd on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install oomd using yum by running the following command:

sudo yum -y install oomd

How To Uninstall oomd on CentOS 8

To uninstall only the oomd package we can use the following command:

sudo dnf remove oomd

oomd Package Contents on CentOS 8

/etc/oomd
/etc/oomd/oomd.json
/usr/bin/oomd
/usr/lib/.build-id
/usr/lib/.build-id/ed
/usr/lib/.build-id/ed/9c45c6301f9385b354aaa474618b371b9cf053
/usr/lib/systemd/system/oomd.service
/usr/share/doc/oomd
/usr/share/doc/oomd/CODE_OF_CONDUCT.md
/usr/share/doc/oomd/CONTRIBUTING.md
/usr/share/doc/oomd/README.md
/usr/share/doc/oomd/docs
/usr/share/doc/oomd/docs/auxiliary_plugins.md
/usr/share/doc/oomd/docs/configuration.md
/usr/share/doc/oomd/docs/core_plugins.md
/usr/share/doc/oomd/docs/drop_in_configs.md
/usr/share/doc/oomd/docs/io_cost.md
/usr/share/doc/oomd/docs/prekill_hooks.md
/usr/share/doc/oomd/docs/production_setup.md
/usr/share/doc/oomd/docs/release_process.md
/usr/share/doc/oomd/docs/stats.md
/usr/share/doc/oomd/docs/writing_a_kill_plugin.md
/usr/share/doc/oomd/docs/writing_a_plugin.md
/usr/share/licenses/oomd
/usr/share/licenses/oomd/LICENSE
/usr/share/man/man1/oomd.1.gz

References

Summary

In this tutorial we learn how to install oomd on CentOS 8 using yum and dnf.