I have a question regarding Memcache and session lock for user session. I want to lock or do something that will prevent Thread Interference for user session...
开发者_开发问答We have a situation like so:
If server is at max, user is redirected to "free" server, but a this point some of data are wrong...
So does anybody has any sugestions :?
All your Memcached servers must be listed in your app/etc/local.xml
file and be the same for each server, that way they will share the session data.
Alternatively - or additionally - a better load balancing policy would be "consistent hashing". Users would be spread evenly over the available servers and each user would be handled by the same server, and hence, same session.
If you want to spread your sessions across multiple servers I would recommend using consistent hashing, as it reduces the number of misses when you add/delete servers.
Memcached does not support locking, but I believe a the new memcached module has a workaround that provides support for locking. I have however not used it yet.
精彩评论