TIP_Avoid_slow_mirrors
Contents |
Introduction
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.
Requirements
net-misc/curl
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.
| File: /etc/make.conf |
FETCHCOMMAND="/usr/bin/curl -Y 200000 --connect-timeout 30 -f --output \${DISTDIR}/\${FILE} \${URI}"
RESUMECOMMAND="/usr/bin/curl -Y 200000 -C - --connect-timeout 30 -f --output \${DISTDIR}/\${FILE} \${URI}"
|
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
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
# eclean-dist -d
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.
Last modified: Sat, 06 Sep 2008 08:10:00 +1000 Hits: 1,315
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
