store: Enable gRPC gzip compression (#490)

Signed-off-by: Ping Yu <yuping@pingcap.com>
This commit is contained in:
Ping Yu 2025-05-19 13:58:28 +08:00 committed by GitHub
parent 1aebfa56ad
commit fa7893173b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 1 deletions

View File

@ -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"

View File

@ -17,3 +17,6 @@ max-open-files = 10000
[storage]
reserve-space = "0MiB"
[server]
grpc-compression-type = "gzip"

View File

@ -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))