zRam increases performance by avoiding paging on disk and instead uses a compressed block device in RAM in which paging takes place until it is necessary to use the swap space on the hard disk drive

This module is enabled in Pi config file [arch/arm/configs/bcmrpi_defconfig ] CONFIG_ZRAM=m

extract from wiki : ZRam

How does it improves the performance in Pi. Please suggest any bench mark tool to verify the performance improvement in R Pi.


All depends of what you use.... there is no "one size fits all"

If you use heavy memory aplications and little cpu, you will probably see a increase in performance with ZRAM. On the other side, a CPU bound application with little memory usage will see a possible DECREASE in performance (as RAM usage might trigger the ZRAM and steal some cpu cycles that would otherwise would go to the app)

you need to monitor your machine for cpu and ram/swap usage to view it's the long term usage.

  • If free RAM, no swap, ZRAM is useless.
  • If free RAM, some swap usage, but less than the free RAM, ZRAM is useless, just tune the swappiness so the swap is less used
  • If free RAM, some swap usage, but a lot more than free RAM, try first to tune the swappiness and the apps, to decrease the ram usage. If no change, try ZRAM is our cpu is free most of the time
  • IF no free RAM, swap usage high, ZRAM might be a good idea, even if CPU is used, as IO operation might be blocking the CPU more than what you would lose with ZRAM

again, all depends of what you use and how you use the RaspberryPI (or any computer)


You're doing something really strange, because Raspberry Pi usually runs with 0 (zero) swap, and most people even disable it outright (i did not, too lazy =):

top - 00:51:36 up 4 days,  5:29,  1 user,  load average: 0.08, 0.07, 0.06
Tasks:  74 total,   1 running,  73 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.7 us,  0.7 sy,  0.0 ni, 98.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:    497544 total,   484512 used,    13032 free,     9124 buffers
KiB Swap:   102396 total,        0 used,   102396 free,   431208 cached

How will ZRam improve the performance? I don't see any reasonable chance in improving something that's not being used at all.

  • 1
    That it's not used in your case does of course not mean it cannot be enabled. Perhaps some distros even do so. I can imagine someone choosing to enable swap if the alternative is programs being killed outright by the out-of-memory killer. In that case determining the performance sweet spot between swapping in compressed ram and no swap at all would be wise. – Martijn Heemels Aug 7 '13 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.