Gentoo Archives: gentoo-user

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