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

Compression: Add threshold for compression #185

Open
spboyer opened this Issue Dec 5, 2016 · 6 comments

Comments

Projects
None yet
5 participants
@spboyer

spboyer commented Dec 5, 2016

There are instances where compression is a detriment by comparison to the benefit. Where the time to compress and gzip payload is higher than the original payload.

ngnix defaults to all content with the gzip_min_length setting used to set the minimum length of a response to that will be gzipped.

expressjs compression module is 1k by default, uses threshold option to set globally.

@Tratcher

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Dec 6, 2016

Member

As content-length is optional and only set by a few components, this would require buffering the response body up to that threshold before enabling compression. That's doable, but it can cause un-expected delays for streaming scenarios.

Member

Tratcher commented Dec 6, 2016

As content-length is optional and only set by a few components, this would require buffering the response body up to that threshold before enabling compression. That's doable, but it can cause un-expected delays for streaming scenarios.

@spboyer

This comment has been minimized.

Show comment
Hide comment
@spboyer

spboyer Dec 6, 2016

For the streaming scenarios the threshold should be set to 0, by passing the need to for check/routine.

spboyer commented Dec 6, 2016

For the streaming scenarios the threshold should be set to 0, by passing the need to for check/routine.

@Tratcher

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Dec 6, 2016

Member

Except that streaming is only done for some requests, where this setting would be for all requests.

Member

Tratcher commented Dec 6, 2016

Except that streaming is only done for some requests, where this setting would be for all requests.

@spboyer

This comment has been minimized.

Show comment
Hide comment
@spboyer

spboyer Dec 6, 2016

So is the use case for the compression middleware only for streaming? Considering that Kestrel is not a web facing server and should be proxied. So typically, compression would be handled by IIS, nginx or apache for requests. Trying to find to use case, or is this in an effort to get to a public facing server?

spboyer commented Dec 6, 2016

So is the use case for the compression middleware only for streaming? Considering that Kestrel is not a web facing server and should be proxied. So typically, compression would be handled by IIS, nginx or apache for requests. Trying to find to use case, or is this in an effort to get to a public facing server?

@Tratcher

This comment has been minimized.

Show comment
Hide comment
@Tratcher

Tratcher Dec 12, 2016

Member

Yes, the main use case is for when Kestrel or WebListener are used independently. Kestrel will eventually be safe for edge deployments, and WebListener already is.

Streams are not the main use case, but the middleware should not break streaming with too much buffering like the IIS implementation does.

Member

Tratcher commented Dec 12, 2016

Yes, the main use case is for when Kestrel or WebListener are used independently. Kestrel will eventually be safe for edge deployments, and WebListener already is.

Streams are not the main use case, but the middleware should not break streaming with too much buffering like the IIS implementation does.

@muratg muratg added this to the Backlog milestone Jan 10, 2017

@RehanSaeed

This comment has been minimized.

Show comment
Hide comment
@RehanSaeed

RehanSaeed Mar 21, 2017

When the static file middleware is being used, the size of the content is known. Can't that scenario be optimized?

RehanSaeed commented Mar 21, 2017

When the static file middleware is being used, the size of the content is known. Can't that scenario be optimized?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment