SLOW on new server - check-backend-session!

I moved all the files to a different server and it seems to be working there are ridiculous load times. Google performance shows long access to “check-backend-session”. Any ideas?

Well … var_dump debugging for the win :slight_smile:

The route is implemented registered in /modules/Cockpit/admin.php

# line 126++
// check + validate session time
$app->bind('/check-backend-session', function() {

    session_write_close();

    $user = $this->module('cockpit')->getUser();
    $status = true;

    if (!$user) {
        $status = false;
    }

    // check for inactivity: 45min by default
    if ($status && isset($_SESSION['cockpit.session.time']) && ($_SESSION['cockpit.session.time'] + $this->retrieve('session.lifetime', 2700) < time())) {
        $this->module('cockpit')->logout();
        $status = false;
    }

    return ['status' => $status];
});

As you can see there is not much happening - but placing a few markers and measuring the time spent for each step in the function might turn up which part is taking so long.

Maybe it’s already the session_write_close; in which case I’d suggest some read up on session lockup like this hopefully not completely outdated article here PHP Session Locking: How To Prevent Sessions Blocking in PHP requests

Thx! Digging in to all this.