In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
How to understand the database read-write separation architecture? Aiming at this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
RD: the amount of data is too large for the database to handle. Help to apply for a separation of reading and writing from the database.
DBA: what is the amount of data?
Around RD:5000w.
DBA: what about read and write throughput?
RD: about 200 for reading QPS and 30 for writing QPS.
Well, database read-write separation is not difficult, but not all "database can not handle" scenarios, should use read-write separation. Take a minute to briefly introduce this scene today.
What is database read-write separation?
One master and multiple slaves, read-write separation, active synchronization, is a common database architecture, generally speaking:
Main library, providing database writing service
From the library, provide database reading service
Synchronize data between master and slave through some mechanism, such as binlog of mysql
A group synchronizing from a cluster is often referred to as a "grouping".
What exactly does the grouping architecture solve?
Most Internet businesses read more and write less, and database reading is often the first to become a performance bottleneck, if you want:
Linearly improve database read performance
Improve database write performance by eliminating read-write lock conflicts
The grouping architecture can be used at this time.
In a word, grouping mainly solves the problem of "database read performance bottleneck". When the database cannot bear reading, it is usually read-write separation to improve system read performance by adding linearity from the database.
What is database horizontal sharding?
Horizontal sharding is also a common database architecture, generally speaking:
There is no data overlap between each database, no association similar to binlog synchronization
All the data are merged to form all the data.
Will use algorithms to complete data segmentation, such as "modularization"
A horizontal slicing of each database in a cluster is often referred to as a "shard".
What exactly does the horizontal segmentation architecture solve?
Most Internet businesses have a large amount of data, and the capacity of a single database can easily become a bottleneck. If you want to:
Linear reduction of single database data capacity
Linearly improve database write performance
At this point, you can use the horizontal sharding architecture.
In a word, horizontal segmentation mainly solves the problem of "large amount of database data". When the database capacity is too large, horizontal segmentation is usually done.
Why don't I like the separation of reading and writing?
For Internet business scenarios with large amount of data, high concurrency, high availability, high consistency, and front-end user-oriented business scenarios, if the database reads and writes are separated:
Database connection pool needs to be distinguished: read connection pool and write connection pool
If the read height is to be available, the read connection pool should fail over automatically.
There is a potential consistency problem between master and slave libraries.
If you are faced with a "read performance bottleneck" problem, it may be more direct and easier to increase the cache.
With regard to cost, the cost of slave storage is much higher than that of cache.
For cloud architecture, take Aliyun as an example, the master library provides highly available services, while the slave library does not provide high availability services.
Therefore, in the above business scenarios, it is recommended to use the cache architecture to enhance the system read performance and replace the master-slave separation architecture of the database.
Of course, there is a potential problem with using the cache architecture: if the cache fails and all the traffic is pressed on the database, the database will avalanche. Therefore, the cache is generally split horizontally to ensure that it is not hung up at the same time.
Summary
Read-write separation to solve the problem of "database read performance bottleneck"
Split horizontally to solve the problem of "large amount of database data"
For the Internet with large data volume, high concurrency, high availability requirements, high consistency requirements, front-end user-oriented business scenarios, micro-service cache architecture, may be more suitable than database read-write separation architecture.
About how to understand the database read-write separation architecture? The answer to the question is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.