Reflector: Customize The Mirrorlist
Pacman uses /etc/pacman.d/mirrorlist file to get package information and download them from remote servers. Sometimes the file becomes old, some mirrors are out of sync and you might not be using the fastest mirror for your location.
Enter Reflector. Reflector retrieves the latest mirrorlist from the Mirror Status Page run filters to sort the list and save it to your /etc/pacman.d/mirrorlist.
You can download reflector.
$ pacman -S reflector
Then I want to get the latest 5 mirrors which have recently been synchronized and also get the 5 fastest mirrors then save it to my /etc/pacman.d/mirrorlist.
$ reflector --verbose --latest 5 --sort rate --save /etc/pacman.d/mirrolist