Skip to content

[tinker] bump async db pool default 5+10→20+40 for concurrent multi-LoRA#1686

Draft
j316chuck wants to merge 1 commit into
NovaSky-AI:mainfrom
j316chuck:chuck/bump-async-engine-pool
Draft

[tinker] bump async db pool default 5+10→20+40 for concurrent multi-LoRA#1686
j316chuck wants to merge 1 commit into
NovaSky-AI:mainfrom
j316chuck:chuck/bump-async-engine-pool

Conversation

@j316chuck
Copy link
Copy Markdown

@j316chuck j316chuck commented May 18, 2026

Title: [tinker] bump async db pool default 5+10→20+40 + env-var tunable

Body: Concurrent multi-LoRA async clients (each holding multiple in-flight requests during rollouts + forward_backward) saturate the SQLAlchemy connection pool at the default pool_size=5, max_overflow=10 (15 total). Observed with 3+ concurrent async clients × mbs=32: pool exhausts → HTTP 500s → client-side "Sampling session not found" cascading failures.

This change raises defaults to pool_size=20, max_overflow=40 (60 total) and makes them env-var-tunable via SKYRL_DB_POOL_SIZE / SKYRL_DB_MAX_OVERFLOW.

Empirically with these defaults, 3 concurrent async clients at mbs=32 run with zero QueuePool errors (vs 100% failure at the old default).

Note: 4+ concurrent async clients are still bottlenecked even with pool_size=500, max_overflow=1000 — uvicorn single-worker + SQLite write contention saturates before pool is even used. That's a separate architectural follow-up (multi-worker uvicorn, or non-SQLite DB).

Concurrent multi-LoRA async clients (each holding several in-flight requests
during rollouts and forward_backward) saturate the SQLAlchemy connection
pool at the default (pool_size=5, max_overflow=10 = 15 total). Observed at
4 concurrent clients × mbs=32: pool exhausts → HTTP 500s → client-side
'Sampling session not found' cascading failures.

This change raises defaults to pool_size=20, max_overflow=40 (60 total) and
makes them env-var-tunable via SKYRL_DB_POOL_SIZE / SKYRL_DB_MAX_OVERFLOW.
Empirically with these defaults, 4 concurrent async clients at mbs=32 run
with zero QueuePool errors.
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