Description
Our requirement is to execute thousands of queries per second on PostGres. Currently we are trying few hundred queries per second. We have database server with fairly high configuration (32 GB, 16 core).
ulimit set to 100000, database/sql max open connection config set to 30000 and max idle to 5000
Queries execute well till certain point but after some time cpu usage reaches 100%. and "connection reset by peer" error occurs. This in turn leads in application panic.
After some short interval when cpu usage starts gradually dropping from 100% . One approach we wanted to take was retry queries for some interval so that queries at least get chanceto get executed when cpu usage drops. Here this article they say default library mechanism is to retry 10 times and logic is hard coded https://www.vividcortex.com/blog/2015/01/19/gos-connection-pool-retries-and-timeouts/.
Could you help with how can I go about retrying queries by specifying certain retry time interval? Or is there any other way to resolve this problem?