Technologies/Prefect/prefect.database.connections.active
PrefectPrefectMetric

prefect.database.connections.active

Active database connections
Dimensions:None
Available on:PrometheusPrometheus (1)
Interface Metrics (1)
PrometheusPrometheus
Number of active database connections
Dimensions:None

Technical Annotations (39)

Configuration Parameters (6)
server.database.sqlalchemy.pool_sizerecommended: 60 (current, may need increase)
Maximum connections in the pool; version 3.x may require more than 2.x
server.database.sqlalchemy.max_overflowrecommended: 10 (current, may need increase)
Additional connections beyond pool_size during bursts
server.database.sqlalchemy.pool_timeoutrecommended: 30
Seconds to wait for connection from pool before timeout
pool_size
SQLAlchemy connection pool size per Prefect process; limits base connections
max_overflow
SQLAlchemy max additional connections beyond pool_size; caps connection burst
max_connections
PostgreSQL setting defining maximum allowed connections
Error Signatures (11)
asyncpg.exceptions.DeadlockDetectedErrorexception
sqlalchemy.exc.DBAPIErrorexception
deadlock detectedlog pattern
waits for ShareLock on transactionlog pattern
ConnectionResetError: [Errno 104] Connection reset by peerexception
httpx.ReadErrorexception
anyio.BrokenResourceErrorexception
BrokenPipeError: [Errno 32] Broken pipeexception
remaining connection slots are reserved for non-replication superuser connectionslog pattern
asyncpg.exceptions.TooManyConnectionsErrorexception
500 Internal Server Errorhttp status
CLI Commands (1)
SELECT count(*) AS total_connections, count(*) FILTER (WHERE state = 'active') AS active, count(*) FILTER (WHERE state = 'idle') AS idle, (SELECT setting::int FROM pg_settings WHERE name = 'max_connections') AS max_connections FROM pg_stat_activity;diagnostic
Technical References (21)
flow_runcomponentdatabase locksconceptworker podscomponentconcurrencyconcepttask_runcomponentasyncpgcomponentON CONFLICTconcept/usr/local/lib/python3.12/site-packages/prefect/server/services/task_run_recorder.pyfile pathShareLockconceptget_runs_in_work_queuecomponentprefect.agentcomponenthttpxcomponentorioncomponentprefect_kubernetes.observercomponent_replicate_pod_eventcomponentSQLAlchemycomponentpgbouncercomponentprefect-servercomponentprefect-workercomponentconcurrency context managercomponentpg_stat_activitycomponent
Related Insights (8)
Database connection pool exhaustion causes severe API slowdown after Prefect 3.x upgradecritical
Long-running tasks monopolize worker resources and block concurrencywarning
Database deadlock on concurrent task_run insertscritical
Connection reset errors in self-hosted Prefect agent-server communicationwarning
Prefect event filter misconfiguration causes excessive database loadcritical
PostgreSQL connection pool exhaustion causes Prefect server errors and worker crashescritical
Database connection pool exhaustion from unlimited concurrencycritical
Connection count approaching max_connections limitcritical