Skip to content

Commit bc9e522

Browse files
pingyuemmanuel-keller
authored andcommitted
store: Enable gRPC gzip compression (tikv#490)
Signed-off-by: Ping Yu <[email protected]> (cherry picked from commit fa78931)
1 parent f9a4f17 commit bc9e522

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ serde_json = "1"
4545
take_mut = "0.2.2"
4646
thiserror = "1"
4747
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }
48-
tonic = { version = "0.10", features = ["tls"] }
48+
tonic = { version = "0.10", features = ["tls", "gzip"] }
4949

5050
[dev-dependencies]
5151
clap = "2"

config/tikv.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ max-open-files = 10000
1919
[storage]
2020
reserve-space = "0MiB"
2121
api-version = 2
22-
enable-ttl = true
22+
enable-ttl = true
23+
24+
[server]
25+
grpc-compression-type = "gzip"

src/store/client.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::time::Duration;
66

77
use async_trait::async_trait;
88
use derive_new::new;
9+
use tonic::codec::CompressionEncoding;
910
use tonic::transport::Channel;
1011

1112
use super::Request;
@@ -37,6 +38,7 @@ impl KvConnect for TikvConnect {
3738
.connect(address, move |channel| {
3839
TikvClient::new(channel)
3940
.max_decoding_message_size(self.grpc_max_decoding_message_size)
41+
.accept_compressed(CompressionEncoding::Gzip)
4042
})
4143
.await
4244
.map(|c| KvRpcClient::new(c, self.timeout))

0 commit comments

Comments
 (0)