John M. Harris Jr wrote:
On my laptop, a Lenovo X200T with Core(TM)2 Duo CPU U9300; 6 GiB
RAM,
enabling swap on zram led to increased CPU usage (Always above 13% where
normally idling at 6%!), and my entire system freezing after about 30
minutes. In all fairness, I don't know why my system froze, as I couldn't
get anything over netconsole and sysrq wasn't working, but I think I'm
going to leave it disabled. Swap on disk is more than fast enough for
buffer/cache and hibernation/resume on my system.
You actually made another point there, between the lines: hibernation/resume
is actually never going to work with zram, by design. You cannot hibernate
to something that is no more persistent than the RAM (because it is actually
just a compressed virtual disk within that exact same RAM).
For servers, swap is useful regardless of the amount of RAM. Swap is
very
nice for use as buffer/cache, and leaves space in RAM for whatever the
server is running. For example, I always configure a 4 GiB swap partition
on servers with 8-24 GiB of RAM, and 8 GiB swap for servers with 64-128
GiB, 16 GiB on servers with 128-256 GiB, etc. Beyond that, tuning is a bit
different depending on the workload, but it sets a very nice starting
point.
I actually created 32 GiB of swap on my desktop with 16 GiB of RAM. Twice
the RAM, as used to be the norm. Though admittedly, much of it sits unused
all the time, and most of the time, the usage is even at 0 altogether. But
with two 3 GiB HDDs, there is plenty of space for a small swap RAID0 next to
the data RAID1. (I care about long-term data integrity for the actual data,
not for swap, which is throwaway content by definition.)
Kevin Kofler