Twitter Updates

    follow me on Twitter

    G-AVLN in front of her home

    G-AVLN in front of her home

    Mostly Unix and Linux topics. But flying might get a mention too.

    Thursday, August 12, 2010

    How did Ubuntu speed up boot time?

    Fact: Ubuntu 10.04 boots significantly faster than any other desktop/laptop OS I have ever used. On the same machine (Asus), boot time went from about 75 seconds to less than 30. My Lenovo X201 takes approximately 25 seconds to go through full reboot cycle.

    How come? Scott of Canonical, explained at LINUXCON.

    When booting a Linux system, four distinct phases occur:
    1.Load into memory the kernel and ramdisk
    2.Load platform drivers
    3.Start X-related stuff
    4.Start the desktop

    Ubuntu developers made a conscious decision to aim for target timing. Rather than tweaking existing sequence of events, they decided to invest time into redesigning the boot process, and aim for 2+2+2+4 seconds for each stage, respectively.

    That would give a cold-to-desktop time of 10 seconds. Test base platform that was used was a Dell laptop (can't remember which one, but it doesn't matter, as advantages and shortened time will apply to most contemporary PCs).

    How they went about it: first of all, they looked at the monolithic kernel content, and cleaned it up. This had a two-fold benefit: it allowed to remove some of the duplicity, where two (or more !) modules were doing the same thing, but also in the process, they managed to nearly half the footprint of the kernel image itself – a massive saving in resource and time to load.

    Ramdisk savings are not that easy to achieve. You can't remove it altogether: ramdisk is essential, as it provides the hibernate/suspend functionality, LVM, RAID, filesystem encryption, etc. However, where the saving can be made is if you start performing ramdisk tasks asynchronously with the loading of mainline kernel. That, of course, relies on the CPU with multi-cores, but even on a single core the benefits are significant, as the kernel will schedule things more efficiently whilst waiting for hardware to return.

    Other improvements:

    blkid process (relying on while/sleep) poll-style operation has now been fully replaced by libudev process (which instead of polling devices, it works on the “tell me when you are ready” principle. That alone saved 3.5 seconds off the boot time

    upstart – a total replacement to the init process; it allowed to eliminate 1000s of shell script code and replaced the sequential processing of the service startup with event-driven service initialisation. For example, in the traditional method, when got to mounting a device and the device wasn't up and running, it would miss out on being connected. With initupstart, device will be mounted when it announces its readiness

    ureadahead – a binary providing a method of speeding up disk seeks and reads; much more effective on SSD drives, because HDD disks are still prone to slow seeks, as disk geometry gets in the way; ureadahead is fs-independent, although it still can't cope with the fs metadata location problems
    use light-weight desktops

    in future compiz will be replaced with faster alternative

    No comments:

    Blog Archive