Can't get "streaming" or pipe to work, Varnish still waits for the full response

Batanun B batanun at hotmail.com
Mon Sep 14 16:52:40 UTC 2020


> It's not obvious why a response would be delayed, but it could
> happen to be related to the fetch_chunksize parameter.

Hmm... fetch_chunksize is 16k by default, and 4k minmum. Does this mean that even if streaming is working fine, it will still buffer at least 4kb of data before sending that to the client? That would be way to much for this use case. The output is basically plain text, and it is flushed after a few lines of text has been written. We are talking maybe 50-100 bytes per flush.

> However I have never come across a setup where we needed to

Well, I actually bit the bullet and decided to refactor this particular admin page that I needed this for, so that the job is done in the background and the current status can be fetched whenever one feels like. That way the response is always quick. Hopefully we won't need this for too many of these old legacy admin pages.


________________________________
From: Dridi Boukelmoune <dridi at varni.sh>
Sent: Monday, September 14, 2020 8:35 AM
To: Batanun B <batanun at hotmail.com>
Cc: varnish-misc at varnish-cache.org <varnish-misc at varnish-cache.org>
Subject: Re: Can't get "streaming" or pipe to work, Varnish still waits for the full response

On Sat, Sep 12, 2020 at 10:08 PM Batanun B <batanun at hotmail.com> wrote:
>
> Hi,
>
> We have some old (legacy) internal admin pages that do some classic old school processing while the page is loading, and outputting the current status as it is working. When requesting these pages directly (through Tomcat), I can see the results in the browser at the same time as the results are written on the other end. But when I go through Varnish, no matter what I try, I only see a blank page that is loading/waiting, and then when the backend is done writing, then I get the entire result in one go.
>
> How can I configure Varnish to bring any content to the client the moment it gets it from the backend, and not wait until the entire response is done?
>
> In vcl_backend_response I do this:
>   set beresp.do_stream = true;
>   set beresp.uncacheable = true;
>   return (deliver);

Streaming is on by default, you don't need to do anything.

> I have also tried returning (pipe) in vcl_recv (with and without do_stream and uncacheable). And gzip is turn off. But nothing helps. What can I do more? And how can I debug this? Varnishlog shows nothing that is telling me that it is buffering, or waiting for the response, or anything like that.

It is indeed hard to get that information just from Varnish, you could
try to capture TCP packets to check how long it takes for backend
traffic to be forwarded to clients. It's not obvious why a response
would be delayed, but it could happen to be related to the
fetch_chunksize parameter.

However I have never come across a setup where we needed to
tune that knob...

Dridi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20200914/9feff78b/attachment.html>


More information about the varnish-misc mailing list