使用sqlx
和几个并发连接,我很快就遇到了Too many open connections
的问题。限制db.DB.MaxOpenConnections
实际上摆脱了问题并激活了我希望的连接池。
现在我们在一些机器上进行了测试,测试中确切地说太多的开放连接没有发生不同的错误:
read tcp [::1]:54883->[::1]:5432: read: connection reset by peer
read tcp [::1]:54886->[::1]:5432: read: connection reset by peer
read tcp [::1]:54884->[::1]:5432: read: connection reset by peer
read tcp [::1]:54887->[::1]:5432: read: connection reset by peer
read tcp [::1]:54885->[::1]:5432: read: connection reset by peer
read tcp [::1]:54888->[::1]:5432: read: connection reset by peer
…
Postgres日志不会透露任何内容。这可能发生在网络堆栈上吗?我还能做些什么来调试这个?我无法在本地重现它。