Analyzing boot performance with bootchart

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

Tags: ,

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

 

 


Posted by labis (83.171.xx.xx) on Thu 11 Aug 2005 at 12:20
Now, this was one useful tip! Thanx, saved myself 10-15secs, plus learned a few things :-)

Just a note:
My system decided it was time to check my disks (...) on the first run of bootchart and ruined the timing. So it might be a good idea to manually check your disks before booting with bootchart (just to avoid an extra reboot)

Anyway, thanx again.

[ Parent | Reply to this comment ]

Posted by fsateler (200.104.xx.xx) on Thu 11 Aug 2005 at 17:30
[ View Weblogs ]
You know, the funny thing is it happened to me also on my first run... I probably should have mentioned it :)
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by Anonymous (128.187.xx.xx) on Thu 11 Aug 2005 at 15:51
I'm still confused - now that I have my pretty picture - what am I supposed to do??

What does the picture mean?

Where's the problem (do I even have a problem)?

I really don't understand this, but I _know_ I want a faster bootup.

[ Parent | Reply to this comment ]

Posted by labis (83.171.xx.xx) on Thu 11 Aug 2005 at 17:22
very short question, veeeery long answer... I'll try to keep it short:
For starters, there is no real "problem" with your system init.
What you see in the picture is the time that it takes your system to boot (horizontal axis) and what happens during that time, in other words which "event" and for ->how long<- does it consume your system resources.
So each horizontal bar is an event (some driver being loaded, or service getting started etc.) and the length of the bar shows the time spent for this particular event.
If you want a faster bootup, you should concetrate on the longer bars, particularly those that are grouped under the "rcS" bar. Then you should ask yourself whether you really need those services, and this is the long part that I cannot answer here. You should probably "man" or "apt-cache show" for the name of the service, and find for yourself if you need it or not.
Just two final points:
1) Look for bars that have a start and end time. Those that keep on going till the end of the picture are usually (not always) things that you don't want to stop.
2) Some services, like Samba, can be kept installed but run through "inetd" and not at boot-time.

Good luck and happy reading :-)

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Thu 11 Aug 2005 at 19:19
[ View Steve's Scratchpad | View Weblogs ]

It is worth noting that several servers now depreciate their inetd options.

Recent examples are sshd, and apache2, which no longer support running this way.

Generally inetd support is slower than direct access and that might be a big consideration for "popular" services which are used a lot.

Just a thought ..

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by Anonymous (128.187.xx.xx) on Fri 12 Aug 2005 at 19:25
Perfect response.

Thanks!

(I _will_ enjoy my reading!)

[ Parent | Reply to this comment ]

Posted by Anonymous (83.170.xx.xx) on Thu 11 Aug 2005 at 17:51
Thanks for pointing to this tool!
It's awesome.

[ Parent | Reply to this comment ]

Posted by tomchuk (24.85.xx.xx) on Thu 11 Aug 2005 at 18:23

Great article, thanks!

Adding an altoption in /boot/grub/menu.lst for bootchart is a clean way to give the option of booting with init=/sbin/bootchartd. It will also survive a kernel upgrade and be appended to new kernels when update-grub is run.

In /boot/grub/menu.lst:

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery mode) single
# altoptions=(recovery mode) single

add the line:

# altoptions=(bootchart) init=/sbin/bootchartd

Keep it commented out - update-grub will read it, but grub will not, which is what we want. Finally, run update-grub as root. A new grub entry will be added for all installed kernels.

[ Parent | Reply to this comment ]

Posted by fsateler (200.104.xx.xx) on Thu 11 Aug 2005 at 19:26
[ View Weblogs ]
Glad you liked the article. Also, thanks for the tip. I hadn't realized that could be done.
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by kamaraju (24.58.xx.xx) on Thu 11 Aug 2005 at 19:38
I followed the article and installed bootchart. The boot process went fine. But when I do

$bootchart --format eps
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException $bootchart --help
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException


Any idea what is wrong? Using Debian Sid, kernel 2.6.12

[ Parent | Reply to this comment ]

Posted by fsateler (200.104.xx.xx) on Thu 11 Aug 2005 at 20:18
[ View Weblogs ]
The bootchart utility needs java. Perhaps you didn't install it completely, or bootchart needs a different java version.
--------
Felipe Sateler

[ Parent | Reply to this comment ]

Posted by kamaraju (24.58.xx.xx) on Fri 12 Aug 2005 at 05:07
Actually I have java installed on my system. Running 'apt-get -f install' fixed the problem by installing libcommons-cli-java . Thanks for your response.

[ Parent | Reply to this comment ]

Posted by Anonymous (83.170.xx.xx) on Fri 12 Aug 2005 at 08:18
how about lilo, init parameter absent in lilo. how add /sbin/bootchartd in boot process?

[ Parent | Reply to this comment ]

Posted by apeekaboo (85.226.xx.xx) on Sat 13 Aug 2005 at 08:26
When lilo waits for you to select a kernel to boot off, you can enter 'your_kernel_name init=/sbin/bootchartd'
This way you won't need to make any changes to your /etc/lilo.conf.

If your lilo has a nice graphical frontend, you can simply press tab to get to the textmode where you can type in parameters to lilo.

[ Parent | Reply to this comment ]

Posted by Anonymous (80.200.xx.xx) on Fri 3 Oct 2008 at 12:34
You can use 'append' option

I got something like this

image = /boot/vmlinuz
root = /dev/sda3
label = Gentoo_Bootchart
append = "init=/sbin/bootchartd"
read-only

[ Parent | Reply to this comment ]

Posted by Anonymous (62.252.xx.xx) on Fri 12 Aug 2005 at 08:25
I tried using this after this article on OSnews

http://www.osnews.com/story.php?news_id=11379
It gives some idea's on how to use these charts to be able to make changes. Knowing where your PC takes a while to boot, is only useful if you're making changes to it. There was an article on here recently entitled "make debian boot faster" which was basically done by making services load in paralel, I found using bootchart that the change only gained me an extra 2 seconds, so wasn't really that productive, as it also made the loading screen unreadable.

Oddly I found the curl line to use the online bootchart to .png converter, in the manual for bootchart-view which you wouldn't need if you used the online renderer.

[ Parent | Reply to this comment ]

Posted by Anonymous (82.39.xx.xx) on Sat 20 Aug 2005 at 13:04
Hi Steve, great article. I've been watching bootchart since it first turned up on the redhat mailing lists (I think it was). Things have certainly come a long way since then. The .deb was very useful and the curl line a time-saver.

[ Parent | Reply to this comment ]

Posted by Steve (82.41.xx.xx) on Sat 20 Aug 2005 at 13:05
[ View Steve's Scratchpad | View Weblogs ]

Hey this wasn't my article - It was written by fsateler!

Steve
-- Steve.org.uk

[ Parent | Reply to this comment ]

Posted by Anonymous (82.39.xx.xx) on Sat 20 Aug 2005 at 13:07
Eek, so it is. Sorry fsateler. Fsateler: great article :)

A good follow-up would be an article which highlighted some of the efforts underway to reduce this boot time in debian, and what people can do to help.

[ Parent | Reply to this comment ]

Posted by Anonymous (195.230.xx.xx) on Mon 19 Sep 2005 at 07:39
Debian have the bootchart in testing
http://packages.debian.org/testing/admin/bootchart

[ Parent | Reply to this comment ]

Posted by Anonymous (84.176.xx.xx) on Fri 7 Mar 2008 at 12:19
anyone know of an alternative boot charting tool thats not so over blown ?

i just installed base lenny and wanted to start experimenting with boot/init etc... but doing "apt-get install bootchart" just blowed my socks out!

79 packages, 44.1MB (115MB) for just making a bootchart ? WTF ?!?!
this is so wrong...


[ Parent | Reply to this comment ]

Posted by Anonymous (192.55.xx.xx) on Mon 9 Jun 2008 at 11:34
..this is the finest tool available for analysing the boot performance.. but i faced issue while using the Renderer Web Form to render the graph, all the time i am getting connection time out or server is not responding . Is there any other sites provides same facility.

[ Parent | Reply to this comment ]

Posted by jeremiah (195.198.xx.xx) on Sun 10 Aug 2008 at 17:27
[ View Weblogs ]
Hello!

There is a dead link in your article: http://www.minet.uni-jena.de/~joergs/bootchart/ Its pointing to a 404 page.

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

What do you use for configuration management?








( 528 votes ~ 7 comments )