I have a problem with my web page made with Sulu CMS (based on Symfony). The page runs on a hosting with PHP 8.2.8, Sulu 2.5.14 and Symfony 6.3.12.
The problem is that first load of webpage after about 3 hours of dormancy is very slow. It takes about 30 seconds to load an entry page. Page should take maximum 1000 ms for load.
After the first load all loads and reloads are relatively fast (even with browser caching disabled) in about 700 ms.
This is a example of first slow load:
I read about Symfony performance improvements, so I enabled APCu cache, ran composer autoloader optimizer, cleared cache, rebuilt Sulu for production.
This all helped the page, but the very long first load problem is persisting.
I checked cache folder permissions and they are set correctly.
I do not think that this is a hosting resources problem, because I observed the CPU and RAM consumption and this page now uses less than 5% of both.
I suspect that this is some sort of cache problem, but I do not know which cache.
I am experiencing the same problem in local environment.
I do not know what else am I doing wrong.
Resources I studied:
- https://symfony.com/doc/current/deployment.html
- https://symfony.com/doc/current/performance.html
- https://dev.to/proxify_dev/how-to-optimize-symfony-project-performance-1fmn
- Symfony first time slow loading
- https://github.com/api-platform/core/issues/6020
Any help or suggestion will be greatly appreciated.