This is an old desktop I use for some small self hosting services. I never use all my RAM and I don’t see any RAM spikes other than when I install/compile things which I haven’t done in months. I restarted the machine a couple of times, but the SWAP will eventually go right back up to 100%.

I have an Ubuntu server/yunohost setup and found: https://askubuntu.com/questions/157793/why-is-swap-being-used-even-though-i-have-plenty-of-free-ram

My cat /proc/sys/vm/swappiness value is indeed 60. Im not sure what would reduce the SWAP space usage.

Would changing this swappiness value help? Anyone come across this issue before?

EDIT: Found out what it is, its the matrix server that is running on the system. Its taking up a significant amount of swap. Found out via:

smem -s swap -r -p

turning that off, the system is now using 90% less SWAP. /opt/yunohost/matrix-synaps was the process.

  • ianhclark510@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    11
    ·
    3 months ago

    You’re not likely to get far with a 16x RAM -> swap ratio

    Also all a full swap means is that your computer has determined that it has 976M of cold pages that were eligible to be swapped out

  • irotsoma@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    6
    ·
    3 months ago

    Note that often it’s more efficient to move infrequently accessed memory for background tasks to swap rather than having to move that out to swap when something requires the memory causing a delay in loading the application trying to get the RAM, especially on a system with lower total RAM. This is the typical behavior.

    However, if you need background tasks to have more priority than foreground tasks, or it truly is a specific application that shouldn’t be using swap and should be quickly accessible at all times, or if you need the disk space, then you might benefit from reducing the swap usage. Otherwise, let it swap out and keep memory available.

  • InvertedParallax@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    ·
    3 months ago

    It pushes stuff when they’re really really cold, so for instance init services and libs that have basically never been touched since boot but still technically need to be in memory.

    They might have been pushed out because the page cache thought it had something more interesting, or if you have VMs, because the system wanted to make some huge pages.

  • just_another_person@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    arrow-down
    2
    ·
    3 months ago

    What do you think it’s going to help? You sound like you’re absolutely sure there is something wrong here. You sure there’s something wrong?

    • mesamunefire@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      3 months ago

      Might not be, it’s just strange.

      My other Linux machines use much less but have more space designated to SWAP. And using Linux for as long as I have, swap space is usually reserved when there is a huge increase in ram usage.

      • just_another_person@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        3 months ago

        No, not a huge increase. It’s whatever is deemed to be most efficient at the time. You should get more familiar with how RAM is committed and used if you’re suspecting something. Perhaps in this case it’s all just committed cache memory and not contiguous tracts being reserved.

        Get the output of free -m

  • RedWeasel@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    arrow-down
    1
    ·
    3 months ago

    Swap is used to defrag ram on linux. Could be related to that. In any case this is pretty normal. I have 43Gi available and it is used 700Mi of swap.

    • JoshCodes@programming.dev
      link
      fedilink
      English
      arrow-up
      5
      ·
      3 months ago

      Counter point, set the ‘swappiness’ lower than the default 60. I’ve set mine to 30 and the system boots a lot faster. You could research and consider 10-20.

      • Possibly linux@lemmy.zip
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        3 months ago

        What are you using swap for? On Fedora installs the swap is just zram. I think that most of usefulness of swap has passed now that we have systems with noodles of ram.

        The worst case without swap is that oom gets triggered. If 16GB gets eaten up chances are it is a single app anyway. Unless you are doing something you know is memory heavy it shouldn’t be a problem. Also memory is cheap and you can probably upgrade if needed.