pkg icon indicating copy to clipboard operation
pkg copied to clipboard

Add Concurrent Downloads of Multiple Packages

Open robmathers opened this issue 8 years ago • 12 comments

I'd like to see pkg have the ability to use parallel downloads to better take advantage of fast connections. With a connection capable of sustaining 5+ MB/s, it's rarely used to its full capacity when upgrading packages, which are typically many small downloads, rather than large ones (especially if set to a quarterly upgrade cycle).

By offering an option for multiple concurrent downloads, bandwidth could be used fully and upgrades completed sooner.

I'd suggest a default value of 2 concurrent downloads, but my 150Mbit connection could easily sustain 5 or 10 or more.

robmathers avatar Nov 16 '17 01:11 robmathers

Please do! Debian added this years ago and it helps a lot with small packages. (tuning FreeBSD so that the TCP ramp-up is faster would help, too. ;) )

v1ne avatar Jul 14 '19 19:07 v1ne

+1 on this; installing large metapackages like xorg can take a long time since downloads are all serial. Many web servers can send data faster with multiple connections open.

suchipi avatar Aug 12 '23 03:08 suchipi

Does pkg (1.20+) try to take advantage of HTTP pipelining when fetching multiple packages to avoid having to establish and ramp up a connection per packet? How would using multiple concurrent downloads (by default without trickery like running pkg fetch from xargs) impact the official package mirrors (e.g. more concurrent connections)?

Crest avatar Sep 07 '23 13:09 Crest

Does pkg (1.20+) try to take advantage of HTTP pipelining when fetching multiple packages to avoid having to establish and ramp up a connection per packet? How would using multiple concurrent downloads (by default without trickery like running pkg fetch from xargs) impact the official package mirrors (e.g. more concurrent connections)?

HTTP pipelining is dead with http/2.

michael-o avatar Jan 03 '24 12:01 michael-o

I "solved" the problem for my usecase with a Varnish caching server, because it's flexible enough to override caching hostile official package mirror HTTP headers and still validate each cache hit using an HTTP HEAD requests to compare via ETag. Finally pkg fetch saturates a 10Gb/s LAN connection and I don't have to feel guilty for hammering the CDN with lots of repeated downloads while testing my automations.

Crest avatar Jul 15 '24 14:07 Crest