当前位置:网站首页>Talk about your understanding of microservices (PHP interview theory question)
Talk about your understanding of microservices (PHP interview theory question)
2022-07-05 14:59:00 【Back end regular developers】
Catalog
brief introduction
Learning links for reference
- Microservice design
- Cloud native distributed storage cornerstone :etcd In depth analysis of
- Docker Introduction to technology and actual combat
- Every day 5 Minutes to play Kubernetes
- The left ear to listen to the wind
- from 0 Start learning about microservices
One 、 What is microservice architecture ?
Microservice is an architectural concept , It aims to realize the decoupling of solutions by decomposing functions into discrete Services . You can think of it as applying a lot more at the architecture level than on the classes that get services SOLID principle . Microservice architecture is a very interesting concept , Its main function is to decompose functions into discrete Services , So as to reduce the coupling of the system , And provide more flexible service support .
Concept : Split a large single application and service into several or even dozens of support services , It can extend a single component rather than the entire application stack , So as to meet the service level agreement .
Definition : Create applications around business domain components , These applications can be developed independently , management , And iteration . Use Cloud Architecture and platform deployment in distributed components , Management and service functions . Make product delivery easier .
The essence : Use some functions to be clear , The service area with relatively refined business is larger , More practical questions
Two 、 Reasons for appearance
Why does microservice appear ? I think this is the inevitable result of the development of the Internet .
As never before IOS Seven layer model , Programmers at that time did programming , They need to do what the seven layer model does , This is something every programmer needs to do , A lot of waste of resources , And everyone's effect is hard to say perfect . then IOS Seven layer model appeared , Unified specifications help programmers complete repetitive work , Greatly improved development efficiency .
In that case , Microservices do the same thing .
The Internet has experienced decades of development , The head company is huge , Encounter a lot of problems , Every enterprise may encounter these problems . In many things, we are building wheels repeatedly , And many times it may not be done very well . On the basis of absorbing excellent practice , Combine your extensive knowledge , Promote the development of micro Services .
At present, it is still difficult to form a unified standard for microservices , First, from the perspective of the whole development stage , It is still in its infancy , There are not a large number of relevant microservice talents , Second, the business situation of each company is different , It is difficult to completely unify . however , In fact, microservices have become a prairie fire , In the near future , It may be easier to start an Internet company , Microservices will be like TCP/IP equally , It is completely transparent to developers , Developers only need to focus on developing business logic , Of course , The premise is to develop to this stage , If you still need programmers .
Develop this universal microservice platform , It's also a very good entrepreneurial direction .
So as a contemporary programmer , Learning micro services is still necessary , This is the inevitable trend , Can also increase their competitiveness . If one day , Microservices and TCP/IP As transparent as before , People who understand the core principles of micro services are still more valuable , After all, only these people can solve some magical problems .
3、 ... and 、 system
The water of micro service is very deep , Accurately speaking , It's not only deep but also very wide . Microservices involve a lot of content , And each piece can be studied in depth , Become an expert in this area .
stay 《 Microservice design 》 In this book , Microservices are defined as : Microservices are small, autonomous services that work together .
This definition is not particularly good , I always feel that the scope of micro services has been narrowed .
In addition, there is a big gap in the understanding of this sentence with different experience . I remember I used to have a comment system , Comment service 、 Comment backstage 、DB、 Caches are deployed independently , At that time, I thought this comment system was a micro service . So it's not 100% wrong , But it is certainly not right .
Because microservices describe a whole set of systems , A single independent service , Only a small part of micro Services .
Microservices mainly consist of 6 Part of the form
- The service description
Documentation for similar services , Simple but indispensable . such as , The first problem to be solved by service invocation is how to describe the service externally . such as , You have provided a service , What is the service name of this service ? What information needs to be provided to call this service ? What format is the result returned by calling this service ? How to analyze ? These are the problems to be solved by the service description .
- Registry Center
With the interface description of the service , The next step is to solve the problem of service publishing and subscription , That means you provide a service (Provider), How to make the outside (Consumer) People who want to call your service know . A similar registry is needed at this time (Registry) Role , Service providers register their services and addresses with the registry , The service consumer queries the registry for the address of the service to be called , Then make a request .
- Service Framework
Through the registry , The service consumer can get the address of the service provider , When you have an address, you can initiate a call . But before you start the call, you need to solve the following problems . What protocol is used for service communication ? yes RESTful API still gRPC? What method is used for data transmission and what format is used for data compression ? These activities are usually integrated into our service framework , There are many such open source frameworks on the market , They are relatively mature , The next test is your ability to get started quickly .
- Service monitoring
Once the service consumer and service provider can normally initiate service invocation , You need to monitor the call , To find out if the service is normal . Generally speaking , Service monitoring mainly includes three processes , Index collection , Data processing , Data presentation . Monitoring is to find problems and anomalies , If you want to further track and locate the problem , You need to learn more about service tracking .
- Service tracking
In addition to the need to monitor service invocation , You also need to record every link that the service calls through , For problem tracking and fault location , Finally, the goal of approaching the problem . Service monitoring and tracking can be combined , But to be clear about their respective responsibilities is not the same .
- Service governance
Service monitoring can find problems , Service tracking can locate the problem , And solving the problem depends on Service Management . Service governance is to ensure that in all kinds of unexpected situations , Service calls still work . On the current open source service framework , Most of them do not include service governance , So it is possible that you and your team need to carry out customized development , It depends on how well you do it , It's like you have a database but you don't ER The picture describes , It does not affect your use of microservices , Of course, if there is one, it is the icing on the cake .
this 6 Part of it is called microservice when combined . The following link is a mind map I made , I haven't completely learned some contents in the map , In the later stage, it will be further sorted out , If you like , You can remember this link first .
https://www.processon.com/view/link/5f3952a17d9c0806d41a90a9
Four 、 The advantages of microservice Architecture
Effective split application , Implement agile development and deployment
The division of different , In the past, we may have one module for each person , Now it could be one person, one system
Different architectures , Service splitting is a high-tech problem , Whether the split is reasonable or not has great influence on the future development
Different deployment methods , If we deploy as before, we're exhausted , Automatic operation and maintenance
Different disaster tolerance , A good microservice can isolate faults and avoid the overall collapse of the service , Bad microservice design can still cause a chain reaction due to a problem with a subservice
Extension is different , Microservices are easier to expand horizontally and vertically according to demand
What microservices do is to split services according to project granularity , Take out the modules separately to make each individual small project . The main features of microservices are :
Each function module is a small project , Run independently on different processes or machines , Different functions can be developed by different people independently , Independent deployment does not need to rely on the overall project to start a single service , Distributed management , Just do your own thing for each service , When designing microservices, you need to consider databases , Whether all services share one database or one service and one database .
5、 ... and 、 Disadvantages of microservices
Because of the complexity of the microservice architecture , High technical requirements , So we should consider whether the team already has relevant technology
Whether the company's business is suitable for microservice transformation , Not all of them are suitable , Traditional industries have many complex vertical business structures .
There are many technologies of micro service ecosystem , Not every technical solution needs to be used , What suits you is the best
For microservice Architecture : It's not a technical problem , Consciousness is more important than tools !
What is? RPC?
A lot of traditional phper Don't know what is rpc,RPC Full name Remote Procedure Call, Remote procedure call , In fact, you can understand it as an architectural design , Or a solution .
adopt RPC We can call methods on other machines as we call local methods , Users will not feel the communication between servers ,RPC It plays a considerable role in microservices
6、 ... and 、 Learning route
Microservice is a master of modern Internet technology . I'm a beginner , You need to establish a learning route for yourself , This can help you better master the content .
For the learning route , I think there are several principles :
Find out what you must learn and take notes
I have read many articles or books before , But I didn't write down the content , I always feel that I have learned a little , Digest the content and write it out , Be able to impress
The necessary content should be the core content , image k8s、docker、 Distribution is 100% of what needs to be learned
You don't have to learn
There are multiple technology options for the same scheme , Just learn one . Such as service arrangement, just look k8s, Because this is already the industry standard . Service tracking can be done from zipkin and skywalking Choose one of them
Some contents are particularly inclined to the operation and maintenance level , You can understand a little or not at all
Constantly update and enrich the brain map
Learning process , Need to practice , Finally, we will build a basic micro service .
At present, the contents of planned learning and relearning are
- k8s
- docker
- Etcd
- GRPC
- Netty
- Dubbo
- ELK
- Grafana
- Kafka
- Skywalking
- Apollo
- Istio
In fact, in addition to these , There are many other things to learn about microservices , These contents can be supplemented slowly in the future .
边栏推荐
- Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
- How to solve the problem of garbled code when installing dependency through NPM or yarn
- Leetcode: Shortest Word Distance II
- CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
- 通过npm 或者 yarn安装依赖时 报错 出现乱码解决方式
- 【华为机试真题详解】字符统计及重排
- 我这边同时采集多个oracle表,采集一会以后,会报oracle的oga内存超出,大家有没有遇到的?
- Microframe technology won the "cloud tripod Award" at the global Cloud Computing Conference!
- 开挖财上的证券账户可以吗?安全吗?
- Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
猜你喜欢

你童年的快乐,都是被它承包了

Select sort and bubble sort

想进阿里必须啃透的12道MySQL面试题

CPU设计相关笔记

Two Bi development, more than 3000 reports? How to do it?

leetcode:881. 救生艇

How to paste the contents copied by the computer into mobaxterm? How to copy and paste

微帧科技荣获全球云计算大会“云鼎奖”!

【NVMe2.0b 14-9】NVMe SR-IOV

用 Go 跑的更快:使用 Golang 为机器学习服务
随机推荐
爱可可AI前沿推介(7.5)
GPS original coordinates to Baidu map coordinates (pure C code)
30岁汇源,要换新主人了
CPU设计实战-第四章实践任务二用阻塞技术解决相关引发的冲突
Two Bi development, more than 3000 reports? How to do it?
Explain Vue's plan to clean up keepalive cache in time
FR练习题目---综合题
长列表优化虚拟滚动
Security analysis of Web Architecture
【华为机试真题详解】字符统计及重排
你童年的快乐,都是被它承包了
[C question set] of Ⅷ
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
PostgreSQL 13 installation
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
Crud de MySQL
有一个强大又好看的,赛过Typora,阿里开发的语雀编辑器
亿咖通科技通过ISO27001与ISO21434安全管理体系认证
可转债打新在哪里操作开户是更安全可靠的呢
What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?