Thursday, December 25, 2008

Hack: A bit better yum-fastestmirror patch

Those who use Fedora might be familiar with yum-fastestmirror plugin. Its a plugin for yum which polls yum mirrors for the one which responds the fastest. However, sometimes, the polling result might not be one might expected.

For example, with the current fastestmirror, I usually get the singaporean mirror as the fastest. But, the singaporean mirror, in fact, only gives me around 2-4KBps download speed, which of course, pissed me off. The taiwanese and the australian mirrors give faster speed than that. So, I went looking at the fastestmirror code.

Seems like fastestmirror does not sort mirrors by its download speed, but rather, by it connect() respond speed. That basically explains why it sometimes pick a mirror with slow download speed as fastest. As fast respond to connect(), doesn't necessarily means the mirror have higher upload speed bandwidth.

So, I changed a bit of that behavior. Altered the code to download the repomd.xml, , see how fast the download went, and sort the mirrors according to that. For those who interested, my patch is here: fastestmirror-repomd-download-speed-timing.patch.

(Yup2, I know repomd.xml is too small for evaluating bandwidth download speed accurately, but at least thats better than simply connect(), and other files might be too large resulting in the polling process slower)

If anybody want to improve on that patch, as usual, feel free to do so :D .
Post a Comment
Locations of visitors to this page