Skip to content

A PoC of a Proxy-WASM based implementation to hold requests until upstream targets are scaled + healthy

License

Notifications You must be signed in to change notification settings

ReToCode/envoy-request-buffer

Repository files navigation

PoC: Envoy based request buffering with WASM

This repo contains a simple PoC for request buffering in Envoy using Proxy-WASM. Note: The control-plane does not really check if the backend is scaled, nor is the control-plane called to actually scale the upstream target.

Architecture

In Envoy

See envoy

In Kubernetes

In the Kubernetes example, this PoC is using istio with Wasm Plugin. The networking is configured using gateway-api resources, while the WASM plugin in Envoy takes care of buffering requests if necessary.

kubernetes-overview

References

Variants

Where to find what

tree -d
.
├── kubernetes                 # kubernetes variant
│   ├── control-plane          # control-plane that reads from K8s API and scales via K8s API
│   └── yaml                   # manifests used on K8s
├── local-envoy                # variant with local envoy in docker-compose
│   ├── static-control-plane   # a static control-plane where you set "scaled-to-zero" manually
├── upstream                   # dummy upstream backend with http and gRPC
└── wasm-request-buffer        # wasm code
    ├── filter                 # code running on every http-request
    ├── service                # shared code running on a ticker to talk to control-plane
    └── shared                 # shared stuff

Kubernetes Demo

For more info about the demo see the scripts in demo

Things to look at next

  • Testing performance and overhead
  • Testing behaviour, CPU+memory consumption with a lot of hold requests
  • Test data architecture (how many request context can be held, how does envoy scale the HTTP contexts)?
  • Make it work with Envoy Gateway-API integration
  • Make it work on K8s, get the scaled-to-zero status from K8s
  • Poke the control-plane to actually scale on requests when scaled to zero

Learnings

  • For now the proxy-wasm-go-sdk uses tinygo, which has some downsides
    • Not all standard library packages are supported
    • No serialization packages work
    • Limited working dependencies available
    • No gRPC support for now --> tetratelabs/proxy-wasm-go-sdk#14
  • The API of the SDK is a bit peculiar
  • Error reporting is quite limited (e.g. when a httpContextID is no longer available, a generic bad argument error is returned)
  • Another option might be to consider using Rust for the module, as Kuadrant dit
  • Istio does not yet support kind: WASMModule for singletons (WASMServices) --> istio/istio#49451

About

A PoC of a Proxy-WASM based implementation to hold requests until upstream targets are scaled + healthy

Topics

Resources

License

Stars

Watchers

Forks