this post was submitted on 11 Apr 2022
28 points (100.0% liked)

Linux

49469 readers
595 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

This is a relief to find! I just looked at htop and panicked over the high amount of "used" memory.

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 3 points 2 years ago (1 children)

Personal experience: on desktop i always disable swap. On a server it makes sense because who fucking cares if your email takes 10ms or 1s to send, but in a graphical context there's so many memory accesses that the tiniest bit swapped to disk starts to make the whole thing sluggishly slow.

Of course that's less of a problem if you're using a SSD, but now you may be putting unnecessary strain on your SSD whose durability is bound by writes not reads.

So disabling swap + enabling systemd-oom/earlyoom (to kill the most gluttonous executable when really needed) is a good combination for me.

[–] [email protected] 2 points 2 years ago* (last edited 2 years ago) (1 children)

I wish I could just buy more RAM every time I hit a memory constraint.

EDIT: There's a more general performance reason for using swap at the default settings (doesn't cover every case but is fine for lots of situations). At the default settings it will start actively swapping at about 40% memory used. This is because the system actively benefits from the fs cache mentioned in the article and performance suffers in low-memory conditions due to the fs cache not having free RAM to work with. You're waiting more on I/O (which has a big performance hit even with fast storage) as opposed to getting files from the cache. As RAM use increases, you can swap some of the less-needed program code to disk to keep more free space available for the disk cache. The default swappiness parameter might not be optimal for your computer/RAM use patterns and you might need to do some experimenting to find optimal values, but overall some amount of swapping is probably a good idea

[–] [email protected] 2 points 2 years ago (1 children)

I've heard that argument and i understand the technical reasoning, but in real-world experience i found that disabling swap was the best swappiness for me. Maybe i'm doing something wrong but "help my computer freezes sometime" is a common problem in my circles and "disable swap" has been the best recommendation i found so far.

[–] [email protected] 1 points 2 years ago

I find that degraded performance is pretty much always preferable to playing Russian roulette with system processes.