当前位置:网站首页>Liuyongzhi: one code communication defect analysis and architecture design scheme - sound network developer entrepreneurship lecture VOL.02
Liuyongzhi: one code communication defect analysis and architecture design scheme - sound network developer entrepreneurship lecture VOL.02
2022-06-09 08:08:00 【Acoustic network】
This article is based on 「 Sound network developer entrepreneurship Lecture Vol.02」 Share your speech , Shared by Thoughtworks Expert consultant liuyongzhi . You can click here link , Watch the video playback and download the instructor PPT.
From the end of last year to now , With the recurrence of the epidemic , The one code communication system in many cities has failed , This proves that there are still some technical deficiencies in the one code communication system , So this sharing will introduce how to use PAST Problem solving framework , Research and solve these problems from the aspects of architecture and design .
01 PAST Problem solving framework
PAST The first word of P yes Problem, It represents the problem . When there is a problem , Don't rush into the program phase , Research and analysis should be carried out first , Identify what the problem is . This is also Eric Evans Of 《 Domain-driven design 》 Mentioned in , Understanding the target domain and integrating the learned knowledge into the software is domain driven design (DDD) Top priority , This underscores the importance of the problem .
The second word A yes Analysis, It represents the analysis of contradictions . There may be many reasons for the problem , In this process, we should first find out the primary and secondary contradictions , Then for these reasons or contradictions Find the corresponding Solution, That is to say S. here , You can list the solutions first , then stay Tradeoff Stage to make trade-offs . In the practice of software or architecture design , Most of the time I'm making trade-offs , Not decisions , Therefore, the design needs to be selected , Finally, the plan is worked out . According to different schemes , You may have to take advantage of the situation , In the final stage of the effective review.
02 Problem problem
The following figure shows the one code communication system of a city . Suppose the place of production is Xihong city , chart 1( Left ) It is a normal one code communication system , Include name 、 ID number and QR code , The two-dimensional code is divided into green code 、 Red or yellow . in addition , chart 1( Left ) The following section also contains vaccination information and 15 Nucleic acid test results within days . It can be seen from the picture that , The main entrance of the one code communication integrates many functions . chart 1( Right ) It is the fault display page of the one code communication system on Monday morning , Display the one code communication system blank , Besides , There is also a problem that the nucleic acid test results do not show any information .

■ chart 1
03 Analysis analysis
3.1 The main contradiction
In the analysis phase, we need to try to investigate and analyze these problems , Find the cause and contradiction of the problem . At this time, a large number of citizens need to open the nucleic acid proof page of the one code communication system from different occasions on Monday morning , And the one code communication system can not meet the contradiction between large concurrency at the same time . The one code communication system cannot be opened , Causes users to refresh repeatedly , System user requests soared . here , Requests may reach the background or even the service layer directly , And then go into distributed cache Or database , This creates The traffic of the back-end server increases suddenly , The corresponding network bandwidth increases .
3.2 Architecture analysis
Next, we will further analyze the architecture and design , At the data level , There may not be a good caching mechanism , Many query requests go directly to the server ⾄ database , Cause cache breakdown , A lot of traffic is “ resentment ” To the database . In terms of frequency elasticity of change , The problem with the one code communication system is , individual ⼈ Code page ⾯ Aggregated too much content , There is no container based cluster construction and circuit breaker mechanism . from CFR Cross functional requirements , The problem lies in , Developers do not consider the peak limit of the server when designing the service , Performance and pressure are not well done in the system test and design stage ⼒ test , Eventually, the system is overloaded . from ⽹ Network bottleneck , In theory 1000M ⽹ The transfer speed of the card is 125MB/s,100M ⽹ The transfer speed of the card is 12.5MB/s, The willingness to fail on the same day may be that the network bandwidth is not enough to support , Causing bottlenecks on the network .

■ chart 2
04 Solution Scheme enumeration
After the analysis is completed, the problem solution needs to be developed , During scheme enumeration , Don't rush to express your inclination , Alternatives should be identified first , And arrange and combine them .
4.1 Based on data layered architecture
For data , Can be divided into UI Layer personality data 、 Cache data and DB Full data . Cache design follows the principle of proximity , The closer the data is to the user, the better , The performance may be better . According to this principle , Data based layered architecture is actually a funnel architecture , It is a caching policy based on objects and collections , Reduce access to lower level systems . For each layer of data , It can be handled in different ways .
about UI Layer personality data , In terms of the problems of the one code communication system , When the user clicks to query the nucleic acid results , You can disable the button , It is functionally forbidden to submit repeatedly , Setting up 15 Seconds before opening , This will block the flow . For cached data , It can be cached in the browser , For example, common pictures 、 Static files 、 The script is cached , This may require only limited resources to allow the request to proceed to the corresponding subsequent phase . Besides , It can also be used CDN Cache distribution network . Data from UI Layer arrives at the application layer or the server , May adopt NGINX Or the intermediate server acts as a proxy , For example, on the server side, for frequent queries , But modify less data to create a cache .
about DB Full data , Focus primarily on storage , Instead of doing complicated calculations . Database manufacturers can support database current limiting , When a certain flow rate is reached . Returning the corresponding exception code will tell the user that it is not available , The corresponding server can fuse according to the situation , Instead of letting the database process information all the time without being able to respond , This will cause the entire application to crash . in addition , When there was a problem with the one code communication system that day , It is a good choice to establish different microservices to dynamically and flexibly expand the capacity of nucleic acid reports , The means of division is DDD.
■ chart 3
4.2 Frequency and flexibility of business changes
In the process of entrepreneurship or in some more complex systems , You can do some experience design , Divide the system business capability . Be context based , Judge whether to switch from single service to micro service according to the business capability of the system . in addition , Also consider the frequency and flexibility of business changes , For example, nucleic acid detection is a recently used function , Put it on the home page , After entering the system, you can directly query . It turns out , At that time, Xihong city directly put the function of nucleic acid detection on the page a few days after the outbreak , This indirectly shows that the business change frequency is very important to the system design .

■ chart 4
4.3 CFR – Test design and performance
in the light of CFR Come on , chart 5 Show the instructive four quadrant test .Q1 Quadrant supports the whole test of the team from the perspective of technology , Including unit test and component test , It can help the team find problems as soon as possible .Q2 Quadrant supports team testing from a business perspective , Focus more on finding functional and business problems .Q3 Quadrant evaluate products from a business perspective , It mainly includes some exploratory tests .Q4 Quadrant evaluates products from a technical point of view , Including performance testing 、 Stress test and safety test . Can be 4 The four quadrants are divided into quality delivery (Q1、Q2、Q3) And operation and maintenance (Q1、Q2、Q3、Q4) Two guidelines . With DevOps The prevalence of , These four quadrants are often combined , Develop effective testing strategies , Enable test and development to be implemented in the project .

■ chart 5
In terms of performance design scheme , In the case of high concurrency , For example, one second has 100 A request , Then whether to put 100 Requests are put directly into the server and database , Conduct 100 Queries ? Obviously not , The solution should be to combine these requests . Requests can be grouped together in the form of timers or timers , Find the corresponding after the query API Return accordingly . This is actually a variant of batch query . But if there are fewer requests , There is no need for request consolidation , It should be configured according to the situation . Another method is called current limiting , You can use Token bucket algorithm , The capacity of token bucket is ⼀ Set the , As a token ⼀ Added at a fixed rate , If the bucket is full , You will not continue to add . You can also use Leaky bucket algorithm , No matter how many concurrency there are currently , Pass out ⽔ The number of requests received by the rate guarantee daemon is ⼀ Set the , Current limiting can be achieved ⽬ Of . This method is not applicable to one code communication system events . Middleware current limiting method yes Tomcat send ⽤ maxThreads To achieve current limiting , It can also be done through NGINX Of limit_req_zone and burst To achieve rate current limiting ,NGINX Of limit_conn_zone and limit_conn Two instructions can control the total number of concurrent connections .
4.4 Network bottleneck
From the perspective of network bottleneck , To prevent network congestion , You can try to change the access mode from HTTP become TCP, For example, to access Redis cache , In this case ⽤ RESP ⽅ type . You can also make ⽤ more ⾼ Classy ⽹ card , Take for example ⽤ DNS Load balancing , Make more than one IP Corresponding to ⼀ Domain names .
05 Tradeoff Trade offs and trade offs
To do software is to do trade-offs . say concretely , After the front end lands , Client cache 、 Browser cache 、CDN Cache, etc. can be started , First access the server , The server here contains the corresponding NGINX Or load balancer , The traffic then reaches the application layer and the service layer , If the flow is large at this stage , Multi line performance optimization or high-performance RPC, You can also add a cache . Then you can enter the microservice framework .
Back to the cache section , The data access layer may contain Redis etc. , Some frequently accessed but infrequently changed data can be cached here , Reduce by requesting a merge or query I/O. In the storage layer , The database pays more attention to full data , If the database is under great pressure , You can consider sub database and sub table . According to different data , Even different people 、 Different areas , Can set up their own database to access . In terms of infrastructure , The system should be able to support rapid capacity expansion , If the frequency elasticity of business changes is taken into account , So cloud primordial is indispensable . Finally, a scheme is listed for reference only .

Q & a session
1、 How to lead and manage the technical team of start-ups ?
To lead a team , First, you should determine the direction of the team , That is, the project vision . The goal comes after the vision is defined , Then according to the actual situation , Identify the skill requirements of the personnel needed to support these goals . secondly , The team should improve its ability , Because to achieve business goals , Corresponding capability output is required . in addition , If there are more team members , There should also be team norms , Make the strategic process of the company or project , Process instrumentalization . For organizations , I think we should keep trying to learn , The pain points should be solved from the perspective of the customer .
2、 One code communication system CDN What are the design principles ?
In general , When configuring , Be clear about what can be cached . such as , You can put infrequently accessed and infrequently changed data into CDN In cache , The details should be determined according to the business data .
3、 Request how to merge ?
stay Java There is feature Functions can introduce requests . such as ,1 Seconds 100 A request , After the request is introduced, it can be divided into 10 Share , Traverse through the thread pool in one second 10 Time . Specifically, you can add requests to the thread pool separately , Then the thread pool triggers the call request at a fixed time .feature The function makes the request return from the database , Be able to find the corresponding request. For these questions ,JavaSpring There are already mature schemes in .
边栏推荐
- How do I add the hours of the current date in SQL Server- How to add hours to current date in SQL Server?
- Market Research - current situation and future development trend of global and Chinese cosmetic grade glycyrrhetinic acid Market
- [reading papers] efficientnet: retailing model scaling for revolutionary neural networks
- 2022 examination questions and mock examination for the third batch of Guangdong Provincial Safety Officer C certificate (full-time safety production management personnel)
- Force to trigger epollin and epollout events
- Real time monitoring, intelligent early warning, CDC's "speed" of war and epidemic
- phaser设置图片资源大小
- 企业运用通兑吧数字会员卡进行营销的优势
- China polytetrafluoroethylene (PCTFE) Industry Research Report (2022 Edition)
- MySQL: subquery
猜你喜欢

Leetcode0001: sum of two numbers (simple, four solutions)

实时监控,智能预警,疾控中心的战疫“速度”

Clickhouse distributed table & local table & Clickhouse realize time series data management and mining

Dbutil auxiliary class, manual commit transaction, metadata

C语言复习10

Taobao classification encyclopedia and its grouping (mysql, XLS) files, hierarchical relationship, spelling, hierarchy, hierarchical tree, tips, data on February 28, 2022

MySQL recursively queries all child nodes according to the parent node, and the list to tree structure tool class

C language review 7

苹果胜诉 法官驳回iPhone安全欺诈集体诉讼

Oracle: Foundation
随机推荐
China GaAs industry chain research and investment strategy report (2022 Edition)
An integrated framework for caching, loading, refreshing and mapping data dictionaries
【学校实验+蓝桥杯题目】接水问题:学校里有一个水房,水房里一共装有m个龙头可供同学们打开水,每个龙头每秒钟的供水量相等,均为1。现在有n名同学准备接水,他们的初始接水顺序已经确定......
Go questions / knowledge gathering - 2
XML json YAML interconversion
【读点论文】Benchmark Analysis of Representative Deep Neural Network Architectures当准确率不再是唯一衡量标准,给多目标优化一个导向
How do I add the hours of the current date in SQL Server- How to add hours to current date in SQL Server?
[learning records of the first week in June] UU computer vision (1):3d Reconstruction & camera calibration
Epoll series system call
MySQL common interview knowledge points
leetcodeSQL:1070. Product sales analysis III
Robot_ Framework: assertions
Oracle 分区表分页查询SQL优化
Installing MySQL using docker
Advantages of enterprises' marketing with universal cash bar digital membership card
PHP get last Monday, get the last week date of the specified date, last Monday
C language review 9
Leetcode0001: sum of two numbers (simple, four solutions)
Summary of redis core knowledge points (ultra detailed)
Selenium: element positioning