Hi.

I did some testing installing using eatmydata to see how much it could
reduce the installation time.  I used the enclosed test script to
compare the installation time for three test setup.  One is the normal
one, the other is using dpkg-divert to divert apt-get, aptitude and
dpkg, while the third uses the Dir::Bin::dpkg setting to use a dpkg
wrapper with eatmydata enabled.

The installation was done with 100Mbit/s connection to the Debian
mirror, so most of the time is spend unpacking.  I tried using two
package sets, kde-standard and kde-full, picked to get a fairly large
number of packages installed.

This was the result.  The number is in seconds.

  Installing kde-standard

  Wed Sep 17 09:54:50 CEST 2014 used: 357 divert
  Wed Sep 17 10:00:51 CEST 2014 used: 359 dpkg_conf
  Wed Sep 17 10:09:38 CEST 2014 used: 525 default

  Installing kde-full with policy-rc.d in place.
  Wed Sep 17 10:29:33 CEST 2014 used: 424 divert
  Wed Sep 17 10:36:29 CEST 2014 used: 413 dpkg_conf
  Wed Sep 17 10:45:35 CEST 2014 used: 543 default

As you can see, the reduction in installation time is in the range
21-32 percent of the current default.  It is not obvious to me why the
Dir::Bin::dpkg approach can be quicker than the divert approach.  This
might be caused by other issues, as the last run was done just after
boot.  Perhaps the order these tests are executed matter?

Anyway, just wanted to share with you this data point comparing the
different ways to speed up package installation in Debian.

------------------------ test-install-speed ----------------------------
#!/bin/sh

suite=testing
chroot=chroot-testing
mirror=http://http.debian.net/debian
mirror=http://ftp.uio.no/debian

unset TMP TMPDIR

# Never wait for input
DEBIAN_FRONTEND=noninteractive
export DEBIAN_FRONTEND

make_chroot() {
    debootstrap $suite $chroot $mirror
    printf "#!/bin/sh\nexit 101\n" > $chroot/usr/sbin/policy-rc.d
    chmod a+rx $chroot/usr/sbin/policy-rc.d
    chroot $chroot apt-get install -y eatmydata
}

install_chroot_pkgs() {
    chroot $chroot apt-get install -y kde-full
}

test_default() {
    make_chroot
    install_chroot_pkgs
}

test_divert() {
    make_chroot
        for bin in dpkg apt-get aptitude tasksel ; do
            file=/usr/bin/$bin
            # Test that the file exist and have not been diverted already.
            if [ -f $chroot/usr/bin/$bin ] ; then
                info "diverting /usr/bin/$bin using eatmydata"
                printf "#!/bin/sh\neatmydata $bin.distrib \"\$@\"\n" \
                    > $chroot/usr/bin/$bin.edu
                chmod 755 $chroot/usr/bin/$bin.edu
                chroot $chroot dpkg-divert --package debian-edu-config \
                    --rename --quiet --add /usr/bin/$bin
                ln -sf ./$bin.edu $chroot/usr/bin/$bin
            else
                error "unable to divert /usr/bin/$bin, as it is missing."
            fi
        done
  
    install_chroot_pkgs
}

# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613428
test_dpkg_conf() {
    make_chroot
    cat > $chroot/usr/bin/dpkg-eatmydata <<'EOF'
#!/bin/sh
/usr/bin/eatmydata /usr/bin/dpkg "$@"
EOF
    chmod a+rx $chroot/usr/bin/dpkg-eatmydata

    cat > $chroot/etc/apt/apt.conf.d/dpkg-eatmydata <<EOF
Dir::Bin::dpkg "/usr/bin/dpkg-eatmydata";
EOF
    install_chroot_pkgs
}

for f in divert dpkg_conf default ; do
    rm -rf "$chroot"
    start=$(date +%s)
    test_$f
    end=$(date +%s)
    (LC_ALL=C date; echo "used: $(($end - $start)) $f" ) >> test.log
done
echo
tail test.log
------------------------------------------------------------------------

-- 
Happy hacking
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to