• Blaster M@lemmy.world
    link
    fedilink
    English
    arrow-up
    13
    ·
    2 months ago

    TLDR: Swap is useful to minimize memory contention, put it on your fastest drive, and set vm.swappiness to 100 for ssd swap for optimal swap operation, or leave vm.swappiness alone or set it between 1-50 for spinny bois (lower is better for slow rando. reads)

    • towerful@programming.dev
      link
      fedilink
      arrow-up
      4
      ·
      2 months ago

      What I’d recommend is setting up a few testing systems with 2-3GB of swap or more, and monitoring what happens over the course of a week or so under varying (memory) load conditions. As long as you haven’t encountered severe memory starvation during that week – in which case the test will not have been very useful – you will probably end up with some number of MB of swap occupied.

      And

      [… On Linux Kernel > 4.0] having a swap size of a few GB keeps your options open on modern kernels.

      And finally

      For laptop/desktop users who want to hibernate to swap, this also needs to be taken into account – in this case your swap file should be at least your physical RAM size.

  • Fizz@lemmy.nz
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    I read a kubenetes engineering post that seemed to have the some conflicting info and preformance testing to show. Specifically with point number 3

    https://kubernetes.io/blog/2025/08/19/tuning-linux-swap-for-kubernetes-a-deep-dive/

    The blog above shows that swapiness should be 0 on workloads sensitive to high I/o latency. Whereas the misconceptions says turning off swap to reduce I/o trashing just shifts the problem elsewhere. I dont have the technical knowledge to know who’s right in this situation.