I'm a programmer by trade with twenty years of experience, having first used Linux in 2004 (iirc), and I thought I knew the game pretty well. There are CPU-bound tasks, memory-bound tasks, network-bound tasks, and disk-bound tasks. I'm doing async programming and it's working fine, offloading i/o to the kernel while my app is doing cpu stuff. Except, I'm now using a laptop with 8 GB of memory and Linux Mint-Cinammon on HDD as my main machine, and somehow shit is constantly in the swap and waits for the disk. Right now I'm moving a Windows partition, I have quit everything except four Firefox tabs, Emacs, and Double Commander — and I still think I might kill myself before the ordeal is over. The entire system is completely and totally fucked. Barely anything moves, nothing responds in any kind of a timely fashion. Emacs freezes when typing, with two open buffers. Audio playback stutters. VPN is nonresponsive. I closed all the hundreds of buffers in Emacs, I set the priority and io priority of Gparted to the minimum, and the other apps to the max. I set swappiness to zero, and turned off the swap altogether with swapoff. All of this barely helps. I'm drunk right now, and still this affair bugs me beyond measure. I could maybe deal with this as a one-time thing if swapping and disk i/o weren't incapacitating the system every day.

Is Linux kernel so ridiculously single-threaded that any i/o cripples the entire thing? Or is something tuned horribly wrong in Mint by default? Can I unfuck this somehow? I live close to a river, I can't take this much temptation.

you are viewing a single comment's thread
view the rest of the comments
[–] 2 points 9 hours ago (1 child)

firefox does a lot of disk caching during regular use, mostly from webapps trying to be clever about using your disk space to cache chats, media, etc. there's functionally nothing you can do about this per-site. It also does a lot of journaling in local sqlite databases for its own cookies, history, caching, etc.

if you want actual solutions:

use a DE like lxde to free up system memory as much as possible.

move firefox's caching and profile directories to /dev/shm and accept the memory footprint penalty on launch. accept that a crash or shutdown without flushing back to disk will result in losing this data.

add an override to journald.conf.d to move the journal to volatile storage with a functionally nonexistant rolling size, but just big enough not to crash (~128mb)

disable rsyslog

create a systemd service to move /tmp /var/tmp /var/log and /var/cache/apt/archives to ramdisk on boot.

disable any systemctl timer that you don't absolutely need (apt-daily.timer apt-daily-upgrade.timer, logrotate.timer etc...)

increase the journal commit interval on your root filesystem to something like ~60s

  • source
  • parent
  • hideshow 1 child comment
  • [–] [S] 1 point 7 hours ago*

    Thanks for proper advice. I think LXDE wouldn't help much, since most memory is likely used by the apps instead of the system. Curiously, I enabled memory compression which was off by default and which helped me a lot with low-memory machines in the past — it's set to use 40% of the memory currently, but I might need to raise that. Unfortunately, I don't think it makes too much difference in the end.

    I'll probably fiddle with the journaling parameters and rsyslog's options first, since those seem fairly harmless. Don't want to lose useful functionality right away.

    I'm gonna move the system partition to an SSD sooner or later just to save what remains of my sanity, except the swap won't be there to avoid the device being hammered to death in a month or two before I can splurge on some mem upgrades. It's remarkable how twenty years ago I could glide through the filesystem as fast as my fingers diddled the cursor keys; or switch through images at 60 fps or so like a Terminator — but now I somehow have to constantly wait for the apps even with an SSD. Not quite sure what happened, but shit's wack.

    firefox does a lot of disk caching during regular use, mostly from webapps trying to be clever about using your disk space to cache chats, media, etc. there’s functionally nothing you can do about this per-site. It also does a lot of journaling in local sqlite databases for its own cookies, history, caching, etc.

    Ironically, I'm a webdev, so I'm somewhat sure that the sites I use don't behave that badly — and I just can't move so fast as to cause much i/o with the history and whatnot, exactly because it's barely responding when shit hits the fan. But I need to trace FF one of these days to figure out what the hell it's doing. Maybe the extensions are the culprits.

  • source
  • parent