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

Replace http util reverese proxy with custom request forwarding #436

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

phillebaba
Copy link
Member

The current implementation with reverse proxy was overly complex. Partially this is due to the retry logic implemented, but also the details of how things are implemented in the package. We really do not need all of the features of reverse proxy as we are not forwarding generic requests that could in theory contain any type of data. Instead the requests forwarded are specific to the OCI distribution spec.

This is the reason for replacing reverse proxy with out own http client that forwards requests.

An additional aspect is that the std lib reverse proxy does not use splice or send file when copying the response body. This solution should in theory improve performance.

@phillebaba phillebaba force-pushed the feature/replace-reverse-proxy branch from d10ca7a to 24b3600 Compare April 12, 2024 15:52
@simongottschlag
Copy link
Contributor

@phillebaba maybe time for a benchmark?

@phillebaba
Copy link
Member Author

Yup I am working on it, but things need to be worked on a bit. Currently doing it manually. Also using pprof to explore the call stack.

@@ -87,6 +86,7 @@ func NewRegistry(ociClient oci.Client, router routing.Router, opts ...Option) *R
r := &Registry{
ociClient: ociClient,
router: router,
httpClient: &http.Client{},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we initialize it with some sane default?

	httpClient := &http.Client{
		Transport: &http.Transport{
			MaxIdleConns:        20,
			MaxIdleConnsPerHost: 20,
		},
	}

@simongottschlag
Copy link
Contributor

@phillebaba phillebaba force-pushed the feature/replace-reverse-proxy branch from 24b3600 to 2ea1404 Compare April 12, 2024 17:44
@phillebaba phillebaba force-pushed the feature/replace-reverse-proxy branch from 2ea1404 to 548b6b1 Compare April 14, 2024 10:47
@phillebaba
Copy link
Member Author

Some testing shows that this does not increase the performance. Either way it is a good change which gives us more control on top of reducing complexity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants