Redis, Memcache, Mysql difference, redismemcache

Source: Internet
Author: User
Tags database sharding

Redis, Memcache, Mysql difference, redismemcache

When using Redis, we found that Redis is different from Memcached and also different from MySQL.
(This article mainly discusses the situation where VM support is not enabled for Redis)

1. Schema

MySQL: requires prior Design
Memcached: no design required
Redis: small systems do not need to be used. However, if you want to properly plan and use Redis, you need to make the following plans in advance:

  • Data items: What is stored by value, such as user data
  • Redis data type: such as String, List
  • Data size: such as 100 bytes
  • Number of records: for example, 1 million (determines whether to split)
  • Zookeeper

The above plan is a schema. Why does Redis need to design a schema in advance for large projects? Because the Redis server has a capacity limit, the data capacity cannot exceed the physical memory size. Considering the scalability of business data, the number of records will increase continuously, and the content of a single record will also increase, therefore, we need to plan the capacity in advance. The data architect uses the schema to determine whether Redis of the current business needs "database/table sharding" to meet scalability requirements.

2. capacity and bandwidth Planning

Capacity Planning
MySQL: Memcached: <RAM
Redis: <RAM

Bandwidth Planning
Because Redis is more than 10 times faster than MySQL, you need to plan the bandwidth in advance to avoid bottlenecks when the bandwidth is full.

3. Performance planning (QPS)

When a bottleneck occurs in system read/write, how can this problem be solved?
MySQL
Write: Split to multiple servers
Read: (1) Split (2) less write can also be solved by adding Slave

Memcached
Read/write: all are split to more nodes through hash.

Redis:
Write: Split
Read: (1) Split (2) less write can also be solved by adding Slave

4. scalability

MySQL: database/table sharding
Memcached: hash Distribution
Redis: Database sharding or hash Distribution

Summary

Through the above analysis, Redis has the features of MySQL and Memcached in many aspects, and is more like MySQL in some aspects.
Because Redis data cannot exceed the memory size, on the one hand, we need to carry out capacity planning in advance to ensure sufficient capacity; on the other hand, we need to prevent the unlimited increase in data size, which leads to Redis not being scalable.
Redis needs to pre-design the sharding scheme like MySQL.

Minor issues

In MySQL, multiple tables or databases can be created in advance to deploy these tables or databases on more servers during business growth.
In Redis, how should we implement "database/table sharding? What are the good design patterns?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.