• Buddahriffic@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    The trick is to first create a RAM disk. Then put the swap file on there and it’s about as fast as RAM. Then, with the new memory you have created, make another RAM disk. Yep, then make more swap space on there.

    I have solved both the memory and SSD availability issues with this infinite RAM and disk space trick.

  • motruck@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    Swap is there an emergency relief for when a runaway process starts to eat all the resources. The system gets slow the user says hey what’s that? They look and see oh wow this one process is really eating a lot of resources that’s bad, can I kill it or do I need to gracefully try to shut it down. Swap buys you time when it could matter. When you don’t have swap OOM killer takes out whatever it wants and for a desktop user that may not be that big of a deal but for a server the database is likely the first target that is taken out.

    • nullptr@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      you misunderstand the meme (of course it doesn’t help either); because the alternative isn’t “no swap”, but rather “use a swap file instead of swap partition”

  • 0x0@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    My 64GiB are enough for my tasks, i don’t use swap.
    I may consider it for laptops but only for hibernation purposes.

  • bdonvr@thelemmy.club
    link
    fedilink
    arrow-up
    0
    ·
    3 days ago

    I basically never used swap until I used some script that was supposed to de-duplicate text messages from SMS backups.

    Turns out feeding it a 100,000 message archive spanning back 15 years will somehow eat up ~80GB of RAM. I doubt it should, I guess it probably just wasn’t optimized for such a large amount.

    So I made a 64GB swap file and it completed fine.

  • sumsinj@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 days ago

    I dislike swap solely because it gets used and when I accidentally open the same file twice then I regularly encounter problems with swap files when opening the file again later.

  • Mwa@thelemmy.club
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 days ago

    SWAP RAM is useful for hibernation mode and fall back ram incase you have low memory.

    • SirLeToet@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 days ago

      Also for when you, for whatever reason, run out of physical memory.

      Who here worries torturing their SSDs? Those things will last lifetimes compared to HDD’s of the past (or present).

    • mexicancartel@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 days ago

      If you(or your distro) use zram then the zram usage may also count as swap in resource monitors. For me this was the case when i saw swap usage where it is clearly not needed to swap. You can check it with swapon commands.

      Other reason is that more frequently accesed files may be cached to ram and less important stuff gets swapped. But if you notice swap being used while total ram usage including cached is much lower than total, then its probably zram(and it does write to disk so dont worry about that)

    • Brkdncr@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 days ago

      Saving ram to swap can be done with minimal impact. Helpful when you run out of memory and that 2gb app idling can be dumped right away instead of waiting for it to be copied to swap.

      • WhyJiffie@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 days ago

        but that’s not what’s happening. processes do actually get removed from RAM, and when they are needed they are very slow until they are loaded back. the system thinks it’s more valuable to have that memory be filesystem cache

    • droans@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 days ago

      Because you just taught your computer how to be lazy. “oH lOoK aT mE i’M sWaP mEmOrY”

  • mazzilius_marsti@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 days ago

    unfortunately with S0ix being forced on all modern laptops, zram is the only logical choice. With s3 sleep at least i can say i need swap because i need hibernation…With S0ix? Dont bother.

  • RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    3 days ago

    I don’t really need swap until I need to compile blender… Need somewhere around 64Gb (with compression) to deal with the peaks

  • diaphragmwp@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    3 days ago

    Once tortured myself with having to go through…

    The Android build system. Booo, scary.

    I only wanted a LineageOS boot image built. The recommended specs list 64GiB RAM. Figured wouldn’t apply to me until I tried to build a target literally called “nothing”. It just used up all of the RAM and OOMed about 2 minutes in, building the “build cache” or whatever the fuck it needs to do to “warm up”.

    After a few fucktons of swapspace, turning off some of my daemons, some sysctl fuckery (there were options for limiting process virtual memory size IIRC? I put it all the way up) and taskset -p 0-15:1 (use logical CPUs 0, 2, 4…), I had my laptop allocating 50 something GiB. I have 16GB (decimal) physical RAM installed and I consider that already way too much for my usual needs.

    After about half an hour of the build system build systeming, it just stopped doing that then built the kernel in 4 minutes with everything else in some time too.

    Yes, I have tried just running make directly. That just resulted in an image that did nothing but toggle on and off an empty (no percentage) charging circle via power button.

  • Axolotl@feddit.it
    link
    fedilink
    arrow-up
    0
    ·
    3 days ago

    My built-in Devil’s Advocate has to ask if that’s really true? Have you got a citation newer than 2 decades old? Frankly, i find it difficult to believe that anyone wouldn’t like to use electron software, for the simple reason that making your SSD suffer is fun.

    Edit: in 30 years of administering Linux and (previously) Solaris sytems i’ve never once had to change HDDs or SSDs, so claims of torture are, i opine, exaggerated. i’ll also claim that keeping electron software out of the filesystem is not good for your hygiene.

    • grrgyle@slrpnk.net
      link
      fedilink
      arrow-up
      0
      ·
      3 days ago

      I manage a cluster that makes heavy use of SSDs in RAID10 configuration. Those things are constantly degrading and having to be swapped out. I’ve started a drawer of faulted drives that I don’t have the heart you throw out.

    • TheRagingGeek@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      3 days ago

      That’s some really great luck you have, over the 15 years or so I have been running my Linux server I have had to replace the SSD twice(likely due to gentoo and compiling everything all the time) and had 2 hdds in my raid cluster need replacement. Here’s hoping my NAS has your luck

        • TheRagingGeek@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          3 days ago

          Definitely bit the onion on this one, it did seem remarkable lol though I just pulled a 16 year old drive out of my Son’s PC(that was technically still working however slowly) hence the semi plausibility on my end lol

            • TheRagingGeek@lemmy.world
              link
              fedilink
              arrow-up
              0
              ·
              3 days ago

              Yeah it was to the point that Samsung doesn’t even admit to have made this drive on their website anywhere, I pulled the drive and was like wtf Samsung rust? I almost exclusively bought western digital in recent memory so was a surprise, had to do some digging to decode the manufacturing codes to identify the manufacturing date