When to use a key/value store such as Redis instea

2019-01-29 15:39发布

I have read great things about key/value stores such as Redis but I can't seem to figure out when it's time to use it in an application.

Say I am architecting a web-based application; I know what stack I am going to use for the front-end, back-end, database(s), etc..what are some scenarios where I would go "oh we also need Redis for X,Y, or Z."

I would appreciate node.js examples as well as non-node.js examples.

标签: redis
4条回答
霸刀☆藐视天下
2楼-- · 2019-01-29 16:05

I can't seem to figure out when it's time to use it in an application.

I would recommend you to read this tutorial which contains also use cases. Since redis is rather memory oriented it's really good for frequently updated real-time data, such as session store, state database, statistics, caching and its advanced data structures offers versatility to many other scenarios.

Redis, however, isn't NoSQL replacement for classic relational databases since it doesn't support many standard features of RDBMS world such as querying of your data which might slow it down. Replacement are rather document databases like MongoDB or CouchDB and redis is great at supplementing specific functionality where speed and support for advanced data structures comes handy.

查看更多
放我归山
3楼-- · 2019-01-29 16:05

One thing off hand is that Redis isn't a relational database. If you're going to be needing an SQL "JOIN" then you won't want to use Redis, nor any other non-relational database. Redis is faster though than most relational databases. If you're only going to be doing key:value pair queries, then you'll want to use Redis.

查看更多
家丑人穷心不美
4楼-- · 2019-01-29 16:09
  • I would love to use redis on the real time projects. I did recently for one gps tracking system which was previously built on mysql as a database.

    ADVANTAGE

    1. Every time the tracker broadcast data I do not need to open mysql connection and store on it. We can save it on redis and later migrate to mysql using some other process. This will avoid concurrent connection from mutiple tracker to mysql.
    2. I can publish all those gps data and other clients(javascript/android) can subscribe in a real time using message queue based on redis
    3. I can trigger real time alerts
查看更多
我命由我不由天
5楼-- · 2019-01-29 16:17

I think nothing explains better the use cases for Redis than this article: http://antirez.com/post/take-advantage-of-redis-adding-it-to-your-stack.html

I bet you'll have an aha! moment. ;)

A quote from a previous reader:

I've read about Redis before and heard how companies are using it, but never completely understood it's purpose. After reading this I can actually say I understand Redis now and how it's useful. Amazing that after hearing so much about it all it took was a relatively simple article.

查看更多
登录 后发表回答