当前位置:网站首页>What are clustering, distribution, and microservices?

What are clustering, distribution, and microservices?

2022-06-24 05:06:00 User 7426861

How to choose an application architecture ?

Microservice architecture is very popular recently ,10 Personal small company to do a project also requires micro service architecture as a hard condition , The daily visits to the website are less than 1000 Of web Applications also require microservice Architecture , So, is it good to use microservice architecture , Let me talk about it in a popular way . To find out the problem , You need to understand the following buzzwords .

colony

Let's talk about clusters : To build a house , Brickwork is needed , One man builds bricks too slowly , need 10 Individual bricklayer, worker, colleague to build , This greatly improves efficiency , We say this 10 Individuals form a cluster . Clustering is that everyone does the same thing , Let's do it together , Everyone doesn't depend on each other . Put it in our software production environment , Clustering is to improve efficiency by stacking up server hardware to do the same job .

Distributed

Distributed , seeing the name of a thing one thinks of its function , There is a concept of division of labor . Let's take the example of bricklaying , We build bricks , You need to move the bricks first , Put it by the wall , Need cement mortar , Then you can start bricklaying . If with cement mortar , To move the brick , Building walls is for the same person , Even if it's 10 personal , Maybe it's not efficient , At this point, distributed is on the stage . We can arrange for 2 Personal specialty and cement mortar ,2 Individuals carry bricks to the wall ,6 The individual is only responsible for bricklaying . In this case , Although the number of people has not increased , But efficiency is bound to improve . That's understandable , Clusters don't have to be distributed , But distributed is definitely a cluster , It requires multiple servers to work together . So at this point , There's another problem , If there is no cement mortar , The bricklayer needs notice and cement mortar suspension , Quickly transport the cement mortar to the wall . In reality, you can shout with your mouth , You can make a phone call , How to inform the server at this time , This involves rpc(remote process communication), Let's briefly mention this , Next time, we can discuss it in depth separately .

Microservices

Microservices are an architecture , The principle is very similar to distributed , Its resolution granularity is very fine , It's so detailed that everyone only does one thing that can't be decomposed , And these little things don't have to be on different servers , Many microservices, such as A service ,B service ,C service , The other server has B service ,C service ,D service . It is worth noting that , All services need to be notified of a place called a registry , It can be understood that this is the project manager , He came to coordinate management .

summary

If your business is simple , There are also very few visits , That all applications put a server can also run smoothly , At this time, even the cluster does not need to use . If your visits are small , But the business is complex , For example , Take e-commerce as an example , The process of placing an order , Orders need to be submitted , payment , Colleagues need to check whether the warehouse has inventory , Then send the address to the third party logistics to place an order , If these things are done together , need 30 second . Users need to wait 30 Seconds to see whether you have successfully purchased , This experience is very bad , Even if your platform only deals one day 100 single , The number of visits is very small , The user experience is still not good . At this time, you can use distributed to solve this problem , Pay , Check inventory , Inform the third party logistics to split into 5 One or more jobs . such , The user experience has greatly improved , You can do a shopping in seconds . If you have a lot of traffic , Each process step is complex , So at this point , You can distribute the steps , Allocate more server clusters , At this time, it is more appropriate to use microservice architecture . Based on previous operations app Experience , Millions of visits a day , Every interaction is 2 Applications in seconds , As long as the bandwidth is enough , take web Separate from the database and add a redis cache ,2 One mainstream server is enough .

原网站

版权声明
本文为[User 7426861]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/08/20210824190016510p.html