Comments (13)
the performance will be not high, is it ture?
yeah, compared to c++ and Rust
BTW, do you know any projects that support go host implementation for proxy-wasm?
AFAIK, there's no project for proxy-wasm host in go
from proxy-wasm-go-sdk.
I have try go-ext-wasm, and it only supports integer when import func. func (imports *Imports) AppendFunction
Invalid input type for the `proxy_log` imported function; given `ptr`; only accept `int32`, `int64`, `float32`, and `float64`.
I can‘t implement proxy-wasm func by go-ext-wasm.
from proxy-wasm-go-sdk.
First of all, TinyGo implements the mark and sweep grabage collector [link].
The allocated pointers are assigned to variables we create when we get data from the host environment. For example, you pass the pointer of retData *byte
variable (created here) to proxy_get_buffer_bytes abi call. Then, IIUC, the host environment (implementation is here) call malloc with the size of required data and pass the returned pointer to the &retData
variable inside the host environment. In this way, the allocated memory can be reached from WASM's vm and can be garbage collected normally.
from proxy-wasm-go-sdk.
thank you ,This is a good project.
Does standard Go will support GC in this issue golang/go#31105 ?
from proxy-wasm-go-sdk.
Well, I am not sure about that, but the point is Go's official binary cannot be used for proxy-wasm since;
- it does not support custom exports golang/go#25612
- this is something to do with
GOOS=js
functionality which restricts host environments, and; - makes it impossible for us to implement proxy-wasm ABI
- this is something to do with
- the resulting binary is huge in its size, that is critical for usage in network proxies.
from proxy-wasm-go-sdk.
I want my project is in go to support proxy-wasm,How can I implement proxy-wasm-go-host,such as https://github.com/proxy-wasm/proxy-wasm-cpp-host ?
Is it difficult or go runtime not support it?
from proxy-wasm-go-sdk.
host environments in Go can be implemented once we have WASM virtual machine and interpreter written in Go (e.g. https://github.com/mathetake/gasm, though mine is a kind of hobbiest one). That is a completely separated issue and nothing to do with Go's limitation for producing proxy-wasm ABI compatible wasm binary as we discussed above.
from proxy-wasm-go-sdk.
Just for my curiosity, is your project https://github.com/mosn/mosn ? 👀
from proxy-wasm-go-sdk.
Just for my curiosity, is your project https://github.com/mosn/mosn ? 👀
yes.
I have been studying wasm, I will have a try at gasm.
thank you!
from proxy-wasm-go-sdk.
gasm is just a toy VM for my learning purpose and it's far from completion. you'd better give it a shot to https://github.com/wasmerio/go-ext-wasm
Anyway, if there's anything I can do to mosn, let me know:)
from proxy-wasm-go-sdk.
First of all, TinyGo implements the mark and sweep grabage collector [link].
The allocated pointers are assigned to variables we create when we get data from the host environment. For example, you pass the pointer of
retData *byte
variable (created here) to proxy_get_buffer_bytes abi call. Then, IIUC, the host environment (implementation is here) call malloc with the size of required data and pass the returned pointer to the&retData
variable inside the host environment. In this way, the allocated memory can be reached from WASM's vm and can be garbage collected normally.
I'm sorry,I have some confusion.
"the WASM GC" only exists as a proposal https://github.com/WebAssembly/gc.
How do WASM builded by tinyGo support GC?
from proxy-wasm-go-sdk.
TinyGo does not use the proposed WASM's gc but implements it at the language level (and this is how TinyGo supports GC on multiple platforms, not only on wasm)
from proxy-wasm-go-sdk.
TinyGo does not use the proposed WASM's gc but implements it at the language level (and this is how TinyGo supports GC on multiple platforms, not only on wasm)
(func $runtime.alloc (type 14) (param i32) (result i32)
(local i32 i32 i32 i32 i32 i32)
block ;; label = @1
local.get 0
i32.eqz
br_if 0 (;@1;)
local.get 0
i32.const 15
i32.add
i32.const 4
i32.shr_u
local.set 1
i32.const 0
i32.load offset=75528
local.tee 2
local.set 3
i32.const 0
local.set 4
i32.const 0
local.set 5
loop ;; label = @2
block ;; label = @3
local.get 3
local.get 2
i32.ne
br_if 0 (;@3;)
local.get 5
i32.const 255
i32.and
local.set 2
i32.const 1
local.set 5
block ;; label = @4
block ;; label = @5
local.get 2
i32.const 1
i32.gt_u
br_if 0 (;@5;)
local.get 2
br_table 2 (;@3;) 1 (;@4;) 2 (;@3;)
end
i32.const 66085
i32.const 13
call $runtime.runtimePanic
unreachable
end
call $runtime.GC
oh, it call runtime.GC when runtime.alloc, the performance will be not high, is it ture?
BTW, do you know any projects that support go host implementation for proxy-wasm?
thank you very much!
from proxy-wasm-go-sdk.
Related Issues (20)
- How to support sending requests as a forward proxy HOT 1
- Convert examples to use docker compose? HOT 1
- how to set label on the metrics HOT 4
- OnHttpRequestBody is not called when calling a `direct_response` route HOT 5
- Enhancing the usability of custom metric tags in the Istio environment for WASM. HOT 2
- Question: how to send a ReponseBody when upstream's response body is empty. HOT 1
- The possibility of re-using memory to reduce the impact of increasing memory usage HOT 1
- OnHttpResponseBody will buffer the whole body when ActionPause returned before HOT 5
- Is it possible to build a filter that get the body content and save as header per request? HOT 4
- Is it possible to make HTTPS calls using DipatchHttpCall HOT 1
- when ResumeHttpResponse make envoy crash HOT 1
- How to get the source workload name info? HOT 1
- Difference between different SDKs. HOT 1
- ActionPause will not pause the processing in the filter chain
- new release of the repo HOT 2
- Question: Adding Data to SYN Packet
- wasm-plugin does not work except 'istio-proxy' namepsace HOT 2
- readme example build error HOT 2
- Wasm Filter Bad Argument Error returned by DispatchHttpCall Method HOT 1
- Redis connection HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxy-wasm-go-sdk.