Gentoo Archives: gentoo-user

From: Florian Philipp <lists@×××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] zram / compcache, anyone?
Date: Tue, 18 Oct 2011 05:54:42
Message-Id: 4E9D1457.8070504@binarywings.net
In Reply to: Re: [gentoo-user] zram / compcache, anyone? by Paul Hartman
1 Am 18.10.2011 07:16, schrieb Paul Hartman:
2 > On Wed, Oct 12, 2011 at 8:52 PM, Pandu Poluan <pandu@××××××.info> wrote:
3 >> Just stumbled upon this blog:
4 >>
5 >> http://www.webupd8.org/2011/10/increased-performance-in-linux-with.html
6 >>
7 >> anyone got any experience with zram/compcache on Gentoo?
8 >
9 > I'm using zram in a gentoo server with only 256mb of RAM, only used
10 > for a few weeks so far. It seems to work and the server hasn't crashed
11 > yet. :) I have allocated 128MB of compressed swap (64x2, actually, to
12 > theoretically utilize both CPU cores for compression at the same time)
13 > followed by normal on-disk swap at lower priority. Usually my total
14 > swap used is less than 128MB so the real disk swap is rarely touched.
15 > It's difficult to say if there is any improved performance, but I
16 > haven't experienced any slowdown, which occasionally I did when swap
17 > became heavily used in the past. Keep in mind the 128MB zram is the
18 > uncompressed size, so the actual amount of RAM used by this should be
19 > much less, depending on contents of the swap. Some even recommend
20 > using zram equal to the amount of RAM but that idea scares me.
21 >
22 > After enabling the CONFIG_ZRAM module in kernel 3.0.6, I did this:
23 >
24 > modprobe zram num_devices=2
25 > echo $((64*1024*1024)) > /sys/block/zram0/disksize
26 > echo 1 > /sys/block/zram0/reset
27 # sleep 1
28 > mkswap /dev/zram0
29 > swapon -p 11 /dev/zram0
30 >
31
32 In my experience, it can be necessary to put a `sleep 1` between reset
33 and mkswap because the /dev/zram0 disappears and reappears after the
34 reset command.
35
36 Another remark: The kernel docs recommend using /bin/echo instead of
37 echo because problems are reported as write errors and the echo builtin
38 of bash doesn't check for that.
39
40 Regards,
41 Florian Philipp

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] zram / compcache, anyone? Paul Hartman <paul.hartman+gentoo@×××××.com>