Search code examples
spring-bootspring-mvcjettyembedded-jettyjetty-9

GzipHandler in Jetty 9.4 - increased wait times


Recently we switched to Jetty 9.4 from Jetty 9.0. Jetty 9.4 comes with GzipHandler so we used that. At the request processing time we flush out response to send back (link) headers to browser early, by doing response.flushBuffer(), this is done on purpose. In jetty 9.0's GzipFilter response used to be flushed right away but in GzipHandler it isn't flushed immediately. This is causing increase in wait time in browser as headers are received little late on browser side. I was wondering how can we make this response flush immediately in GzipHanlder in Jetty9.4 ?

BTW - we are talking about ~40Ms wait increased wait time here!


Solution

  • This was a bug in GzipHandler related to flush of empty initial buffers (a flush before attempting to send any data).

    Issue https://github.com/eclipse/jetty.project/issues/4835 has been closed.

    The fix is present in Jetty 9.4.29.v20200521 (now available on https://eclipse.org/jetty/ and maven central)