Prev | Current Page 262 | Next

Brad Ediger

"Advanced Rails"

0.0.13:11211', '10.0.0.14:11211')
end
By default, memcached acts as a cache. It takes a -m argument that specifies
how much memory to use, and if it hits that limit it will start deleting the oldest
records to make room for new ones. This is usually undesirable for session storage. If
you use memcached for session storage, ensure that you have enough memory in the
cache to hold all current sessions.
Depending on your tolerance for lost sessions, you may want to consider running
memcached with the -M option. This option tells memcached to return an error when
the memory is full, rather than deleting items from the cache.
Remember that memcached stores data in memory only.* If you stop the
memcached process, you instantly lose all sessions. There is a new session store,
* Storing persistent data in memcached is actually a slight abuse of what it was designed for, but it??™s really darn
fast so no one complains.
176 | Chapter 6: Performance
db_memcache_store, which uses memcached as a cache on top of database sessions,
so sessions will not be lost when the memcached server is stopped. It is still slow, but it
looks promising. It can be installed as a Rails plugin from http://topfunky.net/svn/
plugins/db_memcache_store/.
CookieStore
By default, Rails 2.0 assumes that the session will be small (usually a user ID and any
flash data) and stores the entire session in a client-side cookie.


Pages:
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274