Ray Serve
A model-serving framework built on Ray actors. It routes requests, composes deployments and scales replicas; a replica can run a PyTorch model, ordinary Python code or an LLM inference engine such as vLLM.
Client
Sends an inference request to an exposed application endpoint. HTTP and configured gRPC ingress use proxies; Python callers can also invoke deployments through DeploymentHandle.
- Client Ingress proxyHTTP / gRPC request
- Ingress proxy ClientResponse to caller
One pass through the system.
Select a step to highlight the components involved in the diagram.
Why it is built this way.
Batch size is a latency decision
Waiting can form more efficient vectorized batches, but spends part of the response-time budget. Generic request batching also differs from an LLM engine’s iteration-level token scheduler.
Autoscaling has a warm-up cost
A replica needs resources and initialized model weights before it serves traffic. Queue limits and replica scaling must account for bursts that arrive faster than new capacity becomes ready.
Actor recovery is not request durability
Replacing a failed actor restores capacity, not its transient queue or client connection. Applications still need appropriate timeout, retry and idempotency behavior for failed requests.
Read the implementation.
python/ray/serve/_private/proxy.pyFollow the network ingress path and the handoff to deployment routing.
python/ray/serve/_private/replica.pyInspect how an actor initializes application code and executes requests.
python/ray/serve/_private/controller.pyRead reconciliation, recovery and autoscaling coordination away from the request path.
Go deeper with the official docs
- Ray Serve architecture: actors and request lifecycle
- Dynamic request batching
- Replica autoscaling and load metrics
- End-to-end fault tolerance and recovery limits
Educational diagrams, synthesized from the linked project documentation. Components and boundaries vary by version and deployment.