Wednesday, December 21, 2005

Tweaking the penguin's nipples

hdparm: nipple clip of yesteryear

The first tweak I'd recommend is starting with hdparm. It can't hurt, and might help. This article is the one I learned how to use hdparm from a long, long time ago. It's a little dated, but the commands are still the same, so you can at least learn how it works. More than likely, it won't make any difference as the features it's supposed to enable are typically enabled by default. My most current machine did not need hdparm.

Too many consoles spoil the soup

Next, remove some extra virtual consoles. On a Linux box, when you're at the console, you can hit Alt-F1-6 and switch between consoles. Kinda useless if you're booting into a GUI, so let's disable them:

vi /etc/inittab

You'll see a bunch of lines like:

1:2345:respawn:/sbin/mingetty tty1

Comment out the lines that begin with 3 through 6 (keep two as an in case). When you next reboot, you'll only have two gettys running and have freed up a tiny bit of RAM. Hey, tiny, but you weren't using it, right?

Clear out those services

Yes, I'll tell you to do it, too. But, I'll tell you which you can prolly lose:

apmd - The Advanced Power Management daemon. If you don't have a laptop, you can more than likely kill this one.

gpm - Essentially the console mouse driver. In a GUI all the time? Kill it, you won't be using it.

identd - Used for IRC to identify you. Some IRC servers require you to run one. If you don't IRC, say buh-bye!

ip6tables & iptables - Ip6tables can go away if you're not using IPv6. Iptables should only be disabled if your machine is behind a firewall. Even then, you should consider keeping it, but that's your call. This is your machine's firewall.

isdn - Useless if you don't have an ISDN line.

nfs & portmapper - if you're not connecting to NFS file shares somewhere, this can go.

Sloppy with your swappi

The 2.6 kernel gave us the ability to determine how likely things will be swapped to disk, rather than kept in main memory. The kernel does these calculations constantly and there is no cut-and-dried guidelines for setting this. Default is 60, but you can set any value you want betweeen 0 and 100. I use 30 and find that works fine for me on the few occasions I might need to swap (my machine has a gig of RAM, and rarely uses more than that). 20 is a good number if you've got a laptop and want to force the kernel to swap only when absolutely necessary. This is good for those slow-ass laptop harddrives.

Two ways you can set this:

echo 30 >/proc/sys/vm/swappiness

This is a temporary method and lasts until your next reboot. But, you can do a lot of testing by modifying the swappiness on the fly and then determining what works best for you regularly. You can use "free -m" to view your RAM and swap usage at any time. At that point you can....

Most distros use /etc/sysctl.conf to control things like this. Set vm.swappiness = 30 in that file and it'll follow with each reboot.

More to come.

No comments:

Post a Comment