wasilibs / nottinygc

Higher-performance allocator for TinyGo WASI apps
MIT License
64 stars 6 forks source link

Failed to load Wasm module in Istio #8

Closed MengjiaLiang closed 1 year ago

MengjiaLiang commented 1 year ago

HI @anuraaga, thank you for releasing such a great GC strategy in proxy-wasm!

I am having trouble with the default GC in TinyGo(v0.27.0) as well. When I try to compile my wasm plugin use nottinygc and follow the instructions in the readme, the compilation works. But when I deploy it into a k8s cluster with Istio(v1.14 and v1.16), the envoy shows the error when loading the wasm module.

Here is the error message inside envoy proxy.

Failed to load Wasm module due to a missing import: wasi_snapshot_preview1.sched_yield

Do you have any insights for such an issue? Appreciate your help!

anuraaga commented 1 year ago

Hi @MengjiaLiang - thanks for the question. This is a known issue with Envoy which I have just added docs for, I think that should fix it for you

https://github.com/wasilibs/nottinygc#using-with-envoy

For context, it is the same approach we use here

https://github.com/corazawaf/coraza-proxy-wasm/blob/main/init_tinygo.go#L14

MengjiaLiang commented 1 year ago

Thank you Anuraag for the quick response! This works great now!

From my load testing result, the memory usage of Istio(that uses the default GC) increases linearly along with the traffic volume. After replacing the gc and malloc with nottinygc, I didn't see too much CPU increment, but the memory usage will be stable at some level no matter how much the traffic volume is. This is brilliant!

Appreciate your help again!