Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Optimization of swappiness parameters between memory and swap Partition in linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Http://blog.itpub.net/29371470/viewspace-1250975

The size of the value of swappiness has a lot to do with how swap partitions are used. Swappiness=0 means to maximize the use of physical memory, followed by swap space, and swappiness=100 means to actively use swap partitions and move the data in memory to swap space in time. The basic default setting for linux is 60, as shown below:

[root@timeserver ~] # cat / proc/sys/vm/swappiness

sixty

[root@timeserver]

In other words, the use of swap partitions begins to appear when you use 100-60% of your memory. As we all know, the speed of memory will be much faster than that of disk, which will increase the io of the system. At the same time, a large number of pages will be swapped in and out, seriously affecting the performance of the system. So at the operating system level, we should use memory as much as possible and adjust this parameter.

The method of temporary adjustment is as follows, we adjust it to 10:

[root@timeserver ~] # sysctl vm.swappiness=10

Vm.swappiness = 10

[root@timeserver ~] # cat / proc/sys/vm/swappiness

ten

[root@timeserver ~] #

This is only a temporary adjustment. After rebooting, you will return to the default setting.

To make a permanent adjustment, you need to modify it in / etc/sysctl.conf, plus:

[root@timeserver ~] # cat / etc/sysctl.conf

# Controls the maximum number of shared memory segments, in pages

Kernel.shmall = 4294967296

Vm.swappiness=10

[root@timeserver] # sysctl-p

This completes the modification of the settings!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report