How to Display the Swappiness Value of the System?

In this section, we will explore the steps to retrieve and display the current swappiness value of your Linux system. Utilizing the sysctl command, we can easily inspect the active swappiness setting, providing insights into the system’s memory management configuration.

Step 1: Check the Current Swappiness Setting ( sysctl )

The step consists of checking the current swappiness setting using the command sudo sysctl vm.swappiness. By default, major Linux distributions typically set the swappiness value to 60. This command provides a quick way to inspect and understand the active swappiness configuration on your system.

Command:

sudo sysctl vm.swappiness

Output:

Step 2: Check the Current Swappiness Setting (Procps)

In this step, the cat /proc/sys/vm/swappiness command is used to display the current swappiness value of the Linux system. The /proc/sys/vm/swappiness file contains the configuration parameter for swappiness, which determines how aggressively the system swaps out data from RAM to the swap space. The command simply outputs the numeric value representing the current swappiness setting.

Command:

cat /proc/sys/vm/swappiness

Output:

How to Change the Swappiness of your Linux system

In this article, we will explore the crucial aspect of Linux system optimization by exploring the “swappiness” setting. Swappiness determines the system’s tendency to swap data between RAM and disk, influencing overall performance. This article not only explains the underlying mechanics of swappiness but also provides practical insights and examples for adjusting this parameter, both temporarily and persistently, to enhance Linux performance enabled to specific hardware configurations and workloads.

Similar Reads

What is Swappiness?

Swappiness, in the context of Linux, is an important kernel parameter that governs the system’s propensity to transfer less actively used memory pages from RAM to disk swap space. Represented as a value between 0 and 100, swappiness determines the percentage of swapping activity. Higher values encourage more swapping, potentially enhancing system responsiveness, while lower values mitigate swapping, prioritizing the retention of data in physical RAM. With a default setting of 60 in most Linux distributions, indicating a preference to swap out up to 60% of inactive cached pages, users can fine-tune swappiness to align with specific workloads and available RAM, effectively minimizing I/O overhead stemming from excessive swapping....

How to Display the Swappiness Value of the System?

In this section, we will explore the steps to retrieve and display the current swappiness value of your Linux system. Utilizing the sysctl command, we can easily inspect the active swappiness setting, providing insights into the system’s memory management configuration....

How to Change the Swappiness Value?

In the above section, we explored the steps to retrieve the Swappiness Value. In this section, we will navigate through the steps to change the Swappiness Value....

Frequently Asked Questions on Changing Swappiness of Linux System – FAQs

What is swappiness on Linux?...

Conclusion

In conclusion, swappiness is a Linux setting that controls how often the system swaps memory pages from RAM to disk. The default swappiness value of 60 tells Linux to be quite aggressive about using swap space. However, high disk I/O from excessive swapping can lead to performance issues. Lowering the swappiness allows Linux to favor using free RAM over swap, which is faster. The swappiness parameter tunes Linux memory management. Lower values lessen swap usage which usually speeds things up. Try values like 10 or adjust higher if your system lacks RAM. Changing it can optimize Linux to best suit your hardware....