{"id":16826809,"url":"https://github.com/retocode/envoy-request-buffer","last_synced_at":"2025-08-08T23:11:07.292Z","repository":{"id":222648039,"uuid":"754980880","full_name":"ReToCode/envoy-request-buffer","owner":"ReToCode","description":"A PoC of a Proxy-WASM based implementation to hold requests until upstream targets are scaled + healthy","archived":false,"fork":false,"pushed_at":"2024-02-20T14:18:16.000Z","size":109,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T01:43:29.811Z","etag":null,"topics":["envoy","proxy-wasm","proxy-wasm-go-sdk","scaletozero","wasm","wasm-go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ReToCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-09T06:59:43.000Z","updated_at":"2024-06-05T01:53:09.000Z","dependencies_parsed_at":"2024-02-20T13:25:29.533Z","dependency_job_id":"fffaab3c-4939-425a-bd5c-ea4c79422a96","html_url":"https://github.com/ReToCode/envoy-request-buffer","commit_stats":null,"previous_names":["retocode/envoy-request-buffer"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReToCode%2Fenvoy-request-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReToCode%2Fenvoy-request-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReToCode%2Fenvoy-request-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ReToCode%2Fenvoy-request-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ReToCode","download_url":"https://codeload.github.com/ReToCode/envoy-request-buffer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248339287,"owners_count":21087213,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["envoy","proxy-wasm","proxy-wasm-go-sdk","scaletozero","wasm","wasm-go"],"created_at":"2024-10-13T11:18:29.513Z","updated_at":"2025-04-11T03:42:26.741Z","avatar_url":"https://github.com/ReToCode.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PoC: Envoy based request buffering with WASM\n\nThis repo contains a simple PoC for request buffering in Envoy using Proxy-WASM.\nNote: The control-plane does not really check if the backend is scaled, nor is the control-plane called to actually scale the upstream target. \n\n## Architecture\n\n### In Envoy\n\nSee [envoy](./ENVOY.md#architecture)\n\n### In Kubernetes\n\nIn the Kubernetes example, this PoC is using [istio with Wasm Plugin](https://istio.io/latest/docs/reference/config/proxy_extensions/wasm-plugin/). \nThe networking is configured using [gateway-api](https://gateway-api.sigs.k8s.io/) resources, while the WASM plugin in Envoy takes care of buffering requests if necessary.\n\n![kubernetes-overview](./docs/kubernetes-overview.drawio.svg)\n\n**References**\n\n* [Proxy-WASM spec](https://github.com/proxy-wasm/spec/blob/master/docs/WebAssembly-in-Envoy.md)\n* [Proxy-WASM golang SDK docs](https://github.com/tetratelabs/proxy-wasm-go-sdk/blob/main/doc/OVERVIEW.md)\n\n## Variants\n\n* [In Kubernetes](./KUBERNETES.md)\n* [Local envoy in docker-compose](./ENVOY.md)\n\n## Where to find what\n\n```bash\ntree -d\n.\n├── kubernetes                 # kubernetes variant\n│   ├── control-plane          # control-plane that reads from K8s API and scales via K8s API\n│   └── yaml                   # manifests used on K8s\n├── local-envoy                # variant with local envoy in docker-compose\n│   ├── static-control-plane   # a static control-plane where you set \"scaled-to-zero\" manually\n├── upstream                   # dummy upstream backend with http and gRPC\n└── wasm-request-buffer        # wasm code\n    ├── filter                 # code running on every http-request\n    ├── service                # shared code running on a ticker to talk to control-plane\n    └── shared                 # shared stuff\n```\n\n## Kubernetes Demo\n\n\u003ca href=\"https://asciinema.org/a/641795\" target=\"_blank\"\u003e\u003cimg src=\"https://asciinema.org/a/641795.svg\" /\u003e\u003c/a\u003e\n\nFor more info about the demo see the scripts in [demo](./kubernetes/demo)\n\n\n## Things to look at next\n \n- [ ] Testing performance and overhead\n- [ ] Testing behaviour, CPU+memory consumption with a lot of hold requests\n- [ ] Test data architecture (how many request context can be held, how does envoy scale the HTTP contexts)?\n- [x] Make it work with Envoy Gateway-API integration\n- [x] Make it work on K8s, get the scaled-to-zero status from K8s\n- [x] Poke the control-plane to actually scale on requests when scaled to zero\n\n## Learnings\n\n* For now the proxy-wasm-go-sdk uses `tinygo`, which has some downsides\n  * Not all standard library packages are supported\n  * No serialization packages work\n  * Limited working dependencies available\n  * No gRPC support for now --\u003e https://github.com/tetratelabs/proxy-wasm-go-sdk/issues/14\n* The API of the SDK is a bit peculiar\n* Error reporting is quite limited (e.g. when a httpContextID is no longer available, a generic `bad argument` error is returned)\n* Another option might be to consider using Rust for the module, [as Kuadrant dit](https://github.com/Kuadrant/wasm-shim) \n* Istio does not yet support `kind: WASMModule` for singletons (WASMServices) --\u003e https://github.com/istio/istio/issues/49451\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretocode%2Fenvoy-request-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretocode%2Fenvoy-request-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretocode%2Fenvoy-request-buffer/lists"}