Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client/updater design: parallel downloads #1158

Open
jku opened this issue Oct 2, 2020 · 1 comment
Open

client/updater design: parallel downloads #1158

jku opened this issue Oct 2, 2020 · 1 comment

Comments

@jku
Copy link
Member

jku commented Oct 2, 2020

Updater should in some way support parallel downloads.

This came up because I found an obscure corner in pip that does index file downloads in parallel in pip (pip list --outdated): if I plug my TUF-support in there, TUF Updater gets called from multiple threads and very bad things happen.

Some notes on this:

  • for the pip use case, letting pip handle the actual downloads would remove 50% of the need for this -- but bin metadata downloads would still be sequential (and Updater.refresh() would still be thread-unsafe)
  • Still, parallel downloads (for both targets and bin metadata) is probably a wanted feature in other user-facing apps as well: it is faster and is something package managers already often do
  • this feature does not mean that TUF API absolutely needs to be threadsafe: many use cases would be covered by small API change: Updater.get_valid_targetinfos(list) and Updater.download_targets(list) could still be a single-threaded API but they could be implemented in a way that uses multiple threads and multiple connections to the server. I have no idea how easy this would be though.
  • The nicest solution might be a low-level Sans-IO style API (a state machine with events) or at least something that is asynchronous to the users. This API is then wrapped by a simple I/O layer that could look much like it now does. This would mean a large change.
@joshuagl joshuagl added the client Related to the client (updater) implementation label Oct 2, 2020
@jku
Copy link
Member Author

jku commented Nov 13, 2020

Issue #1213 updater: abstract out the network IO might provide a reasonable path to parallelized target downloads: Updater would not need multi-threaded code or to even be thread-safe: custom Fetchers could implement the parallelization and the Updater API just needs to handle a list of targets to update instead of a single target.

@jku jku added ngclient and removed client Related to the client (updater) implementation labels Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants