Original: Cassandra instead of Redis?
Recently with Cassandra more gradually, in addition to the previous 360 cases, at the beginning of the month Qcon Shanghai 2013 Fence also introduced its use case. The million-user fashion sharing web feed system extension Practice article refers to the case of Fashiolista and Instagram migrating from Redis to Cassandra. Considering that there are still many netizens discussing the usage of Redis, is Redis a database, memory, or key value store, and Redis and memcache in real-world scenarios, so simply talk about the difference.
First, Redis and Cassandra are completely nosql products for different usage scenarios. The former is the key value or key list data for small-scale memory, which is suitable for storing large-scale data. So this article mentions that the main reason for switching, perhaps, is that the pre-Redis usage scenario is inappropriate, and that it is understandable to quickly implement functionality with handy tools in the early stages of a startup project.
Several usage scenarios for Redis
- Large number of visits
- Key value or key list data structure
- Small capacity, controllable, can be all put into memory. Because Redis is a single-threaded design, large value results in a certain blockage of subsequent requests. In addition HashSet when Hgetall due to the presence of traversal operations, it is also not suitable for collections too large. If the data exceeds the single machine capacity can be distributed to multiple machines using the conventional sharding method
- Scenarios that need to be persisted
Above four o'clock the general condition should be the necessary condition. As a result, the user profiles and friends List of common websites are available for use with Redis. Since Redis has all the features of memcached, is there any discussion that memcache can quit? I would prefer to choose memcached rather than redis in the following cases
- Simple key value that does not need to be persisted, such as 100 bytes or less. In this case, the use of memcached space is more economical and easier to maintain.
- There are rolling expiration requirements, such as the session of the website, each new logged-on user periodically expires.
The relevant point of view can also refer to memcached really outdated?
Several questions
- Since Redis can be persisted, does the friend list saved with Redis still need to be saved to the relational database?
- Mobile games Clash of Clans in the Castle attribute, and the user's gold, holy water, trophy what data structure is used to save?
Cassandra instead of Redis? (ext.)