当前位置:网站首页>Introduction to microservice architecture
Introduction to microservice architecture
2022-07-07 01:54:00 【Dily_ Su】
List of articles
Introduction to microservice Architecture
One 、 Evolution of Technology Architecture
1.1 Single application
model1 Pattern : jsp + java
model2 Pattern : MVC Pattern
1.2 Vertical application
1.3 RPC Distributed applications
1.4 SOA Flow computing architecture
Resource scheduling 、 Load balancing 、 Dynamic service creation … Service governance
1.5 Microservices
small 、 Single responsibility
Two 、 Introduction to microservice
Microservice is to divide an application with a single architecture into independently running programs as services according to business , Between them HTTP Protocol to communicate ( You can also use message queue , Such as kafaka、RabbitMq etc. ), You can use different programming languages , Using different storage technologies , Automated Deployment , Reduce human control , Reduce the probability of error . There are many services , Management is becoming more and more complex , So centralized management , Such as Eureka、Zookeeper And other common service centralized management frameworks .
Microservice is an architectural style , A large complex software application , Consists of one or more microservices , Various micro services of the system can be deployed separately , Loose coupling between micro Services , Each microservice only focuses on completing one task and accomplishing it well .
2.1 advantage
- It's easy to test
- Scalable
- High reliability
- Cross language
- Collaborative development
- Facilitate system iteration
2.2 shortcoming
- The operation and maintenance cost is high , There are many deployment projects
- Interface compatible version problem
- Distributed system complexity
- Distributed transactions
3、 ... and 、SOA vs Microservices
The service is SOA Developed products , It is a relatively modern fine-grained SOA Realization way
SOA( Service oriented ) | Microservices |
---|---|
Maximize the reusability of application services | Focus on decoupling |
Systematic changes need to be modified as a whole | The systemic change is to create new services |
DevOps And continuous delivery is becoming popular , Not mainstream | Strong official clan DevOps And continuous delivery |
Focus on business function reuse | Pay more attention to Context The border The concept of |
Communication uses the enterprise service bus ESB | For communication , Use less and simple messaging systems |
Support multiple message protocols | Use lightweight protocols , Such as HTTP、REST etc. |
Use a common platform for all services deployed to it | The application server is not really being used , We usually use the cloud platform |
Containers (docker) Is not very popular | Containers work well in microservices |
SOA Services share data storage | Each microservice can have a separate data store |
Common governance and standards | Easy governance , Pay more attention to teamwork and freedom of choice |
Four 、Dubbo vs Spring Cloud
Spring Family bucket
It's very comfortable to use , omnipotent
Dubbo
Many domestic enterprises are still using , Support RESTful Style API, call API Like calling local API equally , At the same time, its interface based approach increases the coupling between services
Contrast item | Spring Cloud | Dubbo |
---|---|---|
Service registry | Spring Cloud Netflix Eureka | ZooKeeper,Nacos |
Service invocation mode | REST API | RPC |
The service gateway | Sping Cloud Netflix Zuul | Dubbo Proxy |
Break route | Sping Cloud Netflix Hystrix | Sentinet |
Distributed configuration | Sping Cloud Netflix Config | Nacos |
Service tracking | Sping Cloud Netflix Sleuth | nothing |
The message bus | Sping Cloud Netflix Bus | nothing |
Data flow | Sping Cloud Netflix Stream | nothing |
Batch task | Sping Cloud Netflix Task | nothing |
summary
Dubbo Because it is binary transmission , Less bandwidth
Spring Cloud yes http Protocol transfer , More bandwidth , Use at the same time http, You usually use Json message , More consumption
Dubbo Development difficulty hit ,Dubbo Of jar Package dependency problems many large projects can't solve
Spring Cloud The interface protocol of is relatively free and loose , Stronger administrative actions are needed to limit the disorderly upgrading of interfaces
Dubbo Registration center of ZooKeeper Redis Many other kinds ,Spring Cloud Only use eureka Or self research
Simple procedure of system structure :
Spring Cloud The system structure is simpler : register + Spring MVC = Spring Cloud
Dubbo: All kinds of complexity Url、protocol、register etc.
performance :Dubbo Network consumption is less than Spring Cloud , But most domestic companies , Network consumption is not a big problem , If it becomes a problem , You can compress 、 Binary system 、 Cache 、 Step by step and so on , It's easy to solve
5、 ... and 、 Microservice design principles
5.1 AKF Resolution principle
- X Axis : Refers to horizontal replication , Is to run more instances of a single system , Become a cluster plus load balancing mode
- Z Axis : It's based on similar data partitioning , For example, Internet taxi App User surge , The cluster cannot bear , Partition data according to user area , Beijing 、 Shanghai 、 Guangzhou and others will build more clusters
- Y Axis : The splitting mode of microservices , Split based on different businesses
5.2 Separation principle of front and rear end
- Front and rear technology separation , Each field can be optimized by its own experts , Improve the front-end user experience
- Front and rear end separation mode , The front and back interactive pages are clearer , And then there's the interface model , The back-end interface is more concise , Easier to maintain
- The front-end multi-channel integration scenario is easier , Back end services don't need to change , Use unified data and models , It can support multiple front ends , for example : WeChat H5 front end 、PC front end 、 Android front end 、IOS front end
5.3 Stateless service
5.4 Restful Communication style
- Stateless protocol HTTP, It has a natural advantage , The ability to expand is very strong
- JSON Message serialization , Light and simple , People and machines can read , The cost of learning is low , Search engine friendly
- Language has nothing to do , Every popular language offers mature Restful API frame , Than RPC The framework ecology is more perfect !
边栏推荐
- js如何快速创建一个长度为 n 的数组
- Today's question -2022/7/4 modify string reference type variables in lambda body
- AcWing 361. 观光奶牛 题解(spfa求正环)
- Use nodejs to determine which projects are packaged + released
- JS es5 peut également créer des constantes?
- 字符串转成日期对象
- centos8 用yum 安装MySQL 8.0.x
- Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
- Golang foundation - data type
- 长按按钮执行函数
猜你喜欢
蓝桥杯2022年第十三届省赛真题-积木画
ROS学习(23)action通信机制
Comparison of picture beds of free white whoring
CISP-PTE实操练习讲解(二)
Analyze "C language" [advanced] paid knowledge [End]
ROS学习(二十)机器人SLAM功能包——rgbdslam的安装与测试
2022/0524/bookstrap
ROS learning (26) dynamic parameter configuration
新工作感悟~辞旧迎新~
ROS学习(十九)机器人SLAM功能包——cartographer
随机推荐
Use nodejs to determine which projects are packaged + released
mongodb查看表是否导入成功
我如何编码8个小时而不会感到疲倦。
PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
Reptile practice (VI): novel of climbing pen interesting Pavilion
Add PDF Title floating window
The cradle of eternity
LeetCode. Sword finger offer 62 The last remaining number in the circle
C language instance_ five
AcWing 904. 虫洞 题解(spfa求负环)
BigDecimal 的正确使用方式
Appium基础 — Appium Inspector定位工具(一)
百度飞将BMN时序动作定位框架 | 数据准备与训练指南 (下)
shell脚本快速统计项目代码行数
AcWing 345. Cattle station solution (nature and multiplication of Floyd)
When grep looks for a process, it ignores the grep process itself
How to use strings as speed templates- How to use String as Velocity Template?
dvajs的基础介绍及使用
Long press the button to execute the function
CISP-PTE实操练习讲解(二)