Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
improving emerge performance
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
chutz
n00b
n00b


Joined: 03 Feb 2003
Posts: 25
Location: Sapporo

PostPosted: Fri Jul 18, 2003 8:47 am    Post subject: improving emerge performance Reply with quote

I don't know if this has ever been covered here (tried searching, but had trouble finding), so I decided I'd just share a tip others may find useful.

The idea is that emerge -s or even emerge -p take quite some time on my system. emerge -s is ridiculously slow and emerge -p is just not as fast as I'd like it to be.

The short story is: I mounted /usr/portage on a loopback device. I am not sure if the fact that I formatted the loopback as reiserfs and the rest of the system is ext3 has anything to do with it, but performance is much better than before. I.e.:

Code:
dd if=/dev/zero of=/var/portage.loop bs=50M count=5
mkreiserfs -f /var/portage.loop
echo "/var/portage.loop /usr/portage reiserfs auto,loop 0 0" >> /etc/fstab
rm -rf /usr/portage
mkdir /usr/portage
mount /usr/portage
emerge sync


I am also an rsync mirror, so it was faster to get the new tree from the LAN than to copy it over, but you would probably wish to rename the old directory and then copy its contents to the new one.

As I said, I don't know if reiserfs has much to do with the speed-up, or if it is only because the files are now on a small, separate "partition", but emerge -s executes almost instantly now.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9550
Location: beyond the rim

PostPosted: Fri Jul 18, 2003 1:49 pm    Post subject: Reply with quote

reiserfs is significantly faster for small files (ebuilds are small in most cases) than ext2/3. You could create a second loopback file with ext3 for comparison.
Back to top
View user's profile Send private message
eckythump
n00b
n00b


Joined: 24 Jul 2003
Posts: 1

PostPosted: Thu Jul 24, 2003 10:30 pm    Post subject: Reply with quote

I had the thought that by using a [i]loop backed filesystem in a file[/i] you could rsync that file instead of rsyncing the portage directory tree. This could make "[B]emerge rsync[/B]" significantly faster or perhaps much more [I]scaleable[/I] particularly solving the problem of people over frequently hitting emerge rsync and requiring at the least a ~1meg dir listing... as opposed to a single checksum... then split rechecksum (we all know how rsync works) .. any way ... it would certainly [i]improve the worst case[/i]and potentially could be done without changing too much other stuff (clearly importaint). Although i will admit it could have the blocking problem that the loop back might need to be unmounted while the rsync happens but this might be ok.. after all should you be using emerge foo whilst emerge rsync?

not sure where to put this idea but i did a quick search for "portage loop rsync" and this was at the top... now to go back and find out that someone else has already had the idea :oops:

or not 8)
Back to top
View user's profile Send private message
Kalin
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2002
Posts: 130
Location: Germany

PostPosted: Sun Aug 03, 2003 11:02 am    Post subject: /usr/portage is growing... Reply with quote

I was just following chutz' suggestion, so I made some slight (say cosmetic) improvements and preparations. Here it is:

Code:

su -

# Inform portage about your intentions
echo 'PORTDIR="/usr/portage"' >>/etc/make.conf
echo 'DISTDIR="${PORTDIR}-distfiles"' >>/etc/make.conf
echo 'PKGDIR="${PORTDIR}-packages"' >>/etc/make.conf
mv /usr/portage/distfiles /usr/portage-distfiles
mv /usr/portage/packages /usr/portage-packages

# Prepare the 384MB file-partition
dd if=/dev/zero of=/var/portage.loop bs=64M count=6
mkreiserfs -ff /var/portage.loop

# Make it automount at boot
echo "/var/portage.loop /usr/portage reiserfs auto,loop 0 4" >> /etc/fstab

# Pivot to the new "partititon"
rm -rf /usr/portage
mkdir /usr/portage
touch /usr/portage/PARTITION_NOT_MOUNTED
chmod 100 /usr/portage/PARTITION_NOT_MOUNTED
mount /usr/portage

# Get in sync
emerge sync

# Enjoy!


The -ff to mkreiserfs doesn't ask for confirmation, so be careful!
The touch is a nice touch :D I often use for mounts such as /boot, etc.
Moving DISTDIR, PKGDIR out of the main portage tree is a good idea, or may be just all that goes inside /usr-portage/*-* should be one dir deeper?


Last edited by Kalin on Mon Apr 12, 2004 2:36 pm; edited 1 time in total
Back to top
View user's profile Send private message
tomaw
Guru
Guru


Joined: 26 Mar 2003
Posts: 429
Location: UK

PostPosted: Mon Apr 12, 2004 1:20 pm    Post subject: Reply with quote

Kalin's suggestions seem to work just fine, although I forgot to emerge reiserfsprogs before starting, so had to reset /etc/make.conf.

Also, I presume something that is a sideeffect of using udev is I've had to add loop to my modules autoload file, or the mount command fails. It doesn't seem bothered if the reiserfs module is loaded or not though, it gets auto-loaded by mount.

Seems a little quicker too.
_________________
Tom Wesley
Back to top
View user's profile Send private message
Kalin
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2002
Posts: 130
Location: Germany

PostPosted: Mon Apr 12, 2004 2:35 pm    Post subject: Reply with quote

Since a lot of time passed, now I am confident in the ReiserFS, so most partitions are such.

Just keeping /boot in ext3 for some unknown reason...

And I am thinking to meve portage tree to /var/portage or something, and mount /usr ro. We'll see.

BTW /usr/portage has grown a bit (290MB at present), so adjust the loop file accordingly.
Back to top
View user's profile Send private message
chutz
n00b
n00b


Joined: 03 Feb 2003
Posts: 25
Location: Sapporo

PostPosted: Mon Apr 12, 2004 3:17 pm    Post subject: Reply with quote

If you need more space on the loopback:

Code:
expand=50M
umount /usr/portage
dd if=/dev/zero bs=$expand count=1 | cat >> /var/portage.loop
resize_reiserfs -s +$expand /var/portage.loop
mount /usr/portage
Back to top
View user's profile Send private message
chutz
n00b
n00b


Joined: 03 Feb 2003
Posts: 25
Location: Sapporo

PostPosted: Mon Apr 12, 2004 3:20 pm    Post subject: Reply with quote

It is also good to sync frequently or we may run out of space when we finally sync, because portage does "rsync --delete-after". Doing a "rsync -av --delete rsync.gentoo.org::gentoo-portage/ /usr/portage/" manually is a workaround, but one would need to interrupt the sync after the files are deleted.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum