当前位置:网站首页>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 !
边栏推荐
- Mongodb checks whether the table is imported successfully
- AcWing 344. 观光之旅题解(floyd求无向图的最小环问题)
- 初识MySQL
- 454 Baidu Mianjing 1
- 刨析《C语言》【进阶】付费知识【一】
- AcWing 904. 虫洞 题解(spfa求负环)
- Domestic images of various languages, software and systems. It is enough to collect this warehouse: Thanks mirror
- BigDecimal 的正确使用方式
- PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
- How did partydao turn a tweet into a $200million product Dao in one year
猜你喜欢
鼠标右键 自定义
centos8 用yum 安装MySQL 8.0.x
我如何编码8个小时而不会感到疲倦。
According to the analysis of the Internet industry in 2022, how to choose a suitable position?
Box stretch and pull (left-right mode)
Analyze "C language" [advanced] paid knowledge [i]
BigDecimal 的正确使用方式
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
Batch delete data in SQL - set in entity
shell脚本快速统计项目代码行数
随机推荐
Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 1)
ROS学习(23)action通信机制
Blue Bridge Cup 2022 13th provincial competition real topic - block painting
一文带你走进【内存泄漏】
【唯一】的“万字配图“ | 讲透【链式存储结构】是什么?
golang 基础 —— 数据类型
@Before, @after, @around, @afterreturning execution sequence
字符串的相关编程题
454-百度面经1
MySQL's most basic select statement
场景实践:基于函数计算快速搭建Wordpress博客系统
LeetCode. Sword finger offer 62 The last remaining number in the circle
增加 pdf 标题浮窗
JS ES5也可以創建常量?
AcWing 1141. 局域网 题解(kruskalkruskal 求最小生成树)
Amway wave C2 tools
Shell script quickly counts the number of lines of project code
糊涂工具类(hutool)post请求设置body参数为json数据
公钥\私人 ssh避password登陆
Let's see how to realize BP neural network in Matlab toolbox