You could convert the original ResponseWriter to a ResponseController and 
call Flush in your middleware before you measure the duration. 
Alternatively you can try to convert ResponseWriter to a http.Flusher and 
call Flush if the conversion is successful.

The documentation says "Flush flushes buffered data to the client." Note 
that if proxies are used, this will push the data only to the proxy. In 
today's proxies-everywhere-world, the next Proxy might be a sidecar 
container in of the pod of your application. You will measure only how fast 
the kernel can transfer a skbuff value from one socket to another and 
process the netfilter rules in between.

On Monday, November 20, 2023 at 12:10:58 PM UTC+1 Mitar wrote:

> Hi!
>
> On Mon, Nov 20, 2023 at 10:26 AM Duncan Harris <dun...@harris3.org> wrote:
> > Why do you care about buffering in Go vs the OS?
>
> Just because I hope that in Go I might have a chance to know when they
> are written out than in OS.
>
>
>
> Mitar
>
> --
> https://mitar.tnode.com/
> https://twitter.com/mitar_m
> https://noc.social/@mitar
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0eb4e7e5-70ab-4311-ae04-72635b6db524n%40googlegroups.com.

Reply via email to