• motruck@lemmy.zip
    link
    fedilink
    arrow-up
    2
    ·
    1 hour 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
      1
      ·
      52 minutes 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
    2
    ·
    1 hour 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
    3
    ·
    2 hours 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
    3
    arrow-down
    1
    ·
    10 hours 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
    9
    ·
    15 hours ago

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

    • SirLeToet@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      2 hours 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).

    • Brkdncr@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      14 hours 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
        1
        ·
        4 hours 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
      6
      arrow-down
      1
      ·
      15 hours 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
    3
    ·
    16 hours 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.

  • diaphragmwp@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    11
    ·
    22 hours 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.

  • RustyNova@lemmy.world
    link
    fedilink
    arrow-up
    6
    ·
    21 hours ago

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

  • topperharlie@lemmy.world
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    1 day ago

    Everyone defending swap like crazy in the comments… so let me give a counter argument specifically for desktop:

    Many years ago I stopped using swap on all my computers (I exclusively use linux) and the reason is: every time anything regarding interactivity went to swap, my system would freeze and literally become unusable for a really long time until I killed something. Since I got tired if that behaviour I decided I prefer for random shit to die but my computer still be usable.

    It wasn’t very often, but I don’t get OOM killer often either (as in I don’t remember the last time it happened and I use linux every day for both work and fun), and the freezing situation was way more annoying, to the point I sometimes ended up cold switching off the computer. I’m surprised on how many people run out of memory constantly. I guess you all are just using linux for servers and have crazy processing of infinite data…

    • JamesBoeing737MAX@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      2
      ·
      19 hours ago

      Or shotcut. I once ran it on 8GB, minimal arch with no swap. Well.

      And I’m not even trying to build android on my new relatively modern laptop. It won’t work.

    • boonhet@lemmy.zip
      link
      fedilink
      arrow-up
      7
      arrow-down
      1
      ·
      1 day ago

      Were you using a HDD for swap? It’s nearly unnoticeable on an NVMe drive.

      • topperharlie@lemmy.world
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        yep it was HDD, but with the low amount of times I have any OOM issue, I’m way more worried about NVMe flash burning than a random process being killed once every blue moon.

        In fact I didn’t mention, but since the advent of flash drives what I’ve done is trying to locate heavy disk writing apps and find alternatives for them, amid disabling many logs.

        For swap, it hunts me to think some automatic process I don’t have control over will burn those sweet erase cycles without me noticing just because someone programmed it poorly. I’m way more happy knowing I have some control over it.

    • cannedtuna@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      27
      arrow-down
      1
      ·
      1 day ago

      Shit did I botch it? I made this on my phone and the toot I copied the script from was just text. Wanted to make it look more interesting so I found this site that let you make the windows. I just went with what I thought looked best.

  • OwOarchist@pawb.social
    link
    fedilink
    English
    arrow-up
    30
    ·
    1 day ago

    Yes, swap partitions are shit.

    The real hotness is swap drives.

    Just the use that your old 64GB SSDs were waiting for!

    (Fun fact: in Linux, if you have multiple swap partitions mounted, the kernel will automatically use striping (like RAID) in order to read and write from them as fast as possible. If you have multiple small SSDs used for swap, the read/write speed from swap can actually become pretty fast.)

      • OwOarchist@pawb.social
        link
        fedilink
        English
        arrow-up
        6
        arrow-down
        4
        ·
        1 day ago

        You’re going to run into issues with your motherboard’s SATA or NVME (or PCIE) controller throughput well before you get close to actual RAM speeds.

        Once you reach that bottleneck, the speed won’t increase anymore when you add more drives. The motherboard architecture just doesn’t support accessing any kind of storage device at that speed.

      • Axolotl@feddit.it
        link
        fedilink
        arrow-up
        2
        ·
        1 day ago

        I did a (very) quick search and they should just sum up, so for example a raid of 2 sata SSD with 64gb that can reach 500MB/s will have a total speed of 1GB/s,
        DDR3 ram can get up to 17GB/s so we would need 34 drives to get DDR3 speeds (not very fast BUT you would be the person with most ““RAM”” in the city without being a data center)