当前位置:网站首页>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 !
边栏推荐
- ROS learning (21) robot slam function package -- installation and testing of orbslam
- AcWing 344. 观光之旅题解(floyd求无向图的最小环问题)
- AcWing 345. Cattle station solution (nature and multiplication of Floyd)
- JS ES5也可以創建常量?
- Let's see how to realize BP neural network in Matlab toolbox
- 修改px4飞控的系统时间
- Add PDF Title floating window
- grep查找进程时,忽略grep进程本身
- Appium基础 — Appium Inspector定位工具(一)
- 454 Baidu Mianjing 1
猜你喜欢
Analyze "C language" [advanced] paid knowledge [II]
CISP-PTE之命令注入篇
Recognition of C language array
Shell script quickly counts the number of lines of project code
PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
ROS学习(25)rviz plugin插件
Errors made in the development of merging the quantity of data in the set according to attributes
ROS learning (21) robot slam function package -- installation and testing of orbslam
Make DIY welding smoke extractor with lighting
CISP-PTE实操练习讲解(二)
随机推荐
Appium foundation - appium inspector positioning tool (I)
CISP-PTE实操练习讲解(二)
The difference between Tansig and logsig. Why does BP like to use Tansig
各种语言,软件,系统的国内镜像,收藏这一个仓库就够了: Thanks-Mirror
C语言【23道】经典面试题【下】
AcWing 904. 虫洞 题解(spfa求负环)
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
增加 pdf 标题浮窗
Amway wave C2 tools
使用nodejs完成判断哪些项目打包+发版
Start from the bottom structure to learn the customization and testing of fpga---- FIFO IP
LeetCode. 剑指offer 62. 圆圈中最后剩下的数
PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
When grep looks for a process, it ignores the grep process itself
开发中对集合里面的数据根据属性进行合并数量时犯的错误
JS ES5也可以创建常量?
ROS学习(25)rviz plugin插件
字符串转成日期对象
拖拽改变顺序
Clickhouse fields are grouped and aggregated, and SQL is queried according to the granularity of any time period