3 ms·
My work Ubuntu laptop has 40GB of RAM and and a very fast Nvme SSD, if it gets under memory pressure it slows to a crawl and is for all practical purposes froze
by kryptiskt 1y ago
My work Ubuntu laptop has 40GB of RAM and and a very fast Nvme SSD, if it gets under memory pressure it slows to a crawl and is for all practical purposes frozen while swapping wildly for 15-20 minutes.
So no, my experience with swap isn't that it's invisible with SSD.
- interroboink 1y agoI don't know your exact situation, but be sure you're not mixing up "thrashing" with "using swap". Obviously, thrashing implies swap usage, but not the other way around.
- db48x 1y agoIf it’s frozen, or if the mouse suddenly takes seconds to respond to every movement, then it’s not just using some swap. It’s thrashing for sure.
- pdimitar 1y agoI get it that the distinction is real but nobody using the machine cares at this point. It must not happen and if disabling swap removes it then people will disable swap.
- webstrand 1y agoI've experimented with no-swap and find the same thing happens. I think the issue is that linux can also evict executable pages (since it can just reload them from disk). I've had good experience with linux's multi-generation LRU feature, specifically the /sys/kernel/mm/lru_gen/min_ttl_ms feature that triggers OOM-killer when the "working set of the last N ms doesn't fit in memory".
- ValdikSS 1y agoEnables Multi-Gen LRU (improved page reclaim and caching policy). Prevents thrashing, improves loading speeds under low ram conditions. Requires kernel 6.1+. Has dramatic effect especially on slower HDDs. For slower HDDs, consider 1000 instead of 300 for min_ttl_ms. sudo tee /etc/tmpfiles.d/mglru.conf <<EOF w- /sys/kernel/mm/lru_gen/enabled - - - - y w- /sys/kernel/mm/lru_gen/min_ttl_ms - - - - 300 EOF
- omgwtfbyobbq 1y agoIt's seldom invisible, but in my experience how visible it is depends on the size/modularity/performance/etc of what's being swapped and the underlying hardware. On my 8gb M1 Mac, I can have a ton of tabs open and it'll swap with minimal slowdown. On the other hand, running a 4k external display and a small (4gb) llm is at best horrible and will sometimes require a hard reset. I've seen similar with different combinations of software/hardware.
- baq 1y agoLinux being absolute dogshit if it’s under any sort of memory pressure is the reason, not swap or no swap. Modern systems would be much better off tweaking dirty bytes/ratios, but fundamentally the kernel needs to be dragged into the XXI century sometime.
- ValdikSS 1y agoIt's kind of solved since kernel 6.1 with MGLRU, see above. Dirty buffer should also be tuned (limited), absolutely. Default is 20% of RAM, (with 5 second writeback and 30 second expire intervals), which is COMPLETELY insane. I limit it to 64 MB max usually, with 1 second writeback and 3 second expire intervals.