R235 · Infrastructure for agents at scale › Inference providers and serving reliability

Streaming LLM tokens from a managed JVM Lambda: SSE without a custom runtime

Read the original

Authors Elena van Engelen-Maslova

inference-servingserverlessstreamingjvmopen-source

Source: Elena van Engelen-Maslova, aws-lambda-response-streaming-jvm (GitHub, MIT; Maven Central nl.vintik:aws-lambda-streaming-core 3.1.0 and aws-lambda-streaming-sse), with a companion Medium article, announced 23 Nov 2026.

The problem

AWS ships response-streaming helpers for the managed Node.js Lambda runtime only. On the managed Java runtime, the OutputStream a RequestStreamHandler receives is an in-memory buffer that is posted only after the handler returns, so calling flush does nothing. The README measures this: 15 MB written at 2 ms, handler idle for 10 s, first byte at API Gateway at about 10,069 ms. For LLM token streaming that means the user waits for the whole answer.

AWS's documented options are a custom runtime (you own runtime updates) or the Lambda Web Adapter (an HTTP server inside the function). Both give up something: managed patching, SnapStart, CRaC priming, or simplicity.

How the library works

Tradeoffs

OptionKeeps managed runtime and SnapStartToken streamingCost
Buffered RequestStreamHandlerYesNoUsers wait for the full answer
Custom runtimeNoYesYou own runtime patching
Lambda Web AdapterPartlyYesEmbedded HTTP server and a layer
This library, coreYesNo (large bodies only)Small dependency
This library, SSEYesYesRelies on undocumented runtime internals via a Java agent

Limits and failure modes

Review checklist

Cited in field guides

Connections

See R235 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.