This is the 14th day of my participation in Gwen Challenge

One, foreword

Before we learn about Redis, we need to ask ourselves a question: How did NoSQL evolve? Why do we use it? What is the development course of Internet database? With these questions in mind, let’s begin the following reading.

Ii. Evolution of the Internet architecture

We know that the evolution of databases has been divided into three stages, from the manual management stage to the file system stage and now the database stage. In today’s database situation, there are a variety of databases, showing a hundred flowers bloom. Finally, it can be roughly divided into two types: relational database and non-relational database.

2.1 Single-server mysql Era (Less than 1W requests)

In the budding era of the Internet, the number of Internet users is not large, the general website visits are not large, a single database can easily cope with

At this point, the bottleneck of data storage depends on:

  • 1. Total size of data volume
  • 2. Index of data (not enough in one machine)
  • 3, access to an instance can not withstand (without read/write separation)

2.2 Memcached +mysql + vertical split

After 2009, memcached technology became popular. As an independent distributed cache server, memcached provides a high-performance shared cache service for multiple Web servers to relieve the pressure on the database. At the same time, mysql database began to be split vertically

2.3 The primary and Secondary read and write operations of Mysql are Separated

As database write pressure increases, Memcached only relieves database read pressure. When the read and write concentration in one database causes the database to reach the bottleneck, the master-slave replication mode completes the read and write separation technology appears. The master library is responsible for the write operation and the slave library is responsible for the read operation.

2.4 Database table + horizontal split + mysql cluster

After Memcached, mysql master/slave copy, read/write separation. The problem is that when the data volume continues to soar, the mysql master library is facing a lot of write pressure, resulting in serious locking problems. Therefore, InnoDB engine with row locking replaces MyISAM with table locking. In complex business, mysql cluster emerges. Multiple master-slave replicates.

2.5 Relational database bottlenecks represented by mysql

Mysql database when storing big data in the data export and recovery is very slow, when storing tens of millions of data at the same time there are a lot of bottlenecks, in addition there is a strong relationship between its structure, have very strong constraint is a relational database table structure, is a typical three paradigms, inflexible table structure changed, It is also not as fast as Nosql.

Therefore, the technique industry has specialized, it can not deal with all occasions, with the advent of the era of big data, we may need to use NoSQL for data processing and mining.

The rise of Nosql

Nosql is a non-relational database and is called not only SQL. NoSQL is a new revolutionary database movement, which has been proposed in the early days and is gaining momentum in 2009. Proponents of NoSQL advocate the use of non-relational data storage.

It makes up for some defects of relational database, but it also loses some features, such as the loss of transaction function. In general, one way to think about it is, if we don’t need SQL for our data or if SQL doesn’t work, we can see if Nosql meets our needs.

Common NoSQL types fall into five categories:

  • K-v: redis
  • Document: indicates MongoDB
  • Column storage: Hbase
  • Full text search: represents Elasticsearch
  • Graphical relational database: represents Neo4j, instead of storing pictures, put relationships. For example: social networking, advertising recommendations

NoSQL applies to the following scenarios:

  • High concurrent reads and writes to data
  • Read and write massive data
  • Highly scalable to data

NoSQL does not apply to the following scenarios:

  • Transaction support required
  • SQL – based structured query storage, handling complex relationships.

Four, summary

Of course, NoSQL itself has the characteristics of random, relative to relational data it has a messy structure, although its query is very efficient, but in the actual scene to see many factors, the formation of mysql + NoSQL has become the mainstream of development now.