当前位置:网站首页>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 !
边栏推荐
- Batch delete data in SQL - set in entity
- AcWing 344. 观光之旅题解(floyd求无向图的最小环问题)
- ZOJ problem set – 2563 long dominoes [e.g. pressure DP]
- 刨析《C语言》【进阶】付费知识【完结】
- C语言关于链表的代码看不懂?一篇文章让你拿捏二级指针并深入理解函数参数列表中传参的多种形式
- Errors made in the development of merging the quantity of data in the set according to attributes
- C language instance_ five
- Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
- JVM 内存模型
- 开发中对集合里面的数据根据属性进行合并数量时犯的错误
猜你喜欢
ROS learning (26) dynamic parameter configuration
shell脚本快速统计项目代码行数
Can't you understand the code of linked list in C language? An article allows you to grasp the secondary pointer and deeply understand the various forms of parameter passing in the function parameter
Batch delete data in SQL - set in entity
Appium自动化测试基础 — uiautomatorviewer定位工具
制作带照明的DIY焊接排烟器
ROS學習(23)action通信機制
Reptile practice (VI): novel of climbing pen interesting Pavilion
ROS学习(24)plugin插件
PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
随机推荐
使用nodejs完成判断哪些项目打包+发版
Reptile practice (VI): novel of climbing pen interesting Pavilion
Drag to change order
一文带你走进【内存泄漏】
npm install 编译时报“Cannot read properties of null (reading ‘pickAlgorithm‘)“
Today's question -2022/7/4 modify string reference type variables in lambda body
curl 命令
Yiwen takes you into [memory leak]
MySQL's most basic select statement
Curl command
Batch delete data in SQL - set in entity
Compile command line terminal swift
Amway wave C2 tools
刨析《C语言》【进阶】付费知识【一】
Can't you understand the code of linked list in C language? An article allows you to grasp the secondary pointer and deeply understand the various forms of parameter passing in the function parameter
First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format
New job insights ~ leave the old and welcome the new~
Image watermarking, scaling and conversion of an input stream
Let's see how to realize BP neural network in Matlab toolbox
WCF基金会