mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 01:48:05 +00:00
fix(sqlstore): increase connection pool size to prevent exhaustion
Increases SQLAlchemy connection pool from default 5+10 to 20+30 to handle concurrent API operations and tests. Prevents deadlocks in conversation API integration tests when using Postgres, where multiple concurrent requests exhaust the small default pool. Also adds pool_recycle=3600 to prevent stale connections. Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
parent
63137f9af1
commit
86ed32817a
1 changed files with 6 additions and 0 deletions
|
|
@ -84,9 +84,15 @@ class SqlAlchemySqlStoreImpl(SqlStore):
|
|||
connect_args["timeout"] = 5.0
|
||||
connect_args["check_same_thread"] = False # Allow usage across asyncio tasks
|
||||
|
||||
# Configure connection pool for concurrent access
|
||||
# Default pool_size=5 + max_overflow=10 = 15 total connections
|
||||
# Increase to handle concurrent tests and API operations (especially with Postgres)
|
||||
engine = create_async_engine(
|
||||
self.config.engine_str,
|
||||
pool_pre_ping=True,
|
||||
pool_size=20, # Increased from default 5
|
||||
max_overflow=30, # Increased from default 10
|
||||
pool_recycle=3600, # Recycle connections after 1 hour to prevent stale connections
|
||||
connect_args=connect_args,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue