Database Connection Pooling
When running the On-Premise Agent, Superblocks database integrations support connection pooling. That is, when a backend API using a database integration is executed, the agent caches the connection so that subsequent queries can reuse it, instead of establishing a new connection. The default connection pool settings can be adjusted with the following environment variables.
Environment Variable | Description | Default |
---|---|---|
SUPERBLOCKS_CONNECTION_CACHE_TTL_MS_DEFAULT | Time connections remain open / idle in the pool (setting this to 0 disables connection pooling) | 60000 ms |
SUPERBLOCKS_CONNECTION_CACHE_MAX_CONNECTIONS_PER_DATASOURCE | Max pool size for a given DB integration | 5 |
SUPERBLOCKS_CONNECTION_CACHE_MAX_CONCURRENT_CONNECTIONS | Max pool size across all integrations | 1000 |
Note, the max connection limits do not prevent more concurrent connections from being created when needed. They are limits on the number of connections kept in the pool, but the agent will still serve new requests normally regardless of whether any of these limits have been reached. New requests beyond the max pool limit will create new connections that tear down immediately after completing, versus being kept open in the pool.