Node is 20x faster Than .NET Core in Connecting to Postgres

前端 未结 3 1066
醉酒成梦
醉酒成梦 2021-01-12 14:05

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

3条回答
  •  猫巷女王i
    2021-01-12 14:38

    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

提交回复
热议问题