ArchiveOrangemail archive

Compressed Caching for Linux


linux-mm-cc.lists.laptop.org
(List home) (Recent threads) (86 other One Laptop per Child lists)

Subscription Options

  • RSS or Atom: Read-only subscription using a browser or aggregator. This is the recommended way if you don't need to send messages to the list. You can learn more about feed syndication and clients here.
  • Conventional: All messages are delivered to your mail address, and you can reply. To subscribe, send an email to the list's subscribe address with "subscribe" in the subject line, or visit the list's homepage here.
  • Low traffic list: less than 3 messages per day
  • This list contains about 551 messages, beginning Jun 2006
  • 0 messages added yesterday
Report the Spam
This button sends a spam report to the moderator. Please use it sparingly. For other removal requests, read this.
Are you sure? yes no

Swapping to RAM activates harddrive.

Ad
Ole Tange 1311770135Wed, 27 Jul 2011 12:35:35 +0000 (UTC)
I am trying to test compcache on my 8 GB laptop before putting compcache
into production on our 256 GB servers.

It is, however, not working out very well.

- o -

For my first test I want to compress swap to RAM without touching the disk
drive at all. I have disabled back storage and stopped swapping to my normal
swap partition.

I run a program that eats up a lot of memory but the memory is highly
compressible (containings 80 * 100M strings with 'X')

When the program hits 6 GB the disk becomes active. I can understand why the
swap becomes active at 6 GB (that is the whole idea), but why does the DISK
become active?

$ uname -a
Linux ole-laptop 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC
2011 x86_64 x86_64 x86_64 GNU/Linux
$ sudo swapoff /dev/ramzswap?
$ sudo modprobe -r ramzswap
$ sudo modprobe -r lzo_compress
FATAL: Module lzo_compress is builtin
$ sudo modprobe -r lzo_decompress
FATAL: Module lzo_decompress is builtin

$ sudo modprobe lzo_compress
$ sudo modprobe lzo_decompress
$ sudo modprobe ramzswap
$ sudo swapoff /dev/sda5
swapoff: /dev/sda5: swapoff failed: Invalid argument
$ sudo rzscontrol /dev/ramzswap0 --init
init: Inappropriate ioctl for device
$ sudo mkswap /dev/ramzswap0
Setting up swapspace version 1, size = 2031948 KiB
no label, UUID=6a7facf4-225e-4c19-9d69-98aa9c3d62fa
$ sudo swapon -p 100 /dev/ramzswap0
$ cat /proc/swaps
Filename                                Type            Size    Used
Priority
/dev/ramzswap0                          partition       2031948 0       100
$
$ perl -e '$a="X"x100000000; @a=(1..80);while(1) { my $b=$a; push @a,$b;
shift @a; print $t++,"\n"; sleep 1 }'
<<disk becomes active after 60 seconds>>
$ sudo rzscontrol /dev/ramzswap0 -s
stats: Inappropriate ioctl for device


/Ole
John McCabe-Dansted 1311776064Wed, 27 Jul 2011 14:14:24 +0000 (UTC)
On Wed, Jul 27, 2011 at 8:35 PM, Ole Tange  wrote:
> I am trying to test compcache on my 8 GB laptop before putting compcache
> into production on our 256 GB servers.
>
> It is, however, not working out very well.
>
> - o -
>
> For my first test I want to compress swap to RAM without touching the disk
> drive at all. I have disabled back storage and stopped swapping to my normal
> swap partition.
>
> I run a program that eats up a lot of memory but the memory is highly
> compressible (containings 80 * 100M strings with 'X')
>
> When the program hits 6 GB the disk becomes active. I can understand why the
> swap becomes active at 6 GB (that is the whole idea), but why does the DISK
> become active?My guess is that the system is starting to evict pages from the page
cache, this wouldn't directly cause disk access (unless the pages are
dirty), but it may cause the occasional cache miss. Perhaps you could
use a tool like iotop to see how heavy the disk access is, and what
the direct cause of the disk activity is.

It appears that your cannot rzcontrol is not compatible with your
module. Perhaps when you modprobe you are loading the version of the
module included with your distro, but using rzcontrol from upstream?
You could try using insmod to manually load the upstream module (as in
"insmod ramzswap.ko", when in the same directory as the upstream
module).

Once you get rzcontrol working, you'll probably want to set the size
of ramzswap to at least 6GB. Note that you can safely set the size of
the ramzswap device to be over 100% of the size your RAM, if you know
that the data is compressible. I recall that I tended to get a 4:1
compression ratio on 64bit Ubuntu.

Linux usually favours evicting page cache over swapping, according to
[1] programs can use up to 80% of ram before it starts swapping. You
could try "echo 100 >     /proc/sys/vm/swappiness" to encourage use of
ramzswap before too much page cache has been evicted.

There is also zcache, that may make more efficient use of the memory
allocated to page cache, but I haven't tried it myself.

[1] http://lwn.net/Articles/83588/-- 
John C. McCabe-Dansted
Home | About | Privacy