NoSQL overview of non-relational databases

NoSQL

1. Problems with relational databases

1. Problem phenomenon

The server crashes during the peak period of users on ticketing websites, mall websites, etc.

2. Phenomenon characteristics

(1) Massive users
(2) High concurrency

3. Causes

Server crash is not the problem of the server itself, but the limitations of relational databases (MySQL, etc.)

(1) Performance bottleneck

Relational databases use disk IO when reading and writing data, which has low performance

(2) Expansion bottleneck

The relationship between tables and tables in relational databases is very complicated. A table may be related to many tables through foreign keys, and these related tables may also be related to many tables, which leads to data query Need to use multiple tables, which greatly affects query efficiency; and it is very difficult to expand due to complexity

4. Solutions

(1) Reduce the number of disk IO

NoSQL puts the data directly in the memory, not on the disk (the data will disappear after restarting by default)

(2) Remove the relationship between data

NoSQL only stores data, not the relationship between data

2. Basic introduction to NoSQL

1. Concept

NoSQL is Not-Only SQL, which generally refers to non-relational databases. As a supplement to relational databases, today’s system design uses a combination of relational and non-relational databases.

2. Function

Deal with data processing problems under the premise of massive users and massive data

3. Features

(1) Easy to expand

The relationship between data is not stored in NoSQL, so it is easier to expand

(2) High performance

NoSQL stores data in memory, and access to data is faster

(3) Flexible data model

NoSQL does not need to create fields for the data to be stored in advance, and can store custom data formats at any time

(4) High availability

4. Common NoSQL databases

Common NoSQL products currently on the market: redis, memcached, HBase, MongoDB

5. Four categories of NoSQL databases

(1) KV key value: common redis, memcached
(2) document database: bson format is more common, common is MongoDB
(3) column storage database: distributed file system, common is HBase
(4) graph relationship Database: What is stored is not graphics, but relations, such as social relations in Moments, and Neo4J is common

Comparison of the four:

Insert picture description here

Three, NoSQL application scenarios

Take the e-commerce system as an example to show the role of NoSQL:

The first type, basic data in e-commerce must be stored, such as product name, price, manufacturer, these are basic data, these data are stored in a relational database (such as MySQL)

The second category is the additional information of the product, such as the product evaluation. The evaluation does not belong to the attributes of the product itself. This type of data can be placed in MongoDB to speed up access.

The third category is the information in the picture. This kind of information is relatively fixed. It has a dedicated storage area and is generally stored by a file system.

The fourth category is to search for keywords. In order to speed up the search, search technologies like Elasticsearch, Lucene, and Solr will be used

The fifth category, hot information, that is, information with a relatively high access frequency. The second feature of this type of information is that it is band, in other words it is not stable and time-sensitive. This type of information is generally stored in redis To speed up access

4. Storage structure design of e-commerce system

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_49343190/article/details/112982203