colinmollenhour / Cm_RedisSession

Redis-based session handler for Magento with optimistic locking
208 stars 121 forks source link

How to reduce amount of session locks in Cm_RedisSession_Model_Session::read #142

Closed mabigo closed 6 years ago

mabigo commented 6 years ago

I get around ~10 failed lock attempts every 30 minutes. which results in unpleasant response time. Is there anything i could tune to boost read/write performance and reduce locks in general?

I run more or less clean Magento 1.9 setup with up-to-date Redis Modules/Libs, all recommended config values and lzf compression.

colinmollenhour commented 6 years ago

I don't have enough information to help you but the general advice I can give is make sure you don't have any fatal errors or excessively slow page loads. I don't know of any reasons you would see timeouts under normal operations so if there are no fatal errors and no slow page loads with locking disabled then you would need to do some more advanced profiling/debugging to get to the bottom of it.

mabigo commented 6 years ago

Thanks for the reply. neither fatal errors nor slow page loads are present. I will try to push some more data into profiler like concurrent requests, referrer, session keys/values to get broader overview. I will report if I find something

mabigo commented 6 years ago

For anyone who experienced the same problem: In my case failed locks have been caused by search engine bots sharing the same session. This may happen when using user agent normalization in FPC modules like Turpentine. For some unknown reason this piece of code does not work any longer: define('CM_REDISSESSION_LOCKING_ENABLED', FALSE);

I fixed the problem by modifying Turpentine to pass user agent detection to Cm_Redissession. Have not seeing any failed locks since then. Memory usage has not changed despite doubts.

mabigo commented 6 years ago

47 was useful