• 0 Posts
  • 2 Comments
Joined 1 year ago
cake
Cake day: July 1st, 2023

help-circle
  • frustbox@lemmy.worldtoSelfhosted@lemmy.worldHow much swap?
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I have a swap partition in my current system (64GB), I’ve had one on my previous system (which was 11 years old, with 16 GB) - I have seen my system¹ swap at most 5 times, and every time it was software misbehaving so badly that it made the system unusable.

    I know this is anecdotal evidence - but my experience is that it’s getting less and less relevant for most desktop systems.

    Edit: ¹my old system, the new one has not swapped at all in the past year.


  • frustbox@lemmy.worldtoSelfhosted@lemmy.worldHow much swap?
    link
    fedilink
    English
    arrow-up
    8
    arrow-down
    2
    ·
    1 year ago

    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.