Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active June 9, 2020 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellularmitosis/16eab2f076cda497cb7f1a9ceb557ff3 to your computer and use it in GitHub Desktop.
Save cellularmitosis/16eab2f076cda497cb7f1a9ceb557ff3 to your computer and use it in GitHub Desktop.
Trying to speed up apt on old hardware

Blog 2019/4/28

<- previous | index | next ->

Trying to speed up apt on old hardware

I run Debian on some old i386 and ARM hardware, and apt can be painfully slow on these platforms.

I noticed in the apt.conf man page that you can configure apt's preference of file format (compression type) of certain index files. Perhaps this will speed things up?

First, let's measure the time taken with the default configuration:

# rm -rf /var/lib/apt/lists
# time apt-get update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie Release.gpg [2,420 B]
Get:3 http://deb.debian.org jessie Release [148 kB]          
Get:4 http://security.debian.org jessie/updates/main i386 Packages [669 kB]
Get:5 http://deb.debian.org jessie/main i386 Packages [6,821 kB]
Get:6 http://security.debian.org jessie/updates/main Translation-en [337 kB]                                         
Get:7 http://deb.debian.org jessie/main Translation-en [4,581 kB]                                                    
Fetched 12.6 MB in 2min 17s (91.4 kB/s)                                                                              
Reading package lists... Done

real	3m30.053s
user	3m5.724s
sys	0m14.128s

Now, with the gzip compression option:

# rm -rf /var/lib/apt/lists
# time apt-get -o Acquire::CompressionTypes::Order::=gz update
Get:1 http://security.debian.org jessie/updates InRelease [44.9 kB]                  
Ign http://deb.debian.org jessie InRelease
Get:2 http://deb.debian.org jessie Release.gpg [2,420 B]
Get:3 http://deb.debian.org jessie Release [148 kB]          
Get:4 http://security.debian.org jessie/updates/main i386 Packages [831 kB]
Get:5 http://deb.debian.org jessie/main i386 Packages [9,100 kB]
Get:6 http://security.debian.org jessie/updates/main Translation-en [337 kB]                                         
Get:7 http://deb.debian.org jessie/main Translation-en [4,581 kB]                                                    
Fetched 15.0 MB in 2min 7s (118 kB/s)                                                                                
Reading package lists... Done

real	3m19.334s
user	2m52.504s
sys	0m15.048s

Hmm, not exactly the improvement I was hoping for.

During apt-get update, this was temporarily visible in the output:

100% [7 Translation-en bzip2 0 B] [5 Packages gzip 0 B]

So it appears that a gzip version of the Packages file is available (a xz version is used by default), but not the Translation-en file.

This was on an AMD PIC (366MHz, 128MB RAM), which is using a USB-ethernet dongle (which appears to have a transfer rate limit of just over 400kB/s).

You can make this behavior permanent by putting this in /etc/apt/apt.conf:

Acquire::CompressionTypes::Order "gz";

You might also try disabling pdiffs:

Acquire::PDiffs "false";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment