WIP: Only obtain a bearer token once at a time#1968
Conversation
84d61b4 to
e2c713b
Compare
1fd9f89 to
3ec2136
Compare
cd3b8ee to
8636ccc
Compare
|
The not-directly-related refactoring are now filed separately in #2480. |
... because we will make it more complex. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
... to decrease indentation and remove a variable. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
We will want to manage concurrency in more detail. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
We will want to add a lock to it, so we must stop copying it by value. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Instead of having getBearerToken* construct a new bearerToken object, have the caller provide one. This will allow us to record that a token is being obtained, so that others can wait for it. Should not change behavior. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Currently, on pushes, we can start several concurrent layer pushes; each one will check for a bearer token in tokenCache, find none, and ask the server for one, and then write it into the cache. So, we can hammer the server with 6 basically-concurrent token requests. That's unnecessary, slower than just asking once, and potentially might impact rate limiting heuristics. Instead, serialize writes to a bearerToken so that we only have one request in flight at a time. This does not apply to pulls, where the first request is for a manifest; that obtains a token, so subsequent concurrent layer pulls will not request a token again. WIP: Clean up the debugging log entries. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
|
Hi, and thank you for your contribution! We’ve recently migrated this repository into a new monorepo: containers/container-libs along with other repositories As part of this migration, this repository is no longer accepting new Pull-Requests and therefore this Pull-Request is being closed. Thank you very much for your contribution. We would appreciate your continued help in migrating this PR to the new container-libs repository. Please let us know if you are facing any issues. You can read more about the migration and the reasoning behind it in our blog post: Upcoming migration of three containers repositories to monorepo. Thanks again for your work and for supporting the containers ecosystem! |
|
This continues in podman-container-tools/container-libs#415 . |
Currently, on pushes, we can start several concurrent layer pushes; each one will check for a bearer token in
tokenCache, find none, and ask the server for one, and then write it into the cache.So, we can hammer the server with 6 basically-concurrent token requests. That's unnecessary, slower than just asking once, and potentially might impact rate limiting heuristics.
Instead, serialize writes to a bearerToken so that we only have one request in flight at a time.
This does not apply to pulls, where the first request is for a manifest, which obtains a token, so subsequent concurrent layer pulls will not request a token again.
WIP: Clean up the debugging log entries.