Nakama Postgresql DB

FATAL: remaining connection slots are reserved for non-replication superuser connections

I’m getting a lot of errors like this. I think I’m having a problem with the max_connection value. 100 by default. How can I solve this problem?

Hey Emre, we allow you to customize the number of connections via our standard configuration file: Heroic Labs Documentation | Configuration see that we expose a value that is passed to postgres max_connections:

Before changing the value though you’ll want to ensure that the number if expected given your level of request usage. And also make sure you don’t have any custom SQL queries that could be unnecessarily inefficient which would increase the number of concurrent connections.Here are a couple of articles that cover the tradeoffs of setting a higher or lower max_connections value:

In Heroic Cloud we handle and calculate a lot of this for you based on your game patterns. In general we can’t advise on your own specific infrastructure setup.

This can also happen if you have custom SQL queries being executed in Go, and you haven’t closed the row. This makes you run out of database handlers and you could end up seeing your error.