Page 1 of 1

yum fastestmirror selection

Posted: 2019/05/21 16:12:29
by reseni
I installed new clean centos 7 server in the network
I have an official mirror, and just created server select mirror outside from my network

how timedhosts.txt is formed ??

Thanks!

Re: yum fastestmirror selection

Posted: 2019/05/21 18:56:08
by avij
There may be various reasons why your preferred mirror did not get picked.
  • Is your official mirror listed on https://mirror-status.centos.org/ ? If not, it is not an official mirror and would need to be registered as an official public mirror.
  • Your server may use IPv6, but the mirror may support only IPv4. mirrorlist.centos.org only gives out IPv6-capable mirrors if the list is requested over IPv6. In this case the best fix would be to convince the mirror operator to add support for IPv6.
  • The mirror may be outdated. See the above mirror status link. Note that the status page shows only the status of the timestamp file in the root of the mirror, but mirrorlist.centos.org operates on a per-repository basis. Even if the mirror shows green, some of its repos may be somewhat behind.
  • fastestmirror measures the time it takes to resolve the mirror's IP address from DNS and the time to connect to the mirror's port 80 over IPv4. Sometimes there are random network delays, causing some other mirror to get the preference. This time (DNS lookup + connection time to port 80) is recorded in timedhosts.txt.
  • mirrorlist.centos.org outputs only 10 mirrors. If there are more than 10 in your region, mirrorlist.centos.org picks 10 mirrors at random to the candidate list.
  • Some other reason -- in this case it'd help to know the URL of the mirror so I'd be able to give you better answers.

Re: yum fastestmirror selection

Posted: 2019/05/21 19:16:40
by reseni
thanks for an explanation. I think my issue caused by some changes BGP routing (
my mirror is mirrors.bytes.ua

Re: yum fastestmirror selection

Posted: 2019/05/21 19:18:20
by TrevorH
The only way to force the use of a particular mirror is to use baseurl= and not mirrorlist=.

Re: yum fastestmirror selection

Posted: 2019/05/21 19:23:02
by avij
You can use http://miuku.net/tmp/testconnectiontime.py.txt to do some measurements of nearby mirrors. Note how DNS caching affects the results:

Code: Select all

$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 100.723982 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 47.858953 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 46.517134 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 46.897173 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 46.386957 ms
You can also use this to see the output of mirrorlist.centos.org (note the quotes, they are important):

Code: Select all

curl "http://mirrorlist.centos.org/?repo=os&arch=x86_64&release=7"

Re: yum fastestmirror selection

Posted: 2019/05/21 19:33:14
by reseni
avij wrote:
2019/05/21 19:21:00
You can use http://miuku.net/tmp/testconnectiontime.py.txt to do some measurements of nearby mirrors. Note how DNS caching affects the results:

Code: Select all

$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 100.723982 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 47.858953 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 46.517134 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 46.897173 ms
$ python testconnectiontime.py mirrors.bytes.ua
mirrors.bytes.ua: 46.386957 ms
thanks for the advice!
I also tried this, and response time is jumping every time (channel not loaded)
domain is hosted in Cloudflare
avij wrote:
2019/05/21 19:23:02
You can also use this to see the output of mirrorlist.centos.org (note the quotes, they are important):

Code: Select all

curl "http://mirrorlist.centos.org/?repo=os&arch=x86_64&release=7"
my local (same LAN network) is on second place ((
ok, will digg further

Re: yum fastestmirror selection

Posted: 2019/05/21 19:42:45
by avij
reseni wrote:
2019/05/21 19:37:32
my local (same LAN network) is on second place ((
ok, will digg further
For clarity, mirrorlist.centos.org does not know which one is the nearest so the position on the list does not matter much. After yum has retrieved these 10 mirrors which mirrorlist.centos.org thinks may be close to you, fastestmirror will do measurements for each mirror in that list, and picks the one with the lowest measured latency.

Re: yum fastestmirror selection

Posted: 2019/05/21 20:22:29
by TrevorH
fastestmirror will do measurements for each mirror in that list, and picks the one with the lowest measured latency.
Based on a completely useless algorithm that's pretty much akin to deciding which is the fastest car by measuring the speed at which its remote door key unlock works.