Laravel - high CPU usage after deployment
Hi Everyone. I have a serious problem with deployment of Laravel app. It's a news website, nothing complicated. Whole homepage is cached in Redis as a plain HTML, also queries results are stored in Redis so MySQL usage is really small. App is fully functional so we dedicided to test it in production environment during the night. After deployment we noticed that CPU usage jumped to 90-100% on all 12 cores so the app was working very slow or not working at all. There were about 400 users, 17-20 requests per sedond. We tried to change server settings (PHP-FPM ex.) but with no success. We made some tests using Apache Benchmark and it showed that with 10 concurrent users CPU usage is about 80-100%. Next we repeat tests with clean Laravel (without our app) and results were similar. What we use:
- Laravel 9.0
- server: 12 cores, 128 GB RAM
- Plesk Obsidian 18.0.48, CentOS 7.9.2009
- Apache + Nginx as a reverse proxy
We noticed that Nginx caching can reduce CPU usage in applications like Wordpress or Drupal. But I suppose that Laravel doesn't use it. Does Laravel need to be configured to work with Nginx reverse proxy and caching in some special way?
I really don't know what to do. Had anyone a similar problem? Any help will be appreciated as the topic is urgent, there is a lot of pressure from the CEO to implement.
Please or to participate in this conversation.