Showing results for 
Search instead for 
Did you mean: 

CPU reach 100% when clear magento cache

CPU reach 100% when clear magento cache

Hello all,

When I run:

bin/magento cache:clear


bin/magento cache:flush

php-fpm active process increase and make 100% CPU. After some mins, depend on current traffic, it's normal back.

System details:

Cloud Provider: AWS
OS: Ubuntu 20.04
Php: 7.4
Magento: 2.4
Frontend: PWA - Nodejs Cache: Redis - AWS fully managed (Session, FP cache) DB: RDS auora
Instances: Ec2 with autoscaling group.

I tried with some instances type: 2CPU+4GB RAM or 4CPU+8GB RAM or 8CPU+16GB RAM and even for more instances one time, it's always full CPU. When I read mage2 docs, I doubt that the root cause come from Graphql caching:

GraphQL allows you to make multiple queries in a single call. If you specify any query that Magento does not cache, Magento bypasses the cache for all queries in the call.

But I have some confuses because even if I clear config cache, it's still happen.

Please give me some advices. Thanks.


Re: CPU reach 100% when clear magento cache

Hello @hoangnguye8361,


This problem can occur due to many reasons. If you have any third-party extension then it will happen due to the problem of the code or something else. I can't tell you the perfect reason. But you can check out this. 


Hope this will help you.


Click KUDOS and accept as a solution.

Thank you!

Re: CPU reach 100% when clear magento cache

Thanks for your advice.

I'm a devops so how can I benchmark/tracking to know exactly what module make it happen?