Connection Pooling

Sombra uses connection pooling to efficiently manage database connections and prevent unbounded connections to upstream databases. This approach maintains a pool of connections for each database endpoint and stores these pools in an LRU (Least Recently Used) cache.

To enable connection pooling, you must set the environment variable ODBC_POOL_CACHE_SIZE based on the number of upstream database servers being scanned, plus some buffer to prevent cache misses.

The following environment variables allow you to configure the connection pooling behavior:

Environment VariableDescriptionDefaultRequired
ODBC_POOL_CACHE_SIZEMaximum size of LRU cache to store the connection pool per databaseNoneYes
ODBC_QUERY_TIMEOUT_IN_SECONDSMaximum time to wait for each ODBC query to execute before returning to the application60 secondsNo
ODBC_CONNECTION_TIMEOUT_IN_SECONDSNumber of seconds to wait for a request on the connection to complete before returning to the application0No
ODBC_LOGIN_TIMEOUT_IN_SECONDSNumber of seconds to wait for a login request to complete before returning to the application10No
ODBC_CONNECTION_MAX_POOL_SIZEMaximum number of open connections the pool will create100No
ODBC_CONNECTION_INITIAL_POOL_SIZEInitial number of connections created in the pool10No
ODBC_CONNECTION_POOL_SIZE_INCREMENTNumber of additional connections to create when all of the pool's connections are in use10No
REUSE_ODBC_CONNECTIONSWhether or not to reuse an existing connection instead of creating a new onetrueNo
ODBC_CONNECTION_POOL_SIZE_SHRINKWhether or not the number of connections should shrink to initialSize as they free uptrueNo