Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] gzip filter

minGzipSize default is 256 bytes.

https://github.com/eclipse/jetty.project/blob/jetty-9.2.6.v20141205/jetty-servlets/src/main/java/org/eclipse/jetty/servlets/GzipFilter.java#L138

Not much value in setting that value lower, as you just generate overhead that doesn't offset the paltry compression ratio.

Also, if you are worried about static files, being served from the DefaultServlet, then you can get an even better performance by pre-compressing those resources in your war file.

So that a war with

/css/main.css
/js/module.js

can now contain

/css/main.css
/css/main.css.gz
/js/module.js
/js/module.js.gz

If the client requested compression, and the pre-compressed version exists, then it just serves it as-is, without having to compress it again and again and again for each client.

In the default servlet there is also a otherGzipFileExtensions init-parameter for other file extensions that can be compressed, like ".svgz"


--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Mon, Jan 12, 2015 at 6:39 AM, Andrew Penhorwood <penhorwood@xxxxxxxxx> wrote:
I believe so. I read the documentation too, which list these requirements.  I also looked at the source for the gzip filter on this version of jetty.  It appears that the 0 Default might be wrong but that does not matter in this case.  I created files that would match all of the above as best I could.

I turned on detail logging and I can see the gzip filter in the chain but the files never seem to be gzipped.  I will try setting up a public test if I have time later today.  Has anyone else got gzip to work on Jetty 9.2.x?

Box is
  • Windows 7 Pro 64 bit.
  • Java is 1.8_20
  • Jetty 9.2.6
  • client is Chrome.  Will try creating a better test too.
Andy

On Mon, Jan 12, 2015 at 8:29 AM, Stefan Magnus Landrø <stefan.landro@xxxxxxxxx> wrote:
Have you verified all this?

GZIP Filter This filter will gzip or deflate the content of a response if:
  • The filter is mapped to a matching path
  • accept-encoding header is set to either gzip, deflate or a combination of those
  • The response status code is >=200 and <300
  • The content length is unknown or more than the minGzipSize initParameter or the minGzipSize is 0(default)
  • If a list of mimeTypes is set by the mimeTypes init parameter, then the Content-Type is in the list.
  • If no mimeType list is set, then the content-type is not in the list defined by excludedMimeTypes
  • No content-encoding is specified by the resource




2015-01-12 12:32 GMT+01:00 Andrew Penhorwood <penhorwood@xxxxxxxxx>:
I am using chrome and I can see the gzip accept headers in the request.  I can also see that the file size never changes when it comes across the wire.


On Mon, Jan 12, 2015 at 2:15 AM, Christoph Läubrich <laeubi@xxxxxxxxxxxxxx> wrote:
Gzip must be requested by the client, have you checked that the client actually request compressed data? What client do you use?
Also make sure your files have proper mime types and try to enable only for a specific mime type to test.

Beside this: How do you verify that content is Gzipped? Some versions of IE+Firebug Console do not report the gzip content type. So you should actually check with wire-shark or a simple java test client (just make sure to request compression!)

Am 11.01.2015 20:14, schrieb Andrew Penhorwood:
I am using jetty9.2.6.  The site has ran for months without issue on the Jetty 9.2.x codes bases.  I decided to audit the site to see if there were things we could do to make it more efficient.  One of those things was enabling gzip. So I added the gzip filter to to my webdefault.xml file.


_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--
BEKK Open
http://open.bekk.no

TesTcl - a unit test framework for iRules

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



--

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top