mb61ab40ce80d9c 2022-01-15 03:23:13 阅读数:927
Increase in active users , Would be right DB Database access pressure is too high , At this time, I will consider Add a cache layer to help DB The relief . When planning for distributed caching , use redis Cluster as cache .redis In the cluster scheme Using hash slots , The amount of cached data has been split , And load balancing . This is The first ** Three load balancing scenarios **
When users are concurrent for thousands of times , We have to consider nginx High availability , although nginx The performance of the system is relatively high , But it can't stand a lot . utilize LVS To achieve nginx High availability and load balancing , This is another load balancing scenario
The business has stabilized at this stage , The larger the amount of data , Users are also very active ; Business complexity is high , Business processes have changed , The market scale has developed to the whole country , Multi machine room and multi area deployment The needs of . When the company is large , Network security is particularly important . The system must be stable
If the database single table exceeds 300 More than 10000 records , Will be Considering the sub table ; Database IO The operation has been in High load state , We can consider The business is split into different DB in , as well as The master-slave design of the database realizes the separation of reading and writing , Designed to reduce DB Load and high availability .
Two schemes can be adopted in sub database and sub table , A proxy layer scheme , Such as ：MyCat frame ; One is the client implementation , Such as sharding-jdbc. This is another load balancing scenario at the database layer
The complexity of the business is high , Need a good split business , Further business decoupling , And message oriented middleware will be used for high parallel transmission and lower current limit , Such as ：RocketMQ,RabbitMQ.
And in distributed transactions , In order to ensure final consistency , Message oriented middleware is also used .
Message oriented middleware is naturally clustered , Ensure high availability and load balancing of message oriented middleware , Yes, this is the load balancing scenario of the message queue layer .
Under distributed architecture , For unified routing , authentication , Current limiting , Monitoring etc. ; At this time, you have to go to the gateway , Now the gateway framework is ：Kong,Zuul,GateWay,Soul etc. , These frameworks are also clustered . Deploy to nginx Below the floor （kong It can be replaced directly nginx, Because it's in nginx Designed on the basis of ） Set up gateway layer . This is the load balancing scenario of the gateway layer
Business in the national market , Even in the global market , because ** Regional network nodes are set up according to regions
《 A big factory Java Analysis of interview questions + Back end development learning notes + The latest architecture explanation video + Practical project source code handout 》
【docs.qq.com/doc/DSmxTbFJ1cmN1R2dB】 Full content open source sharing
, Therefore, we should ensure that many regions can quickly access our website , This is the time to do Multi machine room design . The design of multi machine room is to use DNS, This is DNS Layer load balancing **
At this point , Generally in Under the same machine room , Several system cluster schemes will be deployed , At this time, we usually add... In the computer room Hardware load balancer , Such as ：F5,A10; Hardware load balancer is quite expensive Of , But the company has grown to this point , Should have money .
Involving cross machine room , System design will be very complex , In particular, take into account the machine room data How to share , Sync ？ These points are always in Later articles will introduce , What problems should be solved in cross machine room ？
One thing in common is that large systems No single point of failure is allowed , Clustering is needed , Once there is a cluster , There will certainly be load balancing scenario applications .
Development of large scale systems , It comes from business development , When the business has not reached a certain level , Choose the right system design , You can't choose a very complex scheme ahead of time , It will lead to a long development cycle , The system will also become complex , There is no need to , This is what the technology boss needs to pay attention to .
Share a set of interview dry goods I sorted out , This document combines my years of interviewer experience , From the interviewer's point of view to tell you , The questions asked by the interviewer, what would he most like to hear from you , Share and help those friends who are confused about their future .
It's not easy to sort out the data , Pay attention before you go