Skip to content

feat: [CHA-2956] connection pooling: getstream-php#39

Open
mogita wants to merge 12 commits into
masterfrom
feat/cha-2956_connection-pooling
Open

feat: [CHA-2956] connection pooling: getstream-php#39
mogita wants to merge 12 commits into
masterfrom
feat/cha-2956_connection-pooling

Conversation

@mogita
Copy link
Copy Markdown
Collaborator

@mogita mogita commented May 26, 2026

Summary

Implements the Server-Side SDK Connection Pooling Spec for getstream-php.

  • 4 new chained methods on ClientBuilder: maxConnsPerHost, idleTimeout, connectTimeout, requestTimeout (all int seconds)
  • New GetStream\Http\PoolConfig immutable value object for the 5 canonical knobs
  • HttpClientInterface::request() gains an optional array $options = [] 5th param for per-call overrides (['timeout' => N])
  • GuzzleHttpClient accepts an optional ?PoolConfig constructor arg
  • Defaults: 5 / 55s / 10s / 30s
  • INFO log on build() (spec §8) — error_log() based, quiet under PHPUnit
  • httpClient() escape hatch unchanged — when set, none of the 4 knobs are applied

Behavior change

None for default configuration: the pre-existing Guzzle defaults already matched the spec (30s timeout, 10s connect_timeout). What's new is that they are tunable and an additional MaxConnsPerHost knob is wired through. The Client::__construct signature is preserved.

Version

Bumped to v7.3.0 (the plan named v7.2.0 but that tag already shipped with the gzip work in CHA-2964).

PHP-FPM caveat (§9.1)

idleTimeout and maxConnsPerHost have no effect under PHP-FPM (the curl handle dies with the request). They take effect in long-running PHP runtimes (Swoole, RoadRunner, daemons). Documented in CHANGELOG + README.

Test plan

  • PoolConfig value-object defaults + withers (3 tests, 11 assertions)
  • GuzzleHttpClient applies PoolConfig to Guzzle defaults; user config wins (5 tests, 9 assertions)
  • Per-call ['timeout' => N] reaches Guzzle via Middleware::history
  • ClientBuilder chained methods + end-to-end propagation (13 tests, 43 assertions)
  • httpClient() escape hatch bypasses all 4 knobs (no side effects on the user's client)
  • §8 INFO log content (subprocess integration test — clean output in unit runs, 2 tests, 9 assertions)
  • PHPStan clean at level 8
  • make lint clean

Refs

@mogita mogita changed the title [CHA-2956] connection pooling: getstream-php feat: [CHA-2956] connection pooling: getstream-php May 26, 2026
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