Niklas Rosencrantz
Niklas Rosencrantz

Reputation: 26652

When to avoid memcache?

I see in many cases memcached is used. Can you give examples when to avoid memcached other than large files? How large files are appropriate for memcached?

Thanks for your answer

Upvotes: 2

Views: 397

Answers (2)

indika
indika

Reputation: 923

I have seen Memcached is used to store session data.As my point of view its not recommended storing sessions in Memcached.If a session disappears, often the user is logged out,If a portion of a cache disappears or either due to a hardware crash it should not cause your users noticable pain.According to the memcached site, “memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.” So while developing your application, remember that you must have a fall-back mechanism to retrieve the data once it is not found in the Memcached server. Here are some tips,

  • Avoid storing frequently updated data in Memcached.
  • Memcached does not ship with in-built security mechanisms. So It is your responsibility to handle security issues.
  • Try to maintain predefined fixed number of connections in the connection pool because each set/get operation is a new atomic connection to the Memcached server.
  • Avoid storing raw data coming straight from the database rather than storing processed data

Upvotes: 0

Amber
Amber

Reputation: 526563

If you know when to bust the caches to prevent out-of-date things from being cached, there's not really a reason to avoid memcache for anything small unless it's so trivial to compute that it'd be approximately as long to hit memcache as it would to just compute it.

Upvotes: 3

Related Questions