The handler.passUpstream method buffers the entire upstream response into memory and then returns it to the downstream client. This has two huge issues, firstly if the response is large, it can cause memory overruns, secondly the downstream client might timeout whilst waiting.
Ideally what should happen is just the upstream headers should be read, to determine storeability and then the body should be streamed to the downstream client and the cache in parallel.
The
handler.passUpstream
method buffers the entire upstream response into memory and then returns it to the downstream client. This has two huge issues, firstly if the response is large, it can cause memory overruns, secondly the downstream client might timeout whilst waiting.Ideally what should happen is just the upstream headers should be read, to determine storeability and then the body should be streamed to the downstream client and the cache in parallel.