Skip to content

Commit 1dfa504

Browse files
committed
geyser: add gRPC server options to config (#493)
1 parent ad5dd94 commit 1dfa504

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The minor version will be incremented upon a breaking change and the patch versi
3434
- proto: add `from_slot` ([#477](https://github.com/rpcpool/yellowstone-grpc/pull/477))
3535
- proto: add field `created_at` to update message ([#479](https://github.com/rpcpool/yellowstone-grpc/pull/479))
3636
- nodejs: add parse err function ([#483](https://github.com/rpcpool/yellowstone-grpc/pull/483))
37+
- geyser: add gRPC server options to config ([#493](https://github.com/rpcpool/yellowstone-grpc/pull/493))
3738

3839
## 2024-12-01
3940

yellowstone-grpc-geyser/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
"accept": ["gzip", "zstd"],
1818
"send": ["gzip", "zstd"]
1919
},
20+
"server_http2_adaptive_window": null,
21+
"server_http2_keepalive_interval": null,
22+
"server_http2_keepalive_timeout": null,
23+
"server_initial_connection_window_size": null,
24+
"server_initial_stream_window_size": null,
2025
"max_decoding_message_size": "4_194_304",
2126
"snapshot_plugin_channel_capacity": null,
2227
"snapshot_client_channel_capacity": "50_000_000",

yellowstone-grpc-geyser/src/config.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@ pub struct ConfigGrpc {
192192
/// Number of slots stored for re-broadcast (replay)
193193
#[serde(default = "ConfigGrpc::default_replay_stored_slots")]
194194
pub replay_stored_slots: u64,
195+
#[serde(default)]
196+
pub server_http2_adaptive_window: Option<bool>,
197+
#[serde(with = "humantime_serde")]
198+
pub server_http2_keepalive_interval: Option<Duration>,
199+
#[serde(with = "humantime_serde")]
200+
pub server_http2_keepalive_timeout: Option<Duration>,
201+
#[serde(default)]
202+
pub server_initial_connection_window_size: Option<u32>,
203+
#[serde(default)]
204+
pub server_initial_stream_window_size: Option<u32>,
195205
}
196206

197207
impl ConfigGrpc {

yellowstone-grpc-geyser/src/grpc.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,22 @@ impl GrpcService {
392392
.tls_config(ServerTlsConfig::new().identity(Identity::from_pem(cert, key)))
393393
.context("failed to apply tls_config")?;
394394
}
395+
if let Some(enabled) = config.server_http2_adaptive_window {
396+
server_builder = server_builder.http2_adaptive_window(Some(enabled));
397+
}
398+
if let Some(http2_keepalive_interval) = config.server_http2_keepalive_interval {
399+
server_builder =
400+
server_builder.http2_keepalive_interval(Some(http2_keepalive_interval));
401+
}
402+
if let Some(http2_keepalive_timeout) = config.server_http2_keepalive_timeout {
403+
server_builder = server_builder.http2_keepalive_timeout(Some(http2_keepalive_timeout));
404+
}
405+
if let Some(sz) = config.server_initial_connection_window_size {
406+
server_builder = server_builder.initial_connection_window_size(sz);
407+
}
408+
if let Some(sz) = config.server_initial_stream_window_size {
409+
server_builder = server_builder.initial_stream_window_size(sz);
410+
}
395411

396412
let filter_names = Arc::new(Mutex::new(FilterNames::new(
397413
config.filter_name_size_limit,
@@ -456,7 +472,6 @@ impl GrpcService {
456472
health_reporter.set_serving::<GeyserServer<Self>>().await;
457473

458474
server_builder
459-
.http2_keepalive_interval(Some(Duration::from_secs(5)))
460475
.layer(interceptor(move |request: Request<()>| {
461476
if let Some(x_token) = &config.x_token {
462477
match request.metadata().get("x-token") {

0 commit comments

Comments
 (0)