Instead of downloading full packages for minor changes all the time, delta rpms were invented.
Only changes between the installed package and the new one are downloaded. Once the delta rpm loaded, a rebuilding process is started. At the end, the reconstructed RPM is put into yum download directory, where the normal package installation routines pick it up and install it.
Delta rpms were introduced for the first time in Suse Linux 9.3 in 2005.
In 2009, the Fedora 11 distribution created the presto plugin to get the same feature in yum and RHEL 6 followed.
In 2013 with Fedora 19, the presto plugin was merged into the yum command. RHEL 7 got the same evolution.
From the beginning, the main use cases behind delta rpms were:
- allowing people with limited bandwidth to regularly update their servers,
- reducing costs for people with network connection based on usage,
- alleviating the burden on repositories.
But, as the delta rpm feature requires special packages to be created (finishing with .drpm) and some infrastructure work on the buildsystem, it is not available for all the repositories.
Because the delta rpm feature is a trade-off, CPU against bandwidth/cost, it is not enabled by default. People with fast bandwidth or local mirrors can see the delta rpm feature as a disadvantage because of the CPU consumption. Overloaded or latency critical servers could also expect problems with this feature.
Also, the deltarpm package is not a part of the minimal installation because it’s not a mandatory feature. If you want to use the feature, you need to add the deltarpm package by yourself.
Finally, if for any reason a delta rpm couldn’t be downloaded, yum falls back to downloading the full package.
Install the deltarpm package:
# yum install -y deltarpm
Note: If the delta rpm package is not there, you usually get this message when installing any package: Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
Then, using the delta rpm feature is normally transparent.
For example, when updating your system, you will see:
# yum update -y Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile ... Upgrade 71 Packages Total download size: 120 M Downloading packages: No Presto metadata available for remi-php56 No Presto metadata available for remi Delta RPMs reduced 57 M of updates to 12 M (78% saved) Finishing delta rebuilds of 32 package(s) (53 M) ... Complete!
Note1: The “No Presto metadata available for” messages inform you that there isn’t any delta rpm for the remi-php56 and remi repositories.
Note2: The “Delta RPMs reduced 57 M of updates to 12 M (78% saved)” message provides you with some information about the download saving due to the delta rpm feature.
Note3: The “Finishing delta rebuilds of 32 package(s) (53 M)” message tells you how many packages were rebuilt.
In order to adjust how the delta rpm feature works, two main parameters are available:
- deltarpm can receive an integer value (deltarpm=2 by default) in the /etc/yum.conf file:
- a positive value defines the number of reconstruction made in parallel,
- zero means the delta rpm feature is disabled,
- a negative value asks yum to figure out how many cores are available and to multiply them by the given value to get the number of reconstruction to make in parallel (example: cores=2 and deltarpm=-3 => 2*3 reconstructions in parallel).
- deltarpm_percentage defines the maximum ratio allowed between the delta rpm size and the package size on a per-repository basis: by default, delta rpms can’t be bigger than 75% of the size of the associated rpms, otherwise they are not used. If a null value is assigned to this parameter, the delta rpm feature is disabled for this repository (interesting when using local mirrors).
Assign 0 to the deltarpm parameter in the /etc/yum.conf file if you don’t want to use the delta rpm feature at all. Assign 0 to the deltarpm_percentage parameter in the repository file if you don’t want to use the delta rpm feature for this specific repository.
As the reconstruction of rpms uses a significant amount of disk IO, if you encounter a slowdown, before disabling the feature, assign -1 to the deltarpm parameter in the /etc/yum.conf file. This will autodetect the number of cores and will make it usually as fast or faster than dowloading the full packages.
Concerning dnf, the successor of yum, it is necessary to also install the deltarpm package and add the deltarpm=1 boolean directive in the /etc/dnf/dnf.conf file to get the delta rpm feature working with dnf.
You can read Jonathan Dieter‘s blog about the algorithms used to handle delta rpms.