Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. Why is my server using all my Swap but I have RAM to spare?

Why is my server using all my Swap but I have RAM to spare?

Scheduled Pinned Locked Moved Selfhosted
selfhosted
23 Posts 18 Posters 136 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W [email protected]

    "hey, this memory page is never used and this file block is used a lot, so I'm going to put the memory page on disk and the file block in memory and everything will be faster."

    except when not, like when I just copied a multi GB file, it was cached in RAM to be not read again for long, but at least half of my running programs are swapped out. Additionally if swap is o SSD, it has put totally unnecessary wear into it by doing this

    M This user is from outside of this forum
    M This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #21

    That's why you can adjust swappiness, or designate a different high-endurance storage device for it.

    1 Reply Last reply
    0
    • shimitar@downonthestreet.euS [email protected]

      1gb swap is way too small...

      I usually setup swap to be 2x the total ram size. So, 32gb swap in your case.

      Nothing wrong here, seems normal. With such little swap.

      Actually Linux kernel works better with swap, the more the better. It will lalso perform better than zero swap. Counterintuitive indeed, but that's how it works.

      If you don't want swap, use zram.

      D This user is from outside of this forum
      D This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #22

      +1 for zramswap, especially if you're tight on RAM but have a few CPU cycles to spare.

      1 Reply Last reply
      0
      • S [email protected]

        And how does cache space figure in to this? I have a server with 64GB of RAM, of which 46GB is being used by system cache, but I only have 450MB of free memory and 140MB of free swap. The only 'volatile' service I have running is slapd which can run in bursts of activity, otherwise the only thing of consequence running is webmin and some VMs which collectively can use up to 24GB (though they actually use about half that) but there's no reason those should hit swap space. I just don't get why the swap space is being run dry here.

        mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
        mhzawadi@lemmy.horwood.cloudM This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #23

        That's how Linux manages it memory, it will use free memory as file cache till it needs it. Then free up memory for process use.

        If your only half using the memory for actual services, you may want to reduce it.

        1 Reply Last reply
        0
        • System shared this topic on
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups