Wednesday, May 13, 2015

Redis Use Cases

Redis -REmote DIctionary Service is a key value store which has the ability to store some data, called a value inside a key. This is the essence of a NoSQL database. It is touted as the world's fastest distributed NoSQL data store. Data is available in RAM but unlike Memcache it is also persisted and has failover, replication etc.
About 100K to 400K simple operations per second on a Intel Core 2 Duo 2.6GHz CPU.

Example string data structure
SET person:myname "Frybo"
GET person:myname

No Schemas and no schema migrations! ServiceStack is the most popular C# client API.
Redis is different from document database NoSQL like Couchbase, RavenDB and MongoDB in that primarily it is resident in memory and not persisted in disk as documents, and have no indexes. It's just a key value store where the value can be unstructured, semi and structured data types from strings, hash, lists (5 data types as of now). It is extremely fast though it has no indexes in most use cases and essentially the raw power of Redis comes from it being resident in memory.

Good use cases for Redis:
  • analytics
  • task queues
  • Caching
  • Data that expires
  • Cookie Storage
  • Search engines
  • Ad Targeting
  • Forums
  • Messaging (using Pub/Sub)
  • High I/O Workload
  • Geo searches
Bad Use Cases

  • More data than can fit in RAM
  • Data that fits relational model - have relations and need joins
  • You need ACID transactions

Side Note:
For  the task queues or queuing system, Resque is popular with Redis. Resque’s real power comes with the Redis “NoSQL” Key-Value store. While most other Key-Value stores use strings as keys and values, Redis can use hashes, lists, set, and sorted sets as values, and operate on them atomically. Resque leans on the Redis list datatype, with each queue name as a key, and a list as the value. Read http://girders.org/blog/2011/10/30/how-queuing-with-resque-works/
Must see videos:
 https://www.youtube.com/watch?v=8Unaug_vmFI
https://www.youtube.com/watch?v=CoQcNgfPYPc


No comments:

Post a Comment