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

Implementation of a "Append Token Router" #98

Closed
wants to merge 3 commits into from

Conversation

markmandel
Copy link
Member

Filter that appends the connection_id to each packet on the client side,
and uses it to compare against endpoint stored connection_ids to route
traffic to the appropriate game server on the server side.

Work on #8

Integration tests and Metrics are next.

@markmandel markmandel added the kind/feature New feature or request label Sep 6, 2020
Copy link
Collaborator

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

I think we should be able to separate the append and router into two separate filters in place of nesting filters within each other? Say, an append filter that only appends bytes to payload and router filter that extracts bytes from payload to select endpoints - this way especially the append filter is reuseable e.g the token bytes can come from a different source than the append filter, or we could have another filter that also extracts bytes from the payload for other purposes and neither it nor the router need to be necessarily tied to the append filter.

Also its looking like the router doesn't fit very well as a filter as it depends on having a view of all endpoints while filter implementations today only sees the endpoints that were chosen by the loadbalancer (the router essentially does the job of the loadbalancer?)
If that's the case I think we might be able to to say that:

  • the router filter is only useful if load balancing is turned off or we're broadcasting (though I'm less inclined to this one since it feels awkward and makes it possible for a user to make mistakes).
  • instead of exposing endpoints directly to filters, we could leverage the context object we plan to implement here to expose some function that filters call when they need to know endpoints information - then a router can request all endpoints while the default returns the load balanced endpoints as usual.

src/extensions/filters/append_token_router.rs Outdated Show resolved Hide resolved
src/extensions/filters/append_token_router.rs Show resolved Hide resolved
src/extensions/filters/append_token_router.rs Outdated Show resolved Hide resolved
Filter that appends the connection_id to each packet on the client side,
and uses it to compare against endpoint stored connection_ids to route
traffic to the appropriate game server on the server side.

Work on #8

Integration tests and Metrics are next.
@markmandel
Copy link
Member Author

Updated (with clippy fixes!!!) - PTAL. Also depends on how we feel about the discussion above.

Copy link
Collaborator

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

Regarding my earlier comment, I think this could be two filters rather than nesting multiple filters as one so make the functionality reusable in other contexts.

"connection_id_length" => self.connection_id_length, "packet_length" => contents.len());
return None;
}
let mut contents = contents;
Copy link
Collaborator

Choose a reason for hiding this comment

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

the assignment doesn't look needed? we can have the mut in the function parameter?

return None;
}

Some((filtered_endpoints, contents.to_vec()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

to_vec does a copy of the vector which might not be necessary? since the vec is already truncated by the split_off function?

@markmandel
Copy link
Member Author

Regarding my earlier comment, I think this could be two filters rather than nesting multiple filters as one so make the functionality reusable in other contexts.

I think we should be able to separate the append and router into two separate filters in place of nesting filters within each other

AAAH! I just read this properly. I was reading it as separating the Client implementation from the Server implementation, but that's totally not what you are saying, my bad 🤦

What we're actually saying is - let's have a general purpose ConnectionIdRouter (or something named vaguely like that?) that does the routing part, based on context data that would come from something like an AppendConnectionId Filter.

GOT IT. YES. Agreed. Lemme go back and look at your #102 PR, and then we can swing back around to this. 👍

I'll fix up some of your comments in the mean time as well, just so I can use this PR as a template to lift that functionality out.

And will also file some tickets for the above sections too, unless you beat me to it for whatever reason.

@iffyio
Copy link
Collaborator

iffyio commented Sep 12, 2020

Regarding my earlier comment, I think this could be two filters rather than nesting multiple filters as one so make the functionality reusable in other contexts.

I think we should be able to separate the append and router into two separate filters in place of nesting filters within each other

AAAH! I just read this properly. I was reading it as separating the Client implementation from the Server implementation, but that's totally not what you are saying, my bad

What we're actually saying is - let's have a general purpose ConnectionIdRouter (or something named vaguely like that?) that does the routing part, based on context data that would come from something like an AppendConnectionId Filter.

GOT IT. YES. Agreed. Lemme go back and look at your #102 PR, and then we can swing back around to this.

I'll fix up some of your comments in the mean time as well, just so I can use this PR as a template to lift that functionality out.

And will also file some tickets for the above sections too, unless you beat me to it for whatever reason.

so make the functionality reusable in other contexts.
oof, that read like an order - I could've sworn I wrote to make the functionality reusable in other contexts 😅
Yeah this was what I had in mind whether the general purpose filters make more sense. AppendConnectionId can be called something generic (e.g appendbytes, appendpayload not really sure) so that it doesn't necessarily tie to the connection id use case

@markmandel
Copy link
Member Author

Closing this PR, to clean things up.

@markmandel markmandel closed this Sep 17, 2020
@markmandel markmandel deleted the feature/append-token-router branch January 29, 2021 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes kind/feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants