Thursday, September 26, 2013

Redis - when should I use it?

Hello, guys!

Some years ago, NoSQL movement gained force and many people started using NoSQL databases. One of the most popular NoSQL databases is Redis.

Many developers have questions about when should they use a NoSQL database. Each NoSQL database has specific scenarios to fit. If you use a NoSQL database in an inappropriate situation, you may not obtain the results you want, or even damage your data, depending on your choice.  I'll quickly list in this post the most common uses for Redis! Let's get started!

1. Counting things - Redis is very good for counting things. Since the data in stored in RAM in many cases, counting can be a simple bit operations. Check INCRBY operation.

2. Pub/Sub, the implementation of Publish-Subscribe Pattern. Redis is very good at this. Take a look at this post for more examples.

3. Redis is also very good for caching. It can be used in the same way as memcached. Take a look at this link to have more information about Redis acting as a cache. Amazon Web Services recently added in-memory cache support with Redis. Take a look at this article. To learn more about Amazon Web Services, take a look at our previous post.

4. Leaderboards - A common feature for many applications. Redis can easily implement this with ZADD and ZREVRANGE. Take a look at this tutorial to learn more about Leaderboards and Redis. Or take a look at this open source project that already implements a Leaderboard with Redis.

Redis can do much more things. Take a look at this presentation to have more ideas when and how to use Redis for your application. Also, this post is very interesting - it lists Redis most common use cases.

Thanks for reading our blog! Hope you have enjoyed!

No comments:

Post a Comment