Linux kernel scheduler for a pen drive – noop or deadline?

Posted on

Problem :

I run Debian Live as a persistent system on a 16 GB pen drive. This is my workhorse every day system. I was earlier plagued with continual delays and freezes due to slow write speeds. I have repartitioned the drive and aligned the partitions, resulting in what seems like a significant boost in speed, but I’m also wondering about whether changing the I/O scheduler would help.

There seem to be two candidates: deadline and noop. This page recommends deadline, and I just changed to that. It seems to have helped but the impression is purely subjective. However, the consensus on Stack Overflow seems to be that noop is best for flash devices (see here and here). But I’m not able to understand how a scheduler that does nothing – i.e. noop – can be more efficient.

Since I expect that I’d have to try out either for a week or so to see if it actually helps, I thought I’d ask if anyone has any idea which would be better.

Solution :

Flash devices should be better handled by a no-operation I/O scheduler. Although that’s not a definitive answer. Keep reading.

A mechanical device (such as HDD) spends a lot of time in seeking operations, finding the right position on a disk plate to perform reading or writing. It does that by moving a mechanical head that has a limited speed. Although that speed seems quite high, flash devices don’t require this, and are therefore faster by design.

The task of an I/O scheduler is mainly to group, reorder, and when possible, merge I/O operations. One of the main intents is to decrease the seeking penalty by lowering the amount of necessary seek operations.

That’s why a NOOP scheduler is superior to most schedulers for flash devices. Having in mind there’s no seek penalty incurred in any I/O operation, the scheduler does not need to do much. The less it does, the better. With very few CPU cycles required for each I/O operation, it’s also very battery friendly.

On the other hand, DEADLINE may be a good fit if you are worried by I/O starvation, while your system is rarely going to be overloaded. The scheduler imposes a deadline to every I/O operation, which positively impacts on latency. It uses multiple queues to store operations and sorts them according to their deadline. By committing to these deadlines, it can guarantee no I/O starvation during normal CPU loads.

To conclude, there’s no one size fits all. Every scheduler has its pros and cons.
The best thing you can do IMHO is to read about Noop, Deadline, and SIO, and find which one fits better to your scenario. You could also test them for a period, and see how they react to your daily usage.

Ultimately, I did find a good forum post that seems accurate and covers the main advantages/disadvantages of each I/O scheduler.

Leave a Reply

Your email address will not be published. Required fields are marked *