Skip to content

Add connection pooling to exp module#171

Merged
aisk merged 1 commit into
masterfrom
exp-connection-pool
Jul 19, 2026
Merged

Add connection pooling to exp module#171
aisk merged 1 commit into
masterfrom
exp-connection-pool

Conversation

@aisk

@aisk aisk commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Make the exp clients cloneable and shareable by pooling connections per server.

  • Each server keeps a stack of idle connections behind a mutex: checkout pops one or dials a new connection (never blocks), return keeps it only while under with_max_idle (default 8); there is no cap on concurrent connections, only on retained idle ones, so batches can never deadlock on checkout
  • A connection that fails mid-exchange (io error, EOF, framing error) is dropped instead of reused, since the stream state is unknown; errors after a completely framed response keep the connection
  • Both clients are now Clone + Send + Sync with all methods on &self; clones share the pools; from_connection is removed since a pooled client needs a dialable address
  • Addresses are resolved eagerly at connect time and one connection per server is dialed up front, so connection errors still surface at connect
  • The duplicated batch prepare/grouping logic moves into a shared plan() in the core

@aisk
aisk force-pushed the exp-connection-pool branch from 554ab1f to a72ff0b Compare July 19, 2026 06:51
@aisk
aisk merged commit 06e57cd into master Jul 19, 2026
1 check passed
@aisk
aisk deleted the exp-connection-pool branch July 19, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant