-
Notifications
You must be signed in to change notification settings - Fork 189
[Core] Add Compression middleware #9207
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
Conversation
|
Sending as a draft because this is not intended to be merged until after the current release, but should be ready if anyone wants to look at or test it. |
2b4dddb to
a29ab69
Compare
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.
Works on my machine, reduced candidate_list request from 60kb to 10kb depending on the Accept-Encoding HTTP header.
I would prefer if non-doc type annotations are added to src/Http/GzipStream (unless they are automatically inherited, in which case my bad !), before merging but not blocking on that.
I did a quick search to see if there are existing libraries that do that for us but I did not find any, I am kind of baffled we have to handle this kind of details ourselves.
EDIT: Uh, I thought I was only reviewing, why was I assigned ? Assigning back to @driusan unless there's something I overlooked.
|
@maximemulder you were just assigned to review so that it doesn't show up as unassigned. What do you mean by "I would prefer if non-doc type annotations are added to src/Http/GzipStream"? I can update the docs, but I'm not sure what you mean. |
|
Oh, I mean writing : instead of but if you prefer the latter that's fine as well. |
|
I would also prefer that but the signature needs to match the PSR7 StreamInterface that it implements |
|
Oh okay, I did not take into account that the library could be untyped. If you're confident about your implementation of |
This adds support to LORIS for optionally compressing the response to the client if the `Accept-Encoding` header includes support for gzip using a new PSR-15 middleware. In this pull request the middleware is added for any data framework menu which uses the `format=binary` parameter and it used for the new data query tool results. This can significantly improve the loading time of large datasets. For instance, when combined with PR#9195 on the UK biobank the size of the result downloaded from the candidate_list is reduced from 47.48MB to 7.45MB according to the Firefox dev tools and there are similar reductions in the transferred size for data query results with arbitrary queries.
This adds support to LORIS for optionally compressing the response to the client if the
Accept-Encodingheader includes support for gzip using a new PSR-15 middleware. In this pull request the middleware is added for any data framework menu which uses theformat=binaryparameter and it used for the new data query tool results.This can significantly improve the loading time of large datasets. For instance, when combined with PR#9195 on the UK biobank the size of the result downloaded from the candidate_list is reduced from 47.48MB to 7.45MB according to the Firefox dev tools and there are similar reductions in the transferred size for data query results with arbitrary queries.