My Linux uses the Deadline algorithm for I/O scheduling. One of the parameters is the
front_merges parameter under
/sys/block/sda/queue/iosched/front_merges. By default it is set to 1, which means front merges are likely to occur. One can set it to 0 to gain a performance boost if don’t expect front merges to occur.
- What are front merges exactly? Can someone depict this please?
- How do I know or test whether front merges occur on my system or not?
The kernel documentation says it best:
Sometimes it happens that a request enters the io scheduler that is contiguous
with a request that is already on the queue. Either it fits in the back of that
request, or it fits at the front. That is called either a back merge candidate
or a front merge candidate. Due to the way files are typically laid out,
back merges are much more common than front merges. For some work loads, you
may even know that it is a waste of time to spend any time attempting to
front merge requests. Setting front_merges to 0 disables this functionality.
Front merges may still occur due to the cached last_merge hint, but since
that comes at basically 0 cost we leave that on. We simply disable the
rbtree front sector lookup when the io scheduler merge function is called.
The reason front merges are uncommon is that writers typically do not write blocks to disk in reverse order.
I wouldn’t expect the change in performance to be that significant here, even with high I/O. You can test it both ways on your actual workload. If you aren’t doing something disk intensive, then this isn’t really important.
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.