Repository navigation
Decouple Download and Install Steps #4105
Description
Description of the new feature / enhancement
Packages with package dependencies are now being accepted in the community repository. Running through the installation flow when dependencies are present results in the behavior Download package => Install package => Download package => Install package => . . . . This can be quite slow when there are multiple dependencies, the installer files are large, or it takes a significant amount of time to install a package.
While it is not a good idea to run multiple installs at the same time, it should be feasible to download the next installer while the previous installer is performing the install. In this way, it could be possible that the next installer would be fully downloaded before the previous installer has completed, reducing the overall time to install.
Download #1
||
||===================||
Install #1 Download #2
|| ||
========||===========||
|| ||
Install #2 Download #3
|| ||
======||=======
||
Install #3
Proposed technical implementation details
Take the dependency tree and split it into separate download and install trees. Progress through the download tree consecutively without blocking. Once a node has been marked as completed in the download tree, process it in the install tree, queuing the installs until the previous install has completed.
Activity
Trenly commentedon Jan 26, 2024
After getting some sleep and thinking through this more - This could also benefit the
upgrade --all,import, and multi-query install flows too[Policy] Command-Install
[Policy] Command-Upgrade
[Policy] Command-Import
[Policy] Area-Performance
Trenly commentedon Jan 29, 2024
Demitrius Nelon (@denelon) - looks like there isn’t a trigger for Area-Performance. I'll have to add one later. Would you mind adding the label manually?
denelon commentedon Jan 29, 2024
Area-PerformanceIssue related to CPU or memory performance
looks like it was already there.
nilspep commentedon Sep 30, 2026
I've implemented this and measured it: downloading the next installers while the current package installs cuts multi-package operations by 20–34%, with no change to how or in what order packages are installed. I'd like to contribute it.
Results
About 600 runs on Azure VMs (x64 Release builds), each variant compared only against runs on the same VM. Median time for one
winget install <packages>:The "Download ahead" column was measured with one download at a time and unbounded look-ahead; the final design with at most three installers ahead was within 2% of it in a separate series on the same VMs. The gain scales with download time: the slower the link, the more is saved. It is smallest when installation dominates (−5% for three large packages at 1 Gbit/s). With the feature off, timings match today's flow (±2%).
Design
downloadAhead, off by default. With it off, the flow is unchanged.ProcessMultiplePackages, soinstallwith several packages,upgrade --allandimportall benefit.--ignore-security-hash, download-only operations and duplicate packages in one list keep the normal flow.This is in line with the feedback in #6295: I first built concurrent downloads (limits 1, 2, 4 and 8) and measured them. More concurrent downloads were never faster than one at a time; they split the bandwidth, delayed the next installation and kept up to 921 MB of installers on disk. A single look-ahead download left the link idle during long installations and was up to 19% slower. One download at a time with three installers ahead matched unbounded look-ahead within 2% in every scenario while bounding disk usage.
Validation
FileLoggerit relies on is already merged (Make FileLogger thread-safe #6571).Next steps
A spec following
doc/specs/spec-template.mdand the implementation are ready. I plan to open the spec PR first and the implementation PR once the spec is agreed. If you'd rather fold this into the parallel installation spec in #6295, I'll adapt it. Raw data and benchmark scripts are available on request.Designed by me; GitHub Copilot assisted with implementation, testing and validation under my direction.