1

I am using AWS RDS PostgreSQL 9.4. I am facing an issue of very high CPU utilization. Instance type is t2.xlarge (16 gb ram).

All the time I can see very low ram usage i.e. 14-1 GB free.

But in contrast, cpu utilization is 100%, with 100 active connection.

I have checked all my query in pg_stat_activity, slow query logs. Nothing found wrong. Though it touches 100% CPU utilization and my app becomes non functional even for very less active connections.

What is solution to reduce high CPU utilization against such high RAM?

When it reaches 100% CPU, my write IOPS was 400 count/second and read IOPS was 8.5 count/second.

I need to handle 300 concurrent connections sometimes when there is very high traffic on my website. What should be the ideal configuration of the RDS instance?

1
  • You might find a better response on ServerFault. Commented Feb 14, 2019 at 21:27

1 Answer 1

0

While I support taking questions about the configuration (such as the ideal work_mem setting that would allow more queries to be served from memory instead of disk) elsewhere, high CPU usage is also related to sub-optimal queries, and thus partly a software question.

From a software perspective: even if there are no extremely long queries getting stuck, there may still be extra capacity available by making the current ones return faster.

  1. The load in this question sounds biased towards write operations, but if these include many updates or if the reads are taking disproportionately long, it may still be possible to finish these more efficiently with indexes covering those columns.

  2. If there are frequent inserts or deletes, it may help to batch these in the application and save of the queries' overhead in exchange for extra latency. This would also let you reduce the application's pool size and avoid some overhead from having 100 parallel connections when 50 may actually let queries finish faster.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.