Pages

Saturday, September 18, 2010

Boot time tuning chapter first: bootchart

"Jack gets up and lights a cigarette. Then he turns his laptop on and go to the kitchen to have a coffee cup, a toast and he comes back to his freshly opened desktop..."

Sounds familiar? Tired of a boot up that takes ages? Here come some advices on how you can squeeze some blood out of your gentoo box (or at least improve performances). Obviously I'm not going to talk about Windoze...If you have a Win box, I'll give a good tip: move to Xubuntu and enjoy Open Source!

We are going to introduce bootchartd, used as a tool to monitor timings, and OpenRC, that's actually what makes the difference. Advanced users can find a way to start avoiding login managers using a mingetty autologin.

At last a link to a fresh, shiny and beautiful splashscreen (Powered by Gentoo) to beautify your startup.

In this first chapter I'll treat bootchart installation and configuration. The rest is coming up soon.

We have to make a little disclaimer, if you care of more accurate process tree you have to enable a feature in your kernel "CONFIG_BSD_PROCESS_ACCT_V3" and have the "acct" use. If you don't care you can always skip that step.

To compile bootchart properly you need "java" use. If you don't you won't be able to generate an image, but just a bootchart package (nearly useless). Simple as water you can issue:
emerge -av bootchart
Pay attention to have the needed use activate. If you don't edit use file:
nano /etc/portage/package.use
and add the following line:
app-benchmarks/bootchart java [acct if needed]
When installer has finished let's move to config and set it:
nano /etc/bootchartd.conf
Set some few option as you need:
AUTO_RENDER="yes"
AUTO_RENDER_FORMAT="png"
AUTO_RENDER_DIR="/home/[your path]"
Good. Now we have to get your machine to boot through bootchart daemon. For grub users:
nano /boot/grub/grub.conf
I suggest to add a new entry, so you can use it just when you want but not as default. Copy and paste your whole default entry and just add the red words:
title Gentoo bootchart
root (hd0,0)
kernel /boot/gentoo root=/dev/sda1 ro quiet init=/sbin/bootchartd
Be careful to show grub menu at startup (avoid hiddenmenu option) and reboot your box through the bootchart menu entry.

WHOA! Done!

That strip looks scaring, but actually you can see a detailed report of processes in my boot sequence. Maybe your looks very different, but the interesting things are the same. The ideal boot maximizes the throughput of hard drive(s) and CPU usage, with no dead time. In my case I have a stunning SSD (an OCZ Agility 2E 60G) which makes my wait time very short. It is not clearly visible, you'd better look at the one at the beginning of the post, but a "IO wait" area is shown in the top graph. Minimize that lost time is one of the things we are going to do with OpenRC and other tweaks.

See ya soon.

No comments:

Post a Comment