checkId: check.db.pool.size plugin: stellaops.doctor.database severity: warn tags: [database, postgres, pool, configuration]

Connection Pool Size

This Doctor check validates that a service’s Npgsql connection-pool configuration is sane for the PostgreSQL server it talks to — before the pool is put under load. It is the configuration-time counterpart to check.db.pool.health, which inspects live runtime pressure.

What It Checks

Parses the Npgsql connection string and compares Pooling, MinPoolSize, and MaxPoolSize against PostgreSQL max_connections minus reserved superuser slots.

The check warns when pooling is disabled or when MaxPoolSize exceeds practical server capacity. It returns an informational result when MinPoolSize=0.

Why It Matters

Pool sizing mistakes create either avoidable cold-start latency or connection storms that starve PostgreSQL.

Common Causes

How to Fix

Docker Compose

docker compose -f devops/compose/docker-compose.stella-ops.yml exec postgres psql -U stellaops -d stellaops -c "SHOW max_connections;"
docker compose -f devops/compose/docker-compose.stella-ops.yml exec postgres psql -U stellaops -d stellaops -c "SHOW superuser_reserved_connections;"

Set an explicit connection string:

services:
  doctor-web:
    environment:
      ConnectionStrings__DefaultConnection: Host=postgres;Port=5432;Database=stellaops;Username=stellaops;Password=${STELLAOPS_DB_PASSWORD};Pooling=true;MinPoolSize=5;MaxPoolSize=25

Bare Metal / systemd

psql -h <db-host> -U <db-user> -d <db-name> -c "SHOW max_connections;"

Kubernetes / Helm

kubectl exec -n <namespace> <postgres-pod> -- psql -U <db-user> -d <db-name> -c "SHOW max_connections;"

Verification

stella doctor --check check.db.pool.size