I’m running Kong in DB mode with Postgres and I’m finding it’s exhausting all my DB connections. My suspicion is that Kong isn’t releasing/closing DB connections properly after it uses them.
I’ve setup a “kong” postgres user that’s the owner of the “kong” database. I set the max_connections for the “kong” PG user to 200. Seems like 200 max connections should be more than enough for an API gateway proxy.
However, frequently Kong is throwing an error like the one below.
2019/10/09 17:54:05 [error] 31#0: *37149566 [kong] init.lua:98 FATAL: too many connections for role “kong”, client: 127.0.0.1, server: kong_admin, request: “GET /services HTTP/1.1”, host: “localhost:8444”
Is the Kong Admin API the only component that connects to the DB or does Kong ingress controller connect to the DB too?
Assuming Kong is properly closing its DB connections what would you recommend for max_connections? Disabling max_connection on the “kong” DB user results in all PG connection slots being exhausted and my other apps fail to acquire a DB connection because Kong takes all the connection slots.
Is there any other suggestions you’d recommend to resolve this issue?