Parameters for disk performance in Linux under Proc

Source: Internet
Author: User

We have had a special performance problem on a server where disk writes continue to be busy. Every 30 seconds, the server encounters a disk write activity spike that causes the request processing latency to be very large (more than 3 seconds). Later on the Internet to check the information, by adjusting the kernel parameters, the peak of the write activity is distributed to frequent multiple writes, each write less data. This can be used to flattened the peak write operation into multiple write operations. This is done in a less efficient way because the kernel does not have the opportunity to compose the write operation. But for busy servers, write operations will be more consistent and will greatly improve interactive performance.
Here is the adjustment of the relevant parameters:
One, 2.6 cores
1,/proc/sys/vm/dirty_ratio 
This parameter controls the size of the file system write buffer for the filesystem, in percent, representing the percentage of system memory, indicating how much of the memory is used to write data to disk. Increased use of more system memory for disk write buffering can also greatly improve the write performance of the system. However, when you need a continuous, constant write situation, you should lower its value:
echo ' 1 ' >/proc/sys/vm/dirty_ratio
 
2,/proc/sys/vm/dirty_background_ratio  
This parameter controls the Pdflush process of the file system and when the disk is refreshed. The unit is a percentage that represents the percentage of system memory, meaning that when the write buffer is used to the amount of system memory, Pdflush begins writing data to the disk. Increased use of more system memory for disk write buffering can also greatly improve the write performance of the system. However, when you need a continuous, constant write situation, you should lower its value:
echo ' 1 ' >/proc/sys/vm/dirty_background_ratio

      3,/proc/sys/vm/dirty_writeback_centisecs
    This parameter controls the run interval of the kernel's dirty data refresh process Pdflush. The unit is 1/100 seconds. The default value is 500, which is 5 seconds. If your system is continuously writing to the action, then actually it is better to lower this value, so that the spike write operation can be flattened into multiple writes. The Setup method is as follows:
echo "" >/proc/sys/vm/dirty_writeback_centisecs If your system is short-term spike write, and write data is small (dozens of m/times) and memory is more affluent, Then you should increase this value:
echo ">/proc/sys/vm/dirty_writeback_centisecs

4,/proc/sys/vm/dirty_expire_centisecs  
This parameter declares that the Pdflush process begins to consider writing to disk when the data in the Linux kernel write buffer is "old". The unit is 1/100 seconds. The default is 30000, which means that 30 seconds of data is old and will flush the disk. For specially overloaded writes, it is good to shrink the value appropriately, but it does not shrink too much, because too much narrowing can cause the IO to improve too quickly.
echo "/proc/sys/vm/dirty_expire_centisecs" >
Of course, if your system memory is large, and the write mode is intermittent, and the data written every time is small (such as dozens of M), then this value is better.

  

5,/proc/sys/vm/vfs_cache_pressure
This file indicates that the kernel recycles the memory used by the directory and Inode caches, and the default value of 100 means that the kernel will keep the directory and inode caches at a reasonable percentage based on Pagecache and Swapcache. Lowering this value below 100 causes the kernel to tend to retain the directory and Inode caches, and increasing this value by more than 100 will cause the kernel to tend to recycle the directory and Inode caches
Default setting: 100

6,/proc/sys/vm/min_free_kbytes
This file represents the minimum amount of free memory (Kbytes) that the Linux VM is forced to keep. Default setting: 724 (512M physical memory)

7,/proc/sys/vm/nr_pdflush_threads

This file represents the number of Pdflush processes currently running, and the kernel will automatically add more Pdflush processes with high I/O load.

Default setting: 2 (Read only)

8,/proc/sys/vm/overcommit_memory

This file specifies the kernel's policy for memory allocation, which can be 0, 1, 2.
0, indicates that the kernel will check for sufficient available memory to be used by the process, and if sufficient memory is available, the memory request is allowed; otherwise, the memory request fails and the error is returned to the application process.
1, which means that the kernel allows all physical memory to be allocated regardless of the current memory state.
2, which indicates that the kernel allows allocating more memory than the sum of all physical memory and swap space (refer to Overcommit_ratio).

Default setting: 0

9,/proc/sys/vm/overcommit_ratio
The file indicates that if overcommit_memory=2, the percentage of memory that can be overloaded, the overall available memory of the system is calculated by the following formula.
System assignable Memory = Swap space + physical memory *overcommit_ratio/100 default setting: 50 (%)

10,/proc/sys/vm/page-cluster
This file represents the number of pages written once to the swap area, 0 for 1 pages, 1 for 2 pages, and 2 for 4 pages. Default setting: 3 (2 of 3 parties, 8 pages)

11,/proc/sys/vm/swapiness
The file represents the degree to which the system is exchanging behavior, and the higher the value (0-100), the more likely the disk exchange will occur.


Two, 2.4 cores  

Implemented by modifying the file/proc/sys/vm/bdflush. The nine parameters in the file mean the following:
Nfract:dirty the maximum percentage of buffers in the buffer. Exceeding this value will flush the bdflush process to the hard disk. When there is less available memory, a large amount of disk I/O is raised. To equalize disk I/O, you can maintain a low value.
The maximum number of dirty buffer blocks that the Ndirty:bdflush process writes to the disk at one time. A larger value will cause I/O to increase sharply, and if this is small, the Bdflush process does not perform enough to potentially lead to memory bottlenecks.
Dummy2: Not used
Dummy3: Not used
Interval:kupdated the minimum frequency of work and refresh, the default value is 5 seconds. The minimum value is 0 seconds and the maximum value is 600 seconds.
Age_buffer: The maximum time that the operating system waits before buffering data is written to disk. The default value is 30 seconds, and the minimum value is 1 seconds and the maximum value is 6,000 seconds.
The percentage of Nfract_sync:dirty cache activation Bdflush process synchronization. The default value is 60%.
Nfract_stop:dirty the percentage of the Bdflush process that the cache stopped. The default value is 20%.
Dummy5: Not used
For example, set on a database server with frequent write operations:
10 500 0 0 50 30 10 0 0

Parameters for disk performance in Linux under Proc

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.