NativeSession::startSession taking more time in laravel - Sentinel

42 views Asked by At

As per new relic data NativeSession::startSession taking almost 80% of time ( 6sec) in Laravel some times

/**
 * Starts the session if it does not exist.
 *
 * @return void
 */
protected function startSession()
{
    // Check that the session hasn't already been started
    if (session_status() != PHP_SESSION_ACTIVE && ! headers_sent()) {
        session_start();
    }
}

My controller logic takes less than <800ms but entire request and response takes ~7 sec. Sometimes it will be faster (<1 sec).

For sessions I'm using Redis and I belive there is no session lock in Redis. So if muliple request comes from same user for same session it should not block as per theory.

Screenshot of new-relic data

It might be similar to session_start seems to be very slow (but only sometimes) where session start creating issue

I want some of the request doesn't wait for session as it is read only and won't corrupt the session value

Any solution to fix this or unblock requests?

0

There are 0 answers