Some numbers from ZRAM swap on my two Fedora machines
When Fedora introduced swap on ZRAM I was dubious,
for the traditional reason that I'm dubious about things grabbing
my RAM. However, I let the appropriate Fedora
upgrade automatically enable swap on ZRAM and decided to passively
see how things went. Nothing exploded so I didn't think about ZRAM
again until very recently, when I
got curious to look at the numbers on my machine, when I found out
about the zramctl
command through Daniel Aleksandersen's blog
entry.
There are three ways to look at "swap on ZRAM" numbers. /proc/swaps
will tell you how much has been written to your ZRAM swap area and
how big its maximum capacity is. zramctl
will give
you a quick summary of most of the information (especially with the
--output-all
option). Finally, if you want as much detailed
information as possible, there's information in
/sys/block/zram*/mm_stat, as covered most accessibly in the
kernels's ZRAM documentation
(but also here's sysfs-block-zram).
Of these, zramctl
is probably the most useful by virtue of being more
readable than the raw sysfs data.
Unfortunately I don't have historical data on this on my machines,
since information on ZRAM currently isn't captured by the Prometheus
host agent. All I can do is look at the current detailed numbers
and then extrapolate. Both my work and home machines have 32 GB of
RAM and ZRAM swaps with 8 GB of maximum usage. At work, with little
activity since the last reboot two and a half days ago, zramctl
reports 22.7 MBytes swapped that compressed down to 6 MBytes, and
7.3 Mbytes of RAM used by ZRAM including overheads. At home, rebooted
four days ago, zramctl
reports 109.7M swapped, 26.6M of compressed
swap data, and 28.2M of total memory use These are some impressive
compression ratios, even if you look at the total ZRAM size (including
overheads), not just the raw compressed size.
(After building Firefox from source at home, zramctl
usage jumped
to 230.5M swapped, 59.6M of compressed swap data, and 62.4M of total
RAM usage.)
The Prometheus host agent does capture total swap usage information. Over the length I have saved data for (which is currently over half a year), the highest swap usage is 900 MBytes at work and 855 MBytes at home. If we assume ZRAM still achieved at least a 3:1 space savings, that's only 300 MBytes or so of RAM used, which is entirely tolerable for me and doesn't seem dangerous.
(Our Ubuntu servers can use much more swap and the ones with lots of swap usage generally tend to be compute servers under memory pressure. Given this, I suspect we'll never use swap on ZRAM on them; if Ubuntu starts making it a default, we'll turn it off.)
Comments on this page:
|
|