当前位置:网站首页>[cloud native] what is the microservice architecture
[cloud native] what is the microservice architecture
2022-07-29 02:11:00 【xiaoweiwei99】
Author's brief introduction : Hello everyone , I am a ? Let's make progress together !?? ?? Personal home page : Of csdn Blog
?? Series column : Data structure and algorithm
?? Philosophical quotations : Admit your ignorance , Is to open the door to wisdom
?? If you think the blogger's article is good , Please thumb up ??+ Collection + Leaving a message. ?? Support Bo > Lord ??

Microservice architecture
One 、 Why do you need a microservice Architecture
The emergence of new things will inevitably conflict with the sending of old things , And the vitality of a new thing , It depends on whether there is room for development , So micro service architecture is no exception . With the development of Internet technology , The traditional application architecture has been unable to meet the actual needs , Microservice architecture comes into being . So what are the problems with traditional application architecture ? How to solve it ?
① Problems of traditional single application architecture
Usually, the traditional single application architecture we use is modular design , After the program is written, it will be packaged and deployed as a specific application , The format of the application depends on the corresponding application language and framework . for example : An e-commerce project ,Web The project will be hit WAR Packages are deployed in the form of Web Server , And ordinary. Java The program is marked as a Jar The form of package is contained in WAR in .
Pictured , This is our common development style , The benefits of this are conducive to development and debugging , And easy to deploy . In the case of a small number of customers , This kind of Architecture ( Single application architecture ) Fully meet the needs , But as the number of users increases , One server cannot satisfy , At this point, we will consider the horizontal expansion of the system , Usually our solution is to increase the number of servers , And copy the packaged application to different servers ( for example :Tomcat), Through the load balancer (Apache、Nginx) Easy horizontal expansion .

The problems of this architecture are as follows :
- Application complexity increases , to update 、 Difficult to maintain
- Simple applications are updated many times 、 Maintenance will become huge , Applications will become more complex , The development team faces many problems , The main problem is that the application is too complex , So that it is difficult for a single developer to carry out secondary development or maintenance
- It is easy to waste system resources
- Although load balancing is used to expand the service capacity of the project horizontally across domains , However, there is only one code in the single application architecture that contains all functions WAR package , So while expanding the service capacity , You can only choose to deploy this repeatedly WAR Package to expand service capabilities , Instead of just expanding the services you need .
- Impact on development efficiency
- When an application is bigger , The starting speed will be greatly reduced . In development and debugging , If you spend most of your time on startup , It will greatly affect the development efficiency .
- Low application reliability
- The reliability of single application architecture is low , When a module generates BUG when , It is likely to cause the whole process to collapse , Thus affecting the whole application .
- It is not conducive to the renewal of Technology
- Once certain technologies are selected for the traditional single application architecture , The later development and expansion will be realized on the basis of these technologies . If you need to change a technology , Then it is likely to redevelop the whole application .
② Solve the problems of traditional application architecture
Aiming at the problems of traditional monomer Architecture , Most enterprises pass SOA(Service-Oritend Architecture) Service oriented architecture solves the above problems .SOA The idea is to aggregate similar functions of applications , In the form of service , therefore SOA The application of architecture is simply understood as the combination of a number of services across domains .
- A whole project is divided into several sub projects , Different development teams are responsible for different sub projects , Improve development efficiency
- Split the module , Use interface communication , Reduce the coupling between modules
- Protect customers or service consumers from the impact of changes in service implementation
Although the use of SOA It solves the problems in the traditional monomer architecture , But most of the time ,SOA Independent services in will still be deployed to the same Tomcat For example , Similar to the single application architecture , With the increase of business functions ,SOA Services will also become complex . See the essence through the phenomenon , The problem of monomer architecture has not been solved .
In response to this problem , The architecture idea of microservice architecture also came into being , That is to decompose the application into small 、 Interconnected microservices .
Two 、 What is the microservice architecture
Microservice architecture is an architecture style and architecture idea , It advocates us to build on the traditional software application architecture , Split the system business more finely according to functions , Each service split is an independent application , These applications provide public API, Undertake external service responsibilities independently across domains , The software service entity developed through this idea is Microservices , And a series of architectures built around the idea of microservice ( Development 、 test 、 Deployment, etc. ) Let's call this Microservice architecture
① The advantages of microservice Architecture
- Controllable complexity
- Finer grained application splitting , It will not become complicated with the evolution of time , Each service focuses on only one small function .
- Independently deployable
- Because microservices have independent running processes , So each microservice can be deployed independently .
- Flexible technology selection
- Microservices architecture , The selection of technology is diversified . Each team chooses the most suitable technology according to different needs .
- Easy fault tolerance
- When a component sends a fault , It will only affect a small service , You can go online again by retrying .
- extensible
- A single service application can also achieve horizontal expansion , This extension can completely complex the entire application to different nodes .
- Stable function
- Each microservice has its own business logic and adapter , And only complete a specific function , For example, goods and services only manage goods .
② The shortcomings of microservice Architecture
- Developers have to deal with the complexity of creating distributed systems
- Development tools are geared towards building traditional monolithic applications , Does not provide full functional support for developing distributed applications ( Typical development tools :Eclipse)
- Testing is more difficult . In the microservices architecture , There are many services , Each service is an independent business unit , Services need to interact through interfaces .
- Implement across multiple service use cases , Requires careful coordination between teams .
- The complexity of deployment will greatly increase , This means developing 、 test 、 Operation and maintenance personnel need more solid accounting technology
- Increase memory consumption , The microservice architecture is replaced by multiple service instances 1 A single application instance , If every service is running at an increased JVM in , How many service instances are there , How many instances will have memory overhead at runtime .
③ Microservice architecture and SOA The difference between
Microservice architecture
SOA
A system is split into multiple services , fine-grained
The service consists of several subsystems , coarse-grained
Team level , Implement from bottom to top
Enterprise class , Carry out implementation from top to bottom
No centralized bus , Loose service architecture
Enterprise service bus , Centralized service architecture
Integrated way egg
The integration mode is complex
Services can be deployed independently
Services are interdependent , Can't deploy independently
3、 ... and 、 How to build a microservice Architecture
①、 Development of microservice instance
The development of micro services can choose Spring Boot
②、 Service registration and discovery
The registration and discovery of services in the architecture , Optional Spring Cloud Eureka、Apache Zookeeper、Consul( Domestic deactivation )、Dubbo etc.
③、 Load balancing
Load balancing can be used Spring Cloud Ribbon and Dubbo etc.
④、 Service fault tolerance
The technology of service fault tolerance can use brother Hao (Hystrix) stay SpringCloud The subproject of contains
⑤、API gateway
In the architecture API Gateway service , Use Spring Cloud Zuul、Spring Reactor、Netty etc.
⑥、 Distributed configuration center
have access to Spring Cloud Config
⑦ debugging
The testing of microservice applications generally uses Swagger.Swagger It's the most popular REST API One of the document generation tools , Provides powerful page testing capabilities to debug each RESTful API
⑧ Deploy
Microservices are officially recommended Docker To package and deploy microservices .Docker Is an open source application container engine , Strong portability 、 It's fast to start , Suitable for lightweight applications

边栏推荐
- [the road of Exile - Chapter 6]
- Know that Chuangyu is listed in many fields of ccsip 2022 panorama
- Overview of Qualcomm 5g intelligent platform
- [云原生]微服务架构是什么
- ASCII code table
- Mathematical modeling -- bus scheduling optimization
- Thirty years of MPEG audio coding
- Force deduction brush question (2): sum of three numbers
- Secret skill winter tide branding skill matching
- 关于字符串处理的相关函数记录(长期更新)
猜你喜欢
![[public class preview]: application exploration of Kwai gpu/fpga/asic heterogeneous platform](/img/e7/1d06eba0e50eeb91d2d5da7524f4af.png)
[public class preview]: application exploration of Kwai gpu/fpga/asic heterogeneous platform

Introduction to shared data center agent

Lm13 morphological quantification momentum period analysis

iVX低代码平台系列详解 -- 概述篇(二)

「活动推荐」冲冲冲!2022 国际开源节有新内容

Mathematical modeling -- heat conduction of subgrade on Permafrost

试着换个角度理解低代码平台设计的本质

Know that Chuangyu is listed in many fields of ccsip 2022 panorama

Ciscn 2022 central China Misc

为什么 BI 软件都搞不定关联分析
随机推荐
[the road of Exile - Chapter III]
Mobile communication -- simulation model of error control system based on convolutional code
MySQL stores JSON format data
Resolve the conflict with vetur when using eslint, resulting in double quotation marks and comma at the end of saving
一文读懂Okaleido Tiger近期动态,挖掘背后价值与潜力
(CVPR-2019)选择性的内核网络
Talk about possible problems when using transactions (@transactional)
Process -- user address space and kernel address space
Explanation of yocto project directory structure
[the road of Exile - Chapter 2]
Verilog procedure assignment statements: blocking & non blocking
QT source code analysis -- QObject (4)
Mathematical modeling - location of police stations
Web crawler API Quick Start Guide
autoware中ndtmatching功能加载点云图坐标系修正的问题
12.< tag-动态规划和子序列, 子数组>lt.72. 编辑距离
druid. The performance of IO + tranquility real-time tasks is summarized with the help of 2020 double 11
“蔚来杯“2022牛客暑期多校训练营2,签到题GJK
Overview of Qualcomm 5g intelligent platform
弹性布局 单选