this post was submitted on 07 Jul 2023
35 points (97.3% liked)

Selfhosted

39162 readers
462 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS
 

I've heard a lot of people say your swap should be 2x RAM.. but do I really need 32GB of swap?

you are viewing a single comment's thread
view the rest of the comments
[–] frustbox@lemmy.world 7 points 1 year ago (8 children)

The 2× recommendation is indeed way old, it stems from a time when computers had 1 or 2 GB of RAM or even less. Nowadays, if you have 16GB of RAM I'd say you're not going to need it (in most use cases).

Chances are your RAM will rarely get so full that your system will need to swap to disk, it's probably going to clear buffer/cached data first. This is data kept in RAM that's not actively used by the system but might be useful soon.

If your RAM does run full you either have some very specific application that demands it (then you probably already know the importance and hopefully wouldn't ask internet randos) or you have a memory leak - that's a problem and I don't believe swapping helps in this case. It's way too slow for that.

If you run VMs and reserve RAM for each those considerations might change.

Personally I don't think swap partitions are particularly useful any more, certainly not 2× your RAM. If you ever want to suspend your system, then it needs to store all your RAM content to disk and it will use your swap for it, so 1× your RAM would be required. But with modern systems and SSDs booting only takes seconds, so I don't think suspend to disk has much utility.

For me swap files are a good compromise. But if a system with 16GB starts swapping, something is not going well.

[–] cardes@social.pi.vaduzz.de 2 points 1 year ago

@frustbox @sam I mostly agree, you should always aim to only use ram and not swap with your system. That beeing said you can have swap usage in any kind of system and even if you have terabytes of ram there is still a valid point for having some swap because that's still better than a kernel panic. Also in desktop computers you can get 16-32GB RAm full while gaming and multitasking some stuff along.

load more comments (7 replies)