Micro service mode language

Microservice pattern language

The following summarizes the pattern language of microservice architecture

Application architecture pattern

Which one should you choose for your application Architecture?

  • Monomode-build the application as a single deployable unit
  • Microservice architecture-build the application as a collection of loosely coupled services
  • ul>

    Decomposition

    How to decompose an application into services?

    • Split according to business capabilities-define services corresponding to business capabilities
    • Split according to domain sub-domains-define services corresponding to DDD sub-domains
    • li>

    Data management

    How to maintain data consistency and implement query?

    • Independent database-each service has its own private database
    • Shared database-shared database between services
    • Saga-Use sagas (a series of Local affairs) to maintain data consistency between services
    • API Composition- Realize query by calling services with data and perform in-memory connection
    • Command query responsibility separation CQRS-through Maintain one or more materialized views that can be effectively queried to achieve query
    • Domain events-publish events whenever data changes
    • Event traceability-persist aggregation as a series of events

    Transaction messages

    How to publish messages as part of a database transaction?

    • Transaction Outbox
    • Transaction log tracking
    • Poll the publisher

    Test

    How to make testing easier?

    • Drive contract testing-a test suite for a service, written by another developer who uses its service
    • Service contract testing-a test suite that uses test double precision Isolate and test any services it calls

    Deployment mode

    How to deploy the application’s services?

    • Multiple service instances per host-multiple service instances deployed on a single host
    • Single service instance per host-on each host Deploy a single service instance in each VM
    • Single service instance per VM-Deploy a single service instance in each VM
    • Single service instance per Container-Deploy in each container Single service instance
    • Serverless deployment-use serverless deployment platform to deploy services
    • Service deployment platform-use highly automated deployment platform that provides service abstraction to deploy services

    Boundary issues that need to be paid attention to

    How to deal with the problem of service instances interacting with the outside world?

    • Microservice basic framework-a framework for service instances to interact with the outside world and simplify service development
    • External configuration information-connect similar databases, access keys, etc. Externalization of configuration information

    Communication mode

    Style

    What kind of communication mechanism should be selected for inter-service communication and external client communication?

    • Remote procedure call-use RPI protocol-based communication between services
    • Message delivery-use asynchronous messages for communication between services
    • Domain-specific protocols-use domain-specific communication protocols (such as SIP, etc.)

    External API

    How to handle the communication between external clients and services?

    • API Gateway-Provides a unique interface for each type of client to access the service
    • The back end of the service front end (BFF)-Provides for each type of client An independent API gateway

    Service Discovery

    How does an RPI-based client discover the location of a service instance on the network?

    • Client service discovery-The client obtains the location of the service instance by directly querying the service registry
    • Server-side service discovery-The routing module queries the service registry Get the location of the service instance
    • Service registry-a data that records the location of the service instance
    • Self registration-the service instance completes the registration to the service registry by itself
    • 3rd party registration-The registration process of service instance information to the service registry through a third-party module

    Reliability

    How to avoid service failures or network interruptions The fault spread to other services?

    • Circuit breaker-When the failure rate returned by the remote service exceeds a certain threshold, the client agent (such as the API gateway) will immediately return the failure message when the remote service is called

    Security

    How to pass the identity information of the visiting client to the service instance?

    • Access token-The service instance uses the access token to safely pass the client’s identity information

    Observability

    < p>How to grasp the behavior of a running microservice application and perform effective troubleshooting?

    • Application logs-log files generated by aggregating applications
    • Application metrics-implement the function of collecting various indicators in the application operation process in the code
    • Audit log-record user behavior in the database for future verification
    • Distributed tracking-for each external access in the service code, a unique identifier is assigned, and This identifier is passed during cross-service access to track down problems caused by distribution. For example, when processing an external request through a centralized service, record the information of the request itself and the start and end time of the request.

    • Abnormal tracking-gather all the abnormal information triggered by the service program code into a centralized abnormal tracking service, and notify developers or operation and maintenance personnel according to certain logic. .

    • Health Check API- An API that can be called by a monitoring service, which usually returns service health information or responds to heartbeat check requests such as ping.

    • Log deployments and changes

    UI mode

    How to organize information from multiple services to generate a UI interface Or a web page?

    • Server-side page fragmentation element construction-On the server-side, the front-end output page content is constructed by orchestrating the HTML fragments generated by multiple business or domain-related back-end services

    • 客户端UI 构建- 在客户端通过编排由多个业务或领域相关UI 组件生成的HTML 片段来构建前端输出的页面内容

      以上内容翻译自https://microservices.io/patterns/ 网站的微服务模式,编写的书籍链接地址为:

      链接: https://pan.baidu.com/s/1lPTSjI4ePxLmTyKQ2zoS_A 提取码: 61j2

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 2904 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.