当前位置:网站首页>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 .
边栏推荐
- 浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
- 超越PaLM!北大硕士提出DiVeRSe,全面刷新NLP推理排行榜
- Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
- 【华为机试真题详解】字符统计及重排
- Explain Vue's plan to clean up keepalive cache in time
- 微帧科技荣获全球云计算大会“云鼎奖”!
- 长列表优化虚拟滚动
- Handwriting promise and async await
- 通过npm 或者 yarn安装依赖时 报错 出现乱码解决方式
- Two Bi development, more than 3000 reports? How to do it?
猜你喜欢
How to paste the contents copied by the computer into mobaxterm? How to copy and paste
安装配置Jenkins
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
B站做短视频,学抖音死,学YouTube生?
社区团购撤城“后遗症”
危机重重下的企业发展,数字化转型到底是不是企业未来救星
爱可可AI前沿推介(7.5)
【leetcode周赛总结】LeetCode第 81 场双周赛(6.25)
[JVM] operation instruction
随机推荐
开挖财上的证券账户可以吗?安全吗?
webRTC SDP mslabel lable
机器学习框架简述
Topology可视化绘图引擎
Fr exercise topic --- comprehensive question
[C question set] of Ⅷ
C language -- structure and function
Un week - end heureux
启牛学堂班主任给的证券账户安全吗?能开户吗?
Crud de MySQL
12 MySQL interview questions that you must chew through to enter Alibaba
Two policemen were shot dead in a "safety accident" in Philadelphia, USA
STM32+BH1750光敏传感器获取光照强度
P1451 求细胞数量/1329:【例8.2】细胞
用 Go 跑的更快:使用 Golang 为机器学习服务
[JVM] operation instruction
Detailed explanation of usememo, memo, useref and other relevant hooks
be careful! Software supply chain security challenges continue to escalate
1330:【例8.3】最少步数
Coding devsecops helps financial enterprises run out of digital acceleration