Github's latest dominance, Tencent architects produced "Ceiling Notes" 500-page microservice architecture manual

foreword

Over the past 5 years, the microservice architectural style (organizing applications as a series of fine-grained, loosely coupled, independently deployable services) has become increasingly popular. Regardless of the size of the company, microservices are becoming more and more feasible for engineering teams alone. Today, microservices are no longer a concept, but an unstoppable trend. It has rich practical cases in large Internet e-commerce companies, and the effect is very good. But for other technology enthusiasts who are interested in transforming to the microservice architecture, there are still many unclear points about how microservices will be implemented. In order to help everyone better understand microservices, and lead everyone into the door of microservices.

Today, the editor will share with you a 500+ page microservice architecture study booklet summarized by the big brothers of Tencent to share with you! By studying this document, readers will understand how to develop and deploy microservice applications, and how to implement them through microservices Effective continuous delivery, and how to develop examples with Kubernetes, Docker, and Google Container Engine.

Okay, without further ado, let's take a look at the catalog first!

Directory overview

main content

This article has a total of 13 chapters, leading you to thoroughly interpret the actual combat of microservices. Because there are too many contents, I can only introduce some knowledge points to you. I hope you can understand and like it! !

Chapter 1 Design and Operation of Microservices;

  • (1) Microservice is not only an architectural style, but also a collection of a series of cultural habits. It is supported by five core principles, which are autonomy, recoverability, transparency, automation and consistency.
  • (2) Microservices reduce development conflicts and achieve autonomy, technical flexibility, and loose coupling.
  • (3) The design process of microservices is very challenging, because it not only requires rich business domain knowledge, but also requires developers to balance priorities among teams.
  • (4) Services expose contracts to other services. Well-designed contracts are concise, complete, and predictable.
  • (5) In long-running software systems, complexity is inevitable, but developers can make some decisions to reduce conflicts and risks, and then continue to deliver value in these systems.
  • (6) Automated and verifiable release operations can make the deployment process more reliable and "accident-free", thereby reducing the risk of microservices.
  • (7) Container technology abstracts the differences between services in the operating environment, and simplifies the way of large-scale management of different types of microservices.
  • (8) Failure is inevitable: For the team, microservices need to be transparent and easy to observe, so that the team can actively manage, understand and truly own the service operation and maintenance; and vice versa.
  • (9) The team adopting microservices needs to be more mature in operation and maintenance, and focus on the entire life cycle of the service, not just the design and development phase.

Chapter 2 Microservices of SimpleBank Company;

  • (1) Microservices are well-suited for systems with multidimensional complexity, such as a product's scope of supply, global deployment, and regulatory pressures.
  • (2) When designing microservices, it is crucial to understand the product business domain.
  • (3) Service interaction can be orchestrated or choreographed. The latter will increase the complexity of the system, but can reduce the coupling between services in the system.
  • (4) API gateway is a common pattern, which encapsulates and abstracts the complexity of microservice architecture, so the front-end or external consumers do not need to consider this part of the complexity.
  • (5) If the developer fully trusts that their service can handle the traffic pressure on the production environment, it can be said that the service is production-ready.
  • (6) If developers can reliably deploy and monitor a service, they can have more confidence in the service.
  • (7) Service monitoring should include log aggregation and health checks at the service level.
  • (8) Microservices will fail due to reasons such as hardware, communication, and dependencies, and not only defects in the code will cause failures.
  • (9) Collecting business indicators, logs, and link tracking records between services is crucial to understanding the current and past performance of microservice applications.
  • (10) As the number of microservices and support teams continues to increase, technical differences and isolation will increasingly become challenges for technical teams.
  • (11) Avoiding technical divergence and isolation requires the adoption of similar standards and best practices across different teams, regardless of the technical basis used.

Chapter 3 Architecture of Microservice Application;

  • (1) Separately, the internals of microservices are similar to monolithic applications.
  • (2) A microservice application is like a block: its final appearance is not specified, but is guided by a series of guidelines and a high-level outline model.
  • (3) The principles guiding the microservice architecture will reflect the goals of the organization and have an impact on the practice of the team.
  • (4) Architecture planning should promote healthy development, rather than specifying the entire application program.
  • (5) The microservice application is composed of four layers: platform layer, service layer, boundary layer and client layer.
  • (6) The platform layer provides a series of tools and infrastructure to support the development of production-oriented services.
  • (7) In microservice applications, synchronous communication is usually the first choice, and it is very suitable for command-type interaction, but there are also disadvantages-it will increase coupling and instability.
  • (8) Asynchronous communication is more flexible and can adapt to rapid system evolution, at the cost of increased complexity.
  • (9) Common asynchronous communication patterns include queues and publish-subscribe.
  • (10) The boundary layer is a facade of microservice applications, which is very suitable for external consumers.
  • (11) Common boundary layer patterns include API gateways and consumer-driven gateways (such as GraphQL).
  • (12) Client applications, such as websites and mobile applications, interact with the mobile backend through the boundary layer.
  • (13) The client has the risk of becoming more and more bloated, but now some technologies that apply microservice principles to front-end applications are also beginning to appear.

Chapter 4 New Function Design;

  • (1) Understand business problems - identify entities and use cases - divide service responsibilities, we can use this process to delineate the scope of services.
  • (2) Services can be divided in different ways: by business function, by use case and by variability. Readers can use these methods in combination.
  • (3) A good division decision can make the service meet the three key characteristics of microservices: only responsible for single-responsibility, replaceable and independently deployable.
  • (4) The bounded context usually corresponds to the service boundary, which is a very effective method when thinking about the future development of the service.
  • (5) Through in-depth thinking on variable fields, developers can encapsulate those fields that will change together, so as to improve the adaptability to future changes.
  • (6) If the service division is not good, the cost of late revision will be particularly high, because at that time, developers will need to refactor multiple code bases, and the resulting workload will become particularly large.
  • (7) We can also encapsulate technical functions into a service, which can not only simplify business capabilities, but also provide support for business functions and maximize the availability of services.
  • (8) If the service boundary is not clear enough, we would rather choose a coarse-grained service, but actively adopt a modular solution within the service to prepare for future splits.
  • (9) Service offline is a particularly challenging job, but with the continuous development of microservice applications, we will need to do this one day in the future.
  • (10) In large organizations, splitting ownership among multiple teams is necessary, but this introduces new problems: weakened control, limited design, inconsistent development speed.
  • (11) Open code, clear interfaces, continuous communication, and relaxed requirements for the DRY principle can all ease the tension between teams.

Chapter 5 Transactions and Queries of Microservices;

  • (1) It is difficult to achieve ACID characteristics in cross-service interactions, and microservices need to adopt different methods to achieve consistency.
  • (2) Coordination schemes such as two-phase commit introduce locking operations, and the scalability is not good.
  • (3) The event-based architecture can release the coupling between independent components, and lay the foundation for the business logic and query scalability of microservice applications.
  • (4) It tends to be highly available rather than consistent, which will make the architecture more scalable.
  • (5) Saga is a global operation composed of independent local transactions driven by group messages. They roll back erroneous states through compensating operations to achieve consistency.
  • (6) When building microservices that reflect real-world environments, anticipating and preparing for failure scenarios is a very important part of the content, and the isolation of operations is not so critical.
  • (7) We usually realize the query function across multiple microservices by combining the results of multiple APIs.
  • (8) Efficient composite queries should use CQRS mode to implement a set of independent read data models, especially when those query modes need to use another data storage system.

Chapter 6 Designing Highly Reliable Services;

  • (1) Faults are inevitable in complex distributed systems—developers must consider fault tolerance when designing these systems.
  • (2) The availability of each service will have an impact on the availability of the entire application.
  • (3) Developing appropriate strategies for each application to mitigate the risk of failure requires careful consideration of the frequency, impact, and cost of reducing these rare failure events.
  • (4) Most failures occur in 4 areas: hardware, communication, dependencies, and internals.
  • (5) Cascading failures caused by positive feedback are a very common form of failure in microservice applications. Usually, most of the cascading failures are caused by overloaded services.
  • (6) Retry and timeout strategies can be used to mitigate the impact of failures in service interactions. Developers should be extra careful when adopting the retry method, so as not to aggravate the failure of other services.
  • (7) Backup schemes (fllback) such as caching, candidate services, and default values ​​can be used to return successful results even if service dependencies are unavailable.
  • (8) The timeout period should be propagated to downstream services during service interaction, so as to not only ensure that the timeout period is consistent throughout the system, but also reduce useless work.
  • (9) Circuit breakers between services avoid cascading failures by failing fast when the amount of errors reaches a certain threshold.
  • (10) A service can use a traffic-limiting strategy to protect it from sudden peak load requests that exceed the capacity of the service.
  • (11) Each service should open a health check interface for the load balancer and monitoring system to use.
  • (12) The system recoverability can be verified effectively through stress testing and chaos testing.
  • (13) Standards can be adopted—whether through frameworks or proxies—to help engineers rapidly (“flall into the pit of sccess”"“) develop services that are fault-tolerant by default.

Chapter 7 builds a reusable microservice framework;

  • (1) The microservice base can speed up the startup of new services, expand the field of experimentation and reduce risks.
  • (2) Using the service base allows developers to extract code implementations related to certain infrastructures.
  • (3) Service discovery, observability, and different communication protocols are all the concerns of the service base, and the service base needs to provide these functions.
  • (4) If suitable tools exist, we can rapidly develop prototypes for complex functions such as placing orders to sell stocks.
  • (5) Although the microservice architecture is often associated with the possibility of developing systems in any language, in a production environment, these systems need to ensure and provide mechanisms to make operation and maintenance manageable.
  • (6) The microservice base can realize the above guarantees, and at the same time, it can allow developers to quickly start and develop to verify the correctness of the idea. If the verification is passed, it can be deployed to the production environment.

Chapter 8 Microservice Deployment;

  • (1) Deploying new applications and changes must be standardized and straightforward to avoid friction during microservice development.
  • (2) Microservices can run anywhere, but an ideal deployment platform needs to support a range of functions, including security, configuration management, service discovery, and redundancy.
  • (3) The developer deploys a typical service as a group of identical instances and connects it to a load balancer.
  • (4) Instance groups, load balancers, and health checks can enable the deployed services to achieve self-healing and automatic expansion.
  • (5) Service artifacts must be immutable and predictable to minimize risks, reduce cognitive difficulty, and simplify deployment abstraction.
  • (6) Developers can package services as language-specific packages, operating system packages, virtual machine templates, or container images.
  • (7) Adding/deleting a single instance of a microservice is a basic primary operation that can be combined by developers into higher-level deployments.
  • (8) Developers can use canary deployment or blue-green deployment to reduce the impact of unexpected defects on availability.

Chapter 9 Container- and Scheduler-Based Deployment;

  • (1) Packaging microservices as immutable, executable artifacts enables developers to orchestrate the deployment process through basic operations (adding or removing containers).
  • (2) In order to facilitate service development and deployment, the scheduler and container will extract the underlying machine management concept.
  • (3) The job of the scheduler is to try to match the resource requirements of the application with the resource usage of the cluster machines, and to perform health checks on the running services to ensure that they are running correctly.
  • (4) Kubernetes has the ideal characteristics of a microservice deployment platform, including password credential management, service discovery, and horizontal expansion.
  • (5) Kubernetes users define the desired cluster service state (or specification), and Kubermetes will continuously execute the "observation-comparison execution"-loop operation to calculate how to achieve the desired state.
  • (6) The logical application unit of Kubernetes is pod: a container or multiple containers executed together.
  • (7) The replica set manages the life cycle of the pod group. If an existing pod fails, the replica set starts a new pod.
  • (8) Deployment objects in Kubernetes are designed to maintain service availability by performing rolling updates to pods in a replica set.
  • (9) Developers can use service objects to group underlying pods for access by other applications inside and outside the cluster.

Chapter 10 builds a microservice delivery pipeline;

  • (1) The microservice deployment process should meet two goals: rhythm safety and consistency.
  • (2) The time it takes to deploy new services is usually a major hindrance in microservice applications.
  • (3) For microservices, continuous delivery is an ideal deployment practice, which reduces risk by quickly delivering small versions of verified change sets.
  • (4) A good continuous delivery pipeline can ensure the visibility of the deployment process, the correctness of the deployment results, and can feed back rich information to the engineering team.
  • (5) Jenkins is a very popular automated build tool, which uses a scripting language to link different tools together and combine them into a delivery pipeline.
  • (6) The pre-release environment is very valuable, but when faced with a large number of independent changes, maintaining a good pre-release environment is also facing great challenges.
  • (7) Readers can reuse declarative pipeline steps across services; actively promoting standardization can improve the predictability of the deployment process across different teams.
  • (8) To provide fine-grained control over releases and rollbacks, the reader should manage the technical activity of deploying separately from the business activity of feature releases.

Chapter 11 builds a monitoring system;

  • (1) A reliable microservice monitoring system includes metrics, link tracking and logs.
  • (2) Collecting rich data from microservices helps developers find faults, investigate problems, and understand the performance of the entire application.
  • (3) When collecting metrics, developers should focus on the four golden signs: latency, error volume, traffic (throughput rate), and saturation.
  • (4) Prometheus and StatsD are two common and language-independent tools for collecting metrics from microservices.
  • (5) Developers can use Grafana to display metric data in the form of charts, create human-readable dashboards and trigger alerts.
  • (6) If the alarms based on metrics reflect the symptoms of system abnormalities rather than the reasons, then these alarms are more durable and maintainable.
  • (7) A well-defined alarm should have a clear priority, be able to be escalated to the corresponding personnel layer by layer, be operable and contain concise and valuable information.
  • (8) Data collected and aggregated from multiple services enables developers to correlate and compare disparate metrics to gain a more comprehensive understanding of the system.

Chapter 12 uses logging and link tracing to understand system behavior;

  • (1) Readers can use Elasticsearch, Kibana and Fluentd to build a log infrastructure together, and use Jaeger to build a distributed link tracking system.
  • (2) The log infrastructure can generate, forward and store indexed log data to facilitate retrieval and correlation of different requests.
  • (3) Distributed link tracking enables developers to track the execution process of requests between different microservices.
  • (4) In addition to the collection of metrics, link tracking allows developers to better understand how the system operates, discover potential problems, and review the system at any time.

Chapter 13 Microservice team building;

  • (1) Building excellent software is not only related to the choice of solution, but also related to effective communication, coordination and collaboration.
  • (2) Application architecture and team structure have a symbiotic relationship. The latter can be used to change the former.
  • (3) If you want teams to be efficient, they should be organized to maximize autonomy, ownership, and end-to-end responsibilities.
  • (4) In terms of microservice delivery, cross-functional teams are faster and more efficient than traditional functional teams.
  • (5) Larger engineering organizations should establish a layered model with infrastructure, platform, and product teams. Lower-level teams provide services to higher-level teams to enable them to work more effectively.
  • (6) Community practices (such as associations and chapters), where functional knowledge can be shared.
  • (7) Microservice applications are difficult to fit into the human brain, which brings challenges to global decision-making and on-duty engineers.
  • (8) The architect should guide and influence the evolution of the application, rather than dictate the direction and results of the application.
  • (9) The internal open source model can improve cross-team collaboration, weaken possessiveness, and reduce the risk of the bus factor.
  • (10) Design reviews can improve the quality, accessibility, and consistency of microservices.
  • (11) Microservice documentation should include overview, operation manual, metadata, and service contract.

This [Microservice Actual Combat] document has a total of 551 pages. If you are interested, please private me

Guess you like

Origin blog.csdn.net/wdj_yyds/article/details/127224896