Skip to content

Harden control plane connection management and optimize worker initialization#228

Merged
fuziontech merged 3 commits intomainfrom
feat/worker-pooling-and-prewarm
Feb 18, 2026
Merged

Harden control plane connection management and optimize worker initialization#228
fuziontech merged 3 commits intomainfrom
feat/worker-pooling-and-prewarm

Conversation

@fuziontech
Copy link
Member

Resolved Fivetran job failures caused by worker initialization timeouts and resource contention during concurrent "ATTACH" operations.

Key improvements:

  • Worker Reusability: Workers are now pooled and reused across sequential sessions, avoiding the overhead of spawning a new process for every connection. Idle workers are reaped after a configurable 5-minute timeout.
  • Shared Worker State: All sessions within a worker process now share a single sql.DB instance (with dedicated sql.Conn for isolation). This allows sessions to share pre-loaded extensions and attached DuckLake catalogs, making subsequent session creation near-instant.
  • Background Pre-warming: Workers now perform full DuckDB initialization (loading extensions, attaching catalogs) at startup in the background. This ensures workers are "warm" and ready to serve before handling their first client request.
  • Parallel Spawning: Pre-warmed workers are spawned in parallel to accelerate control-plane startup.
  • Configuration: Added 'worker_idle_timeout' (default 5m) to duckgres.yaml and CLI flags.

These changes eliminate the "spawn storms" observed under heavy load and ensure that client connections receive a 'ReadyForQuery' response within milliseconds after authentication.

…lization

Resolved Fivetran job failures caused by worker initialization timeouts and
resource contention during concurrent "ATTACH" operations.

Key improvements:
- Worker Reusability: Workers are now pooled and reused across sequential
  sessions, avoiding the overhead of spawning a new process for every
  connection. Idle workers are reaped after a configurable 5-minute timeout.
- Shared Worker State: All sessions within a worker process now share a
  single sql.DB instance (with dedicated sql.Conn for isolation). This
  allows sessions to share pre-loaded extensions and attached DuckLake
  catalogs, making subsequent session creation near-instant.
- Background Pre-warming: Workers now perform full DuckDB initialization
  (loading extensions, attaching catalogs) at startup in the background.
  This ensures workers are "warm" and ready to serve before handling their
  first client request.
- Parallel Spawning: Pre-warmed workers are spawned in parallel to
  accelerate control-plane startup.
- Configuration: Added 'worker_idle_timeout' (default 5m) to duckgres.yaml
  and CLI flags.

These changes eliminate the "spawn storms" observed under heavy load and
ensure that client connections receive a 'ReadyForQuery' response within
milliseconds after authentication.
@github-actions
Copy link

🤖 Hi @fuziontech, I've received your request, and I'm working on it now! You can track my progress in the logs for more details.

@github-actions
Copy link

🤖 I'm sorry @fuziontech, but I was unable to process your request. Please see the logs for more details.

@fuziontech fuziontech merged commit 51021d7 into main Feb 18, 2026
11 checks passed
@fuziontech fuziontech deleted the feat/worker-pooling-and-prewarm branch February 18, 2026 01:44
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

Comments