You say the normal way to use memcached. But Session is something special. If the web lose the session data. It's doesn't Matter. And session data were userd frequently. So The best solution is just put the session data in memcached.
-- Blog: http://www.chenzongzhi.info Twitter: https://twitter.com/baotiao Git: https://github.com/baotiao On 2012-3-19, at 下午7:36, Alexander Kolesen wrote: >> We have one big server that serves our rails web application. >> >> I'm new to using memcached and I'm planning to use it for storing session >> data, I mean as a session store. What happens if memcache consumes too much >> memory? Should I monitor the memcached process now and then and restart it? >> Or, can I set memory limits for it so that it won't exceed the allocated >> space? > > You shouldn't use memcached as a persistent storage. > Your issue as a rule implemented in the following maner: > - store the session's data in the persistent storage (DB, files etc.) > - cache the session's data in the memcached > > All the read requests should go to the memcached. If there is an empty > result - go to the persistent storage and cache the result in the > memcached. > All the write requests should update the both persistent storage and > memcached.
