envoy-request-buffer

module
v0.0.0-...-96468c2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: Apache-2.0

README

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
  • 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) --> https://github.com/istio/istio/issues/49451

Directories

Path Synopsis
kubernetes
local-envoy
wasm-request-buffer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL