Uncomment 5 favorite mirrors and place them at the top of the mirrorlist file. That way it's easy to find them and move them around if the first mirror on the list has problems. It also makes merging mirrorlist updates easier.

HTTP mirrors are faster than FTP due to persistent HTTP connection: with FTP, a new connection to server has to be established each time pacman requests a package to be downloaded, which results in a brief pause.

It is also possible to specify mirrors in /etc/pacman.conf. For the [core] repository, the default setup is:

[core]
Include = /etc/pacman.d/mirrorlist

To use the HostEurope mirror as a default mirror, add it before the Include line:

pacman will now try to connect to this mirror first. Proceed to do the same for [testing], [extra], and [community], if applicable.

Note: If mirrors have been stated directly in pacman.conf, remember to use the same mirror for all repositories. Otherwise packages that are incompatible to each other may be installed, like linux from [core] and an older kernel module from [extra].

Force pacman to refresh the package lists

Mirrors can be out of sync and the package list from the old mirror may not correspond to the package list of the new mirror, even though the dates of the lists may suggest that they do.

After creating/editing /etc/pacman.d/mirrorlist, issue the following command:

# pacman -Syyu

Passing two --refresh/-y flags forces pacman to refresh all package lists even if they are considered to be up to date. Issuing pacman -Syyu is an unnecessary waste of bandwidth in most cases, but can sometimes fix issues when switching from a broken mirror to a working mirror. See also Is -Syy safe?.

Warning: In most cases if you force refresh the pacman database, you will want to force downgrade any potentially too-new packages to correspond to the versions offered by the new mirror. This prevents issues where packages are inconsistently upgraded, leading to a partial update.

# pacman -Syyuu

This is not necessary when using timestamps to ensure the mirrors are only upgraded.

Sorting mirrors

When downloading packages, pacman uses the mirrors in the order they are listed in /etc/pacman.d/mirrorlist. The order servers appear in the list sets their priority.

It is not optimal to only rank mirrors based on speed since the fastest servers might be out-of-sync. Instead, make a list of mirrors sorted by their speed, then remove those from the list that are out of sync according to their status.

It is recommended to repeat this process before every system upgrade to keep the list of mirrors up-to-date.

List by speed

Ranking an existing mirror list

The pacman-contrib package provides a Bash script, /usr/bin/rankmirrors, which can be used to rank the mirrors according to their connection and opening speeds to take advantage of using the fastest local mirror.

Back up the existing /etc/pacman.d/mirrorlist:

# cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.backup

To prepare mirrorlist.backup for ranking with rankmirrors, the following actions can be carried out:

Edit mirrorlist.backup and uncomment the servers to be tested

If the servers in the file are grouped by country, one can extract all the servers of a specific country by using:

Fetching and ranking a live mirror list

In order to start with a shortlist of up-to-date mirrors based in some countries and feed it to rankmirrors one can fetch the list from the Pacman Mirrorlist Generator.
The command below pulls the up-to-date mirrors in either France or the United Kingdom which support the https protocol, it uncomments the servers in the list and then ranks them and outputs the 5 fastest.

Server-side ranking

The official Pacman Mirrorlist Generator provides an easy way to obtain a ranked list of mirrors. Because all ranking is done on a single server that takes multiple factors into account, the amount of load on the mirrors and the clients is significantly lower compared to ranking on each individual client.

Another popular alternative is the following tool:

Reflector — Retrieves the latest mirrorlist from the MirrorStatus page, filters and sorts them by speed and overwrites /etc/pacman.d/mirrorlist