mirror of https://github.com/tikv/client-rust.git
store: Enable gRPC gzip compression (#490)
Signed-off-by: Ping Yu <yuping@pingcap.com>
This commit is contained in:
parent
1aebfa56ad
commit
fa7893173b
|
@ -43,7 +43,7 @@ serde = "1.0"
|
|||
serde_derive = "1.0"
|
||||
thiserror = "1"
|
||||
tokio = { version = "1", features = ["sync", "rt-multi-thread", "macros"] }
|
||||
tonic = { version = "0.10", features = ["tls"] }
|
||||
tonic = { version = "0.10", features = ["tls", "gzip"] }
|
||||
|
||||
[dev-dependencies]
|
||||
clap = "2"
|
||||
|
|
|
@ -17,3 +17,6 @@ max-open-files = 10000
|
|||
|
||||
[storage]
|
||||
reserve-space = "0MiB"
|
||||
|
||||
[server]
|
||||
grpc-compression-type = "gzip"
|
||||
|
|
|
@ -6,6 +6,7 @@ use std::time::Duration;
|
|||
|
||||
use async_trait::async_trait;
|
||||
use derive_new::new;
|
||||
use tonic::codec::CompressionEncoding;
|
||||
use tonic::transport::Channel;
|
||||
|
||||
use super::Request;
|
||||
|
@ -37,6 +38,7 @@ impl KvConnect for TikvConnect {
|
|||
.connect(address, move |channel| {
|
||||
TikvClient::new(channel)
|
||||
.max_decoding_message_size(self.grpc_max_decoding_message_size)
|
||||
.accept_compressed(CompressionEncoding::Gzip)
|
||||
})
|
||||
.await
|
||||
.map(|c| KvRpcClient::new(c, self.timeout))
|
||||
|
|
Loading…
Reference in New Issue