Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #5198 - update gzip handler #5248

Merged
merged 8 commits into from
Sep 21, 2020

Conversation

lachlan-roberts
Copy link
Contributor

Fixes #5198 - We now use the ByteBuffer API for inflaters/deflaters for GzipHandler.
Fixes #4988 - The GzipHandlers IncludeExclude for the MIME types now uses case insensitive set.
Fixes #1761 - Added extra configuration in the .ini file for gzip.mod.
Fixes #5246 - add deflater/inflater pools to server dump.

…sitive

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
…Pool

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
The CRC32 checksum may need to convert the ByteBuffer to an array anyway so
we are better off not setting the deflater input with ByteBuffer directly.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
Copy link
Contributor

@joakime joakime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor improvements suggested.

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
{
return new DeflaterPool(capacity, Deflater.DEFAULT_COMPRESSION, true);
return new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "INFINITE_CAPACITY" mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means there is no limit on the number of objects allowed to be pooled.
This is now changed later by the setter, as I have made the capacity of the pool configurable after it is constructed. This lets us make the pool final and add it as a bean to the GzipHandler.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to eventually switch the pools over to using the Pool class, which has it's size set when constructed. So we need to not assume that the pool size can be configured after construction.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened PR #5295, which uses the new Pool class for the CompressionPool and still allows the pool size to be changed before it is started.

@lachlan-roberts
Copy link
Contributor Author

@gregw this PR is ready for review.

@gregw
Copy link
Contributor

gregw commented Sep 15, 2020

@lachlan-roberts OK looking... but can you start a second PR that will replace the inflater and deflater pools with a Pool. This can be in 9.4

{
return new DeflaterPool(capacity, Deflater.DEFAULT_COMPRESSION, true);
return new DeflaterPool(CompressionPool.INFINITE_CAPACITY, Deflater.DEFAULT_COMPRESSION, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to eventually switch the pools over to using the Pool class, which has it's size set when constructed. So we need to not assume that the pool size can be configured after construction.

_deflater.setInput(array, off, len); // TODO use ByteBuffer API in Jetty-10
// Ideally we would want to use the ByteBuffer API for Deflaters. However due the the ByteBuffer implementation
// of the CRC32.update() it is less efficient for us to use this rather than to convert to array ourselves.
_deflater.setInput(array, off, len);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good comment, but can we raise a bug on the JVM to provide an efficient implementation of CRC32 that does not copy ByteBuffers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only does the copying if it is not a DirectBuffer and does not have an array.
I don't think I can raise JVM bugs anyway, @sbordet could do this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is a readonly buffer!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or if it is read-only!

lachlan-roberts added a commit that referenced this pull request Sep 17, 2020
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
@lachlan-roberts
Copy link
Contributor Author

@gregw I think we should merge this before considering the further changes to make CompressionPool use the new Pool class.

@lachlan-roberts lachlan-roberts merged commit df085a6 into jetty-10.0.x Sep 21, 2020
@lachlan-roberts lachlan-roberts deleted the jetty-10.0.x-5198-UpdateGzipHandler branch September 21, 2020 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants