Disk Performance Parameters in proc in Linux

Source: Internet
Author: User

We have encountered a special performance problem on the server where disk write operations are constantly busy. Every 30 seconds, the server will encounter a peak of disk write activity, resulting in a very high request processing latency (more than 3 seconds ). Later, I checked the information online. by adjusting the kernel parameters, I distributed the peak Write activity into frequent writes, with less data written each time. In this way, you can flatten the peak write operations into multiple write operations. The execution efficiency in this way is relatively low, because the kernel does not have the opportunity to combine write operations. However, for busy servers, write operations will be performed more consistently and interactive performance will be greatly improved.

Below are the adjustments to relevant parameters:

I. In the 2.6 kernel

1./proc/sys/vm/dirty_ratio

This parameter controls the size of the file system write buffer in the file system. The unit is the percentage, indicating the percentage of the system memory, indicating the amount of the system memory used by the write buffer, write Data to the disk. By increasing the size, you can use more system memory for disk write buffering and greatly improve the system write performance. However, when you need continuous and constant writing, you should reduce the value ,:

Echo '1'>/proc/sys/vm/dirty_ratio2,/proc/sys/vm/dirty_background_ratio

This parameter controls the pdflush process of the file system and when to refresh the disk. The Unit is the percentage, indicating the percentage of the system memory. This means that when the write buffer is used to the system memory, pdflush starts to write data to the disk. By increasing the size, you can use more system memory for disk write buffering and greatly improve the system write performance. However, when you need continuous and constant writing, you should reduce the value ,:

Echo '1'>/proc/sys/vm/dirty_background_ratio3,/proc/sys/vm/dirty_writeback_centisecs

This parameter controls the run interval of the kernel's dirty data refresh process pdflush. Unit: 1/100 seconds. The default value is 500, that is, 5 seconds. If your system writes data continuously, it is better to reduce the value. In this way, you can split the peak write operation into multiple write operations. The setting method is as follows:

Echo "100">/proc/sys/vm/dirty_writeback_centisecs if your system is a short-term peak write operation and the write data is not large (dozens of MB/Time) in addition, the memory is rich, so the value should be increased:

Echo "1000">/proc/sys/vm/dirty_writeback_centisecs4,/proc/sys/vm/dirty_expire_centisecs

This parameter declares that the data in the write buffer in the Linux kernel is too old, and the pdflush process begins to consider writing data to the disk. Unit: 1/100 seconds. The default value is 30000, that is, if the data of 30 seconds is old, the disk will be refreshed. For write operations with special overloading, it is also good to narrow down this value, but it cannot be reduced too much, because too much will lead to IO increase too quickly.

Echo "100">/proc/sys/vm/dirty_expire_centisecs. Of course, if your system memory is large and the write mode is intermittent, and the data written each time is not big (for example, dozens of MB), so this value is better.

5./proc/sys/vm/vfs_cache_pressure

This file indicates that the kernel recycles the preference for directory and inode cache memory. The default value 100 indicates that the kernel will keep directory and inode cache in a reasonable percentage based on pagecache and swapcache; if this value is lower than 100, the kernel tends to retain directory and inode cache. If this value is increased to more than 100, the kernel tends to recycle directory and inode cache.

Default: 100

6./proc/sys/vm/min_free_kbytes

This file indicates the minimum number of idle memory (Kbytes) reserved by the Linux VM ).

Default setting: 724 (MB physical memory)

7./proc/sys/vm/nr_pdflush_threads

This file indicates the number of currently running pdflush processes. When the I/O load is high, the kernel will automatically add more pdflush processes.

Default setting: 2 (read-only)

8./proc/sys/vm/overcommit_memory

This file specifies the kernel memory allocation policy. The value can be 0, 1, or 2.

0 indicates that the kernel will check whether there is enough available memory for use by the process. If there is enough available memory, the memory application will be allowed; otherwise, the memory application will fail, and return the error to the application process.

1 indicates that the kernel allows all physical memory allocation regardless of the current memory status.

2, indicating that the kernel can allocate more memory than the total physical memory and swap space (refer to overcommit_ratio ).

Default Value: 0.

9./proc/sys/vm/overcommit_ratio

This file indicates that if overcommit_memory = 2, the percentage of memory can be overloaded. The following formula is used to calculate the overall available memory of the system.

System allocable memory = swap space + physical memory * overcommit_ratio/100

Default setting: 50 (%)

10./proc/sys/vm/page-cluster

This file indicates the number of pages written when writing to the swap area once. 0 indicates 1 page, 1 indicates 2 pages, and 2 indicates 4 pages.

Default settings: 3 (3 to the power of 2, 8 pages)

11./proc/sys/vm/swapiness

This file indicates the extent to which the system performs swap. The higher the value (0-100), the more likely disk swap will occur.

  • 1
  • 2
  • Next Page

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.