Announcement

Collapse
No announcement yet.

Fedora 34 Looking To Tweak Default zRAM Configuration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #41
    honestly.. zram is compressed storage in RAM, either as a filesystem or swap. The ratio is usually between 2x and 3x. so if you have 4GB of real RAM, you can get up to 12GB of effective RAM. Sure it's slower as you have to compress/decompress, but what's the alternative? swapping into a HDD?... seriously...

    Also zram uses RAM only on demand. If your fs has the strip option enabled or you remove something from the swap you free the RAM.

    I really don't understand how people don't get this. There is literally no downside to zram.

    Comment


    • #42
      bonus points: hibernation wasn't even supported on Fedora before and the swap partition by default (50% of RAM) was too small for hibernation anyway. For reliable hibernation you need twice as much RAM as swap otherwise there is always something you can't save, like VRAM.

      Comment


      • #43
        Originally posted by HyperDrive View Post
        I mean having multiple swap devices prioritised by access time, not some arbitrary number. Right now, swap devices are used from the highest to the lowest priority (a lower priority device is only used if a higher priority one is full).
        The idea would be, for example, if we had three swap devices (zram, SSD, spinning rust), to use the zram device until it filled up, then move the LRU compressed data to the SSD. When the SSD filled up, do the same from the SDD to the spinning rust, and so on.
        Got it - just like multilevel cache right? e.g. LRU to swap cache first, then LRU of that to SSD, then LRU of that again to HDD (or even tapedrive haha :P )

        http://www.dirtcellar.net

        Comment


        • #44
          Originally posted by karolherbst View Post
          I really don't understand how people don't get this. There is literally no downside to zram.
          Are you sure? What if happens if a page is "swapped" out to zram and never used again (e.g. LRU) it will just stay in memory consuming space right?
          zswap will evict the page to physical swap and works otherwise more or less the same. (oh and hibernation is not straight away if you got zram , you have to disable swap on zram first IIRC)

          http://www.dirtcellar.net

          Comment


          • #45
            Originally posted by waxhead View Post

            Are you sure? What if happens if a page is "swapped" out to zram and never used again (e.g. LRU) it will just stay in memory consuming space right?
            zswap will evict the page to physical swap and works otherwise more or less the same. (oh and hibernation is not straight away if you got zram , you have to disable swap on zram first IIRC)
            you can have different priorities for all your swap devices, but yeah, I am not quite sure which would behave better in this case. I'd assume that with zram pages are just put into disc swap once the zram swap is full, where with zswap they would get moved into swap at some point.

            But in the end it really doesn't matter all that much. You can for example use zram instead of tmpfs and reduce your memory consumption. And I think zswap is inferior in low memory systems as you either require a real swap or zram in addition.

            Comment


            • #46
              Originally posted by karolherbst View Post

              you can have different priorities for all your swap devices, but yeah, I am not quite sure which would behave better in this case. I'd assume that with zram pages are just put into disc swap once the zram swap is full, where with zswap they would get moved into swap at some point.

              But in the end it really doesn't matter all that much. You can for example use zram instead of tmpfs and reduce your memory consumption. And I think zswap is inferior in low memory systems as you either require a real swap or zram in addition.
              I would say that even with zram you would need physical swap regardless. If you swapoff /dev/zram0 for example it would be good to have some backing storage that has plenty of space. Where zram is useful memory is sacred so your zram typically can't / or should not be too large.
              I personally find zswap to be more transparent and since it provide me with essentially the same functionality, it is the way to go for me (at least for now).

              http://www.dirtcellar.net

              Comment


              • #47
                Originally posted by karolherbst View Post
                And I think zswap is inferior in low memory systems as you either require a real swap or zram in addition.
                Yeah, and combining zswap with zram is probably the most horrid thing I can think of, but that doesn't stop a lot of people around the internet from suggesting such craziness. It means you have to compress the data to store in the zswap cache, and then decompress it and recompress it again to store it in zram.
                Personally, I only use zram with zstd compression. I have a laptop with 2 GiB of RAM and it works perfectly fine like this, without any physical swap. Never once I had an oom.

                Comment


                • #48
                  Originally posted by waxhead View Post
                  Got it - just like multilevel cache right? e.g. LRU to swap cache first, then LRU of that to SSD, then LRU of that again to HDD (or even tapedrive haha :P )
                  Exactly. And yes, even tape.

                  Comment


                  • #49
                    Originally posted by waxhead View Post

                    I would say that even with zram you would need physical swap regardless. If you swapoff /dev/zram0 for example it would be good to have some backing storage that has plenty of space. Where zram is useful memory is sacred so your zram typically can't / or should not be too large.
                    I personally find zswap to be more transparent and since it provide me with essentially the same functionality, it is the way to go for me (at least for now).
                    Sure, but then I still prefer a swapfile as thise one is easy to change in size if you don't want to mess around with lvm.

                    Comment


                    • #50
                      Originally posted by karolherbst View Post

                      Sure, but then I still prefer a swapfile as thise one is easy to change in size if you don't want to mess around with lvm.
                      Absolutely. I find swapfiles a bit scary as (from what I know) they seem to violate just about anything a file is. A swapfile apparently is not much different than reserving a contiguous area of space that can be writen directly to by almost ignoring the filesystem. I personally feel better with partitions. Then again I use BTRFS (which has horrible swapfile "support"), but it makes it supereasy to juggle around stuff and create a suitable partition.

                      http://www.dirtcellar.net

                      Comment

                      Working...
                      X