The Linux Blog

2/4/2005

Spam Karma

Filed under: — Clete R. Blackwell 2 @ 4:36 pm

If you are having any problems posting comments, just let me know.

I have installed the spam karma plugin and I hope this will solve some problems.

Optimizing Gentoo

Filed under: — Clete R. Blackwell 2 @ 6:00 am

Lately, I have been busy hacking away at the Gentoo forums, looking for ways to best optimize my system, other than the normal CFlags optimizations and ones covered in the manual.

If you haven’t set up USE or CFlags, check out Gentoo’s main website, read the manual again, and check out some of the other documentation they have.

Free up Space

Deleting downloaded source code and package work directories is a good way to save a lot of harddrive space, while being risk-free. If you are a 56K user, skip this one, as it deletes files that may need to be downloaded again later. Personally, I use a cron job to do this, but you may use it any way you wish. Try this out for size:

rm -r /usr/portage/distfiles/* && rm -r /var/tmp/portage/*

For my cron job, I also update nightly (not ideal for servers or anyone but bleeding-edge type people):

emerge sync && emerge -uD world && rm -r /usr/portage/distfiles/* && rm -r /var/tmp/portage/* && shutdown -h now

Ccache

The next optimization came as a surprise to me. After over two years of using Gentoo, I have just realized that “ccache” is not installed on a system by default, but is defaulted to on in portage. Summary of ccache (taken from man):

DESCRIPTION
ccache is a compiler cache. It speeds up re-compilation of C/C++ code
by caching previous compiles and detecting when the same compile is
being done again.

It will only make a small difference in most cases, but go ahead and:

emerge ccache
emerge info | grep ccache
ccache -s

On “emerge info | grep ccache,” it should display the version and say “[enabled].” If not, be sure to add it to /etc/make.conf in your portage options.

Deltup

Installing and using deltup will give a great benefit to people using 56K or other low-speed internet connections. Deltup checks for differences in previously updated packages and downloads the new one, threading the old package into the new one, effectively reducing bandwidth by a large margin. Unfortuonately, deltup has become outdated, but there is a new project out that is kept up, so here’s how to get it up and running.

First, you need to know how to “inject” ebuilds into portage. Basically, you are adding your own package to the system. Open up /etc/make.conf and change the value of PORTDIR_OVERLAY. I suggest changing it to “PORTDIR_OVERLAY=/usr/overlay/portage” and make sure that the directory exists.

It’s almost as easy as that. Just place your ebuild into the overlay directory and emerge the name of the package.

Read the official dynamic deltup server page for details in installing it.

Swap Management

The best way to have swap installed is having your root parition on one drive and swap on a completely seperate one, but that is not always possible with most users. For users who have kernel 2.6.0 and up, you can use a feature called swappiness.

Swappiness defaults to a value of 60 and is raised and lowered by editing /etc/sysctl.conf with:

vm.swappiness = x

It ranges from a value of 0 to 100. The closer to 0 you get, the more the kernel tries to free RAM before using swap. The closer to 100 you get, the more readily the kernel will use swap.

Portage Search Speedup

A simple and risk-free (easily removable) addition to portage is to use psycho to speed up searching.

Psycho should already be emerged in your system, but if it isn’t, just “emerge psycho” and then add the portion of code below to /usr/bin/emerge (+ denotes added code, do not actually insert a +).

import portage

#Revision
try:
import psyco
psyco.full()
except ImportError:
pass
#End revision

import emergehelp,xpak,string,re,commands,time,shutil,traceback,atexit,signal,s$
from stat import *
from output import *

Kernel 2.6.X

If you are still using kernel 2.4.X, I highly recommend the upgrade to 2.6.X. (gentoo-development-sources is good) 2.6.X improves system speed by a large margin, is more stable, and is being updated constantly. More on compiling the kernel can be found on the Gentoo forums or in the Gentoo documentation.

More optimizations coming as I find them.

Continue to Optimizing Gentoo (Part 2)



Powered by WordPress