当前位置:网站首页>3. Business and load balancing of high architecture
3. Business and load balancing of high architecture
2022-07-06 06:54:00 【Ybb_ studyRecord】
Three high architecture business and load balancing
Three high architecture business and load balancing
Ensure the plan first Simple available , Then consider universality and reusability
General idea : Load balancing , cache ( Reduce link depth ), Message queue ( Peak shaving decoupling asynchronous ), Sub database and sub table
Dynamic and static separation
Dynamic data and static data
All users see the same page , It is also static data ( The first user's request , Make it static )
Data classified as static , Just for caching , Improve performance , Reduce links .
app cache , Browser cache ,apache, cache
stock
1. Large amount of visits , Is the bottleneck
2. For data consistency , Lock it , It is also a bottleneck
Lock stock
Ideas : Load balancing , cache , Sub database and sub table
1 Inventory fields 100 Inventory .10 Inventory fields ,10 Inventory .
A watch : goods id, Total inventory .
reids: goods id- stock -1:10 , goods id- stock -2:10
Total inventory :100 , Lock stock :1 (++)
When you release the lock , Lock stock –
Three high methodology
Writing data , Reading data .
Write : Read / write separation , Sub database and sub table , Delayed operation
read : Multi level cache , Optimization of request data
Less data transmission . Reduce cpu,io.
Low number of requests ( A page , There are few requests )
Less dependence .( High availability .5 individual 0.99=0.95)
Short path , short url.( The path is short , cache .)
Reduce transmission
Avoid single point . Downgrade plan
Estimate the number of system users , It's larger than the quantity
Current limiting , Refuse . Dynamic expansion and contraction
Load balancing of three high architecture
indicators
Concurrency number
1. Number of concurrent users , Some users use business , Another part of users Hang up , No specific operation .
2. Number of concurrent connections . Link between user and server . Some links are transmitting data , Some links Just links .
3. Number of concurrent requests . Request static data , It may be a write operation .
4. Number of concurrent threads . In the system , Number of concurrent threads .
The number of callers of services at the same time
throughput
Within unit time , The amount of data requests that can be accepted and returned .
1. Look at business logic .
2. Look at the requested data .
TPS: Transaction Per Second. The number of transactions per second .( Define the transaction as a whole request 、 operation 、 return )
QPS:Queries Per Second. Queries per second .
TPS and QPS The relationship between : Opening the home page is a transaction , It depends on the specific scene . One TPS May include more than one QPS
Mean response time
User's perspective . response time ( Request issued , Response received , Time between )
Average of all response times .
Reliability index
Mean time between failures .
System on-line , To the first failure , Average running time .
Formula calculation :
Amdal's law :
Speedup ratio : Response time before optimization / Optimized response time . r.
Increase the proportion : Response time of a module / Total time . <=1,p.
Average response time of the whole system : t new =t Old time *((1-p)+p/r).
Acceleration ratio of the whole system : 1/((1-p)+p/r).
Purpose : Optimize P Systems with high value . enlarge r
The relationship between indicators
The relationship between concurrency and throughput :
Began to increase , When it is full, it reaches the maximum , Slowly descend behind
Concurrent number pairs response time :
The front rises slowly , After the index rose
The impact of average response time on concurrency
User perspective : Concurrency is not affected by the system
System perspective : The more concurrent , The longer the response time , The longer the response time , The more concurrent , A vicious cycle .
Reliability index and other indexes
The worse other indicators , The worse the reliability index
How to optimize the system
Concurrency number
Reduce concurrency . Prevent the system concurrency from being too high .
Development Engineer : Current limiting
Architects :
Daily plan 、 industrial design .
Ticket gate , Drive more than one , shunt
Put the original request to a system , Distributed to different systems .
take request Various stages before reaching the system , Make a request shunt .
first floor :DNS The server , Domain name resolves to IP Address
A Record (Address).ip.
CName Record (Canonical name Alias ). Domain name to domain name .
Use A Record and CNAME The difference of domain name resolution A Record is to resolve a domain name to a IP Address (Address, Special numbers IP Address ), and CNAME The record is to resolve the domain name to another domain name . Its function is almost ,CNAME Point several host names to an alias , In fact, it points to IP The address is the same , Because this alias also needs to be a A Records of the . But use CNAME Records can be easily changed IP Address . If a server has 100 Website , They all do aliases , The server changes IP when , Just change the alias A Just record it .
One domain name maps to multiple ip Address
One domain name maps to multiple domains , Multiple domain names map to multiple ip Address
dns Load balancing : Add multiple domain names A Record (IP Address ).
The second floor :CDN The server , Send the request to , The server closest to the user's network topology
characteristic : It takes up a lot of traffic , Not often
( Topological proximity It's dynamic , Network load , Content availability , Equipment working status )
Conventional http The access process is that the user fills in the domain name to be accessed in the browser , The browser calls the domain name resolution function library to resolve the domain name , To get the corresponding IP Address ; Re pass IP Address sends a data access request to the service host of the domain name , Get the requested data , Finally, return the required content .CDN The basic idea of is to avoid bottlenecks and links on the Internet that may affect the speed and stability of data transmission , By placing node servers everywhere in the network, an intelligent virtual network based on the existing Internet is formed .CDN The system can connect each node according to the network traffic in real time 、 Load condition , As well as the distance to the user and response time and other comprehensive information , Redirect the user's request to the nearest service node .
Kill two birds with one stone :
1. Reduce Concurrency per system
2. Let the user access the system closest to him ( Network topology recently ), Reduce network latency , Reduce average response time
Higher deployment costs , The synchronization of data will be complicated
Find a special CDN provider
cnd node , Cache nodes , Edge node .
Origin station .
User request —> Edge node ( Static resources such as pictures , If so, go back to , No access to the source site and cache )
Caching static content : Configure rule list , Decide which data needs caching
Dynamic content : Source station processing
Example 1: Not introduced CDN
Suppose your original server is in South China , There is a picture on the server , here , All users , Want to access this picture , Can only run to this server in South China , Even if the user is in North China .
Example 2: introduce CDN
introduce CDN after , The interview situation is different .CDN The most important function is to realize the nearby access of resources . For example, Alibaba cloud is in South China 、 East China 、 In North China CDN The server , that , Users in North China visit that picture at this time , You can run directly to North China CDN On the server , So the speed is faster .
What is? “ Origin station ”
But there's a problem here , On the server in North China , Where did the picture come from , Will not come out of thin air . This is it. ” Origin station “ The role of the .
North China users visit North China DDN The server , North China CDN The server found that there was no picture the user wanted , So I ran to ” Origin station “ Look for that picture , After finding , Return to the user , And cache it locally . Next time there is a request to visit , Directly return the cached image .
This is it. ” Origin station “ The role of the , The above process , Namely ” Back to the source “. The general process is
user --> CDN The server --> Origin station
Reduce the concurrency of user system ( Blocking flow ).
Reduced average response time .
Reduce network congestion .
How to learn fastest : Design by yourself . Then compare the advantages and disadvantages of others' plans
The purpose of the request is baidu.com, Don't let users go to the real server , Call the request to the node closest to me .
Intercept
边栏推荐
- LeetCode每日一题(1997. First Day Where You Have Been in All the Rooms)
- 简单描述 MySQL 中,索引,主键,唯一索引,联合索引 的区别,对数据库的性能有什么影响(从读写两方面)
- Prefix and array series
- Attributeerror: can 't get attribute' sppf 'on < module' models. Common 'from' / home / yolov5 / Models / comm
- After sharing the clone remote project, NPM install reports an error - CB () never called! This is an error with npm itself.
- [advanced software testing step 1] basic knowledge of automated testing
- RichView TRVStyle 模板样式的设置与使用
- 中青看点阅读新闻
- Data security -- 13 -- data security lifecycle management
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
猜你喜欢
SQL Server Manager studio (SSMS) installation tutorial
[ 英语 ] 语法重塑 之 动词分类 —— 英语兔学习笔记(2)
My creation anniversary
女生学软件测试难不难 入门门槛低,学起来还是比较简单的
Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
Fedora/rehl installation semanage
ROS learning_ Basics
【软件测试进阶第1步】自动化测试基础知识
AttributeError: Can‘t get attribute ‘SPPF‘ on <module ‘models. common‘ from ‘/home/yolov5/models/comm
机器人类专业不同层次院校课程差异性简述-ROS1/ROS2-
随机推荐
Leetcode daily question (1997. first day where you have been in all the rooms)
UNIPRO Gantt chart "first experience": multi scene exploration behind attention to details
Py06 dictionary mapping dictionary nested key does not exist test key sorting
19.段页结合的实际内存管理
Briefly describe the differences between indexes, primary keys, unique indexes, and joint indexes in mysql, and how they affect the performance of the database (in terms of reading and writing)
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Latex文字加颜色的三种办法
Blue Bridge Cup zero Foundation National Championship - day 20
【服务器数据恢复】IBM服务器raid5两块硬盘离线数据恢复案例
SSO process analysis
Bitcoinwin (BCW): 借贷平台Celsius隐瞒亏损3.5万枚ETH 或资不抵债
PCL实现选框裁剪点云
Three methods of adding color to latex text
[hot100] 739. Température quotidienne
SSO流程分析
PCL realizes frame selection and clipping point cloud
How to translate professional papers and write English abstracts better
医疗软件检测机构怎么找,一航软件测评是专家
Do you really know the use of idea?
librosa音频处理教程