Scenario: XML file parsing into the library, and backup
Problem: Disk IO exception, often 100%busy;
Linux IO optimization methods:
1, modify the disk hanging parameters, modified to writeback mode, for the file read frequently can be set noatime;
2. Modify cache Write Disk Time
The behavior of Pdflush is controlled by the parameters in the/PROC/SYS/VM
/proc/sys/vm/dirty_writeback_centisecs (default 500): 1/100 seconds, how long it takes to wake Pdflush to write the cached page data to the hard disk. The default of 5 seconds wakes up 2 (more) threads.
If the wrteback time is longer than dirty_writeback_centisecs, there may be a problem.
Pdflush mechanism:
The first thing is to read the expiration time (old data) of the data in the cache page and write it to the hard disk in the next cycle. The default of 30 seconds is a very long time.
Configuration:/proc/sys/vm/dirty_expire_centiseconds (default 3000) unit: 1/100 seconds.
The second thing is to determine if the memory is up to the limit to write to the hard disk, as determined by the parameters:
/proc/sys/vm/dirty_background_ratio (default 10) percent, which retains the maximum value of the expired page cache (Dirty page cache). is based on the value of the mmefree+cached-mapped.
Pdflush write to hard disk see two parameters:
1 if the data is in the page cache for more than 30 seconds, and if so, it is marked as dirty page cache;
2 whether the dirty page cache reaches 10% of the working memory;
The following parameters also affect the Pdflush
/proc/sys/vm/dirty_ratio (default 40)
The maximum percentage of total memory that the system can have for the maximum amount of dirty page cache. Above this value, turn on Pdflush write to hard disk. If the cache grows faster than Pdflush, then the entire system encounters an I/O bottleneck at 40%, all
I/O waits for the cache to be pdflush into the hard drive before it can start again.
For systems with high write operations
Dirty_background_ratio: Main adjustment parameters. If you need to keep the cache persistent rather than a large amount of write to the hard disk, lower this value.
Dirty_ratio: Second adjustment parameter.
Reprint: http://wlservers.blog.163.com/blog/static/120622304201241715945256/
Linux IO optimization