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

RPC level compression to reduce network b/w #9370

Closed
iSignal opened this issue Jul 20, 2021 · 3 comments
Closed

RPC level compression to reduce network b/w #9370

iSignal opened this issue Jul 20, 2021 · 3 comments
Assignees
Labels
area/docdb YugabyteDB core features priority/high High Priority

Comments

@iSignal
Copy link
Contributor

iSignal commented Jul 20, 2021

In areas where network b/w is at a premium (cross-AZ network costs, say), having network-level compression, at the RPC layer, would allow us to tradeoff CPU to reduce networking costs.

Ideally, this would work similar to HTTP Accept-Encoding, where the request RPC header flags would specify a bitmask of compression types it prefers and the response would carry equivalent flags to indicate compression.

@iSignal iSignal added the area/docdb YugabyteDB core features label Jul 20, 2021
@bmatican bmatican assigned spolitov and unassigned bmatican Jul 20, 2021
@bmatican bmatican added this to Backlog in YBase features via automation Jul 20, 2021
@bmatican bmatican added the priority/high High Priority label Jul 20, 2021
@bmatican
Copy link
Contributor

oops, seems I duplicated some GH issues, will close #9378

@iSignal
Copy link
Contributor Author

iSignal commented Jul 21, 2021

OpenSSL has some support for compression in-built https://www.openssl.org/docs/manmaster/man3/SSL_COMP_add_compression_method.html though there is some discussion on whether it is a good idea.

@spolitov
Copy link
Contributor

It seems deprecated.

spolitov added a commit that referenced this issue Jul 26, 2021
Summary:
This diff implements support for network traffic compression.
There are 2 flags to configure it:
enable_stream_compression - whether we enable compression at all.
stream_compression_algo - algorithm index that should be used for compression:
0 - no compression
1 - gzip

It should be safe to enable compression and set the algorithm to 0.
But since this feature is pretty new, we fully disable compression by default.

Introduced a StreamRefiner for refined streams, ie; encryption / compression.

The following compression related work should be done in follow-up diffs:
1) Add tests for encryption+compression.
2) Add more compression algorithms.
3) Change `StreamRefiner` interface to avoid the extra copy of decompressed data.

Test Plan:
ybd --gtest_filter CompressedStreamTest.*
ybd --gtest_filter TestRpcCompression.*

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: sanketh, ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12328
spolitov added a commit that referenced this issue Jul 30, 2021
Summary:
This diff adds tests for simultaneous traffic compression and encryption.

Also refactored RefinedStream to avoid extra copy for compressed streams.
Added test that checks that we actually compress the traffic.
Added test for disabled refined streams.

Test Plan:
ybd --gtest_filter TestRpcSecureCompression.*
ybd --gtest_filter TestRpcCompression.Compression
ybd --gtest_filter ExternalMiniClusterSecureTest.InsecureCql
ybd --gtest_filter SecureConnectionTest.Compression

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12406
spolitov added a commit that referenced this issue Aug 10, 2021
Summary:
This diff adds 2 traffic compression algorithms:
Snappy: using `stream_compression_algo=2`
LZ4: using `stream_compression_algo=3`

Test Plan: ybd --cxx-test rpc-test --gtest_filter RpcTestCompression.*

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12449
spolitov added a commit that referenced this issue Aug 11, 2021
Summary:
Debug log was added while working on 4c6f492/D12449.
It was not removed before landing, so this diff removes it.

Test Plan: Jenkins

Reviewers: timur

Reviewed By: timur

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12555
radekg pushed a commit to radekg/yugabyte-db that referenced this issue Aug 12, 2021
Summary:
This diff adds 2 traffic compression algorithms:
Snappy: using `stream_compression_algo=2`
LZ4: using `stream_compression_algo=3`

Test Plan: ybd --cxx-test rpc-test --gtest_filter RpcTestCompression.*

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12449
radekg pushed a commit to radekg/yugabyte-db that referenced this issue Aug 12, 2021
Summary:
Debug log was added while working on 4c6f492/D12449.
It was not removed before landing, so this diff removes it.

Test Plan: Jenkins

Reviewers: timur

Reviewed By: timur

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12555
YBase features automation moved this from Backlog to Done Aug 20, 2021
spolitov added a commit that referenced this issue Aug 31, 2021
Summary:
This diff implements support for network traffic compression.
There are 2 flags to configure it:
enable_stream_compression - whether we enable compression at all.
stream_compression_algo - algorithm index that should be used for compression:
0 - no compression
1 - gzip

It should be safe to enable compression and set the algorithm to 0.
But since this feature is pretty new, we fully disable compression by default.

Introduced a StreamRefiner for refined streams, ie; encryption / compression.

The following compression related work should be done in follow-up diffs:
1) Add tests for encryption+compression.
2) Add more compression algorithms.
3) Change `StreamRefiner` interface to avoid the extra copy of decompressed data.

Original commit: 3df0149/D12328

Test Plan:
Jenkins: rebase: 2.6
ybd --gtest_filter CompressedStreamTest.*
ybd --gtest_filter TestRpcCompression.*

Reviewers: bogdan, mbautin

Reviewed By: mbautin

Subscribers: ybase, sanketh

Differential Revision: https://phabricator.dev.yugabyte.com/D12771
spolitov added a commit that referenced this issue Sep 3, 2021
Summary:
This diff adds tests for simultaneous traffic compression and encryption.

Also refactored RefinedStream to avoid extra copy for compressed streams.
Added test that checks that we actually compress the traffic.
Added test for disabled refined streams.

Original commit: e9c7f79/D12406

Test Plan:
Jenkins: rebase: 2.6
ybd --gtest_filter TestRpcSecureCompression.*
ybd --gtest_filter TestRpcCompression.Compression
ybd --gtest_filter ExternalMiniClusterSecureTest.InsecureCql
ybd --gtest_filter SecureConnectionTest.Compression

Reviewers: bogdan, mbautin

Reviewed By: mbautin

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12811
spolitov added a commit that referenced this issue Sep 4, 2021
Summary:
This diff adds 2 traffic compression algorithms:
Snappy: using `stream_compression_algo=2`
LZ4: using `stream_compression_algo=3`

Original diff: 4c6f492/D12449

Test Plan:
Jenkins: rebase: 2.6
ybd --cxx-test rpc-test --gtest_filter RpcTestCompression.*

Reviewers: bogdan, mbautin

Reviewed By: mbautin

Subscribers: mbautin, ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D12876
@kmuthukk kmuthukk changed the title [DST] Flag to allow compression of RPC calls to reduce network b/w [DST] RPC level compression to reduce network b/w Oct 6, 2021
@kmuthukk kmuthukk changed the title [DST] RPC level compression to reduce network b/w RPC level compression to reduce network b/w Oct 6, 2021
spolitov added a commit that referenced this issue Oct 7, 2021
Summary:
This diff enables stream compression by default.
So after this diff, one could start compressing network traffic w/o extra rolling restart.

Also fixed the following issues that happen when compression is enabled, but compression algorithm is not specified.
1) Correctly handle cancel of sending data when compression is not used.
2) Correctly transfer big data received right after handshake when compression is not used.

Test Plan: Jenkins

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D13331
spolitov added a commit that referenced this issue Oct 8, 2021
…default

Summary:
This diff enables stream compression by default.
So after this diff, one could start compressing network traffic w/o extra rolling restart.

Also fixed the following issues that happen when compression is enabled, but compression algorithm is not specified.
1) Correctly handle cancel of sending data when compression is not used.
2) Correctly transfer big data received right after handshake when compression is not used.

Original diff: 98f6160/D13331

Test Plan: Jenkins: rebase: 2.6

Reviewers: bogdan

Reviewed By: bogdan

Subscribers: ybase

Differential Revision: https://phabricator.dev.yugabyte.com/D13342
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docdb YugabyteDB core features priority/high High Priority
Projects
Development

No branches or pull requests

3 participants