I have been setting up Zram, Swap, Swappiness and EasyOOM daemon on 16gb ram boxes, or lower. Someone asked me about 32gb of ram, or more, and I’m unsure. Wondering if others have experimented with this!

  • adarza@lemmy.ca
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 hours ago

    i don’t see a lot of swap use on my systems, but i do have zswap backed by a swap partition on a couple of them; otherwise i generally i just use a basic swap partition on most everything.

    basic systems (browser, email, light docs/media use) i set up for others that are using ext4 might use a swapfile instead if it was the default for whatever distribution i used for it.

  • Mactan@lemmy.ml
    link
    fedilink
    arrow-up
    5
    ·
    edit-2
    11 hours ago

    been testing this quite a lot for star citizen which regularly sees 20-40 GB use. zram is the easiest solution to avoiding OOM Killer by a long shot. zswap was swapping over 100 GB to disk cumulative throughout the day and still oom killing the game. zswap is also a pain in the ass to configure for the lay user and harder to get human readable stats. I don’t want lay users going anywhere near their bootloader but zswap is all kernel command line to make permanent changes

      • ISO@lemmy.zip
        link
        fedilink
        arrow-up
        4
        arrow-down
        14
        ·
        1 day ago

        It’s shit info. zram is actually better, more so with high ram size+high usage situations.

        • floquant@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          9
          ·
          16 hours ago

          Anything you’d like to dispute specifically or we should just take your “it’s shit” over a detailed explanation?

          • moonpiedumplings@programming.dev
            link
            fedilink
            arrow-up
            1
            ·
            2 hours ago

            In my testing, zram has much, much better compression than zswap.

            The points about LRU inversion, cgroups, and so on are valid, but at the end of the day, I don’t really care. I was able to open as many firefox tabs as I wanted with zram, but I could not do so with zswap, and that’s what matters to me.

            The author of a blogpost is a facebook engineer. Millions of ultra high performance Linux servers are a very different usecase than a single desktop. It’s perfectly reasonable for a solution for one to not be appropriate for the other.

            Copied from my previous comment about this where ISO also gave a similar reply and was met with a similar response lmao.

          • ISO@lemmy.zip
            link
            fedilink
            arrow-up
            1
            ·
            4 hours ago

            Alright, I will only reply to you, since you raised a fair question.

            First of all, I must admit that I thought what was linked was an earlier similar writing, but the general theme is still the same.

            The problem with the writing is that it focuses on use-cases like Android and some servers, but doesn’t take into account other use-cases. It also seems to come with the assumption that setup is done by the distributor only, or if it’s done by the user, it’s a configure-and-forget situation.

            What he represents is:

            • Limited RAM space
            • Swap will always/often happen (outside of (z)ram)
            • Single tier of non-RAM swap
            • Non-ram swap is significantly slower
            • OOM can be preferable over (outside of ram) swapping
            • Swapped out pages stay where they are until they are required by their process (important).

            Now let’s look at a possible modern workstation setup:

            • Large RAM size
            • Swap is rarely hit, especially if set up with zram.
            • Multiple swap tiers beyond zram/zswap
              • Intel Optane disk used as a super-fast zram write-back device, or a high-priority swap
              • Fast NVME disk used as a second tier swap disk
              • Large HDD swap partition used as a third tier swap disk
            • The biggest consideration is avoiding worst case latency, i.e. hitting HDD swap.
            • Killing processes MUST be avoided, unless exceptional circumstances are hit where the kernel’s OOM would kick in anyway. This holds true even when HDD swap starts getting used.
            • When unusual loads are observed, swapped pages can be moved around by the user (or a tool), by turning swap devices off and on. This is how you can empty the HDD swap partition for example.

            This last point in particular should make it clear why his “imagination” was rather limited in his LRU inversion section.

  • PetteriPano@lemmy.world
    link
    fedilink
    arrow-up
    6
    arrow-down
    3
    ·
    edit-2
    1 day ago

    zram makes sense if you do not have swap.

    zswap is probably enabled by default in most distros. It compresses cold pages on the fly so that they’re ready to quickly get swapped in and out.

    I do hit the swap partition occasionally on my 32GB systems.

    It doesn’t really kick in until you have proper pressure. I want my swap partition for hibernation, anyway.

  • Eggymatrix@sh.itjust.works
    link
    fedilink
    arrow-up
    2
    arrow-down
    1
    ·
    1 day ago

    Genuinely curious: what are you doing to be needing this?

    I cannot think of any modern usecase for swap a part from hybernation

  • monovergent@lemmy.ml
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    edit-2
    1 day ago

    My workstation has 48 GB RAM with 50% allocation allowed to zram, no disk swapping. It works just fine. Once I use up the majority of my RAM, it kicks in the same way it would on any other system with less RAM.

    • SoulKaribou@lemmy.ml
      link
      fedilink
      arrow-up
      1
      ·
      12 hours ago

      Shouldn’t total ram amount always be powers of 2 (forgot the reason exactly) ? It sounds like 32 +16 wouldn’t be ideal ? I remember that from my early days, but maybe it has changed ?

      • monovergent@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        8 hours ago

        That is correct, IIRC, the mismatch does limit how much of it can run in dual-channel. Even if a single stick is natively 24 or 48 GB, there is additional strain on the memory controller. It is the way it is on my setup since I had planned an upgrade to a full 64 GB and was holding off until a good deal on the remaining 32 GB kit, which will never come unless the AI bubble bursts.

      • monovergent@lemmy.ml
        link
        fedilink
        arrow-up
        1
        ·
        19 hours ago

        What about it? I see it kicking in at least 10 GB before my RAM is full and I haven’t noticed any fundamental differences between how zram works on my 48 GB workstation and my 8 GB devices. Maybe I’ve never had a workload that filled all 48 GB + extra zram capacity, but it’s never given me an issue.

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

    Why do you think 32GiB is special compared to 16GiB?
    And wtf is EasyOOM?

    You maximize the usefulness of zram by actually increasing sappiness, and giving zram devices high priority. e.g.

    sysctl vm.swappiness=100
    
    for i in {1..8}; do
      swapon /dev/zram${i} -p 32767
    done
    

    Then you enable other swap devices with lower priority.

    This is the way regardless of how much RAM you have. I mean, it may be pointless if you never ever exceed, let’s say 10/32GiB (including caching). But it still wouldn’t be harmful in any way.

    • non_burglar@lemmy.world
      link
      fedilink
      arrow-up
      6
      ·
      edit-2
      1 day ago

      That isn’t how swappiness works.

      Changing the sysctl for swappiness only adjusts the ratio of anonymous and file pages, it doesn’t set a “threshold” or “aggressivity” in swapping pages, nor does it dictate how much or how little to swap.

      It’s generally ill-advised to touch swappiness at all unless you know what you’re doing. You can start here.

      If you’re going to hand out free advice, at least make sure the advice is worth the price of admission.

      • ISO@lemmy.zip
        link
        fedilink
        arrow-up
        1
        arrow-down
        6
        ·
        24 hours ago

        If you’re going to hand out free advice, at least make sure the advice is worth the price of admission.

        This is very ironic, considering your comment is a mix of straw man and wrong.

      • ISO@lemmy.zip
        link
        fedilink
        arrow-up
        1
        arrow-down
        4
        ·
        1 day ago

        Oh, you wrote “easy” not “early” in OP. In any case, this looks stupid. But to each their own, I guess.