Swappiness parameter setting and memory swapping

Source: Internet
Author: User

Brief introduction

Swappiness,linux the kernel parameter to control the relative weight of the swap out run-time memory. The swappiness parameter value can be set in the range from 0 to 100. Low parameter values allow the kernel to use less swap, and higher parameter values will allow the kernel to make more of the swap space. The default value is 60 (refer to Network data: Start using swap space when the remaining physical memory is below 40% (40=100-60)). For most operating systems, setting to 100 may affect overall performance, while setting to a lower value (even 0) may reduce response latency.

swappiness parameter Value Description

vm.swappiness = 0

Use swap space only when there is insufficient memory-when the remaining free memory is below vm.min_free_kbytes limit.

vm.swappiness = 1

Kernel version 3.5 and above, Red hat kernel version 2.6.32-303 and above, for minimal switching without disabling switching.

Vm.swappiness = 10

When there is enough memory on the system, it is recommended to set this value to improve performance.

Vm.swappiness = 60

Default value

vm.swappiness = 100

The kernel will actively use swap space.

For kernel version 3.5 and above, Red hat kernel version 2.6.32-303 and above, in most cases, set to 1 may be better, 0 is suitable for the ideal case (it is likely better the use of 1 for cases where 0 used to Be optimal)

Modify swappiness the value

1) temporary settings (fail after reboot)

# Sysctl-a | grep vm.swappiness

Vm.swappiness = 30

# echo >/proc/sys/vm/swappiness

# Sysctl-a | grep vm.swappiness

# vm.swappiness = 10

The optional method is as follows

# sysctl-w vm.swappiness=10

Vm.swappiness = 10

# cat/proc/sys/vm/swappiness

10

2) Permanent settings

Edit in/etc/sysctl.conf, add the following parameters (if present)

Vm.swappiness = 10

Swappiness parameter setting and memory swapping

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.