NoSQL database usage scenarios and architecture introduction


Insert image description here

Other related recommendations:
Microservice architecture of system architecture
Microkernel architecture of system architecture design
Hongmeng Operating system architecture
Architecture design of big data architecture (Lambda architecture, Kappa architecture)

Column:System Architect

1. What is NoSQL?

NoSQL (Not-onlySQL): Not just SQL, but generally refers to non-relational databases.
Insert image description here

It is a supplement and improvement to the relational database. It does not use the traditional table mode, but uses other data models to store data. NoSQL databases are very suitable for processing large-scale unstructured or semi-structured data and have the characteristics of high scalability, high flexibility, high performance, and high availability. Common NoSQL databases include MongoDB, Cassandra, Redis, etc.


2. NoSQL classification

  1. key-value
  • This type of database includesRedis, Memcached, Tokyo Cabinet/Tyrant, Voldement, Oracle BDB
  • Typical application scenarios: content caching, mainly used to process high access loads of large amounts of data, and also used in some logging systems, etc.
  • Data model: key points to the key-value pair of value, usually implemented using a hash table.
  • Advantages: Fast search speed.
  • Disadvantages: The data is unstructured and is usually only treated as string or binary data.
  1. Column store database
  • This type of database includesHbase, Cassandra, Riak
  • Typical application scenario: distributed file system.
  • Data model: stored in column clusters, the same column data is stored together.
  • Advantages: Fast search speed, strong scalability, and easier distributed expansion.
  • Disadvantages: The functions are relatively limited.
  1. document database
  • This type of database includesMongoDB, CouchDB
  • Typical application scenarios: Web applications (similar to key-value, value is structured, but the difference is that the database can understand the value content)
  • Data model: Key-value pairs corresponding to key-value, and value is structured data.
  • Advantages: The data structure requirements are not strict, the table structure is variable, and there is no need to predefine the table structure like a relational database. This database type stores data according to document formats (such as JSON, XML, etc.). Data can have nested relationships, has better flexibility, and supports various complex data structures. Supports dynamic mode, good scalability, and flexible data structure.
  • Disadvantages: The query performance is not high and there is a lack of unified query syntax.
  1. Graph database (Graph)
  • Databases of this type include Neo4J, InfoGrid, and Infinite Graph
  • Typical application scenarios: social networks, recommendation systems, etc. Focus on building relationship maps.
  • Data model: graph structure.
  • Advantages: Utilize graph structure related algorithms. For example, shortest path addressing, N-degree relationship search, etc.
  • Disadvantages: In many cases, the entire graph needs to be calculated to obtain the required information, and this structure is not suitable for distributed storage cluster solutions.

3. What is the difference between NoSQL and relational databases?

Contrast Dimensions relational database NoSQL
Application areas Oriented to general fields specific application areas
Data capacity Limited data Sea volume Quantity
type of data Structured data (two-dimensional table) UnstructuredData
Concurrency support Supports concurrency, but low performance High concurrency
Transaction support High transactional Weak transactionality
Extension mode Expand upward ExtraversionExhibition

Compared with relational databases, NoSQL databases are more flexible in processing relationships between data, so they can meet more types of application scenarios, such as big data, cloud computing, distributed storage, etc.

4. NoSQL main advantages and disadvantages

Main advantages:
(1) Avoid unnecessary complexity
(2) High throughput
(3) High-level scalability and low-end hardware cluster
(4) Avoiding expensive object-relational mapping

Disadvantages:
(1) The data model and query language have not been mathematically verified
(2) ACID features are not supported
(3) Simple function
(4) No unified query model

5. NoSQL system framework

The overall framework of NoSQL database is divided into four layers, namelydata persistence layer (data persistence), overall distribution layer (data distribution model), and data logical model layer (data logical model) ) and interface layer (interface), these four layers complement each other and work in coordination.

The data persistence layer defines the storage form of data, which mainly includes four forms: based on memory, hard disk, combination of memory and hard disk, and customized pluggable. The memory-based data access speed is the fastest, but may cause data loss; the hard disk-based data may be saved for a long time, but the access speed is slower than the memory-based form; the combination of memory and hard disk combines the first two The advantages of the form ensure not only speed but also data loss; customization and pluggability ensure high flexibility of data access.

The overall distribution layer defines how data is distributed. Compared with relational databases, NoSQL has more optional mechanisms, which mainly come in three forms: First, CAP support, which can be used for horizontal expansion.

The data logic model layer defines the connection and operation methods between data, mainly including documents, key-value pairs, images, column storage, etc.

The interface layer defines interfaces related to data access, including queries, indexes, transactions, permissions, etc.

Insert image description here

Other related recommendations:
Microservice architecture of system architecture
Microkernel architecture of system architecture design
Hongmeng Operating system architecture
Architecture design of big data architecture (Lambda architecture, Kappa architecture)

Column:System Architect

Guess you like

Origin blog.csdn.net/qq_41273999/article/details/134172279