libzbxpgsql
libzbxpgsql copied to clipboard
Connection pooling
Connection pooling is currently recommended via PG Bouncer/other (http://cavaliercoder.com/libzbxpgsql/documentation/connection-pooling/).
There is an opportunity however to reuse a single connection for each agent thread. This would mean that:
- connection overhead is significantly reduced
- server version information can be persisted between each query to simplify version switching of queries
We would need:
- a hash of the connection so multiple connections can be monitored per thread
- a way to query the state of a connection and reconnect if needed
- to pass server information to each metric handler so it knows which version to query
- reasonable timeouts
- cleanup on exit