YUM fastestmirror is not picking up closer mirrors

General support questions
buanacb
Posts: 4
Joined: 2018/07/14 18:12:53

YUM fastestmirror is not picking up closer mirrors

Post by buanacb » 2018/07/14 18:24:35

Any idea on how YUM/fastermirror plugin/mirrorlist determines closest mirror?

I tried to reset using 'yum clean all' several times, but 'yum update' is always pickup up mirrors which are far from my server's location.
Is it determined by server's IP address?
The IP address is 103.113.28.12 .. checked using https://www.iplocation.net/ ... it shows that the IP is located in Indonesia, but yum always pick mirror from japan instead of indonesia.

CB

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: YUM fastestmirror is not picking up closer mirrors

Post by avij » 2018/07/14 21:31:06

Yes, you should indeed get Indonesian mirrors with that IP address. What does this output:

Code: Select all

curl 'http://mirrorlist.centos.org/?repo=os&arch=x86_64&release=7'
mirrorlist.centos.org will return 10 mirrors that it thinks are close to you, and fastestmirror will pick the fastest among those. If the mirrorlist.centos.org output points to the wrong country, fastestmirror is usually not able to help.


User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: YUM fastestmirror is not picking up closer mirrors

Post by avij » 2018/07/15 09:26:14

That looks like you are using IPv6. What is your IPv6 address? If you are not sure, run curl ipv6.miuku.net which will return your IPv6 address.

buanacb
Posts: 4
Joined: 2018/07/14 18:12:53

Re: YUM fastestmirror is not picking up closer mirrors

Post by buanacb » 2018/07/15 10:58:02

No, i am not using IPv6

curl ipv6.miuku.net
curl: (7) Failed to connect to 2a01:51c0:1000:23:80:69:163:42: Network is unreachable

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: YUM fastestmirror is not picking up closer mirrors

Post by avij » 2018/07/15 12:39:14

I stand corrected -- the default IPv6 list looks similar, but you get that kind of output also when the country of the IPv4 address is unknown.

All the GeoIP databases I looked at seem to point to Indonesia. Perhaps it is a new IP address assignment to your ISP, and the GeoIP data at CentOS needs to be refreshed. This may take a month or so.

In any case, instead of using baseurl= I would suggest adding &cc=id to the end of your mirrorlist= lines, e.g. mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra&cc=id

This will override the GeoIP detection and use the specified country code.

buanacb
Posts: 4
Joined: 2018/07/14 18:12:53

Re: YUM fastestmirror is not picking up closer mirrors

Post by buanacb » 2018/07/18 15:50:21

@avij: your suggestion works perfectly.

sorry for the late report:)

thanks a lot

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: YUM fastestmirror is not picking up closer mirrors

Post by avij » 2018/08/20 10:07:22

For the record, it's likely that this will now work properly even without that &cc=id at the end of the URL.

vladoboss
Posts: 1
Joined: 2018/12/26 22:09:09

Re: YUM fastestmirror is not picking up closer mirrors

Post by vladoboss » 2018/12/26 22:24:38

By which criteria CentOS choose fastest mirror? For me it always choose mirror with much slower ping response then mirror of my internet provider. Example:

Code: Select all

yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
 * base: mirrors.uni-ruse.bg
 * epel: mirrors.uni-ruse.bg
 * extras: mirrors.uni-ruse.bg
 * updates: mirrors.uni-ruse.bg
 # cat /var/cache/yum/x86_64/7/timedhosts.txt | grep mirrors.uni-ruse.bg
mirrors.uni-ruse.bg 0.0469510555267
cat /var/cache/yum/x86_64/7/timedhosts.txt | grep mirror.onevip.mk
mirror.onevip.mk 0.0777509212494

ping mirrors.uni-ruse.bg
PING mirrors.uni-ruse.bg (91.210.88.42) 56(84) bytes of data.
64 bytes from mirrors.uni-ruse.bg (91.210.88.42): icmp_seq=1 ttl=55 time=14.8 ms
64 bytes from mirrors.uni-ruse.bg (91.210.88.42): icmp_seq=2 ttl=55 time=15.1 ms
64 bytes from mirrors.uni-ruse.bg (91.210.88.42): icmp_seq=3 ttl=55 time=14.6 ms
^C
--- mirrors.uni-ruse.bg ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 14.678/14.870/15.133/0.238 ms


 ping mirror.onevip.mk
PING mirror.onevip.mk (146.255.69.2) 56(84) bytes of data.
64 bytes from 146.255.69.2 (146.255.69.2): icmp_seq=1 ttl=58 time=0.751 ms
64 bytes from 146.255.69.2 (146.255.69.2): icmp_seq=2 ttl=58 time=0.748 ms
64 bytes from 146.255.69.2 (146.255.69.2): icmp_seq=3 ttl=58 time=0.734 ms
64 bytes from 146.255.69.2 (146.255.69.2): icmp_seq=4 ttl=58 time=0.725 ms
^C
--- mirror.onevip.mk ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 0.725/0.739/0.751/0.029 ms
As you can see response time for choosed fastest mirror is much slower the mirror of my ISP. I'm from Macedonia, but it always choose mirrors in Bulgaria.

User avatar
avij
Retired Moderator
Posts: 3046
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: YUM fastestmirror is not picking up closer mirrors

Post by avij » 2018/12/26 23:16:28

vladoboss wrote:
2018/12/26 22:24:38
By which criteria CentOS choose fastest mirror? For me it always choose mirror with much slower ping response then mirror of my internet provider.

Code: Select all

...
mirrors.uni-ruse.bg 0.0469510555267
mirror.onevip.mk 0.0777509212494
As you can see, fastestmirror has determined that it was faster to connect to mirrors.uni-ruse.bg than to mirror.onevip.mk. Fastestmirror does not use ICMP echo requests (pings) to determine the speed, but it measures the time it takes to look up the DNS name and open a TCP connection to the mirror.

http://miuku.net/tmp/testconnectiontime.py.txt is essentially the code that gets executed when measuring the speed of a mirror.

These are the results for these two mirrors from Finland (I don't have a closer server available):

Code: Select all

$ python testconnectiontime.py.txt mirrors.uni-ruse.bg
mirrors.uni-ruse.bg: 216.744900 ms
$ python testconnectiontime.py.txt mirror.onevip.mk
mirror.onevip.mk: 150.221825 ms
... retrying the tests, cached DNS:
$ python testconnectiontime.py.txt mirrors.uni-ruse.bg
mirrors.uni-ruse.bg: 66.222906 ms
$ python testconnectiontime.py.txt mirror.onevip.mk
mirror.onevip.mk: 68.807840 ms
You can use the above script to do your own measurements. Note that DNS caching can affect your testing.

mirrorlist.centos.org returns a list of 10 nearby mirrors, and the assumption is that the fastestmirror plugin would select one of the nearest mirrors, if not the nearest. As of now, the list looks like this:

Code: Select all

$ curl -4 'http://mirrorlist.centos.org/?repo=os&arch=x86_64&release=7&cc=mk'
http://mirror.onevip.mk/centos/7.6.1810/os/x86_64/
http://mirror.t-home.mk/centos/7.6.1810/os/x86_64/
http://centos.uni-sofia.bg/centos/7.6.1810/os/x86_64/
http://centos.telecoms.bg/7.6.1810/os/x86_64/
http://mirrors.neterra.net/centos/7.6.1810/os/x86_64/
http://mirror.host.ag/centos/7.6.1810/os/x86_64/
http://mirrors.uni-ruse.bg/centos/7.6.1810/os/x86_64/
http://mirrors.netix.net/centos/7.6.1810/os/x86_64/
http://ftp.ntua.gr/pub/linux/centos/7.6.1810/os/x86_64/
http://ftp.cc.uoc.gr/mirrors/linux/centos/7.6.1810/os/x86_64/

Post Reply