How to optimize a RAM-only (swapless) system?

John McCabe-Dansted gmatht at gmail.com
Thu Dec 23 00:50:29 MST 2010


On Thu, Dec 23, 2010 at 2:52 AM, Von Fugal <von at fugal.net> wrote:
> It really should sit as an in-between swap and memory place. Recently
> "swapped" pages should go straight to compcache, evicting pages if
> necessary *from* compcache to disk. That would be ideal. I don't know if
> the kernel devs would ever want to futz with the kernel that much,
> though.

Compcache is a module that can be compiled by itself, so it doesn't
really need to be accepted by the Kernel devs. The real issue is
whether anyone (e.g the author of compcache) will find time to do
this.

> I wonder why nobody has done compression on regular swap yet. I mean,
> the HUGE downside of swap is disk time, compressing the data on the disk
> would at least marginally speed up access time to that swapped data.

I am guessing that the benefit is considered to be so small as to be irrelevant:

Seek time: ~10ms
Time to read 4K: ~0.05ms
Time to read 1K: ~0.01ms

Compression adds considerable complexity but can't do anything about
the seek time of rotational media so it is like 10.05ms vs 10.01ms
even if we ignore the time required to compress/decompress the pages.
It becomes even less relevant with 4K sectors. Since the compression
only affects the sequential read it seems likely that it could even
slow things down. My CPU can compress with lzop at about 50MB/s, while
my harddisk can do sequential reads at 80MB/s.

It may be worthwhile with SSDs to reduce the amount of wear caused by
writes. Also an i7 exploiting all 8 threads could probably compress
faster than the SSD can be written to, even sequential writes to an
X25 are limited to about 80MB/s [1] while I presume 4 threads on an i7
could compress with lzo at over 200MB/s (since the cores of the i7 are
presumably faster than the cores on my Core2Duo).


-- 
John C. McCabe-Dansted

[1] http://benchmarkreviews.com/index.php?option=com_content&task=view&id=283&Itemid=60&limit=1&limitstart=6

$ time lzop -1 < ~/Downloads/penumbra_overture_1.1.sh > /dev/null

real	0m6.585s
user	0m6.460s
sys	0m0.060s

$ ls ~/Downloads/penumbra_overture_1.1.sh -lh
-rw-r--r-- 1 xp xp 287M 2010-12-07 06:56
/home/xp/Downloads/penumbra_overture_1.1.sh

$ cat /proc/cpuinfo  | grep model.name
model name	: Intel(R) Core(TM)2 Duo CPU     E7200  @ 2.53GHz

$ sudo hdparm -t /dev/sda

/dev/sda:
 Timing buffered disk reads:  252 MB in  3.00 seconds =  83.95 MB/sec


More information about the PLUG mailing list