How capple217/cache-aware-llm-proxy works
This repository is a cache-aware, streaming reverse proxy for LLM inference replicas, plus a simulated backend and an open-loop load generator. The main workflow is to accept and frame a client request, choose a replica using cache and load estimates, stream the upstream response, and update routing state from progress and backend KV events. The README documents the cache tiers, routing modes, and measurement goals; some implementation details are unsampled, so those links rely on documented behavior rather than inspected internals.
Main entry points: proxy.cpp Proxy workers · fake_backend.cpp Fake inference server · router.cpp Replica router · loadgen.cpp Open-loop loadgen
Components 15
Traffic and proxy
- Proxy launcher
apps/proxy.cpp - Proxy workers
src/proxy.cpp - HTTP framing
src/http.cpp - Socket poller
src/net.cpp
Cache-aware routing
- Replica router
src/router.cpp - Tiered cache index
src/kv_cache.cpp - KV event follower
src/proxy.cpp
Inference backends
- Inference replicas
- Fake backend launcher
apps/fake_backend.cpp - Fake inference server
src/fake_backend.cpp - Backend KV tiers
src/fake_backend.cpp - Backend KV event stream
src/fake_backend.cpp
Load and measurement
- Open-loop loadgen
apps/loadgen.cpp - Router metrics
src/router.cpp
Other components
- LLM client
Connections 18
- LLM client → Proxy workers: sends requests
README.md - Open-loop loadgen → Proxy workers: sends workload
apps/loadgen.cpp - Proxy launcher → Proxy workers: configures and starts
apps/proxy.cpp - Proxy workers → Socket poller: polls sockets
README.md - Proxy workers → HTTP framing: frames messages
src/proxy.cpp - Proxy workers → Replica router: routes requests
README.md - Replica router → Tiered cache index: matches cache blocks
src/router.cpp - Proxy workers → Inference replicas: forwards and streams
README.md - Inference replicas → Proxy workers: streams responses
README.md - KV event follower → Backend KV event stream: reads KV events
README.md - Backend KV event stream → Replica router: updates shadow index
src/router.cpp - Proxy workers → Replica router: reports progress
README.md - Fake backend launcher → Fake inference server: starts server
apps/fake_backend.cpp - Fake inference server → Backend KV tiers: updates cache tiers
src/fake_backend.cpp - Fake inference server → Backend KV event stream: publishes events
src/fake_backend.cpp - Inference replicas → Fake inference server: simulated by
README.md - Proxy workers → Router metrics: exposes metrics
README.md - Open-loop loadgen → Router metrics: fetches proxy stats
apps/loadgen.cpp