turbo boost emerge --sync and cvs up on gentoo-x86
November 17, 2012
I while ago I used seekwatcher
to find out that portage
operations
are seek-bound and better handled by small loop device.
I had some problems creating such btrfs
loop device, due to
nonworking nocow
loop devices, but now I have the solution!
The recipe:
for
btrfs
host filesystem: make sure you have at least>=sys-fs/e2fsprogs-1.42.6
which haschattr
/lsattr
withnocow
support.for
btrfs
host filesystem: mark a directory with loop device asnocow
:$ mkdir -p /subvolumes/nocow-images/ $ chattr +C /subvolumes/nocow-images/ $ sudo lsattr -ld /subvolumes/nocow-images/ /subvolumes/nocow-images/ No_COW
Build small
btrfs
loop device:dd if=/dev/zero of="$image" bs=1M count=1K mkfs.btrfs \ -d single -m single \ -L "$label" \ -l 32k -n 32k \ "$image"
for
btrfs
host filesystem: make sure created file isnocow
:$ lsattr -l /subvolumes/nocow-images/gentoo-32k.img /subvolumes/nocow-images/gentoo-32k.img No_COW $ /usr/sbin/filefrag /subvolumes/nocow-images/gentoo-32k.img /subvolumes/nocow-images/gentoo-32k.img: 1 extent found
And mount it:
/subvolumes/nocow-images/gentoo-32k.img /gentoo-32k btrfs loop,nodatasum,noatime,nodiratime 0 0
Amend
/etc/portage/make.conf
like that:PORTDIR=/gentoo-32k/portage
and so on.
Have fun!
Some notes:
- Larger leaf sizes allow better inlining of small files and speeding up read pattern
- Smaller loop device allow faster reading-out the whole loop file in
RAM reducing all the
I/O
. - Disabling
datasum
s andatime
s for loop contents we leave only raw data there.
Some numbers:
$ time emerge --sync # 72 seconds
...
real 1m12.111s
user 0m1.706s
sys 0m1.819s
gentoo-x86 $ time cvs up # ~4 minutes
...
real 4m35.208s
user 0m3.656s
sys 0m14.226s