OptimizedLiveCDLayoutForFasterBoot
Launchpad Entry: https://launchpad.net/distros/ubuntu/+spec/optimized-live-cd-layout-for-faster-boot
Created: 2006-06-08 by KrzysztofLichota
Contributors: KrzysztofLichota, TollefFogHeen, JunKobayashi
Packages affected: livefs building script, kernel
Summary
Live CD boot time can be shortened significantly by laying out files on CD (or more precisely in SquashFS image) in such way that CD-ROM head movements are minimized.
Rationale
Faster boot time means a better user experience. Inexperienced users might also think time to boot from CD will be the same as time to boot from hard disk.
Use cases
- Alice gets Ubuntu live CD from friend, boots it, but starting takes 3 minutes, so she gets discouraged and thinks every time Ubuntu boots she will have to wait for 5 minutes.
- Bob gets the new and optimized version of the live CD. It boots quickly so he is happy and installs Ubuntu.
- Charlie uses live CD as portable system as it boots quickly, he takes the live CD to friends and encourages them this way to try Ubuntu.
Scope
Need a way to record which files are opened, together with timing information. This is then post-processed into a weighted list fed to mksquashfs as part of the livefs build process
Design
- A tool records all open(2) calls through a kernel module using the kprobe interface. Using inotify for a system-wide recording of all open(2) calls is quite cumbersome and the alternative is a kernel patch.
The list of files is then retrieved and post-processed into a weighted list of file names. http://blogs.sun.com/roller/page/moinakg/20060426 has an interesting idea of using a non-naive optimisation, but we will have to see how much the initial run gets us.
- The list of weights is passed to the livefs build process.
Implementation
- The kernel need to include support for kprobes (or a custom kernel needs to be used on the live cd when instrumenting)
- A kprobe which registers all open(2) calls and when they are done is included in the initramfs and loaded early in the boot process.
- Instrumentation data is recorded when booting and recovered when the probe is rmmod-ed at the end of the boot.
The list of files is post-processed, first by a trivial "order by first access" approach, with a possibility for using a "sliding window" approach later and assigned weights in the format required by mksquashfs
- Said list of files is fed to the livefs build process.
Unresolved Issues
How and when will this list be updated? It should be done at least for beta and RC/final to account for changes during the development cycle --MattZimmerman
It'll be added to the list of tasks to be done for each milestone (see MilestoneRhythm) -- TollefFogHeen
Useful links
An implementation: http://lichota.net/~krzysiek/projects/kubuntu/dapper-livecd-optimization/ Includes file access tracing facility, script to optimize layout by first access and script to create CD with optimized layout. The result for Kubuntu 6.06 RC live CD is cutting down boot time by about 60 seconds. Exact results on Athlon 1.2 Ghz, 256 MB RAM: plain Kubuntu (3:22, 3:25), plain optimized CD (2:22, 2:22).
The Gentoo-Wiki has some useful information at http://gentoo-wiki.com/HOWTO_build_a_LiveCD_from_scratch#.22Defragmenting.22_the_LiveCD_to_make_it_faster
http://www.redhat.com/magazine/005mar05/features/kprobes/ has a bunch of information about kprobes
http://www.ubuntulinux.jp/Members/jkbys/Ubuntu6.06DesktopCDReadahead - Dapper Desktop CD with readahead and background X configuration
OptimizedLiveCDLayoutForFasterBoot (last edited 2008-08-06 16:35:04 by localhost)