4 ms·
Swap on zram seems very interesting. My current home computer is a NUC with 16GiB, but I sometimes build from source and a tmpfs drive is helpful for that so I’
by transfire 4y ago
Swap on zram seems very interesting. My current home computer is a NUC with 16GiB, but I sometimes build from source and a tmpfs drive is helpful for that so I’m a little concerned I might not have quite enough RAM. Thoughts?
I’ll definitely double my RAM for my next system (in a year or two) and will definitely have to consider swap on zram then.
- nottorp 4y agoI wonder if swap on zram is similar to what Mac OS calls "compressed memory".
- dtgriscom 4y agoThat's my understanding.
- 95014_refugee 4y agoNo. ZRAM is a compressed ramdisk. Darwin “compressed memory” is an intermediate state for pages as they age out of the working set, but before they are written out to a swapfile. Incidentally, Darwin creates, defragments and reclaims swapfiles dynamically. All this complaining about swap partition / file sizes is kind of … silly. None of that code is rocket science.
- WirelessGigabit 4y agoI wouldn’t do less than 64GB. I’m running 32 on my current NUC as my main machine with Windows 11 and WSL and a RAM drive. With current source sizes and Electron apps consuming RAM, just 32 GB is no longer a nice to have.
- mixmastamyk 4y agoI do fine on 16gb, with loaded browser and 4gb vm of Windows running.
- WirelessGigabit 4y agoGB*. I don’t. Docker containers and IDEs all over. I also don’t close stuff.
- mixmastamyk 4y agoContainers use much less ram than vms. One can always use and write wasteful programs but it is a choice, rather than necessity as folks often portray.
- jakogut 4y ago> I sometimes build from source and a tmpfs drive is helpful for that so I’m a little concerned I might not have quite enough RAM. I used to do this as well, but consider that the VFS cache basically does the same thing. The main difference is that cached data can be dropped or flushed if necessary to free memory, whereas this can't be done automatically with tmpfs. Benchmark both cases and I'll bet you'd be surprised at how little difference there is.
- kevincox 4y agoThe nice thing about swap here is that the kernel is under no obligation to sync the data to disk "soon". I have lots of tmp files that are written and read quickly and never hit the disk. With tmpfs+swap the kernel is free to swap out unused files if that memory is better used elsewhere, but otherwise won't bother touching the disk. I do a lot of builds on my system and most are small enough to entirely live in RAM. But when you build Firefox it is best to start flushing some data to disk.
- jakogut 4y agoThat's another great point. With a large build in tmpfs, you can either run into the size limit of the tmpfs, breaking the build and wasting time, or run out of memory and end up with an unresponsive machine. Entrusting this to the VFS cache has better predictability, and nearly the same performance in many cases.
- opencl 4y agoNot having quite enough RAM is the exact scenario when swap on ZRAM is most useful. Assuming the data you have in RAM is compressible it lets you use a few extra gigabytes before hitting disk swap or OOM (depending on if you have a disk swap device configured in addition to ZRAM). Zswap is somewhat similar and might also work well for you, it uses disk swap but with a compressed cache in RAM.