ZRAM might be a budget solution for high-priced DRAM

Table of Contents

Background

As DRAM prices continue to rise, many users are exploring alternative solutions to manage memory more efficiently. I recently tried using ZRAM on my personal server with 256GB of RAM running 2 Vivado 2025.2 simultaneously to synthesize XiangShan with OpenLLC to FPGA. Note that a typical XiangShan does not require that much memory, but with OpenLLC enabled, the memory usage can spike significantly during synthesis on Vivado. Result was quite impressive that lz4 can compress the memory to around 20% of original size, allowing me to run both syntheses without hitting swap space on disk, and does not see serious performance degradation (Thanks to Vivado’s working set size is relatively small).

Some experiments

Since this is only a blog post. I did not a fair comparison among different compression algorithms as I would like to do for a research paper. But just to give some idea of how ZRAM can help in memory-intensive workloads.

I have tried lz4 and zstd, here are some results:

With zstd, 48.7G data can be compressed to 1.8G (27x), while with lz4, 189.3G data can be compressed to 32.5G (5.8x). The compression ratio varies a lot depending on the data being compressed, but in general, lz4 is faster but with lower compression ratio, while zstd is slower but with higher compression ratio.

Conclusion

ZRAM can be a cost-effective solution for users facing high DRAM prices for Vivado synthesis workloads. By leveraging memory compression, users can effectively increase their available memory capacity without the need for additional physical RAM, thus saving costs while maintaining performance.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top