当前位置:网站首页>Architecture evolution of high-performance servers -- Suggestions
Architecture evolution of high-performance servers -- Suggestions
2022-06-25 15:24:00 【Running pig ZC】
Catalog
The way of architecture evolution
Write in the front
For back-end development , High concurrency is an old topic , Recently, the author encountered a very thorny problem , It's about high concurrency , At present, it is in support of 30W Terminals , But it will continue to grow in the later period , When I hear to support 500W When , I feel like I will have a bald head soon , But don't panic , There is always a way , I checked various materials and consulted several big men , Solved the problem step by step , Next, I will share how to build a high-performance , Highly concurrent servers .
The way of architecture evolution
1: The simplest --- Direct access tomcat Single application , Basically no problem

2: in consideration of tomcat Handle task Upper limit ( Plus tuning ) I still can't bear it , use nginx Load balancing , There should be no problem compared with this

3: Find this time DB The pressure will be greater , So I made a separation of reading and writing , No problem

4: Even if it is read-write separation , But now a large number of streams are generally queries ,DB There is still a bottleneck , You can consider DB colony ( at present mysql Has supported ), Skip here , Caching is considered in this article ( Now the projects are basically distributed , Then consider distributed caching ), So the architecture diagram becomes a dead end

5:4 It just basically solves the problem of reading , But what if it's written ? I'm not going straight to DB Write , Every time I write ? It doesn't exist well , Consider using caching , When the data is accumulated to a certain amount , Write the data once again DB, Or is it ES( After my test ,ES Write performance is really low , But reading is really powerful , Basically, it can be counted G Data in 100ms Back inside .), Use here JVM The cache of , You may need a global clock . Then the architecture diagram looks like this

6: Think it's over here ? As a person who is about to have a bald head , We must not stop here , So consider whether you can not let the request return results without passing through the background server ? So there was a great roar OpenResty(nginx Enhanced version of , The original author is Russian , The Chinese will strengthen and upgrade it , Add a series of plug-ins , And open source , at present JD Use this to cache product details ), Currently used in the project OpenResty Of Cache( operation nginx The cache of , Expiration time can be set , Cache size , Strategy and so on ),mysql( Can be operated directly mysql),redis( Can operate redis) modular , Cooperate with Lua Script together , The result is really fragrant , Then the architecture diagram evolves into the following ghost , It looks a little complicated anyway .

summary
There are many high concurrency problems in the project , Many solutions can be considered , For example, a single body cannot , I just distributed + colony , If not, consider caching , Caching can be divided into two types , Server cache and web Layer cache , Then you can optimize the code , Unnecessary synchronization can be changed to asynchronism , Use thread pool , The parameters of the thread pool can be tuned , Reference resources https://blog.csdn.net/weixin_45191798/article/details/100153524 , When writing for a large amount of data traffic , We can take into account the so-called tens of millions of KAFKA To cut the flow peak , Finally, it's really no good , With a bald head , Growing cabbages and raising pigs at home is also an option ( Pork is still more expensive , The way to get rich ), like JAVA And architecture students can discuss , AC duck .
边栏推荐
- Usage of qlist
- Usage of pure virtual functions
- Disable scrolling in the iPhone web app- Disable scrolling in an iPhone web application?
- Detailed summary of reasons why alertmanager fails to send alarm messages at specified intervals / irregularly
- Luogu p5707 [deep foundation 2. example 12] late for school
- Qt: Pro project file
- QT article outline
- Design and implementation of thread pool
- BM setup process
- About?: Notes for
猜你喜欢
![[paper notes] poly yolo: higher speed, more precise detection and instance segmentation for yolov3](/img/28/6d58759a4a4b18923a5ed5ed573956.jpg)
[paper notes] poly yolo: higher speed, more precise detection and instance segmentation for yolov3

Custom structure type

(2) Relational database
![[paper notes] contextual transformer networks for visual recognition](/img/e4/45185983e28664564bbf79023ccbf6.jpg)
[paper notes] contextual transformer networks for visual recognition

Yolov4 coco pre train Darknet weight file

Arithmetic operations and expressions

Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password

Introduction to flexible array
![[C language] implementation of magic square array (the most complete)](/img/b2/2595263b77e0abac667972bbfe0c8a.jpg)
[C language] implementation of magic square array (the most complete)

google_ Breakpad crash detection
随机推荐
Go build reports an error missing go sum entry for module providing package ... to add:
Shared memory synchronous encapsulation
System Verilog - function and task
google_ Breakpad crash detection
Ubuntu 20.04 installing mysql8.0 and modifying the MySQL password
Installing QT plug-in in Visual Studio
How to download and install Weka package
Use Matplotlib to draw a line chart
Introduction to flexible array
Pytorch | how to save and load pytorch models?
Bessie's weight problem [01 backpack]
Learning notes on February 18, 2022 (C language)
Paddlepaddle paper reproduction course biggan learning experience
Errno perrno and strerrno
Advertising effect cluster analysis (kmeans)
Single user mode
System Verilog - thread
Data preprocessing - normalization and standardization
Character encoding minutes
Yolov5 Lite: fewer parameters, higher accuracy and faster detection speed