Analyzing boot performance with bootchart

Posted by fsateler on Thu 11 Aug 2005 at 09:16

Often the boot process of a machine is not as fast as one would like. It is commonly suggested that you reduce the number of started services so that your machine boots up faster. However, one thing we must know before trying to optimize our boot process, is where it is slow. To do that, we will use a tool called bootchart.

The first thing we must do is, obviously, install the package. To do that, we download a couple of debian packages, since unfortunately bootchart is not currently in the debian archive. I chose to install both bootchart and boothchart-view version 0.8-2. So, after downloading we install them:

# dpkg -i bootchart-view_0.8-2_all.deb  bootchart_0.8-2_all.deb

Note that there may be some dependencies unsatisfied. Install them and then retry. Also, note that bootchart-view is not necesary for bootchart to work, so if it gives you problems, just uninstall it.

After we installed the packages, we need to make some modifications to the system to make it work. Edit your bootup process so that it loads /sbin/bootchartd instead of /sbin/init. Here's my GRUB line:

/boot/vmlinuz-2.6.8-2-k7 root=/dev/hda5 ro init=/sbin/bootchartd

Now we are ready to reboot our system. Important: Keep an alternate kernel entry in case something goes wrong!. bootchart works by logging when processes start and exit, and also logs disk usage. The booting process should be almost exactly the same as always, hopefully. When the boot is complete, there should be a file /var/log/bootchart.tgz, which can be used to generate a graph of your boot process. If you installed bootchart-view, then all you need to do is:

$ bootchart --format fmt   # Where fmt is one of png, eps, svg. The default is png

Then you should have a nice graph image that you can analyze. If you didn't install it, then you can use the web renderer to generate the graph. Alternatively, you can do it from the command line:

$ curl --form format=fmt --form log=@/var/log/bootchart.tgz \
    http://bootchart.klika.si:8080/bootchart/render > bootchart.ext

Of course, use a valid fmt, and a correspnding ext.

For more information, visit bootchart's official web site


This article can be found online at the Debian Administration website at the following bookmarkable URL (along with associated comments):

This article is copyright 2005 fsateler - please ask for permission to republish or translate.