[perf] imgpkg seems to make lots of repeated requests to `/v2` endpoint
Description
running imgpkg pull --debug I notice lots of requests being made to the registry /v2 endpoint, trying to get a token.
When pulling a bundle with lots of images / nested bundles, I think this may contribute to a performance degradation.
It would be nice to know:
- how much performance we lose by making repeated calls to
/v2and assuming the registry requires abearer token, repeated calls to an oauth server - assuming it is causing excessive slowness, can we somehow cache the bearer token avoiding the need to make these repeated calls.
Reference:
- https://github.com/google/go-containerregistry/issues/740
This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.
This issue needs further investigation to try to understand the reason behind the requests and if it is related to the linked issue. Added needs more info and important-longterm as labels
This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.
We did some investigation and the amount of requests is due to a feature from ggcr where before any request is done to a registry it pings the registry to understand the type of authentication needed to it. https://github.com/google/go-containerregistry/blob/ab77ea68f600de27f0563dbfdb1431960ad96af0/pkg/v1/remote/transport/transport.go#L53
We also found that we were doing 1 request to the OAuth server per request to the server. We are addressing this issue in #334