Development/Howto/Boot Time Optimisation
From Mandriva
The goal of this page is to gather all the ideas to improve Mandriva Linux's Boot Time.
You may also vote to ask for Boot Time improvement in Bugzilla.
Contents
|
How To Profile?
- Install the sysstat package: Sysstat is in Contributions RPMs. If the Contributions RPMs Media is not yet installed, install it with the 2 following commands (as root):
# urpmi.addmedia contrib_10.1 ftp://mandrake.contactel.cz/Mandrakelinux/official/10.1/i586/media/contrib with ./hdlist.cz # urpmi sysstat
- Install Bootchart:
- Install bootchart and bootchart-logger packages (available from contrib) or download the latest Bootchart release
- Follow the installation instructions
- Reboot
- Upon reboot change the kernel command line interactively with the command init=/sbin/bootchartd. LILO : You do this in LILO by pressing ESC at LILO boot screen, and typing [your-lilo-entry] init=/sbin/bootchartd.
- After boot, verify that /var/log/bootchart.tgz was created and contains the log files.
- Produce the chart by uploading your /var/log/bootchart.tgz file on http://www.bootchart.org/download.html (Renderer Web Form section). Or you can also generate the bootchart graph yourself by running bootchart on your system.
- Rename the downloaded chart "bootchart-testXX.png", and create an attachment for it in this page, meaning you're the XX'th person reporting its test (see reports below)
For more information, see: http://www.bootchart.org/
Trial Results
Put the results you've had on your system here, describing:
- Your hardware
- The services that were running (if it is not a fresh basic installation)
- The amendments you've applied to improve time of successive boot processes
- Time results for each trial
To ease comparisons, it would be best to do your first test with a fresh basic installation, without modifying anything.
Test 1 (BuchanMilne)
Hardware
- HP NX 7010 laptop
- 512MB RAM
- 1.4 GHz Centrino
- 40GB 4200rpm IDE disk
- Radeon 9200 Mobility
- On-board RTL8139 and IPW2100 NICs
System / Services / Modifications (Configuration 1)
- Mandrake 10.0 install with many services upgraded to 10.1. This is not your average desktop (or even your average server) ...
- bluetooth, winmodem, firewire, ldap, mb, clamav, squid, httpd, sshd, Win4lin
Results (Configuration 1)
Total Boot Time: 87sec (to KDM login screen)
System / Services / Modifications (Configuration 2)
- Mandrake 10.1 new install on a 2GB partition, mostly default but actually testing an auto_install configuration with some non-standard (ie xprint) software installed). This is a more typical corporate desktop setup.
- cups, bluetooth, xprint
Results (Configuration 2)
Total Boot Time: 47s (to KDM login screen)
Test 2 (FredericConrotte)
Hardware
- AMD Duron 1200 Mhz
- 256Mo DDR
- SoundBlaster Live
- NVidia GeForce2
- Carte Ethernet RTL-8139
- Modem ADSL USB Speedtouch
System / Services / Modifications
No additional services, just those selected by default with 10.1 PowerPack
Results
Total Boot Time: 33s
Test 3 (DickGevers)
Hardware
- Pentium II @ 350 MHz
- 458Mb SDRAM
- ESS1887 soundcard (isa)
- S3 ViRGE
- 3C509B-TPO ethernet card
System / Services / Modifications
- Running current Cooker 10.2, usb commented out in rc.sysinit, intel-agp not loaded in kernel.
- Internet not running (LAN only, which connects to router which connects to ADSL)
- Additionally running: Prelude-manager, microcode_ctl, lm_sensors, shorewall, Guarddog (at boot time only), IPtables IPv6, iplog
Results
Total Boot Time:
- 59s, according to bootchart
- 133s counting from entering password in lilo until appearance of mdkkdm
Test 4 (GregorP) (testing some optimisations)
Hardware
- CPU: AMD Duron 750 Mhz
- RAM: 512MB SDR SDRAM
- Disk: 5400 RPM
System / Services / Modifications
- alsa, dm, kheader, network, partmon, xinetd, keytable, syslog, crond, xfs, atd, udev, cups, shorewall
- filesystem: ext3
Results
Boot Chart (& update)
Boot Chart (KDE autologin - it take 60s from LILO to KDE login sound)
Test 5 (AustinActon)
Hardware
- HP TC1100 laptop
- Pentium M, Centrino
- Nvidia GeForce 4
- 512 MB ram
Results
Total Boot Time:
As you can see, boot time has been cut in half over the last year.
Remaining gaps
- zombie at end of fsck
- big hole during pcmcia
- big hole during alsa
- harddrake has to be disabled for decent boot time
Test 6 UPDATED (PieroOttuzzi)
Hardware
- Athlon 2200+ Desktop PC NONAME
- NForce2
- ATI Radeon9000
- 1024 MB ram
System / Services / Modifications
I use Mandrake for work... I've disabled CUPS and Apache because I need them very seldom and I know how to start them when needed ;-)
Results
Total Boot Time:
I'm really satisfied about my boot time... It is not on par with Windows XP but it is OK for me.
Update
I made another test with a fresh Mandrake 10.1 Official Edition: boot times are equals but graphs are a bit different.
Test 7 (RobinRosenberg)
This is more than a minimal configuration.
Hardware
- Dell Inspiron 8500 2GHz
- GeForce4 Ti 4200 Go (nvidia 6111 driver)
- 512MB RAM
- Wireless pcmcia prism54
System / Services / Modifications
- Mandrake 10.1, Kernel 2.6.10-rc3, KDE 3.3.1
- acpi acpid alsa atd bluetooth cpufreq crond cups dkms dm gpm hotplug iptables irda keytable kheader mdadm messagebus netfs netplugd network ntpd partmon pcmcia pcscd proftpd rawdevices smartd smb sound sshd syslog udev xfs xinetd KDE-autologin
Results
Test 8 (LoicBaudry)
Hardware
- Duron 1,2 Ghz
- 256 MB RAM
System / Services / Modifications
- Mandrake 10.2 Beta 3
- KDE 3.3.1
Results
Time from lilo key press until kde splash screen disappear :
- Fresh install : 1'21
- After disabling unused applets (net_applet, mdkonline, kdiskfree etc.) and unused services (harddrake, blutooth*, howl* ) : 1'15
- With lilo option "compact" : 1'15
- Starting service dm earlier : S30dm -> S02dm : 1'08
- Using grepmap : 1'04
- Using prelink : 1'02
- Using noatime mount option on "/" : 1'01
For me, the last bootleneck is:
- mount -a during rc.sysinit : 6 secs.
For kde startup, i wanted to try to disabling kbuildsyscoca but the panel to do it is not present in mandrakelinux kde version...
(strange that fresh 10.2 install takes more time (1'21) with basically the *same* hardware than test2 (0'33) with fresh 10.1 install...) (FredericConrotte)
(Same hardware but probably not the same method. My method is until kde splash disappear. Not sure that test2 use the same end point.) (LoicBaudry)
Test 9 (JohnKeller)
Hardware
- Pentium II 400 MHz
- 256 MB RAM
System / Services / Modifications
- 2005 LE updated to Cooker (10 May 2005)
- all services at default
- no configuration tweaks
Results
attached "bootchart_2005-05-10.png"
Total Boot Time: approximately 2m15s from LILO to GDM login (services still starting on VT 1).
Test 10 (LuisMenina)
Hardware
- AMD 3000+
- 512 MB RAM
- ATI Radeon 9800 PRO
- ADSL Modem : SAGEM Fast 800 (first test)/ Bewan Eternet 100 (second test)
- USB Zip 100
- nVidia nForce2 MCP Networking Adapter 10/100
System / Services / Modifications
- 2005 LE fresh install
- all services, with some exceptions
- - all bluetooth related services
- + wine, ddclient
- no configuration tweaks
Results
Test with SAGEM Fast 800:
- Total Boot Time*: 1m15s from LILO to the end of GDM autologin
attached "bootchart-test10.png"
Test with BeWan Ethernet 100:
- Total Boot Time*: 55s from LILO to the end of GDM autologin
attached "bootchart-test10-1.png"
Ideas to improve Boot Time
- iptables/shorewall takes about 6 seconds ([How can I speed up start (restart)?])
- harddrake takes 5 seconds at every boot => automatically activate harddrake service only when system detects new hardware before rebooting.
- Add boot image [kernel name]-New_Hardware. When this boot image is selected, HardDrake/other hardware detection software runs. Otherwise skip the hw detection.
- KDE Performance Tips (How to turn off system configuration startup check (kbuildsycoca) in Mandrakelinux 10.1?) (GregorP)
- Run some services in background.
- Start services xfs & dm sooner.
- Use prelink.
- Use dash instead of bash.
- Start CUPS later in the boot process; it's rarely needed before login.
- Start gpm later in the boot process
- Add readahead support
- Optimise file layout on disk (e.g. with a set aside partition)
- Integrate highly experimental Ubuntu patches (hacked up xorg loader, hotplug changes)
- Take a look on what Ubuntu is doing regarding Faster Boot (http://www.ubuntulinux.org/wiki/FasterBootProcess)
- Parallelization of startup scripts (see below)
Parallelization of Startup Scripts to Save Bootup Time
According to this article, it's possible to greatly shorten system startup time by parallelizing execution of startup scripts.
Dependencies between services are handled by using make instead of linearizing their invocation as with current approach.
This way, computer's resources (CPU, I/O throughput) are better utilised to launch services and the time needed to statup is much shorter.
This would be especially useful for desktop computers and laptops.
See also this discussion on Slashdot, Initng and the Serel tool that do this thing too.
See also ParallelInit project : Parallel Init
Current status
With udev-065-8mdk, hotplug-2004_09_23-16mdk, sound-scripts-0.28-1mdk dynamic-0.26-1mdk, and harddrake-10.3-0.43mdk, the startup time has been dramatically reduced, especially on old machines. What takes time now at this stage is rc.sysinit, shorewall. Where we really spent time now is between the time X and the dm are forked off and the time the desktop is usable.
More information
- http://jw.dyndns.org/initng/ - Initng, sysvinit replacement
- http://www.fastboot.org/ - parallelisation for sysvinit