Increase in Postgresql CPU usage from Sidekiq
Summary
Since a few days, our Gitlab Postgresql is under heavier load, using twice as much CPU, even when our instance is not used (eg: during out of office hours). It might comes from Sidekiq / Rails.
Stack:
- Kubernetes (EKS) 1.32
- RDS Postgresql 16.8
- GitLab 18.5.1-ee
After a bit of drill-down, I can now pin-point this CPU increase to Sidekiq and to the following request:
SELECT a.attname FROM ( SELECT indrelid, indkey, generate_subscripts(indkey, ?) idx FROM pg_index WHERE indrelid = ?::regclass AND indisprimary ) i JOIN pg_attribute a ON a.attrelid = i.indrelid AND a.attnum = i.indkey[i.idx] ORDER BY i.idx
Relevant logs and/or screenshots
Here is an example where I disable all Cron from Sidekiq, before enabling them back.

Possible fixes
I found an issue and a fix on rails' Github: https://github.com/rails/rails/issues/55648
Edited by 🤖 GitLab Bot 🤖