I have two servers connecting to a PostgresSQL 9.6 db hosted on Azure. The servers are doing one thing - hitting the Postgres db with a SELECT 1 qu
You need to set a min pool size. Doing so ensures that this amount of connections remains open to the DB regardless of the pool usage.
By default (at least for NPGSQL), the min size is 0, so if the connection is not used for a while, it will be closed.
In your test, you do one call every 5 seconds, which is not much, and the pool might decide to close the unused connection. According to the doc it should keep it open for 300 seconds though, not just 15