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 are the solutions to high concurrency

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the solutions for high concurrency". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the solutions to high concurrency"?

Three solutions to high concurrency are: (1) system split, which divides a system into multiple subsystems; (2) cache, one of the important factors for all modern computer systems to play a high performance; and (3) MQ (message queue), a "first-in, first-out" data mechanism in the basic data structure.

The operating environment of this tutorial: windows7 system, Dell G3 computer.

1: system split, a system is divided into multiple subsystems, using dubbo to do. Then each system is connected to a database, so it is originally a library, and now there are multiple databases, so that it can resist high concurrency.

2: cache, cache must be used. Most of the high concurrency scenarios are read more and write less, so you can write a copy in both the database and the cache, and then read a lot of cache. After all, there are tens of thousands of concurrency of redis on a single machine. No problem. So you can consider how to use caching to resist high concurrency in your project that carries the main request read scenarios.

3:MQ (message queuing), must use MQ. You may still have scenarios of high concurrent writes, such as frequently doing database dozens of times in a business operation, adding, deleting, deleting and deleting, crazy. That high concurrency will definitely fail your system. If you use redis to carry and write, you can't do it. The data will be LRU (eliminated the least frequently used) at any time. The data format is incomparably simple and there is no transaction support. So you have to use mysql as well as mysql. So what do you do? With MQ, a large number of write requests are poured into MQ, wait in line to play slowly, and the later system writes slowly after consumption, which is controlled within the load range of mysql. So you have to consider how to use MQ to write asynchronously and improve concurrency in your project, in scenarios that carry complex business logic. MQ stand-alone anti-tens of thousands of concurrency is also ok.

Extended data:

Three other ways to deal with high concurrency

Sub-database sub-table

It may be inevitable to resist high concurrency at the database level in the end, so split a database into multiple libraries to resist higher concurrency; then split a table into multiple tables to keep less data in each table to improve the performance of sql running.

Separation of reading and writing

That is to say, most of the time, the database may also read more and write less, so it is not necessary for all requests to be concentrated in one library. We can set up a master-slave architecture, write to the master library, read from the library, and make a read-write separation. When there is too much read traffic, you can add more slave libraries.

SolrCloud

SolrCloud (solr Cloud) is a distributed search solution provided by Solr, which can solve the distributed full-text retrieval of massive data. Because the cluster is built, it has the characteristics of high availability. At the same time, the master-slave backup of the data avoids the problem of single point of failure. The data can be recovered quickly. And can dynamically add new nodes, and then balance the data, can achieve load balancing.

At this point, I believe you have a deeper understanding of "what are the solutions for high concurrency"? you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

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

Internet Technology

Wechat

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

12
Report