I am seeing this behaviour where the AWS RDS Proxy TargetGroup is set to take 75%
of the available connections. As per documentation, RDS proxy should only take up these connections as required and not try to take them all.
What I am actually seeing is something like this -
where the currently 'borrowed' connections is same as the number of incoming client connections but the 'total' connections that are taken up is around the 75% mark of the max connections.
What could be the cause for this ? The application that is using this database is not holding any of these connections, this i've checked from the pg_stats_activity
table.
Any pointers would help.
UPDATE:
The large connections are fine, even if they are idle
, as long as they are re-used the proxy. In my case, the problem seems to stem from 'pinning' of connections due to a SET client_encoding
statement before every connection and thus not allowing the proxy to re-use the connection.
There's a value called EXCLUDE_VARIABLE_SETS
which should exclude SET statements from being pinned but it is not doing what it is documented to be.
I have also tried moving this query to init query but no luck.