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

Avoid copying endpoints list for every packet #138

Closed
iffyio opened this issue Nov 17, 2020 · 1 comment · Fixed by #140
Closed

Avoid copying endpoints list for every packet #138

iffyio opened this issue Nov 17, 2020 · 1 comment · Fixed by #140
Labels
kind/cleanup Refactoring code, fixing up documentation, etc

Comments

@iffyio
Copy link
Collaborator

iffyio commented Nov 17, 2020

Currently, we make a copy of the list of endpoints for every packet that flows through the system
https://github.com/googleforgames/quilkin/blob/master/src/proxy/server.rs#L155

this isn't ideal since the copies can be expensive and the list sizes can be significant.
We already wrap the list within a smart pointer like an Arc, and clone that instead of cloning the list and expose the wrapper to the rest of the code and filter chain - so that the overhead becomes a counter increment vs of a list copy.
e.g

pub struct Endpoints(Arc<Vec<EndPoint>>);

and pass this type in DownstreamContext as endpoints.

@markmandel
Copy link
Member

Makes sense to me!

iffyio added a commit that referenced this issue Nov 18, 2020
This exposes `UpstreamEndpoints` to filters. Since filters
can change the list of endpoints passed to them, the wrapper
includes logic that instead tracks changes made by filters
to the list.

Fixes #138
markmandel pushed a commit that referenced this issue Nov 24, 2020
* Add wrapper over Endpoints

This exposes `UpstreamEndpoints` to filters. Since filters
can change the list of endpoints passed to them, the wrapper
includes logic that instead tracks changes made by filters
to the list.

Fixes #138
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants