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

How to use large dynamic data in wasm proxy rust filter? #37992

Closed
leandrocurioso opened this issue Jan 14, 2025 · 5 comments
Closed

How to use large dynamic data in wasm proxy rust filter? #37992

leandrocurioso opened this issue Jan 14, 2025 · 5 comments
Labels
question Questions that are neither investigations, bugs, nor enhancements

Comments

@leandrocurioso
Copy link

leandrocurioso commented Jan 14, 2025

Title: How to use large dynamic data in wasm proxy rust filter?

Description:

I have develop several filters with wasm proxy using rust and now there is a requirement I'm not sure how to tackle.

Scenario:

I have a large file with a list of clients more than 1000000+ registers and I need to route to specific endpoints based on a header request header. Ex: X-Client-Id: 123456

Have have some options:

  1. Create a route for each one of them: (Bad idea since the routes are evaluated top/down this would increase a lot my downstream time)
  2. Create a wasm proxy filter and inject this as a configuration sent by the go-control-plane (xds delta snapshot grpc) and build a hash map inside the filter configuration. (Tried this but the snapshot request gets too big and result in a timeout, and the envoy memory increases a lot)
  3. Do not send this data by xds delta but load that file content on the on_configure hook of the wasm proxy filter. (Tried that but the sandbox rust vm doesn't allow io:filesystem operations)

I also noticed that if I keep sending snapshots to envoy they keep increasing the memory, I looked into the os process and if the envoy container keeps receiving snapshots it puts all in memory without any recycling.

IMPORTANT POINT:

Envoy will run in kubernetes, when the pod starts up it should have this data ready to be used and ocasionally new updates in this list will happen and I need to update the "cache".

Is there a way anyone can recommend me to go? I 'm kinda lost at this point.

Thanks in advance for your help and if you need more details please comment! =D

@leandrocurioso leandrocurioso added the triage Issue requires triage label Jan 14, 2025
@leandrocurioso leandrocurioso changed the title How to use large dynamic data in wasm rpoxy rust filter? How to use large dynamic data in wasm proxy rust filter? Jan 14, 2025
@yanavlasov
Copy link
Contributor

You can try using universal matcher https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto for matching routes. It supports MatcherTree with the exact or prefix matchers that are very efficient.

@yanavlasov yanavlasov added question Questions that are neither investigations, bugs, nor enhancements and removed triage Issue requires triage labels Jan 14, 2025
@leandrocurioso
Copy link
Author

leandrocurioso commented Jan 14, 2025

@yanavlasov

Do you know if there is a limit of the tree nodes?

@agrawroh
Copy link
Contributor

Is it 1:1 mapping for route to endpoint?

@leandrocurioso
Copy link
Author

leandrocurioso commented Jan 15, 2025

Is it 1:1 mapping for route to endpoint?

@agrawroh

No.

The routing will happen when I check for a header key: "X-Client-Id: 123", then I match against a key paired list or hashmap. The key is the client id and if the match successfully happens then go to a specific cluster endpoint.

So basically and endpoint can serve a list/hashmap of clients.

@yanavlasov
Copy link
Contributor

There is no limit, other than resources available to Envoy process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions that are neither investigations, bugs, nor enhancements
Projects
None yet
Development

No branches or pull requests

3 participants