Optimize Swap and speed up Ubuntu response

Source: Internet
Author: User
As we all know, swap is a block of virtual memory in a hard disk. Swap temporarily stores books that have not been activated. When the system determines that the physical memory RAM is required to activate the process, swap is used. If the system happens to need more memory resources or space, unactivated books in physical memory will be moved to the swap space, so free up space for him. The hard disk is much slower than RAM, which reduces the system response time. Therefore, if there is enough RAM, we can control swap usage to accelerate Ubuntu. There is a switch parameter to control the kernel from the physical memory

As we all know, swap is a block of virtual memory in a hard disk. Swap temporarily stores books that have not been activated. When the system determines that the physical memory RAM is required to activate the process, swap is used. If the system happens to need more memory resources or space, unactivated books in physical memory will be moved to the swap space, so free up space for him.

The hard disk is much slower than RAM, which reduces the system response time. Therefore, if there is enough RAM, we can control swap usage to accelerate Ubuntu.
There is a switch parameter that controls the kernel to move the process from the physical memory to the swap space. This parameter ranges from 0 to 100. When this parameter is set to 0, it indicates that the SWAp process is prevented from moving out of the physical memory whenever possible. This parameter is set to 100, this tells the kernel to move data out of the physical memory to the swap cache.
The default switching parameter is 60. For Ubuntu Desktop Users, we recommend that you set the switching parameter to 10.

Next we will accelerate our Ubuntu system step by step:
1. Open the terminal and check the value of the switch parameter. Enter the following command:

Cat/proc/sys/vm/swappiness


Use the following command to temporarily change the switching parameter to 10. After restart, the system will still restore the original state to 60:

Sudo sysctl vm. swappiness = 10


To change this parameter permanently, run the following command:

Gksudo gedit/etc/sysctl. conf


Search for the keyword "vm. swappiness" (without quotation marks) and change it to the value you want. If vm. swappiness does not exist, add:
Vm. swappiness = 10

After saving the file, restart it ~~

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.