Red Hat Bugzilla – Bug 1018686
fastest mirror detection slow
Last modified: 2014-09-30 19:41:50 EDT
testing out some package downloading features in DNF I measured that detecting the fastestmirror takes about 5s, i.e. DNF saves in average 5 seconds per the download phase if I disable fastestmirror in Repo.get_package_target():
Can this be sped up?
It takes as much time even if single package has to be downloaded, and even if (as it turns out eventually) it is already downloaded.
If this can not be improved please assign back to DNF. We will have to implement some strategy then to only use LRO_FASTESTMIRROR selectively.
Fastest mirror detection is done once per handle before first download. Currently it takes about 3-4 sec at most, it could be less if less number of mirrors is present and all the mirrors are fast.
Librepo itself doesn't consider number of packages that should be downloaded and do this detection, if enabled, at the time when the internal mirrorlist is builded (right after the metalink/mirrorlist is parsed). So if you know that only one single (and small) package will be downloaded, then disable the LRO_FASTESTMIRROR option could be suitable.
The "single and already downloaded package trigger the fastest mirror detection" issue is fixed by the commit https://github.com/Tojaj/librepo/commit/5688dae9413523bb5c64a910a6aa64a0697860ab
A measure that should leads to better performance could be a cache for the fastestmirror results. I will implement a cache mechanism soon.
(In reply to Tomas Mlcoch from comment #1)
> The "single and already downloaded package trigger the fastest mirror
> detection" issue is fixed by the commit
> A measure that should leads to better performance could be a cache for the
> fastestmirror results. I will implement a cache mechanism soon.
Or maybe have a hard limit on total download size (10MB?) below which fastestmirror is not triggered (e.g. change LRO_FASTESTMIRROR not to take a boolean but an integer for MB).
Your idea is not bad, but I would prefer the approach with the cache.
Pros of cache:
- All downloads, not just the big one, are done from the fastest mirror(s).
- The mentioned 5sec overhead comes only when the cache is expired or doesn't exist, not for every bigger download.
I will implement a prototype of cache and we'll see.
> Pros of cache:
> - All downloads, not just the big one, are done from the fastest mirror(s).
> - The mentioned 5sec overhead comes only when the cache is expired or
> doesn't exist, not for every bigger download.
> I will implement a prototype of cache and we'll see.
Good idea, thanks.
New options for caching FASTESTMIRROR results are available:
LRO_FASTESTMIRRORCACHE - Path to the cache file
LRO_FASTESTMIRRORMAXAGE - Maximum age of a record in cache (older records won't be used)
Example of usage:
Acceptance test that cover this behaviour:
librepo-1.4.0-1.fc20 has been submitted as an update for Fedora 20.
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing librepo-1.4.0-1.fc20'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
librepo-1.4.0-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.