views:

517

answers:

6

We need a caching solution that essentially caches data (text files) anywhere from 3 days up to a week based on user preferences and criteria. In this case memory based caching does not make sense to us. We were referred to MemcacheDB however I also thought of some NO SQL solutions.

Our current application uses RDMS (MYSQL) and I guess it makes sense to use MemcacheDB however NOSQL does appeal as it is something more on the horizon. However we have not deployed a production level application under NOSQL and the beta stuff does not settle well with management/investors. Any how what are your thoughts and how would you address it?

Thank You

A: 

I'd also take a look at Cassandra ( http://cassandra.apache.org/ ). I've tried MemcacheDB and CouchDB, somehow found Cassandra more appealing (Dunno about PHP since i work with Coldfusion). Here's related question http://stackoverflow.com/questions/2508649/cassandra-php-module

zarko.susnjar
+2  A: 

If you're worried about the appeal to management and investors, and the current system (you mention MySQL) works, why would you change? You're moving from a fairly stable project to projects still in beta, and what value are you adding if the current system already works?

Steven Schlansker
Our application is currently MYSQL based however we don't have a caching system in place. Since file based caches are faster, we were looking at the above mentioned technologies.
jini
A: 

CouchDB does already some caching: when you get a document the server also sends the HTTP ETag header (it's the same as the document revision in CouchDB).

The next time the browser asks for the same document it sends the Etag received. If the document hasn't been modified the server responds with the HTTP code 304 Not Modified and your browser retrieves the document from its local cache.

However if you have to cache files for different times based on user preferences, even if the text file changes, probably your best option is to write custom code that sends the approriate HTTP caching headers based on the user preferences.

For completeness another good option is Redis. You get performance comparable to Memcache but Redis also supports various data structures (hashes, lists, set, sorted sets) and atomic operations.

filippo
If you're interested in high performance, think twice about CouchDB. CouchDB is really a nice (backend) database and also very powerful due to easy replication BUT it is not the fastest. So if you're dealing with problems concerning latency in context of scalability, think about alternatives.
PartlyCloudy
A: 

If you memcached with persistence, you should check out Redis. It has all the memecached functionality (and more) along with persistence.

I have not tried it myself, but I do remember reading that Redis also supported the memcached API as well.

Scott Watermasysk
+1  A: 

As mentioned above, all CouchDB resources contain etags.

What wasn't mentioned is that you can put any HTTP caching solution in front of CouchDB and have it do etag based caching. This way you can use Varnish, nginx, whatever you want.

mikeal
+2  A: 

CouchDB and MongoDB are both great databases, but they are terrible choices for a cache layer on top of your existing RDBMS. Besides the fact that they are still fairly immature, they don't suit the purpose at all. Also, speed-wise you'd be better off going without a cache layer than using CouchDB or MongoDB--they are both slower for simple read/writes than even MySQL. Yes, the NoSQL databases are "cool", but that does not mean you should use them for something they were not meant to do.

I'd go with Memcached, as it's just about the fastest and lightest thing you'll find, and it's well-known and well-supported.

musicfreak