当前位置:网站首页>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 .
边栏推荐
- Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
- mysql8.0JSON_ Instructions for using contains
- 超级哇塞的快排,你值得学会!
- Two policemen were shot dead in a "safety accident" in Philadelphia, USA
- B站做短视频,学抖音死,学YouTube生?
- Interview shock 62: what are the precautions for group by?
- Run faster with go: use golang to serve machine learning
- 华为哈勃化身硬科技IPO收割机
- 12 MySQL interview questions that you must chew through to enter Alibaba
- FR练习题目---简单题
猜你喜欢
【jvm】运算指令
Live broadcast preview | how to implement Devops with automatic tools (welfare at the end of the article)
计算中间件 Apache Linkis参数解读
Penetration testing methodology
Drive brushless DC motor based on Ti drv10970
社区团购撤城“后遗症”
There is a powerful and good-looking language bird editor, which is better than typora and developed by Alibaba
爱可可AI前沿推介(7.5)
你童年的快乐,都是被它承包了
两个BI开发,3000多张报表?如何做的到?
随机推荐
Easyocr character recognition
useMemo,memo,useRef等相关hooks详解
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
我想咨询一下,mysql一个事务对于多张表的更新,怎么保证数据一致性的?
mysql8.0JSON_ Instructions for using contains
maxcompute有没有能查询 表当前存储容量的大小(kb) 的sql?
Explain Vue's plan to clean up keepalive cache in time
外盘入金都不是对公转吗,那怎么保障安全?
你童年的快乐,都是被它承包了
leetcode:881. 救生艇
亿咖通科技通过ISO27001与ISO21434安全管理体系认证
Stm32+bh1750 photosensitive sensor obtains light intensity
C language -- structure and function
STM32+BH1750光敏传感器获取光照强度
Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de
基于TI DRV10970驱动直流无刷电机
Is it OK to open the securities account on the excavation finance? Is it safe?
Handwriting promise and async await
Talking about how dataset and dataloader call when loading data__ getitem__ () function
【华为机试真题详解】字符统计及重排