Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What does the NoSQL of redis learning mean?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you what the NoSQL of redis learning means. I hope you will get something after reading this article. Let's discuss it together.

1. Why use NoSQL in the context of great opportunities in the Internet era

1.1 A wonderful era of stand-alone MySQL

In the 1990s, the number of visits to a website was generally small and could be easily handled with a single database.

At that time, there were more static web pages than dynamic interactive websites.

DAL dal is the abbreviation of data access layer, namely data access layer (Data Access Layer).

Under the above architecture, let's take a look at what is the bottleneck of data storage.

1. The total size of the amount of data when a machine cannot fit.

two。 Index of data (B + Tree) when there is no room for storage in a machine

3. The number of visits (mixed read and write) an instance cannot bear

If the above-mentioned 1or3 is satisfied, evolution...

1.2.Memcached (cache) + MySQL+ vertical split

Later, with the increase in the number of visits, almost most websites using MySQL architecture began to have performance problems on the database. Web programs are no longer only focused on functionality, but also in pursuit of performance. Programmers begin to make extensive use of caching technology to ease the pressure on the database and optimize the structure and index of the database. At first, it is popular to ease the pressure on the database through file caching, but when the traffic continues to increase, multiple web machines cannot be shared through file caching, and a large number of small file caches also bring high IO pressure. At this time, Memcached naturally becomes a very fashionable technology product.

This is equivalent to the previous dao layer accessing the database directly, but now a cache layer is inserted in the middle. Frequent database access results in performance degradation, and we put some of it in the cache to reduce stress.

1.3.Mysql master / slave read / write separation

Due to the increased write pressure on the database, Memcached can only alleviate the read pressure on the database. The concentration of read and write on a database makes the database unbearable. Most websites begin to use master-slave replication technology to achieve read-write separation, so as to improve read-write performance and read-library scalability. Mysql's master-slave mode has become a standard part of the website at this time.

Explanation: there is a record update in the master library, which needs to be copied to the slave library in order to ensure the integrity of the data. Read-write separation: Master/slaver. We can put the write operation in the master library and the read operation in the slave library.

1.4. Sub-table and sub-database + horizontal split + mysql cluster

On the basis of Memcached cache, master-slave replication and read-write separation of MySQL, the write pressure of MySQL master library begins to appear bottleneck, and the amount of data continues to soar. Because MyISAM uses table locks, there will be serious lock problems in high concurrency. A large number of highly concurrent MySQL applications begin to use InnoDB engine instead of MyISAM.

At the same time, it has become popular to use sub-table and sub-database to alleviate the expansion problem of writing pressure and data growth. At this time, sub-table and sub-database has become a hot technology, which is not only a hot issue in the interview, but also a hot technical issue discussed in the industry. It was at this time that MySQL launched an unstable table partition, which brought hope to companies with average technical strength. Although MySQL launched the MySQL Cluster cluster, its performance can not meet the requirements of the Internet, but it only provides a great guarantee in terms of high reliability.

Watch lock and row lock?

Sub-library sub-table 1-3000 into library 1. 3001-6000 goes to library 2. Wait

Scalability bottleneck of 1.5.MySQL

MySQL database often stores some large text fields, resulting in very large database tables, which is very slow when doing database recovery, and it is not easy to recover the database quickly. For example, text with a size of 10 million 4KB is close to the size of 40GB, and if you can omit this data from MySQL, MySQL will become very small. Relational database is very powerful, but it can not cope with all application scenarios well. The scalability of MySQL is poor (complex technology is needed to implement it), the pressure of IO under big data is great, and it is difficult to change the table structure, which is exactly the problem faced by developers using MySOL at present.

1.6. What's it like today?

Firewall-nginx-Tomcat Cluster

1.7. Why use NoSQL?

Today we can easily access and grab data through third-party platforms (such as Google,Facebook, etc.). Users' personal information, social networks, geographic locations, user-generated data and user action logs have increased exponentially. If we want to mine these user data, then SQL database is no longer suitable for these applications, but the development of NoSQL database can well deal with these large data.

two。 What is it

NoSQL (NoSQL = Not Only SQL), which means "not just SQL", generally refers to non-relational databases. With the rise of the Internet web2.0 website, the traditional relational database has been unable to cope with the web2.0 website, especially the super-large-scale and highly concurrent SNS type web2.0 pure dynamic website, which has exposed many insurmountable problems, while the non-relational database has developed rapidly because of its own characteristics. The emergence of NoSQL database is to solve the challenges brought by large-scale data collection and multiple data types, especially the application problems of big data, including the storage of very large-scale data.

Google or Facebook, for example, collect terabytes of data for their users every day. These types of data stores do not require fixed schemas and can be scaled out without redundant operations.

3. What can I do?

Easy to expand

There are many kinds of NoSQL databases, but a common feature is to remove the relational characteristics of relational databases. There is no relationship between the data, so it is very easy to extend. It also brings scalable capabilities at the architectural level.

Large amount of data and high performance

NoSQL databases have very high read and write performance, especially in the case of large amounts of data.

This benefits from its non-relational nature and the simple structure of the database.

Generally, Query Cache is used in MySQL, and Cache is invalid every time the table is updated. It is a kind of large-grained Cache. In applications with frequent interactions for web2.0, Cache performance is not high.

NoSQL's Cache is record-level and is a fine-grained Cache, so NoSQL has much higher performance at this level.

Diverse and flexible data models

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

In a relational database, adding and deleting fields is a very troublesome thing. If it is a table with a very large amount of data, adding fields is a nightmare.

Traditional RDBMS VS NOSQL

RDBMS

Highly organized structured data

Structured query language (SQL)

Data and relationships are stored in separate tables

Data definition language

Strict consistency

Basic affairs

NoSQL

It represents more than just SQL.

No declarative query language

There are no predefined patterns

Key-value pair storage, column storage, document storage, graphic database

Final consistency, not ACID attribute

Unstructured and unpredictable data:

CAP theorem

High performance, high availability and scalability

4. What NoSQL do you have?

Redis (data type and cache, excellent in all aspects)

Memcached (cache)

MongDB (most similar to relational database)

5. How to play?

KV

Cache

Persistence

Talk about your understanding of Redis, just say KV-CACHE-PERSISITENCE

3V + 3 high

3V in the era of big data:

Massive Volume

Multiple Variety

Real-time Velocity

There are some descriptions of problems on the system, Taobao Singles Day massive data. A Weibo, text field, video domain, background domain and so on. Diversification. 12306 requires high real-time performance. Can't do absolute real-time

3 high demand for Internet:

High concurrency

Gao Kekuo

High performance

The system should support high concurrency, such as 12306. There are four ways to get threads.

Scalability, horizontal and vertical. Horizontally, one machine is not enough, plus a machine.

High performance requirements

After reading this article, I believe you have a certain understanding of "what is the meaning of NoSQL in redis learning". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report