Zswap: Compressed Swap Caching For Linux
Phoronix: Zswap: Compressed Swap Caching For Linux
Published to the Linux kernel mailing list were a set of patches to provide a new feature called Zswap for lightweight compressed swap caching...
This seems like a very solid idea for HDDs, given how swap IO completely kills a desktop Linux-based OS. Reducing the time would be an improvement.
Benchmarks - http://ibm.co/VCgHvM
Last edited by Vadi; 12-12-2012 at 09:43 PM.
Reason: Added benchmarks link
Funny how these things work out. Earlier today, I was thinking that compressing swapped data before actually writing it to the swap device might reduce the demand on the HDD's throughput and provide a marginal performance gain.
Now I feel silly. This is obviously a much better idea.
Of course, I haven't had a swap partition configured on my computer for a couple of years now. I'd much rather suffer the occasional OOM crash instead of frequent lag caused by swapping.
kinda ironic, because isnt one of the perks about compressing data that it takes up a lot of ram and CPU power in favor of faster loading and smaller disk consumption? anyways, while I'm sure there's some huge technical detail I'm not aware of, I think this kind of thing came a few years too late. RAM is really cheap nowadays, I'd rather buy another GB or 2 than use a swap partition.
Ram is cheap for a new PCs and if one has in his possesion machine that has few years than it might be quite a different story especially if place where place one lives has GDP much lower than US or Western Europe therefore IMHO it is never to late for this kind of development. Besides who is not to say that in 5 years one would not need 10 times more RAM for basic work like to display some new 3D desktop, manufactures use some excuse to increase prices of parts like it was with HDDs and flooding and it would make You think again about Zswap...
Originally Posted by schmidtbag
RAM may be cheap and you may want to add some more RAM, but that's not the point. Even if you could add RAM you can still use a compressed swap device that can improve performance.
Oh! I hope Zswap will improve swap and system performance.
Everyone knows that especially in Linux, when the swap is used the system performance is disastrous. I know this should be normal because the speed of the hard disk, but Linux swap have worse performance compared to other systems who do heavy usage of the paging file. I think this problem is well known in Linux because there is much written on the internet to avoid the swap usage changing the swappiness.
Last edited by YAFU; 12-13-2012 at 06:41 AM.
In case anyone else is befuddled...
I've got a short snippet on each of the z* modules that were/are in development and what their differences are. I guess I'm writing this more for my own sanity, but I like to share with others
- compcache (a.k.a. ramzswap): developed by Nitin Gupta, it creates a block device backed by compressed RAM - never made it to main line
- zram: a rewrite of compcache
- zcache: Nitin Gupta's 2nd attempt to get a RAM compression module into the kernel. It uses the CleanCache framework, which hooks into the page cache and file system code. CleanCache was merged in May 26, 2011 and zCache was merged in October 2011. zcache uses LZO to compress the pages. Unlike zram/compcache, zcache transparently stores the cache pages (no block device).
- zswap: written by Seth Jennings under the Unix philosophy of "doing one thing well", it leaves file cache compression and other features for separate code. zswap focuses on managing the compressed memory pool well. It also uses the Frontswap API from which it receives pages. This allows configuration of which compression algorithm to use.
Although I don't need it any more, I still use zcache back from when I was running Minecraft server and client on the same machine. My free RAM certainly increased and the game performance improved as it no longer hit swap. There haven't been any problems either.
Don't forget latest zcache2 from Dan Magenheimer (with ramster in staging-next drivers).
Originally Posted by FourDMusic
Zcache2 was the first attempt to address the problem of zcache that has no writeback to real swap, allowing evcting pages from swap compressed memory to real swap partition.
Please remember that zcache (or zcache2) tries to dynamically balance both compressed pagecache pages and compressed swap pages against other system memory pressure (and, with ramster, across multiple machines, and with Xen tmem, across multiple Xen guests).
Zswap is only focused on compressing swap pages: this architecture has the great advantage of being simple.