Something I came up in during the small FAD we had in .MY last week.

Yum's fastestmirror plugin is kindof broken by design, because the plugin's definition of 'fastest' means shortest handshake time, rather than shortest download time (highest bandwidth).

If a particular country had nearby mirrors which have a really low bandwidth, fastestmirror actually made the download speed slower for users who are using it. (in my case, the nearby mirrors are extremely slow, its faster to simply force yum to grab from Taiwan mirrors, and I believe lots of local users here are also affected by this)

This plugin is a hack which complements fastestmirror by timing the metadata download time of repositories, sort them and set fastestmirror.conf to only include the top 3 mirrors with shortest metadata download time for each repository.

Source: timemirrorbandwidth.py

To install, simply copy the file into /usr/lib/yum-plugins/ and create a /etc/yum/pluginconf.d/timemirrorbandwidth.conf with this contents:


(I should put this in RPM i guess)

To use, simply execute:

yum time-mirrors --disableplugin=fastestmirror

the plugin will start scoring the available mirrors and add the fastest 3 mirrors for each repository into fastestmirror.conf's include_only list. I wont make this plugin to run the timing each time yum is executed, because that will mean extreme slowdown.

Feel free to improve it .. (probably i should move this into github or something).. Have fun!


Anonymous said…
you, sir, rock most mightily. there's a small typo in the post, though - you have the config file the extension .py instead of .conf . i've wanted this for ages though!
Ben C said…
This is a great plugin. If you do make it into an RPM, I'd recommend putting something in /etc/cron.weekly so that the list stays fresh.

Also, what adamwill said above.
Unknown said…

Thanks!. fixed :D


nice idea!. thanks :D
luke said…
Nice work.

I have been wanting to add support for more sophisticated algorithms to fastestmirror for a long time, but have never gotten around to it.

fastestmirror's current method, which involves timing how long it takes to open a socket to the mirror, is very fast, and generally yields reasonable results most of the time. However, it's extremely dumb, and isn't optimal for situations like yours with low-latency low-bandwidth mirrors.

If you wanted to add bandwidth tests to fastestmirror as a configurable option, I would be glad to merge it upstream.
skvidal said…
Nice plugin. Suggestion - maybe think about taking your plugin and making it into a patch to yum itself. So users get this data automatically.

pop by #yum if you get a chance
Anonymous said…
luke: fastestmirror always seems to wind up giving me such a mirror, btw. I think it's most useless when you have a pretty fast, say 5mbit+, link: latency is good for weeding out *really* slow mirrors, but it does almost nothing when it comes to a set of mirrors that can provide between, say, 0.5mbit and 10mbit.
Unknown said…
Hi, it's a great plugin. In my case, mirrorlist return only 2 http mirrors and plugins wait forever. Also, the plugin only test http mirrors, ftp mirror are excluded.

Popular posts from this blog

Announcing PlatoCDP, a Plone distribution for enterprises.

Adding simple popup to Plone frontpage

An Open Letter for the Rector of PETRONAS University of Technology