I got bored and rewrite my entire system to boot up with Upstart. Yes, I rewrote all jobs, essentially wrapping them to call init scripts individually and tweaking the dependencies correctly.
Short Statistics:
Time spent hacking: 5+ hours. Ran into a lot of snags getting udev and filesystem mount ordered correctly, and each time I failed at that it meant needing a livecd!
The Victim: Me. Err, oh you meant the computer: Macbook Core 2 Duo 2.16, 2GB RAM, running Hardy.
Enjoyment: Infinite. This kind of nerdy thing keeps me going.
Stopwatch/Visual statistics:
I'll get to bootchart in a moment, but bootchart doesn't tell the whole story -- what bootchart calls a bootup time and what the user sees as the bootup time are two entirely different things. These boot times are from a stopwatch from GRUB to login chime:
Native Upstart:
18s
SysV Upstart: 30s
Bootchart Stats:
Native Upstart: (
22s)
http://jdong.mit.edu/~jdong/macbook/bootchart-upstart.png
SysV Upstart: (27s)
http://jdong.mit.edu/~jdong/macbook/bootchart-sysv.png
Observations:
(1) Note how slow my laptop hard drive is. Around 12MB/s is its peak read speeds. If I tried this with a powerful desktop hard drive, the 10 second long "readahead-list" could be shaved to 5 seconds or less.
(2)
Ignore the first 17s of both bootup charts for the time being: Time spent probing modules and slurping readahead cannot be optimized by parallelized startup and are more or less hardware and kernel limitations on bootup speed. Focus on what's after the big blue trapezoid @ 15s: The actual time it took to set up dbus, hal, avahi, GDM, anacron, sysklog, and other system services. It took
5 seconds to do all of that on Upstart while SysV took
over 10s. That's effectively doubling the speed at which services are coming up. In addition, notice how Upstart was more consistently able to break the one-core barrier of CPU usage.
The event.d:
For educational purposes, here's how I wrote my upstart events:
http://jdong.mit.edu/~jdong/event.d.tar.gz
You're welcome to play with it all you want, but
DO IT ON AN EXPERIMENTAL BOX. It's extremely easy for one typo or logic error to result in an unbootable system.
EDIT
As a proof-of-concept, I "defragged" (rewrote rapidly) all the files readahead identified as being used at bootup, and got peak IO to around 15MB/s and upstart boot time to
19s by bootchart
EDIT 2: Youtube video of bootup: (note how rough around the edges it is
)
http://www.youtube.com/watch?v=cY8MWwbESy4
Bookmarks