TheOne
TheOne

Reputation: 11159

memcached vs a db based key value table?

Which is faster? A two column select to a traditional db or a query to memcached?

If the db query is roughly as fast, why bother with adding another layer to your stack (assuming you don't care about expiring entries)?

Wouldn't it be easier to add a two column table (key varchar, value text) which can be used for all caching purposes?

Upvotes: 3

Views: 406

Answers (1)

Christian Dahlqvist
Christian Dahlqvist

Reputation: 1665

When you decide where to cache the results of complex queries, you should consider throughput as well as latency. If you put it in the database, you get a simpler solution, although it is unlikely to be able to handle as many requests per second as if you instead cached the data in memcached (or some other NoSQL database).

Upvotes: 1

Related Questions