Are you leveraging the power of Redis? – by John Hall Founder Loyhall.com, Co-founder Tradesy.com

Redis is known as either a NoSQL database or a cache.    We all know that calling anything a “NoSQL” database doesn’t really tell us much about it, and using Redis as a cache is like using a Ferrari for a golf-cart… it can do a lot more than drive you from hole to hole.  So for those who aren’t familiar with Redis, I’m going to lay out what I think its best use cases are.

But first a note of caution:  I see a lot of tech articles that try to compare various NoSQL databases against each other.  They will benchmark Redis vs Mongo, ElasticSearch vs Splunk, etc.   Most of these comparisons are pointless and don’t tell you the whole story.  The problem is that almost all of these tools are great at what they do, but they are almost all made to do different things!  So I encourage you to learn what each type of NoSQL database is great at, and focus on only leveraging it’s strengths without trying to make it do something it was never made to do.

As a data tool, Redis lives in a very special place.  It excels as a read-heavy production data-source.  It has seen benchmarks of between 70k and 500k queries per second on a single server, depending on how you use it.

Redis is incredibly:

  • Stable
  • Fast
  • Light-weight
  • Simple to use

A great use-case example is for web pages and API calls to which an ID is passed, for example a user id, or a product id.  Pulling the associated product or user data (no matter how much) from ANY other source will take longer than Redis.

If you use a key value pair, with the key being the ID, and the value being a data structure of your choice (JSON for example), Redis can fetch it in a couple of milliseconds.   That’s a lot faster than other NoSQL databases and potentially hundreds of times faster than a SQL database like Oracle or MySQL.   But the key is to put all of the information you will need into the value of the key value pair, because unlike a SQL database or filtered search products like ElasticSearch and Solr, you can’t look for anything in Redis, you have to know where it is.  You have to know the key.

Another great use-case for Redis is for application data that doesn’t change very often, like category/sub-category data, and business logic constraints.  Basically, anything that you don’t want to hard-code but at the same time don’t want to load from the SQL database on each page load.

I’ve found that Redis alone will help your site or app scale by a huge degree.   As often as possible read your data from Redis!

A lot of companies are using Redis these days, but I’m still surprised that it’s not more.   Perhaps it’s because people don’t understand the most obvious use cases.  And now with the stable release of the Redis cluster, companies will be able to reach speed & scalability levels never seen before.  I really hope to see more companies take advantage of this great open-source database.

John Hall can be reached at www.linkedin.com/pub/john-hall

Pin It on Pinterest