[tinker] bump async db pool default 5+10→20+40 for concurrent multi-LoRA#1686
Draft
j316chuck wants to merge 1 commit into
Draft
[tinker] bump async db pool default 5+10→20+40 for concurrent multi-LoRA#1686j316chuck wants to merge 1 commit into
j316chuck wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).