Repository navigation
feat(I/O): change default SSD and HDD schedulers to remove system lag #3856
Replies: 8 comments 7 replies
|
I'd be happy to implement this and make a PR, but would prefer to get confirmation from a project owner or contributor before doing so. If this gets a green light, then I'd like to be educated on where the script should live. After parsing through the file structure of the repo, I would guess |
|
I've been running into this problem pretty heavily. |
|
im having the same issue here, other distros dont do that, ive tride in arch with no issues, but in Omarhcy any internet download freeze the system, i work with video editing andc cant even export a video to the internal nvme , where the system are too. And the problema is that my laptop has just two nvme slot, nothing else. Can someone please help me? |
Problem UpdateI've noticed that this heavy read/write freezing seems to be centered around applications that block their main threads while waiting for disk reads/writes. Therefore, web based applications are heavily affected by this. The UI for web apps or chromium will lock up, input from the mouse and keyboard becomes frozen, and only unfreezes after the heavy read/writes finish. However, while my web apps are frozen, I can still interact with my integrated development environment (Zed), where it has zero lag, and input from mouse/keyboard still works. Chromium - Synchronous Blocking Reads/WritesSupposedly Chromium writes often synchronously, so each tab will block the thread of execution while waiting for disk. Even if the system isn't frozen, the tab process will hang until the disk flush completes. Zed - Asynchronous Non Blocking Reads/WritesWhile Zed buffers writes in memory, which doesn't block the main thread on every I/O. ConclusionI'm not sure how to fix this problem. I think it has to do with btrfs file compression mixed with LUKS2 disk encryption causing overhead during heavy read/writes to disk, which causes some programs to hang while they wait for their turn to use the storage device. |
|
@kevinpbaker it may be related to Ghosty #4507 |
|
I managed to partially mitigate this problem by doing |
|
A summarization of the this entire thread:
I've seen much better system performance because of this, and the OS hasn't locked up on me like I described in the original post. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Problem
I was running into some issues where I thought Omarchy was slow/laggy. This didn't make sense, so I decided to troubleshoot. I discovered that heavy IO tasks will kill UI responsiveness (if you're not running NVMe drives). I'll try to explain why below.
All data drives (SSDs and HHDs) currently default to using none as their selected scheduler. Using none can lead to poor interactive latency on desktop systems. Background workloads such as large file copies, indexing, or builds can dominate I/O submission, causing foreground tasks like UI redraws, audio playback, or terminal input to stall. While throughput remains high, the system feels unresponsive because the kernel is not prioritizing latency-sensitive processes.
Therefore, I propose a change is put in place to switch all SSDs and HDDs to default to BFQ (Budget Fair Queueing) scheduling. It addresses the problem stated above by introducing per-process I/O fairness and explicit latency control. BFQ ensures that interactive applications receive timely access to storage even under heavy background I/O, which significantly improves perceived system responsiveness. So there is slightly more scheduling overhead in exchange for a smoother, more predictable user experience.
I had large downloads running in the background, and kept getting "program is unresponsive" pop ups, and my mouse would freeze up, or typing input would lag. I'd hate for someone to think Linux is slow/laggy, just because the wrong IO schedulers are being used for their data drive types. I think it's highly likely that the average person will install Omarchy on an SSD or HDD, because they don't want to nuke their daily driver OS (until they see how epic Omarchy is), which is likely on their NVMe. So they'll look for an old SSD or HDD to install Omarchy onto.
Solution
Add a new shell script to boot process (not sure where? perhaps under the hardware folder?) that creates a new udev rule for automatically applying BFQ to SSDs and HDDs. These rules are stored in a file under
/usr/lib/udev/rules.d(for vendor / distro policies).The file would be named
60-auto-io-scheduler.rules. 60 is the rule load priority where udev executes rules in lexical order. I was reading that rules 10-50 are used for kernal and drivers, while 60 is the sweet spot for hardware policies.The rule inside the file would look like this:
Users can implement an override to the rule inside
/etc/udev/rules.d/if they want to use a different scheduler.TL;DR
Not using a software scheduler for IO causes significant system lag when spamming a drive with work, which can render UI as frozen, or unresponsive. Therefore, add appropriate schedulers for specific drive types to increase perceived system performance.
All reactions