In the use of Redis process, we found that a lot of redis different from the memcached, but also different from the characteristics of MySQL.
(This article mainly discusses Redis is not enabled for VM support) 1. Schema
MySQL: Need to design beforehand
Memcached: No design required
Redis: Small systems can be used, but if you want to plan and use Redis, you need to do something similar to the following planning data items: Value What is saved, such as user data Redis data type: such as String, List data size: such as 100-byte record number: such as 1 million (decide whether the need to split) ...
The above plan is a schema, why Redis need to design schemas in advance for large projects. Because the Redis server has capacity limits, the data capacity can not exceed the physical memory size, while taking into account the scalability of business data, the number of records will continue to increase, the contents of a single record will grow, so need to plan the capacity in advance, Data architects use schemas to determine whether the current business Redis requires a "split-table" to meet scalable requirements. 2. Capacity and bandwidth planning
Capacity Planning
MySQL: < hard drive size
Memcached: < RAM
Redis: < RAM
Bandwidth Planning
Because Redis than MySQL faster than 10 times times, so bandwidth is also required in advance planning, to avoid bandwidth run full and bottlenecks. 3. Performance Planning (QPS)
When the system reads and writes a bottleneck, usually how to solve the problem.
Mysql
Writing: Splitting to multiple servers
READ: (1) split (2) write less can also be solved by adding slave
Memcached
Read and write: Split to more nodes through hash.
Redis:
Write: Split
READ: (1) split (2) write less can also be solved by adding slave to 4. Scalability
MySQL: Sub-Library table
Memcached:hash distribution
Redis: can also be divided into libraries, can also hash distribution summary
Through the above analysis, Redis in many ways with MySQL and memcached use features, in some ways more like MySQL.
As the Redis data can not exceed the memory size, on the one hand, the need for prior capacity planning, to ensure sufficient capacity, on the other hand, the design needs to prevent unlimited increase in the size of the data, resulting in Redis can not be extended.
Redis needs to design the split scheme as well as MySQL. Small Problem
In MySQL, by building multiple tables or libraries in advance, you can deploy these tables or libraries in Split to more servers as your business grows.
In Redis, how the "Sub-Library table" should be implemented. What are the good design patterns.
Article Source: http://timyang.net/data/redis-capacity/