大网数据广告活动
服务器运维问答

High Postgres-RDS CPU usage after migration

· 52CE 我爱测

We deployed an update of our software today (3 EC2 instances) and made a migration to our RDS (db.t2.medium, Postgres) which added one column to a table with ~15 rows. Before migrating, we had a CPU usage of around "2". After the…

问题原文

原帖链接 · trnc · CC BY-SA 3.0

We deployed an update of our software today (3 EC2 instances) and made a migration to our RDS (db.t2.medium, Postgres) which added one column to a table with ~15 rows. Before migrating, we had a CPU usage of around "2". After the migration the CPU usage increased to "60". After a db reboot, it dropped, but went up again.

As a sidenote: After migration we tried to connect using a GUI and it hanged while SSL-verification. We restartet the GUI and it worked again.

Any advice on this? Here is a screenshot with current metrics. You can clearly see the increase in usage.

We currently use PostgreSQL 9.6.2!

已采纳解答

原帖链接 · trnc · CC BY-SA 4.0

We fixed this ourselves:

The problem was, we didn't shut down our background service, which made several transactions while updating our software and the db. These transactions polluted the database. We found these transactions using this snippet:

SELECT pid, age(query_start, clock_timestamp()), usename, query,state 
FROM pg_stat_activity 
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' 
ORDER BY query_start desc;

After flushing our redis queue and restarting the background services, the CPU went down to 2% again.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-11-03)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。