We are using rds(postgres) with instance type as db.m4.2xlarge.
Usually most of the time number of connections are 8-10. But on some occasion as the number of connections increases to 100-200. DB becomes non-responsive. DB non-responsiveness we have seen many time in cases of sudden spike in number or read connections(so even in cases where connections have increases from 10 to 100).
Queries which are being executed at max takes 2sec to execute.
My application server is running on django/python stack(with Gunicorn). Latency of these servers go high when DB server response time increases.
Any changes in configuration of postgres rds we should do to improve performance(currently most of the settings are default) ?
select now()-query_start, query from pg_stat_activity where state<>'idle' order by 1
), how large RDS disk size (small sizes are extremely slow), which non-default db parameters you use. You may also use pg_stat_statements extension to see worst queries from some time span etc.