Linux Performance and Tuning Tricks: Difference between revisions
No edit summary |
|||
Line 29: | Line 29: | ||
* http://doc.opensuse.org/products/draft/SLES/SLES-tuning_sd_draft/cha.tuning.memory.html | * http://doc.opensuse.org/products/draft/SLES/SLES-tuning_sd_draft/cha.tuning.memory.html | ||
* http://www.redbooks.ibm.com/redpapers/pdfs/redp4285.pdf | * http://www.redbooks.ibm.com/redpapers/pdfs/redp4285.pdf | ||
[[Category:Whitepaper]][[Category:RidgeRunTechnology]][[Category:System Design]] |
Revision as of 18:20, 28 March 2014
Introduction
Usually the biggest bottlenecks for performance in processes are the I/O operations. A simple GStreamer pipeline to decode and display video files may present performance problems (eg. stopping for a while each undefined quantity of minutes) that can be fixed tuning the memory management subsystem in order to avoid processes waiting for data to be available.
Tuning Write/Read memory operations
Writeback
While writing files, there are cache pages becoming dirty, each amount of time or once dirty memory reaches a percentage of RAM, the kernel starts doing writeback. If dirty data reaches a critical percentage of RAM, processes begin to be throttled to prevent dirty data exceeding this threshold.
Writeback tuning parameters:
- /proc/sys/vm/dirty_background_ratio
When the amount of dirty pagecache exceeds this percentage, writeback threads start writing back dirty memory. Default: 10%
- /proc/sys/vm/dirty_ratio
When this is exceeded, applications that want to write to the pagecache are blocked and start performing writeback as well. Default: 20%
- /proc/sys/vm/dirty_expire_centisecs
This defines the interval between writeback operations. Default: 3000
It's recommendable to modify only one of the previous tuning parameters.
Readahead
When a process reads sequentially a file the kernel starts reading some data in advance to reduce the amount of time that a process have to wait for data to be available, so this parameter sets the maximum amount of data that the kernel reads ahead for a single file. Also, the actual amount of data being read in advance is computed dynamically, based on how much "sequential" the I/O seems to be. This is why for large video files it's needed to increase the maximum amount of data to be read ahead in order to display large videos properly.
- /sys/block/<bdev>/queue/read_ahead_kb
This parameter sets the maximum amount of data that the kernel reads ahead for a single file. Default: 128KB