I posted this case also under CakePHP Github Issues. The CakePHP member othercorey gave me the advice to check Authentication\Authenticator\SessionAuthenticator
and here I found the reason:
in vendor/cakephp/cakephp/src/Http/Session.php
–> In the function start()
–> The call if (!session_start()) {
The full code:
if (!session_start()) {
throw new RuntimeException('Could not start the session');
}
Then the solution was quite simple. I am using SSE and this was the reason for these unpredictable delays. After calling session_write_close()
in the SSE function the page loads <2 seconds.
When I got some time I will check if sessions stored in the database may be another solution.
CLICK HERE to find out more related problems solutions.