In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
What this article shares with you is what micro-service means. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
Micro service microservice
Micro-service refers to the service that provides a single business function. From a technical point of view, it is a small and independent process, similar to the process concept, which can be started or destroyed independently, and has its own independent database.
A complex software architecture consists of many micro services that run independently (with their own ports). These independent processing components communicate with each other through language-independent API, simple protocols with synchronous RMI/RPC and RESTful Web Services, asynchronous message push and Reactive.
These modular approaches enable the company to divide the project into multiple development teams, across different business departments, providing very sufficient flexibility, helping to improve the life cycle of the project and speed up the efficiency of project development.
Each micro-service component has its own allocated storage memory and CPU resources, which makes hardware utilization easier to optimize and track, especially in the cloud-based Pass environment, where the development team can use the technology they like, any language, as long as ensure that the micro-services are interactive and can combine the following applications.
When management complexity is reduced by the adoption of a micro-service architecture, updating one of the micro-service components usually does not cause a chain reaction because the micro-services are loosely coupled.
At present, the enterprises that use micro services are: Netflix Twitter Amazon Web Services (AWS), Google, eBay and so on.
Because many applications and services are deployed in a CVM-based environment, the micro-service architecture will rely heavily on container technology. The container isolates the micro-service processing and divides an application into small instances. The small instances in these containers have their own ports and virtualized environments.
The widely used container technology is Docker, an open source implementation based on Linux, supported by many software companies such as Canonical, Red Hat, and Parallels. PaaS service support includes Cloud Foundry for Google App Engine, Red Hat Open Shift, and VMware.
The micro-service architecture is not just about traditional services getting smaller and smaller. Two remarkable features of microservices are:
Hongmeng official Strategic Cooperation to build HarmonyOS Technology Community
The microservice itself is stateless.
There is little variable sharing between microservices.
You can imagine that if microservices can be shared, there are two problems: cooperation between microservices teams, because they share a unified database, and if this sharing does not bring communication costs and does not break the purpose that a team can do, then this kind of shared database can also be considered, but this is rarely the case, and most teams break their independence because of the sharing problem. In addition, if micro services are packaged in a container using Docker, these containers may be deployed across different infrastructures, and the deployment method is very flexible, which is a kind of cloud native application, while the shared database belongs to the underlying infrastructure, which obviously increases the deployment difficulties.
In addition, the communication between traditional services, whether RPC/RMI or Http/RESTful, is synchronous, while the communication between microservices should be asynchronous or reactive, that is, asynchronous. According to the impossible principle of FLP, the network is unreliable by default, and RPC will explode in the event of network congestion. Post-event monitoring can not fundamentally solve this problem. It is necessary to balance the design from the perspective of CAP theorem. The introduction of event-driven or Pub/Sub messages can improve the network fault tolerance and ensure the final consistency of data. Flexible transactions are the main choice of micro-service environment.
Traditional services often become monolithic because of transaction requirements, and the code of a service method needs to be stuck in the same transaction boundary, although this brings high consistency, but the scalability is relatively poor, because the actions within the same transaction boundary can not be separated into several micro services, so the use of micro services must actively embrace the final consistency and have some understanding of distributed systems and CAP theorem. Of course, these are only considered when there must be multiple micro-service invocations. because the micro-service granularity is small and single-minded, we can use composition to replace the idea of shared inheritance and tolerate some repetition of the code.
A microservice architecture requires the following conditions:
Basic monitoring, measurement and health examination
Distributed log trace
For each service, you need not only to isolate the code, but also to isolate the whole part of build + test + package + submit.
Can clearly define the upstream and downstream, compile time and run dependencies of each service.
Know how to build, expose, and maintain good API and contracts.
You need to respect the compatibility of BBOS and FGOS, even though you may be a consumer of the services you produce at different times.
Good unit testing and more readability
Pay attention to the differences between micro-services and modules and library packages, as well as the differences between distributed holistic monolith, collaborative version release, and database-driven inheritance.
Know the automation of infrastructure
Infrastructure based on CI/CD continuous integration / continuous delivery is required
Service division:
Define the scope of services according to business capabilities
Define the scope of services according to the concept of subdomains in domain-driven design
Communication mode:
Using synchronous communication based on RPC
Using asynchronous messages for inter-service communication
External API:
API Gateway (API gateway)-provides a unique interface for each type of client to access the service
The back end of the service front end (Backend for front-end)-provides a separate API gateway for each type of client
Data Management:
Each service has its own private database interface
Share the same database between services
Use events to maintain data consistency between services event traceability / CQRS
Operation and maintenance monitoring:
Service discovery: the registration process of the service instance information to the service registry through the third-party module
Distributed tracking (Distributed tracing) new-assigns a service identifier for each external access in the service code and passes this identifier across service accesses for tracking distributed throws
Circuit breaker (Circuit Breaker)-when the failure rate returned by the remote service exceeds a certain threshold, the call to the remote service by the client agent (such as the API gateway) will immediately return the failed message
This is what micro-service means. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.