Skip to content

Magento 2.4.6 – any way to make Memcached work – Please Help!

Is there any way to configure memcached to work on Magento for session storage. Let’s say it works, and you can really see the difference, especially in the admin backend.

Everything works fine until, for example, when I open Catalog / Products and need to load 200+ products per page, problems arise there.

env.php:

    'session' => [
    'save' => 'memcached',
    'save_path' => '127.0.0.1:11211'
],

First i got red box with text:

“A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.”

Browser console:

[Error] Failed to load resource: the server responded with a status of 500 ()

https://xxxxx.xx/xxxxxxxxxxx/mui/bookmark/save/key/aa0e91ea2ab9dc5b54161be5a9695013137eecb6ff5c3a215d9efb22f254f828/?isAjax=true

Var/report:

{"0":"Warning: SessionHandler::read(): Unable to clear session lock record in /home/customer/www/xxx/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 24","1":"#1 SessionHandler->read() called at [vendor/magento/framework/Session/SaveHandler/Native.php:24]n#2 Magento\Framework\Session\SaveHandler\Native->read() called at [vendor/magento/framework/Session/SaveHandler.php:212]n#3 Magento\Framework\Session\SaveHandler->callSafely() called at [vendor/magento/framework/Session/SaveHandler.php:125]n#4 Magento\Framework\Session\SaveHandler->read()n#5 session_start() called at [vendor/magento/framework/Session/SessionManager.php:186]n#6 Magento\Framework\Session\SessionManager->start() called at [generated/code/Magento/Backend/Model/Auth/Session/Interceptor.php:149]n#7 Magento\Backend\Model\Auth\Session\Interceptor->start() called at [vendor/magento/framework/Session/SessionManager.php:123]n#8 Magento\Framework\Session\SessionManager->__construct() called at [vendor/magento/module-backend/Model/Auth/Session.php:105]n#9 Magento\Backend\Model\Auth\Session->__construct() called at [generated/code/Magento/Backend/Model/Auth/Session/Interceptor.php:14]n#10 Magento\Backend\Model\Auth\Session\Interceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]n#11 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]n#12 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#13 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170]n#14 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]n#15 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]n#16 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]n#17 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]n#18 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#19 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:170]n#20 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]n#21 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]n#22 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]n#23 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]n#24 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#25 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:206]n#26 Magento\Framework\ObjectManager\Factory\AbstractFactory->parseArray() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:182]n#27 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:276]n#28 Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:239]n#29 Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:34]n#30 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:59]n#31 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#32 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/App/FrontController.php:109]n#33 Magento\Framework\App\FrontController->__construct() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:14]n#34 Magento\Framework\App\FrontController\Interceptor->__construct() called at [vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:121]n#35 Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject() called at [vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:66]n#36 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:70]n#37 Magento\Framework\ObjectManager\ObjectManager->get() called at [vendor/magento/framework/App/Http.php:115]n#38 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]n#39 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]n","url":"/admin_nxxi29/mui/bookmark/save/key/aa0e91ea2ab9dc5b54161be5a9695013137eecb6ff5c3a215d9efb22f254f828/?isAjax=true","script_name":"/pub/index.php","report_id":"2cd732cb68493b03475a72e06fe6f989c1248e988a1d2e3b489c96f5f5038795"}

Log/exception.log:

main.critical: Exception: Warning: SessionHandler::read(): Unable to clear session lock record in /home/customer/www/xxx/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 24 in /home/customer/www/xxx/public_html/vendor/magento/framework/App/ErrorHandler.php:62

Log/system.log:

[2023-05-08T01:22:33.197921+00:00] main.ERROR: Warning: SessionHandler::read(): Unable to clear session lock record in /home/customer/www/xxx/public_html/vendor/magento/framework/Session/SaveHandler/Native.php on line 24 [] []

Setup:

Magento CE 2.4.6,
4 CPUs,
8 GB RAM,
50 GB SSD

I beg you for help! Thank you in advance.