Meta's CRAM compresses memory in RAM for up to 452x faster reads than ZRAM

Started by Stargazer86, Today at 05:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Topic: Meta's CRAM compresses memory in RAM for up to 452x faster reads than ZRAM   Views(Read 21 times)
Active members in this topic:
Stargazer86(1)

Stargazer86

Meta have presented a new Linux memory compression approach called CRAM, Tom's Hardware reports. The talk was at the Linux Plumbers Conference in Prague. Existing tools such as zswap and ZRAM work at the swap layer, treating compressed memory as a kind of block device. CRAM instead keeps compressed data in memory as a private NUMA node, using standard memory semantics

That difference matters. Because CRAM looks like ordinary memory to the kernel, Linux keeps features such as page migration and memory ballooning. It is also byte addressable, so reads run at DRAM speed. With ZRAM, every read of a compressed page has to go through the swap path and get decompressed first

The numbers are striking. The article reports up to 452 times the performance of ZRAM in read only cases. In the worst tested case CRAM managed about 489 million operations per second, against about 1.1 million for ZRAM. With 20% writes it was still about 5.4 times faster

Writes are the weak spot. When a compressed page is written to, it has to fault and migrate back to its original NUMA node, which takes time. There is also a mechanism called the Chicken Bit, which stops Linux using CRAM to prevent a cascading poison storm when writes outpace allocation. Working out how much usable RAM a system has when compressibility keeps changing is still an open research problem

The author is upfront that he relied on the session's slides and that his explanation might not be completely correct. So treat the details with some caution until there is a paper or kernel patches to read. He notes that ZRAM is widely used on devices like the Steam Deck. If CRAM makes it into the mainline kernel, everyday devices could see the benefit, not just Meta's data centres

Do you use ZRAM or zswap on any of your machines? And with RAM prices where they are, could tools like this make a difference for ordinary users?

First post, best pin