-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
Only compress responses if request was compressed #36867
Conversation
This is a follow-up to some discussions around elastic#36399. Currently we have relatively confusing compression behavior where compression can be configured for requests based on `transport.compress` or a specific setting for a remote cluster. However, we can only compress responses based on `transport.compress` as we do not know where a request is coming from (currently). This commit modifies the behavior to NEVER compress responses based on settings. Instead, a response will only be compressed if the request was compressed. This commit also updates the documentation to more clearly described transport level compression.
Pinging @elastic/es-distributed |
This PR is based on a conversation with I had with @jasontedor where I suggested it might be nicer to have simpler rules for compressing responses. Instead of having this odd edge-case where only some of the compression settings apply to responses, none of the compression settings will apply to responses 🤣. I wanted to open this PR and see if others agreed. If we all agree and generally there is agreement that the description about compression I added to the documentation is correct, I'll add @lcawl as a specific reviewer to iron-out the language. But @lcawl - you can hold off reviewing until we agree that this is a change we want to make. |
The change makes sense to me. Can you also add tests that check that we're getting the desired behavior with this change? |
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.
`cluster.remote.${cluster_alias}.transport.compress` setting. | ||
|
||
When compression is enabled using either `transport.compress` or for a specific | ||
remote cluster, only the outbound requests are compressed. Elasticsearch only |
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.
Elasticsearch only
-> Elasticsearch
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.
LGTM2
@lcawl - I think that we're at a point where it is probably worth you reviewing the documentation. |
noticeable CPU cost and local clusters tend to be setup with fast network | ||
connections between nodes. If compression is necessary for remote cluster | ||
connections only, this can be configured on a per-cluster basis using the | ||
`cluster.remote.${cluster_alias}.transport.compress` setting. |
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.
`cluster.remote.${cluster_alias}.transport.compress` setting. | |
<<remote-cluster-settings,`cluster.remote.${cluster_alias}.transport.compress` setting>>. |
[float] | ||
==== Transport Compression | ||
|
||
By default Elasticsearch network-level compression is disabled. This default |
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.
By default Elasticsearch network-level compression is disabled. This default | |
By default, the `transport.compress` setting is `false` and network-level compression is disabled between nodes in the cluster. This default |
|
||
By default Elasticsearch network-level compression is disabled. This default | ||
normally makes sense for local cluster communication as compression has a | ||
noticeable CPU cost and local clusters tend to be setup with fast network |
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.
noticeable CPU cost and local clusters tend to be setup with fast network | |
noticeable CPU cost and local clusters tend to be set up with fast network |
By default Elasticsearch network-level compression is disabled. This default | ||
normally makes sense for local cluster communication as compression has a | ||
noticeable CPU cost and local clusters tend to be setup with fast network | ||
connections between nodes. If compression is necessary for remote cluster |
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.
connections between nodes. If compression is necessary for remote cluster | |
connections between nodes. If you want to compress remote cluster |
normally makes sense for local cluster communication as compression has a | ||
noticeable CPU cost and local clusters tend to be setup with fast network | ||
connections between nodes. If compression is necessary for remote cluster | ||
connections only, this can be configured on a per-cluster basis using the |
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.
The "only" here seems to imply that setting transport.compress affects both internode and remote cluster communications. i.e. you set this cluster-level setting if you only want to compress remote cluster connections. If that's not right, we should remove the "only".
`cluster.remote.${cluster_alias}.transport.compress` setting. | ||
|
||
When compression is enabled using either `transport.compress` or for a specific | ||
remote cluster, only the outbound requests are compressed. Elasticsearch compresses |
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.
remote cluster, only the outbound requests are compressed. Elasticsearch compresses | |
remote cluster, only the outbound requests are compressed. |
|
||
When compression is enabled using either `transport.compress` or for a specific | ||
remote cluster, only the outbound requests are compressed. Elasticsearch compresses | ||
responses if and only-if the inbound request received was compressed. |
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.
responses if and only-if the inbound request received was compressed. | |
If compression is enabled and an inbound request is compressed, {es} also compresses the response. |
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.
Not sure if it's true that the compression of responses requires compression to be enabled, but it seemed like a reasonable assumption. If that's not true, I'd suggest something like this:
responses if and only-if the inbound request received was compressed. | |
If an inbound request is compressed, {es} compresses the response--even when compression is not enabled. |
@lcawl - I made some changes. I went ahead and split it into request and response sections to be completely clear. |
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
Thanks @lcawl |
This is a follow-up to some discussions around elastic#36399. Currently we have relatively confusing compression behavior where compression can be configured for requests based on transport.compress or a specific setting for a remote cluster. However, we can only compress responses based on transport.compress as we do not know where a request is coming from (currently). This commit modifies the behavior to NEVER compress responses based on settings. Instead, a response will only be compressed if the request was compressed. This commit also updates the documentation to more clearly described transport level compression.
* elastic/master: (539 commits) SQL: documentation improvements and updates (elastic#36918) [DOCS] Merges list of discovery and cluster formation settings (elastic#36909) Only compress responses if request was compressed (elastic#36867) Remove duplicate paragraph (elastic#36942) Fix URI to cluster stats endpoint on specific nodes (elastic#36784) Fix typo in unitTest task (elastic#36930) RecoveryMonitor#lastSeenAccessTime should be volatile (elastic#36781) [CCR] Add `ccr.auto_follow_coordinator.wait_for_timeout` setting (elastic#36714) Scripting: Remove deprecated params.ctx (elastic#36848) Refactor the REST actions to clarify what endpoints are deprecated. (elastic#36869) Add JDK 12 to CI rotation (elastic#36915) Improve error message for 6.x style realm settings (elastic#36876) Send clear session as routable remote request (elastic#36805) [DOCS] Remove redundant ILM attributes (elastic#36808) SQL: Fix bug regarding histograms usage in scripting (elastic#36866) Update index mappings when ccr restore complete (elastic#36879) Docs: Bump version to alpha2 after release Enable IPv6 URIs in reindex from remote (elastic#36874) Watcher: Remove unused local variable in doExecute (elastic#36655) [DOCS] Synchs titles of X-Pack APIs ...
* master: (31 commits) Move ingest-geoip default databases out of config (elastic#36949) [ILM][DOCS] add extra scenario to policy update docs (elastic#36871) [Painless] Add String Casting Tests (elastic#36945) SQL: documentation improvements and updates (elastic#36918) [DOCS] Merges list of discovery and cluster formation settings (elastic#36909) Only compress responses if request was compressed (elastic#36867) Remove duplicate paragraph (elastic#36942) Fix URI to cluster stats endpoint on specific nodes (elastic#36784) Fix typo in unitTest task (elastic#36930) RecoveryMonitor#lastSeenAccessTime should be volatile (elastic#36781) [CCR] Add `ccr.auto_follow_coordinator.wait_for_timeout` setting (elastic#36714) Scripting: Remove deprecated params.ctx (elastic#36848) Refactor the REST actions to clarify what endpoints are deprecated. (elastic#36869) Add JDK 12 to CI rotation (elastic#36915) Improve error message for 6.x style realm settings (elastic#36876) Send clear session as routable remote request (elastic#36805) [DOCS] Remove redundant ILM attributes (elastic#36808) SQL: Fix bug regarding histograms usage in scripting (elastic#36866) Update index mappings when ccr restore complete (elastic#36879) Docs: Bump version to alpha2 after release ...
This is a follow-up to some discussions around #36399. Currently we have relatively confusing compression behavior where compression can be configured for requests based on transport.compress or a specific setting for a remote cluster. However, we can only compress responses based on transport.compress as we do not know where a request is coming from (currently). This commit modifies the behavior to NEVER compress responses based on settings. Instead, a response will only be compressed if the request was compressed. This commit also updates the documentation to more clearly described transport level compression.
This is a follow-up to some discussions around #36399. Currently we have
relatively confusing compression behavior where compression can be
configured for requests based on
transport.compress
or a specificsetting for a remote cluster. However, we can only compress responses
based on
transport.compress
as we do not know where a request iscoming from (currently).
This commit modifies the behavior to NEVER compress responses based on
settings. Instead, a response will only be compressed if the request was
compressed. This commit also updates the documentation to more clearly
described transport level compression.