|
Scalability
IntroductionEach ramzswap device has its own compression buffer, memory pools and other metadata. All these buffers are protected by a per-device lock which are serious bottlenecks on multi-core machines. Starting with compcache-0.6, we have support for creating multiple ramzswap devices, primarily to overcome this scalability problem. Divide and Conquer! DetailsIf you have multiple cores, then using a single ramzswap can be a bottleneck. To avoid this problem, following configuration is recommended:
modprobe ramzswap num_devices=4 # Assuming you need total disksize of 256MB. # So, per-device size would be 256/4=64MB. rzscontrol /dev/ramzswap0 -i --disksize_kb=65536 rzscontrol /dev/ramzswap1 -i --disksize_kb=65536 rzscontrol /dev/ramzswap2 -i --disksize_kb=65536 rzscontrol /dev/ramzswap3 -i --disksize_kb=65536 (you can add backing swap disk/files to any/all of above devices. See rzscontrol manpage for more information).
swapon /dev/ramzswap0 -p 10 swapon /dev/ramzswap1 -p 10 swapon /dev/ramzswap2 -p 10 swapon /dev/ramzswap3 -p 10 This kind of split setup should give you much better performance on multi-cores than a single giant ramzswap device. |
► Sign in to add a comment
num_devices doesn't work (ramzswap: Unknown parameter `num_devices'). It should be NUM_DEVICES as rzscontrol(1) says. On the other hand, why not use lowercase letters like other kernel arguments.
KJackie: compcache-0.6.1 uses lower case parameter num_devices.
Any future plans to move to per cpu locks. So making the locking auto spliting and only a single device entry required.
Really if per cpu locks can be used inside ramzswap0. The device lock can be used to search the swap for duplicated pages between cpu zones. Basically a split and merge system.
What I am thing is more a auto pool system. On device init ramzswap detects numbers of cpu's and might create like number cpu + 1 memory pools out of the total disk size.
In idle time ramzswap can compare the pools and merge as required. No point having like 3 copies of the same data in different ramzswaps due to not being able to compare because it was locked at the time.
Even if they stay as independent devices a way to merging there stored data has added.
On livecd and the like it being auto would be great.
rzscontrol man page still says NUM_DEVICES http://code.google.com/p/compcache/source/browse/sub-projects/rzscontrol/man/rzscontrol.1
@pedretti.fabio: Fixed in repository. Thanks for pointing it out.
Hi all,
I am trying to implement two ramzswap area for a dual core(arm core) board.I first did a insmod with 2 devices.
successfully creating two devics under the /dev directory. Next using rzscontrol utility I initialized the first devices viz ramzswap0 Now when i tried to initialize the second device simultaneously I got resource busy notification How to over come this? Please give me some suggestionOne more clarification while testing for ramzswap I got a error for allocating memory.Is the ramzswap area getting completely filled the reason for such a error?
http://code.google.com/p/compcache/source/browse/sub-projects/rzscontrol/man/rzscontrol.1
On July 20th 2011, the zram driver in the linux 3.1 staging area was modified to use zram_num_devices as modprobe parameter - so if you use a recent kernel, update your init scripts!
commit efd54f4375982a3f8bef3cce610955f4cc37d5cb Author: Noah Watkins <noahwatkins@gmail.com> Date: Wed Jul 20 17:06:08 2011 -0600 staging: zram: make global var "num_devices" use unique name The global variable "num_devices" is too general to be global. This patch switches the name to be "zram_num_devices".