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

Example of host function in wasm.runtine.v8 for a wasm rust filter? #38066

Closed
leandrocurioso opened this issue Jan 16, 2025 · 2 comments
Closed
Labels
area/wasm question Questions that are neither investigations, bugs, nor enhancements

Comments

@leandrocurioso
Copy link

leandrocurioso commented Jan 16, 2025

Title: Example of host function in wasm.runtine.v8 for a wasm rust filter?

Description:
I need to have a large dataset available to all wasm rust filters

I tried top pass the large data as a configuration for the wasm vm. (Bad idea! Since there is more then 1 VM the configuration gets duplicated and uses a lot of memory).

I think the approach should be to handle this large data set in the host (envoy) and call host functions to get what I need.

The whole idea is that I need in the wasm filter get a http header and match against a large list.

Can you guys send me an example repo or article of how to build this kind of host function?
Is the whole thinking about how to tackle this ok? Any suggestions?

Thanks in advance!

@leandrocurioso leandrocurioso added the triage Issue requires triage label Jan 16, 2025
@leandrocurioso leandrocurioso changed the title Example of host function in wasm.runtine.v8 for a wast rust filter? Example of host function in wasm.runtine.v8 for a wasm rust filter? Jan 16, 2025
@jmarantz jmarantz added question Questions that are neither investigations, bugs, nor enhancements area/wasm and removed triage Issue requires triage labels Jan 17, 2025
@krinkinmu
Copy link
Contributor

@leandrocurioso

I did create a custom host function in one of the experiments I did, here is a commit that did that (among other things): krinkinmu@3581a81. The relevant bit is in source/extensions/common/wasm/foreign.cc it seems rather straightforward to add a function like that.

Hope this might help you get started.

@leandrocurioso
Copy link
Author

@leandrocurioso

I did create a custom host function in one of the experiments I did, here is a commit that did that (among other things): krinkinmu@3581a81. The relevant bit is in source/extensions/common/wasm/foreign.cc it seems rather straightforward to add a function like that.

Hope this might help you get started.

Thanks a lot man! This will for sure help =]

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

No branches or pull requests

3 participants