Avoid slow mirrors

Gentoo has the mirrorselect utility, which allows you to select a fast mirror. However it does not cover all cases, especially not files that reside outside the Gentoo mirrors. Also, the load or connection speed on the mirrors may have changed since mirrorselect was last called.

The idea is to make the download fail if the mirror turns out to be slow. Portage will then attempt to use another one until it finds a mirror that is sufficiently fast.

Configuration
The default fetch command will be replaced with curl. In this case we will set a lower limit of 200 kB/s for the mirror. Adjust it for your Internet connection.

Explanation:

-Y 200000            set a speed limit of 200000 Bytes per second, adjust this to the minimum speed that you want -y seconds           (not used in this example) timeframe to determine the download speed, 30 seconds is the default --connect-timeout 30 wait up to 30 seconds for a reply from the server --retry num          (not used in this example) try to reconnect up to the specified number of times to the server on failure -f                   do not download 404 error pages from http servers -L                   follow http redirects

Caveats

 * curl will not distinguish whether the mirror is slow or your Internet connection is congested. If other applications consume bandwidth, take this into account.
 * unlike wget, curl may download certain status pages (eg. 301) that http servers return. They will end up cluttering your distfiles directory. Run to remove unnecessary files from there.
 * If no fast enough mirror exists, or if portage exhausts retries before one is found, the fetch might fail.

Unikanie powolnych serwerów