How to Setup Rate-Mirrors to get the fastest Arch Mirrors from your location

Hi,

As I have seen more time outs using reflector, I have decided to move over to rate-mirrors and do some testing in that. One question I see repeatedly asked is how do I specify my starting country (knowing the default is the US)? This note below is what I have written to address this.

Simply, the rate-mirrors command parses “rate-mirrors --entry-country=” differently then when you specify get me arch mirrors “rate-mirrors --protocol=https arch”.

Any suggestion to the below note are welcome.

How to Setup Rate-Mirrors to get the fastest Arch Mirrors from your location

Rate-mirrors is a Rust application which will test the speed of various Arch\EndeavourOS mirrors and create a recommended list of completely synced mirrors. The application considers:

  • TeleGeography data (like submarine cables, internet exchanges).
  • The starting location you have specified (by default the application assumes the US).
  1. Install Rate-Mirrors application:
sudo pacman -S rate-mirrors
  1. Update Arch Mirror (setting Canada as the starting location) and saving the results to /etc/pacman.d/mirrorlist:
rate-mirrors --disable-comments-in-file --entry-country=CA --protocol=https arch --max-delay 7200 | sudo tee /etc/pacman.d/mirrorlist
  1. Update EndeavourOS Mirrors (setting Canada as the starting location) and saving the results to /etc/pacman.d/endeavouros-mirrorlist:
rate-mirrors --disable-comments-in-file --entry-country=CA --protocol=https endeavouros  | sudo tee /etc/pacman.d/endeavouros-mirrorlist

Source:

https://wiki.archlinux.org/title/Reflector

2 Likes

I usually add --max-delay for example, --max-delay 7200.

This ensures you aren’t given out of date mirrors. Otherwise you may be given a mirror that is fast but not up-to-date.

I would also point out that using --entry-country doesn’t actually help much. It only defines the starting point. It can find the fastest mirrors from any starting point.

6 Likes

Good point. The help for the arch sync:

      --max-delay <MAX_DELAY>
          Max acceptable delay in seconds since the last time a mirror has been synced
          [env: RATE_MIRRORS_MAX_DELAY=] [default: 86400]

Seems pretty high. So will update note to use “7200”. Do you think that is the best practice for North America?

I don’t think your location should really matter.

That is the beauty of rate-mirrors. You don’t need to worry about location at all.

2 Likes

Updated the post with your recommendations … so lets see if anyone else gives feedback.

Just noticed … no max delay option for EndeavouOS mirrors. So removed that.

hello,
I prefer to use 100% synced mirrors, --completion=1, and also noticed very short max delay give me better scores (verified with milcheck ).

1 Like

Thanks for the feedback. Look like the default is already 1.

    --completion <COMPLETION>
          Minimum mirror sync completion percentage, in a range of 0-1.
            If this is below 1, the mirror synchronization is in progress and it's
            best to filter out such mirrors [default: 1] [env: RATE_MIRRORS_COMPLETION=]
            [default: 1]

Options for rate-mirrors are somewhat different between Arch based distros.

BTW, if possible, you could try with even smaller max-delay values. I’m using approximately 100 as a value here, and it seems to give a good result here. But there can be a location related trade-off between speed and age of mirrors, so experimenting a bit will likely give the best result.

That is less than 2 minutes. Unless you have fast access to a large number of mirrors you may end up with much slower mirrors being selected.

This (partial but with essential options) command

rate-mirrors --disable-comments-in-file --protocol https --entry-country DE --country-test-mirrors-per-country 10 --country-neighbors-per-country 0 arch --max-delay=90

gives me a very good list here. This is of course extremely location dependent.

1 Like

Germany has a high concentration of very fast Arch mirrors, maybe the most in the world. I often get several German mirrors on my list and I am in the US which has a lot of mirrors.

I don’t think that would be a good approach for the general user to take.

That’s why I said this above…

Thanks for your feedback. It was very insightful.

@dalto is right: you should not worry about helping rate-mirrors to know your location, default settings should work.
Adjust --max-delay, --protocol (if needed) and whether you want to see comments or not and that’s it.

1 Like

When I started using it, I had some mirrors at 99%, since it’s the default, I can remove it from my alias.

I created aliases for it a while back, but only use it if I get really slow mirror results once every blue moon. Kind of a rarity throughout the year. I’m lazy like that and probably not needed/efficient(?), but good enough for me. :melting_face:

#
# ~/.bash_aliases
#

# Update mirrors: Arch.
alias update-mirrors="sudo mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak && rate-mirrors arch --max-delay 43200 | sudo tee /etc/pacman.d/mirrorlist"

# Update mirrors: EndeavourOS.
## eos-rankmirrors (official tool EndeavourOS), but with parameter changes.
alias eos-mirrors="eos-rankmirrors --sort rate --timeout 15"
## rate-mirrors.
alias update-mirrors-eos="sudo mv /etc/pacman.d/endeavouros-mirrorlist /etc/pacman.d/endeavouros-mirrorlist.`date +"%Y.%m.%d-%H.%M.%S"` && rate-mirrors endeavouros | sudo tee /etc/pacman.d/endeavouros-mirrorlist"

# Update all mirrors, pacman- and aur packages.
alias update-all="update-mirrors && update-mirrors-eos && paru -Syyu"
1 Like

Thanks for the feedback WestandSkif. I agree with your outlook that the application just gets the fast complete mirrors by default (even if location assumes the starting location is the US).

I think the reason I am looking at the various switches in the application is to make sure users can configure to their needs. In my case I do prefer:

  • Starting from Canada.
  • I only want Arch Mirrors in Canada + US
  • If possible exclude mirrors from regions I am not familar with (e.g. China + Russian Federation).

This is something configurable in reflector. So part of my learning process to use your application.