Repository navigation
Conversation
Signed-off-by: zty98751 <zty98751@alibaba-inc.com>
Signed-off-by: zty98751 <zty98751@alibaba-inc.com>
Signed-off-by: zty98751 <zty98751@alibaba-inc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pkg/wrapperHTTP API, includingnet/http.Header, in the default buildpkg/wrapper/httpcallwasm_lite_httpbuild tag to exclude the legacynet/httpimplementation only for migrated pluginsgoogle/uuidinside the wrapper with a small RFC 9562 UUID v4 implementation backed by WASIrandom_getpkg/litehttpimplementation-Oz --enable-bulk-memoryWASM_SKIP_OPTIMIZATION=1for diagnosticsCompatibility and opt-in usage
Existing plugins do not need to change. Without a build tag,
wrapper.HttpClient,wrapper.NewClusterClient,wrapper.ResponseCallback, and theirnet/http.Headercallback API remain available.Plugins that want to remove
net/httpfrom the Wasm dependency graph migrate HTTP callouts to:and build with:
GO_BUILD_TAGS=wasm_lite_http ./scripts/build-wasm.sh -o main.wasm .GO_BUILD_TAGSis passed through as Go's-tags; direct builds can usego build -tags=wasm_lite_http .... The build tag is required because importing the parentpkg/wrapperpackage otherwise compiles its legacynet/httpsource file even when no legacy HTTP client method is called.The tag only selects the HTTP API implementation. Binaryen
-Ozruns in both profiles, and the Proxy-Wasm host ABI is unchanged.Benchmark
Minimal wrapper plugin using
wrapper.SetCtx, Go 1.24.4, Binaryen 130-Oz, Envoy v1.27.2 V8 with a 0.25 CPU limit. Values are three alternating runs measured tostarting main dispatch loopusing the final PR code:wasm_lite_httpThe default dependency graph contains
net/http; the lightweight graph does not. A bundled request-block build also decreased from 5,566,586 B to 4,300,419 B (-22.7%), showing that the package-level saving applies beyond the synthetic minimal plugin.Verification
go test -race -count=1 -timeout=8m ./pkg/...go test -tags=wasm_lite_http ./pkg/...go vet ./pkg/...go vet -tags=wasm_lite_http ./pkg/...GO_BUILD_TAGS=wasm_lite_httppkg/wrapper/httpcallnet/httpgit diff --check,gofmt, and shell syntax checks