yum-plugin-timemirrorbandwidth
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
(I should put this in RPM i guess)
To use, simply execute:
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!
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:[main]
enabled=1
(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!
Comments
Also, what adamwill said above.
Thanks!. fixed :D
@ben
nice idea!. thanks :D
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.
pop by #yum if you get a chance