From 6f8650782f1bd67d0d32e27146fceb895939c9db Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Thu, 3 Jul 2025 14:54:23 +0200 Subject: [PATCH] Client tweaks --- Cargo.lock | 2 ++ pageserver/client_grpc/src/client.rs | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d9caf22c93..fec843b652 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1358,6 +1358,7 @@ dependencies = [ "metrics", "neon-shmem", "nix 0.30.1", + "pageserver_api", "pageserver_client_grpc", "pageserver_page_api", "prometheus", @@ -4605,6 +4606,7 @@ dependencies = [ "async-trait", "bytes", "chrono", + "compute_api", "dashmap 5.5.0", "futures", "http 1.1.0", diff --git a/pageserver/client_grpc/src/client.rs b/pageserver/client_grpc/src/client.rs index 546c9d41bd..82d47219a1 100644 --- a/pageserver/client_grpc/src/client.rs +++ b/pageserver/client_grpc/src/client.rs @@ -2,25 +2,25 @@ use std::collections::HashMap; use std::sync::Arc; use anyhow::anyhow; +use tokio::time::Instant; +use tracing::{error, info, instrument, warn}; + +use crate::pool::{ChannelPool, ClientGuard, ClientPool, StreamGuard, StreamPool}; use compute_api::spec::PageserverProtocol; use pageserver_api::key::{Key, rel_block_to_key}; use pageserver_api::shard::{ShardStripeSize, key_to_shard_number}; use pageserver_page_api as page_api; -use tokio::time::Instant; -use tracing::{error, info, instrument, warn}; use utils::backoff::exponential_backoff_duration; use utils::id::{TenantId, TimelineId}; use utils::shard::{ShardCount, ShardIndex, ShardNumber}; -use crate::pool::{ChannelPool, ClientGuard, ClientPool, StreamGuard, StreamPool}; - /// A rich Pageserver gRPC client for a single tenant timeline. This client is more capable than the /// basic `page_api::Client` gRPC client, and supports: /// /// * Sharded tenants across multiple Pageservers. /// * Pooling of connections, clients, and streams for efficient resource use. /// * Concurrent use by many callers. -/// * Internal handling of GetPage bidirectional streams. +/// * Internal handling of GetPage bidirectional streams, with pipelining and error handling. /// * Automatic retries. /// * Observability. /// @@ -337,7 +337,7 @@ impl Shards { /// /// TODO: consider separate pools for normal and bulk traffic, with different settings. struct Shard { - /// Dedicated channel pool for this shard. Used by all clients/streams in this shard. + /// Dedicated channel pool for this shard. Shared by all clients/streams in this shard. _channel_pool: Arc, /// Unary gRPC client pool for this shard. Uses the shared channel pool. client_pool: Arc,