5

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.

0
7

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)

3
  • Your list is wrong. swap is useful to have even if RAM isn't full, as this will leave more space for "hot" buffer contents. Also, some kernel operations actually need swap (though I can't quote a source RN... maybe reclaiming hugepages?). Moreover, SD cards and flash devices have limited endurance, so swapping on them is not a good idea if it happens often.
    – MayeulC
    Jun 17 at 10:30
  • @MayeulC i never said that swap isn't useful, i'm one of the first to say that even a machine with 32GB of ram still needs to have some swap. What people usually need to do is finetune the swappiness if they think that their swap should be more or less used and that most of the time, the default is good enough
    – higuita
    Jun 23 at 12:13
  • Agreed that swappiness is the real tunable here! Sorry for misunderstanding your answer.
    – MayeulC
    Jul 7 at 18:09
3

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
  • 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. 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.