I am experiencing CPU spike issues on my EBS instances. At the beginning of some minutes, the CPU usage of php-fpm occasionally spikes for a short time before returning to normal. I don’t have any cron jobs in my Laravel project that could be causing this issue. I can’t understand this behavior at all. When the CPU spikes, my response times decrease significantly. This problem occurs at exactly the same seconds of the minute (02,04,06).
When I log requests that take longer than 1 second in my Nginx access.log, these results appears:
14/Sep/2024:00:14:02 +0000
14/Sep/2024:01:39:04 +0000
14/Sep/2024:01:00:06 +0000]
14/Sep/2024:01:13:02 +0000
14/Sep/2024:10:06:04 +0000
14/Sep/2024:09:50:02 +0000
For each time period, an average of 20-25 requests take longer than 1 second,My average response time is around 0.018 seconds, with 90% of requests completing in under 0.05 seconds so I am sure my php script is lightweight.
Project and system specifications:
Project and system specifications:
- Instance Type : T3 small (Amazon Linux 2023 AMI)
- Framework: Laravel
- Database: ElastiCache Redis (Redis database is not shared with any other project)
There is a video showing this behaviour, Please examine the change in idle CPU in the top command at 06:45:04 and 06:46:04:
https://drive.google.com/file/d/1-iaTlionP52x5GyPm46maRjyOqKuVGep/view?usp=sharing
I cannot found problem yet.