Yii2 session open is slow when ajax request

Yii2 session open is slow when ajax request.

It takes more time to response.

Please check and provide solution.

Are you making lots of requests? If yes, default session storage which is files could be blocking. Try using something like Redis.

I see it takes like 1 minute which is way too much, what is your normal requests like?

Its just single request only. I am write this code in Module.php file in inside of module.

Its work perfectly in every normal get and post requests. But takes too much time when make ajax request.

I’m using PHP7.

It doesn’t matter. Default session storage wasn’t changed since 5.3 or even longer.

I looked at the attached image - it seems like the "Loading module: provider" is slow, not the session.

Or did I read the log wrong?

Good catch, amnah :)