-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Adds Brotli compression support for HTTP (via libbrotli) #40750
Conversation
Thanks for your pull request! The title of your pull request does not follow our editorial rules. Could you have a look?
This message is automatically generated by a bot. |
🙈 The PR is closed and the preview is expired. |
I see, I have to fix the pom structure. I have the parent already installed locally. |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
...http/runtime/src/main/java/io/quarkus/vertx/http/runtime/options/HttpServerOptionsUtils.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
Documentation error is unrelated to my PR. An error was merged with another PR. |
Documentation update preview: https://quarkus-pr-main-40750-preview.surge.sh/version/main/guides/http-reference#http-compression |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@cescoffier This can be merged. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Oh my oh my.
This PR has been here for so long that apart from rebases there are conflicts now. As there is no new material feedback, I will merge it once I resolve the conflicts. |
This comment has been minimized.
This comment has been minimized.
Ad Data 7 module: #40960 |
This comment has been minimized.
This comment has been minimized.
"/yes/text | deflate,gzip,br | gzip | 2414", | ||
"/yes/text | deflate | deflate | 2402", | ||
"/no/text | deflate,gzip,br | null | 6483", | ||
"/yes/json | deflate | deflate | 2402", | ||
"/no/json | deflate,gzip,br | null | 6483", | ||
"/yes/xml | deflate,gzip,br | gzip | 2414", | ||
"/no/xml | deflate,gzip,br | null | 6483", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, can't we check a marker in the content instead? That's what I originally asked for and I don't want to be in the situation we already encountered with AWT and other things, where we have to update numeric values when a new implementation of Brotli appears.
Checking the magic number at the beginning of the received file does not test that the compression took place as we expected, using the parameters we set. Note in the code that I am not comparing as I excruciatingly tested your hypothesis by testing numerous old versions across platforms. I did find that a very old Vert.x indeed showed 1 byte difference, better in fact, compression result. I accounted for this by adding a tolerance of 2 bytes. I this PR, we have our webserver vendor's hats on and we are testing a web server. That's why I manipulate headers in the test as that is what webserver test must do correctly. I don't want to be checking a magic number at the beginning of a binary and calling it a day, I want to see that the whole exchange makes sense and the compression works as expected. When I add dealing with chunked responses, this will get even more pertinent.
Can you point to a single trouble with vastly more complex AWT test suite I hadn't fixed in a timely fashion? I maintain the tests I commit. I had to refresh my memory, and I would like to add that the moment where pixel ranges suddenly didn't match was actually caused by the native-image using a different library for fonts processing, JDK in-tree built one versus the OS one. To learn about this change from the test suite is not without value. A change in JDK, given the AWT extension's nature, is again very valuable to learn about. Bringing the argument home, if the compression ratio gets worse (e.g. by not passing correct compression level arguments), we want to know about it. |
Let's at least please up the commits and rebase onto the latest main |
// Depending on the defaults of the compression algorithm, | ||
// the compressed content length may vary slightly between | ||
// Vert.x/Netty versions over time. | ||
public static final int COMPRESSION_TOLERANCE_BYTES = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 bytes is quite small for a 5x factor compression. would 2% tolerance be better / less likely to break ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, having a reasonable tolerance window would mitigate the potential issue and still be accurate enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented in cc361d1.
@Karm FWIW, there was nothing personal in my comments. I completely agree that you maintain the AWT tests and that you do it in a timely manner. But what if you are on PTO for 3 weeks or have more pressing things to do? We need to find a balance between being thorough and being brittle. And also how failures are actionable and by who. Because you, as any other developer, have the right to not be available to fix a test in the Quarkus test suite. Now, if these actually allowed to catch important things to fix/adjust then it's all fine. My perception is that you had on a few occasions to spend some time maintaining some test values because of changes that were completely out of our control. Or because we wanted to test another platform/Java version/... In this very case, we are testing a compression library that is out of our control. It will probably improve over time but really, there might be cases where it gets slightly worse for specific inputs for whatever reason (while improving overall). If you want to make sure that a particular set of settings is taken into account then fine, but I'm not entirely sure testing the size is going to bring you that. Let's say they improve things well enough that even without your settings applied, you are below the threshold? Anyway, what I wanted to emphasize is that it's not because it's fine now, that it will be fine along the life of Quarkus and the fact that Brotli compresses our text with 3 more bytes have very little value to us. And definitely not enough value for us to break our test suite. I dismissed my review so feel free to merge this PR but I would still have a look at Max' comment, which results from a discussion we had just now. |
* Integration tests for compressors * Adds Native image integration tests modules
… at compressing our example to trigger a failure.
Thx for the additional explanation and especially for the time spent on the case. I appreciate it.
That is on me. I was curious how stable those implementations behave. Whether they get any worse or better between versions historically. @gsmet @maxandersen @cescoffier If for some reason the compressor gets wayyy worse, this is how the failure looks like:
|
Status for workflow
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good with the 2% threshold.
Status for workflow
|
fixes #40692
relates to #40533
Tested Platforms Checklist ✔️
Ready for review.