A request-response method, system, computer equipment, and medium for microservices.

By generating and routing lists of normal and canary instances within a microservice architecture, the issue of iteration conflicts during canary releases was resolved, improving system efficiency and user experience.

CN116594769BActive Publication Date: 2026-11-17PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310525587.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-10
Publication Date
2026-11-17
Estimated Expiration
2043-05-10

AI Technical Summary

Technical Problem

In canary deployments, microservice architectures can experience conflicts in parallel iteration across different environments during request-response scenarios, leading to low iteration efficiency and a degraded user experience.

Method used

By receiving resource call requests, determining the grayscale instance matching strategy, generating lists of normal instances and grayscale instances, and routing based on these lists to generate target instances, the microservice processing results are finally generated and displayed.

Benefits of technology

This avoids conflicts in parallel iteration across different environments, improves system iteration efficiency, reduces request response time costs, and enhances user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116594769B_ABST
    Figure CN116594769B_ABST
Patent Text Reader

Abstract

This invention relates to the fields of the Internet and digital healthcare, and discloses a request-response method, system, computer device, and medium for microservices. The method includes: receiving a resource call request for a microservice architecture; determining a grayscale instance matching strategy based on the resource call request; processing a pre-built service instance list according to a preset grayscale instance identifier and the strategy to generate a normal instance list and a grayscale instance list; routing based on the normal instance list and the grayscale instance list to generate a target instance; generating a microservice processing result based on the target instance and returning it to the client for display. Because the pre-built service instance list is processed according to the preset grayscale instance identifier and the grayscale instance matching strategy to generate the normal instance list and the grayscale instance list for routing, the problem of parallel iteration conflicts between different environments is avoided, improving the system's iteration efficiency, reducing unnecessary time costs for request-response, and improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of Internet and digital healthcare technology, and in particular to a microservice request-response method, system, computer equipment, and medium. Background Technology

[0002] With the rapid development of microservice technology, more and more software platforms are adopting microservice architecture and combining it with canary releases. Canary release (also known as gray-scale release) refers to a release method that allows for a smooth transition between black and white releases. A / B testing can be performed on it, where some users continue using product feature A, while others start using product feature B. If users have no objections to B, the scope is gradually expanded until all users are migrated to B. Canary releases can ensure the stability of the overall system, allowing problems to be identified and addressed during the initial gray-scale release, thus minimizing their impact, improving product and feature stability, reducing the impact of product upgrades on users, and reducing downtime for production releases.

[0003] In real-world request-response scenarios, canary deployment software systems typically have multiple service instances forming a target service cluster. Therefore, when a service consumer initiates a Remote Produce Call (RCP) to perform a remote call, it first needs to select a service instance from the target service cluster – this is the process of service routing and load balancing. This process can lead to conflicts in parallel iterations across different environments, reducing system iteration efficiency, increasing unnecessary time costs for request-response, and degrading user experience. Summary of the Invention

[0004] Therefore, it is necessary to provide a microservice request-response method, system, computer equipment, and medium to address the problems of parallel iteration conflicts and low iteration efficiency in various environments.

[0005] A request-response method for microservices includes: receiving resource call requests for a microservice architecture and determining a canary instance matching strategy based on the resource call requests; processing a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy to generate a normal instance list and a canary instance list; wherein, normal instances are service instances that are not configured with a canary strategy during canary release; and canary instances are service instances that are configured with a canary strategy during canary release; routing based on the normal instance list and the canary instance list to generate a target instance; generating a microservice processing result based on the target instance, and returning the microservice processing result to the client for display.

[0006] In one embodiment, the pre-built service instance list in the load balancer is processed according to a preset grayscale instance identifier and a grayscale instance matching strategy to generate a normal instance list and a grayscale instance list, including: initializing the pre-built service instance list; distinguishing multiple service instances in the service instance list according to the preset grayscale instance identifier to generate a normal service instance set and a grayscale service instance set; matching in the grayscale service instance set according to the grayscale instance matching strategy to generate a successfully matched grayscale instance list; and determining the normal service instance set as the normal instance list.

[0007] In one embodiment, the grayscale instance matching strategy includes a label matching strategy and a coloring instance matching strategy. Matching is performed on a set of grayscale service instances according to the grayscale instance matching strategy to generate a list of successfully matched grayscale instances. This includes: using the label matching strategy to match service instances carrying preset labels in the set of grayscale service instances, and filtering out grayscale service instances without preset labels, to obtain a first set of grayscale service instances; using the coloring instance matching strategy to match service instances carrying preset coloring parameters in the first set of grayscale service instances, and filtering out service instances without preset coloring parameters, to obtain a second set of grayscale service instances; classifying the second set of grayscale service instances into levels to obtain a multi-level set of grayscale service instances; and determining the multi-level set of grayscale service instances as the list of successfully matched grayscale instances.

[0008] In one embodiment, routing based on a normal instance list and a grayscale instance list to generate a target instance includes: performing load balancing based on the grayscale instance list to obtain a matching result; determining whether there is a target grayscale instance corresponding to the resource call request in the grayscale instance list based on the matching result; if so, determining the target grayscale instance as the target instance; or, if not, performing load balancing based on the normal instance list to obtain the target instance.

[0009] In one embodiment, before receiving a resource call request for a microservice architecture, the method further includes: identifying multiple assemblies in the current system that can provide services externally; constructing a service instance for each assembly to obtain multiple service instances; adding service tags to each of the multiple service instances to obtain tagged service instances; classifying the tagged service instances according to the service tags to obtain multiple types of service instances; configuring a grayscale policy for any one of the multiple types of service instances when a grayscale policy configuration instruction is received; and generating a pre-built list of service instances after the grayscale policy configuration is completed.

[0010] In one embodiment, determining a grayscale instance matching strategy based on a resource call request includes: parsing the resource call request to obtain parsed data; extracting a strategy identifier from the parsed data; and when the strategy identifier matches the identifier of a preset label and / or a preset coloring parameter, determining the label matching strategy corresponding to the matching label and / or the coloring instance matching strategy corresponding to the matching identifier as the grayscale instance matching strategy.

[0011] In one embodiment, generating a microservice processing result based on a target instance includes: obtaining instance parameters carried in a resource call request; determining the application interface corresponding to the target instance and calling the method function of the application interface; inputting the instance parameters into the method function to obtain an executable service script; and running the service script to generate the microservice processing result.

[0012] A microservice request-response system includes: a gray-scale instance matching strategy determination module, used to receive resource call requests for a microservice architecture and determine a gray-scale instance matching strategy based on the resource call requests; an instance list generation module, used to process a pre-built service instance list according to a preset gray-scale instance identifier and gray-scale instance matching strategy to generate a normal instance list and a gray-scale instance list; wherein, normal instances are service instances that are not configured with a gray-scale strategy during gray-scale release; and gray-scale instances are service instances that are configured with a gray-scale strategy during gray-scale release; a target instance generation module, used to route based on the normal instance list and the gray-scale instance list to generate target instances; and a microservice processing result display module, used to generate microservice processing results based on the target instances and return the microservice processing results to the client for display.

[0013] A computer device includes a memory and a processor, the memory storing computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the request-response method of the microservice described above.

[0014] A medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the request-response method of the microservice described above.

[0015] The aforementioned request-response method, system, device, and medium for microservices involve a system that first receives resource call requests for the microservice architecture and determines a canary instance matching strategy based on the request. Then, it processes a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy, generating a normal instance list and a canary instance list. Normal instances are service instances that were not configured with a canary strategy during canary release, while canary instances are service instances that were configured with a canary strategy during canary release. Next, routing is performed based on the normal instance list and the canary instance list to generate target instances. Finally, a microservice processing result is generated based on the target instances and returned to the client for display. Because this application processes the pre-built list of service instances according to the preset canary instance identifier and the canary instance matching strategy to generate the normal instance list and the canary instance list for routing operations, dynamic load balancing can be performed based on these two tables during routing. This avoids conflicts in parallel iterations across different environments, improves system iteration efficiency, reduces unnecessary time costs in request-response, and enhances user experience. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0017] Figure 1 This is a diagram illustrating the implementation environment of the request-response method for microservices provided in one embodiment of this application.

[0018] Figure 2 This is a schematic diagram of the internal structure of a computer device in one embodiment of this application;

[0019] Figure 3 This is a schematic diagram of a request-response method for microservices provided in one embodiment of this application;

[0020] Figure 4 This is a schematic diagram of a request-response method for microservices provided in another embodiment of this application;

[0021] Figure 5 This is a schematic diagram of the system architecture of a microservice request-response system provided in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0023] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.

[0024] Figure 1 Here is an implementation environment diagram of the request-response method for a microservice provided in one embodiment, such as... Figure 1 As shown, this implementation environment includes a server 110 and a client 120.

[0025] Server 110 can be a server, specifically a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. For example, it could be a server device storing a list of service instances. For instance, when a user conducts a remote consultation on a medical platform, the user generates a resource call request for a microservice architecture by clicking any consultation-related function and sends this request to server 110. Server 110 receives the resource call request for the microservice architecture and determines a canary instance matching strategy based on the request. Server 110 processes the pre-built service instance list according to the preset canary instance identifier and canary instance matching strategy, generating a normal instance list and a canary instance list. Server 110 routes based on the normal instance list and the canary instance list to generate a target instance. Server 110 generates a microservice processing result based on the target instance and returns the microservice processing result to client 120 for display.

[0026] It should be noted that the client 120 can be a smartphone, tablet, laptop, desktop computer, etc., but is not limited to these. The server 110 and the client 120 can connect via Bluetooth, USB (Universal Serial Bus), or other communication connection methods, which are not limited in this invention.

[0027] Figure 2 This is a schematic diagram of the internal structure of a computer device in one embodiment. For example... Figure 2As shown, the computer device includes a processor, media, memory, and network interface connected via a system bus. The media of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a sequence of control information. When the computer-readable instructions are executed by the processor, they enable the processor to implement a microservice request-response method. The processor of the computer device provides computing and control capabilities to support the operation of the entire device. The memory of the computer device may store computer-readable instructions, which, when executed by the processor, enable the processor to execute a microservice request-response method. The network interface of the computer device is used for communication with a terminal. Those skilled in the art will understand that… Figure 2 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. A specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. The medium is a readable storage medium.

[0028] The following will be combined with the appendix Figure 3-4 This application provides a detailed description of the microservice request-response method provided in its embodiments. This method can be implemented using a computer program and can run on a microservice request-response system based on the von Neumann architecture. This computer program can be integrated into an application or run as a standalone utility application.

[0029] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0030] Foundational artificial intelligence technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, request-response technology for large-scale microservices, operating / interaction systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.

[0031] Please see Figure 3 This is a flowchart illustrating a microservice request-response method provided in this application embodiment. Figure 3 As shown, the method in this application embodiment may include the following steps:

[0032] S101 receives resource call requests for microservice architecture and determines the canary instance matching strategy based on the resource call requests;

[0033] Microservices are a cloud-native architectural approach where a single application consists of many loosely coupled and independently deployable smaller components or services. Services communicate remotely via RPC (Remote Produce Call), which makes inter-service calls as convenient as local calls, making the caller unaware of the remote call logic. Resource request requests are generated by users triggering a function on the software platform.

[0034] In this embodiment of the application, when a resource call request for a microservice architecture is received, the resource call request is first parsed to obtain parsed data. Then, the strategy identifier in the parsed data is extracted. Finally, when the strategy identifier is consistent with the identifier of a preset label and / or a preset coloring parameter, the label matching strategy corresponding to the consistent label and / or the coloring instance matching strategy corresponding to the consistent identifier is determined as the grayscale instance matching strategy.

[0035] Furthermore, when the strategy identifier is inconsistent with the identifier of the preset label and / or preset coloring parameters, the currently used general strategy can be determined as the grayscale instance matching strategy.

[0036] It should be noted that different grayscale instance matching strategies can provide users with different instances, and different instances can provide users with different functional processing logic.

[0037] S102, Process the pre-built service instance list according to the preset grayscale instance identifier and grayscale instance matching strategy to generate a normal instance list and a grayscale instance list;

[0038] Normal instances are service instances that are not configured with a canary release strategy during canary release; canary instances are service instances that are configured with a canary release strategy during canary release.

[0039] Typically, canary release (also known as gray-scale release) refers to a release method that allows for a smooth transition between black and white releases. It enables A / B testing, where some users continue using product feature A while others start using product feature B. If users have no objections to feature B, the release is gradually expanded until all users are migrated to feature B. Canary releases ensure overall system stability, allowing issues to be identified and addressed during the initial phase to minimize impact. This improves product and feature stability, reduces the impact of product upgrades on users, reduces production system downtime, enables seamless production environment switching, and eliminates the need for developers and testers to perform online verification of production functions overnight. Bugs that would normally require a second day to discover can also be identified earlier.

[0040] In this embodiment of the application, when generating a pre-built list of service instances, firstly, multiple assemblies that can provide services to the outside world in the current system are identified, and service instances of each assembly are built to obtain multiple service instances. Then, service tags are added to each of the multiple service instances to obtain tagged service instances. Next, the tagged service instances are classified according to the service tags to obtain multiple types of service instances. Then, when a grayscale policy configuration instruction is received for any one of the multiple types of service instances, a grayscale policy is configured for any one service instance. Finally, after the grayscale policy configuration is completed, a pre-built list of service instances is generated.

[0041] In one possible implementation, when processing the pre-built service instance list in the load balancer, the pre-built service instance list is first initialized. Then, multiple service instances in the service instance list are distinguished according to a preset grayscale instance identifier to generate a normal service instance set and a grayscale service instance set. Next, the grayscale service instance set is matched according to the grayscale instance matching strategy to generate a successfully matched grayscale instance list. Finally, the normal service instance set is determined as the normal instance list.

[0042] Specifically, grayscale instance matching strategies include label matching strategies and coloring instance matching strategies.

[0043] Furthermore, when matching in the gray-scale service instance set according to the gray-scale instance matching strategy to generate a list of successfully matched gray-scale instances, the first step is to use a label matching strategy to match service instances carrying preset labels in the gray-scale service instance set and filter out gray-scale service instances that do not carry preset labels, resulting in a first gray-scale service instance set. Then, the second step is to use a coloring instance matching strategy to match service instances carrying preset coloring parameters in the first gray-scale service instance set and filter out service instances that do not carry preset coloring parameters, resulting in a second gray-scale service instance set. Next, the second gray-scale service instance set is divided into levels to obtain a multi-level gray-scale service instance set. Finally, the multi-level gray-scale service instance set is determined as the list of successfully matched gray-scale instances.

[0044] Specifically, when classifying the second grayscale service instance set, the number of times each second grayscale service instance in the second grayscale service instance set is called within a preset period is first counted. Then, service instances whose number of calls is greater than the upper limit of the preset range are determined as the first level, service instances whose number of calls is within the preset range are determined as the second level, and service instances whose number of calls is less than the lower limit of the preset range are determined as the third level.

[0045] The order of the levels is: Level 1 > Level 2 > Level 3. The preset cycle can be determined based on the actual application scenario, such as several hours, several days, or a week.

[0046] S103, Based on the list of normal instances and the list of grayscale instances, perform routing to generate the target instance;

[0047] In this embodiment of the application, when routing based on the normal instance list and the grayscale instance list, load balancing is first performed based on the grayscale instance list to obtain a matching result. Then, based on the matching result, it is determined whether there is a target grayscale instance corresponding to the resource call request in the grayscale instance list. If so, the target grayscale instance is determined as the target instance; or, if not, load balancing is performed based on the normal instance list to obtain the target instance.

[0048] In one possible implementation, after obtaining the list of successfully matched normal instances and the list of grayscale instances, routing is performed. The grayscale instance list is used first for load balancing. If the grayscale instance list is empty, the normal instance list is used for load balancing to obtain the target instance. If the grayscale instance list is not empty, it means that a target instance corresponding to the resource call request exists in the grayscale instance list, and the target instance is obtained directly after load balancing using the grayscale instance list.

[0049] S104: Generate microservice processing results based on the target instance and return the microservice processing results to the client for display.

[0050] In one possible implementation, when generating microservice processing results based on the target instance, the instance parameters carried in the resource call request are first obtained, then the application interface corresponding to the target instance is determined and the method function of the application interface is called, then the instance parameters are input into the method function to obtain an executable service script, and finally the service script is run to generate the microservice processing results.

[0051] Furthermore, after obtaining the microservice processing results, the microservice processing results can be returned to the client for display.

[0052] For example, after obtaining the target instance, the corresponding function code can be associated and mapped with the parameters in the user request before execution, and the result can be fed back to the user.

[0053] In this embodiment, the microservice request-response system first receives resource call requests for the microservice architecture and determines a canary instance matching strategy based on the resource call requests. Then, it processes a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy to generate a normal instance list and a canary instance list. Normal instances are service instances that were not configured with a canary strategy during canary release, while canary instances are service instances that were configured with a canary strategy during canary release. Next, it routes based on the normal instance list and the canary instance list to generate a target instance. Finally, it generates a microservice processing result based on the target instance and returns the microservice processing result to the client for display. Because this application processes the pre-built list of service instances according to the preset canary instance identifier and the canary instance matching strategy to generate the normal instance list and the canary instance list for routing operations, it avoids the problem of parallel iteration conflicts between different environments, improves the system's iteration efficiency, reduces unnecessary time costs for request and response, and enhances the user experience.

[0054] Please see Figure 4 This provides a flowchart illustrating another microservice request-response method for embodiments of this application. For example... Figure 4 As shown, the method in this application embodiment may include the following steps:

[0055] S201: Receive resource call requests for microservice architecture and determine the canary instance matching strategy based on the resource call requests;

[0056] S202, Initialize the pre-built list of service instances;

[0057] S203, Based on the preset grayscale instance identifier, distinguish multiple service instances in the service instance list and generate a normal service instance set and a grayscale service instance set;

[0058] S204, Match the gray service instance set according to the gray instance matching strategy, generate a list of successfully matched gray instances, and determine the normal service instance set as the normal instance list;

[0059] S205, perform load balancing based on the grayscale instance list to obtain the matching results;

[0060] S206, Determine whether the target grayscale instance corresponding to the resource call request exists in the grayscale instance list based on the matching results;

[0061] S207, if yes, then determine the target grayscale instance as the target instance; or, if no, perform load balancing based on the normal instance list to obtain the target instance;

[0062] S208 generates microservice processing results based on the target instance and returns the microservice processing results to the client for display.

[0063] In this embodiment, the microservice request-response system first receives resource call requests for the microservice architecture and determines a canary instance matching strategy based on the resource call requests. Then, it processes a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy to generate a normal instance list and a canary instance list. Normal instances are service instances that were not configured with a canary strategy during canary release, while canary instances are service instances that were configured with a canary strategy during canary release. Next, it routes based on the normal instance list and the canary instance list to generate a target instance. Finally, it generates a microservice processing result based on the target instance and returns the microservice processing result to the client for display. Because this application processes the pre-built list of service instances according to the preset canary instance identifier and the canary instance matching strategy to generate the normal instance list and the canary instance list for routing operations, it avoids the problem of parallel iteration conflicts between different environments, improves the system's iteration efficiency, reduces unnecessary time costs for request and response, and enhances the user experience.

[0064] The following are system embodiments of the present invention, which can be used to execute the method embodiments of the present invention. For details not disclosed in the system embodiments of the present invention, please refer to the method embodiments of the present invention.

[0065] Please see Figure 5 This diagram illustrates the structure of a microservice request-response system provided by an exemplary embodiment of the present invention. This microservice request-response system can be implemented as all or part of a device through software, hardware, or a combination of both. System 1 includes a grayscale instance matching strategy determination module 10, an instance list generation module 20, a target instance generation module 30, and a microservice processing result display module 40.

[0066] The gray-scale instance matching strategy determination module 10 is used to receive resource call requests for microservice architecture and determine the gray-scale instance matching strategy based on the resource call requests.

[0067] The instance list generation module 20 is used to process the pre-built service instance list according to the preset grayscale instance identifier and grayscale instance matching strategy to generate a normal instance list and a grayscale instance list; wherein, a normal instance is a service instance that has not been configured with a grayscale strategy during grayscale release; and a grayscale instance is a service instance that has been configured with a grayscale strategy during grayscale release.

[0068] The target instance generation module 30 is used to generate target instances based on the normal instance list and the grayscale instance list;

[0069] The microservice processing result display module 40 is used to generate microservice processing results based on the target instance and return the microservice processing results to the client for display.

[0070] It should be noted that the microservice request-response system provided in the above embodiments is only illustrated by the division of the above functional modules when executing the microservice request-response method. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the microservice request-response system and the microservice request-response method embodiments provided in the above embodiments belong to the same concept, and the implementation process is detailed in the method embodiments, which will not be repeated here.

[0071] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0072] In this embodiment, the microservice request-response system first receives resource call requests for the microservice architecture and determines a canary instance matching strategy based on the resource call requests. Then, it processes a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy to generate a normal instance list and a canary instance list. Normal instances are service instances that were not configured with a canary strategy during canary release, while canary instances are service instances that were configured with a canary strategy during canary release. Next, it routes based on the normal instance list and the canary instance list to generate a target instance. Finally, it generates a microservice processing result based on the target instance and returns the microservice processing result to the client for display. Because this application processes the pre-built list of service instances according to the preset canary instance identifier and the canary instance matching strategy to generate the normal instance list and the canary instance list for routing operations, it avoids the problem of parallel iteration conflicts between different environments, improves the system's iteration efficiency, reduces unnecessary time costs for request and response, and enhances the user experience.

[0073] In one embodiment, a computer device is provided, the device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0074] Receive resource call requests for microservice architecture and determine the canary instance matching strategy based on the resource call requests;

[0075] The pre-built service instance list is processed according to the preset grayscale instance identifier and grayscale instance matching strategy to generate a normal instance list and a grayscale instance list. Normal instances are service instances that are not configured with a grayscale strategy during grayscale release; grayscale instances are service instances that are configured with a grayscale strategy during grayscale release.

[0076] The target instance is generated by routing based on the list of normal instances and the list of grayscale instances.

[0077] Generate microservice processing results based on the target instance, and return the microservice processing results to the client for display.

[0078] In one embodiment, when the processor processes the pre-built service instance list in the load balancer according to the preset grayscale instance identifier and grayscale instance matching strategy to generate the normal instance list and the grayscale instance list, the following operations are performed:

[0079] Initialize the pre-built list of service instances;

[0080] Based on the preset grayscale instance identifier, multiple service instances in the service instance list are distinguished to generate a normal service instance set and a grayscale service instance set;

[0081] Based on the grayscale instance matching strategy, a matching is performed in the grayscale service instance set to generate a list of successfully matched grayscale instances;

[0082] The set of normal service instances is determined as the normal instance list.

[0083] In one embodiment, when the processor performs matching in the set of grayscale service instances according to the grayscale instance matching strategy and generates a list of successfully matched grayscale instances, it specifically performs the following operations:

[0084] A tag matching strategy is used to match service instances carrying preset tags in the grayscale service instance set, and grayscale service instances without preset tags are filtered out to obtain the first grayscale service instance set.

[0085] A coloring instance matching strategy is used to match service instances carrying preset coloring parameters in the first grayscale service instance set, and service instances without preset coloring parameters are filtered out to obtain the second grayscale service instance set.

[0086] The second set of grayscale service instances is divided into levels to obtain a multi-level set of grayscale service instances.

[0087] The set of multi-level grayscale service instances is determined as the list of successfully matched grayscale instances.

[0088] In one embodiment, when the processor performs routing based on the normal instance list and the grayscale instance list to generate the target instance, it specifically performs the following operations:

[0089] Load balancing is performed based on the list of grayscale instances to obtain matching results;

[0090] Based on the matching results, determine whether the target grayscale instance corresponding to the resource call request exists in the grayscale instance list;

[0091] If so, then the target grayscale instance will be determined as the target instance;

[0092] or,

[0093] If not, load balancing is performed based on the normal instance list to obtain the target instance.

[0094] In one embodiment, before the processor executes the operation of receiving a resource invocation request for a microservice architecture, it also performs the following:

[0095] Identify multiple assemblies in the current system that can provide services to the outside world;

[0096] Build a service instance for each assembly to obtain multiple service instances;

[0097] Add service tags to each of the multiple service instances to obtain tagged service instances;

[0098] The tagged service instances are classified according to their service tags, resulting in various types of service instances;

[0099] When a gray-scale policy configuration instruction is received for any one of the multiple types of service instances, a gray-scale policy is configured for that service instance.

[0100] After the canary deployment strategy is configured, a list of pre-built service instances is generated.

[0101] In one embodiment, when the processor executes the grayscale instance matching strategy determined based on the resource invocation request, it specifically performs the following operations:

[0102] Parse the resource request to obtain the parsed data;

[0103] Extract the policy identifier from the parsed data;

[0104] When the strategy identifier is consistent with the identifier of the preset label and / or the preset coloring parameter, the label matching strategy corresponding to the consistent label and / or the coloring instance matching strategy corresponding to the consistent identifier are determined as the grayscale instance matching strategy.

[0105] In one embodiment, when the processor executes the microservice processing result generated based on the target instance, it specifically performs the following operations:

[0106] Retrieve instance parameters carried in the resource request;

[0107] Determine the application interface corresponding to the target instance and call the method function of the application interface;

[0108] Input the instance parameters into the method function to obtain an executable service script;

[0109] Run the service script to generate the microservice processing results.

[0110] In this embodiment, the microservice request-response system first receives resource call requests for the microservice architecture and determines a canary instance matching strategy based on the resource call requests. Then, it processes a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy to generate a normal instance list and a canary instance list. Normal instances are service instances that were not configured with a canary strategy during canary release, while canary instances are service instances that were configured with a canary strategy during canary release. Next, it routes based on the normal instance list and the canary instance list to generate a target instance. Finally, it generates a microservice processing result based on the target instance and returns the microservice processing result to the client for display. Because this application processes the pre-built list of service instances according to the preset canary instance identifier and the canary instance matching strategy to generate the normal instance list and the canary instance list for routing operations, it avoids the problem of parallel iteration conflicts between different environments, improves the system's iteration efficiency, reduces unnecessary time costs for request and response, and enhances the user experience.

[0111] In one embodiment, a medium storing computer-readable instructions is provided, which, when executed by one or more processors, cause the one or more processors to perform the following steps:

[0112] Receive resource call requests for microservice architecture and determine the canary instance matching strategy based on the resource call requests;

[0113] The pre-built service instance list is processed according to the preset grayscale instance identifier and grayscale instance matching strategy to generate a normal instance list and a grayscale instance list. Normal instances are service instances that are not configured with a grayscale strategy during grayscale release; grayscale instances are service instances that are configured with a grayscale strategy during grayscale release.

[0114] The target instance is generated by routing based on the list of normal instances and the list of grayscale instances.

[0115] Generate microservice processing results based on the target instance, and return the microservice processing results to the client for display.

[0116] In one embodiment, when the processor processes the pre-built service instance list in the load balancer according to the preset grayscale instance identifier and grayscale instance matching strategy to generate the normal instance list and the grayscale instance list, the following operations are performed:

[0117] Initialize the pre-built list of service instances;

[0118] Based on the preset grayscale instance identifier, multiple service instances in the service instance list are distinguished to generate a normal service instance set and a grayscale service instance set;

[0119] Based on the grayscale instance matching strategy, a matching is performed in the grayscale service instance set to generate a list of successfully matched grayscale instances;

[0120] The set of normal service instances is determined as the normal instance list.

[0121] In one embodiment, when the processor performs matching in the set of grayscale service instances according to the grayscale instance matching strategy and generates a list of successfully matched grayscale instances, it specifically performs the following operations:

[0122] A tag matching strategy is used to match service instances carrying preset tags in the grayscale service instance set, and grayscale service instances without preset tags are filtered out to obtain the first grayscale service instance set.

[0123] A coloring instance matching strategy is used to match service instances carrying preset coloring parameters in the first grayscale service instance set, and service instances without preset coloring parameters are filtered out to obtain the second grayscale service instance set.

[0124] The second set of grayscale service instances is divided into levels to obtain a multi-level set of grayscale service instances.

[0125] The set of multi-level grayscale service instances is determined as the list of successfully matched grayscale instances.

[0126] In one embodiment, when the processor performs routing based on the normal instance list and the grayscale instance list to generate the target instance, it specifically performs the following operations:

[0127] Load balancing is performed based on the list of grayscale instances to obtain matching results;

[0128] Based on the matching results, determine whether the target grayscale instance corresponding to the resource call request exists in the grayscale instance list;

[0129] If so, then the target grayscale instance will be determined as the target instance;

[0130] or,

[0131] If not, load balancing is performed based on the normal instance list to obtain the target instance.

[0132] In one embodiment, before the processor executes the operation of receiving a resource invocation request for a microservice architecture, it also performs the following:

[0133] Identify multiple assemblies in the current system that can provide services to the outside world;

[0134] Build a service instance for each assembly to obtain multiple service instances;

[0135] Add service tags to each of the multiple service instances to obtain tagged service instances;

[0136] The tagged service instances are classified according to their service tags, resulting in various types of service instances;

[0137] When a gray-scale policy configuration instruction is received for any one of the multiple types of service instances, a gray-scale policy is configured for that service instance.

[0138] After the canary deployment strategy is configured, a list of pre-built service instances is generated.

[0139] In one embodiment, when the processor executes the grayscale instance matching strategy determined based on the resource invocation request, it specifically performs the following operations:

[0140] Parse the resource request to obtain the parsed data;

[0141] Extract the policy identifier from the parsed data;

[0142] When the strategy identifier is consistent with the identifier of the preset label and / or the preset coloring parameter, the label matching strategy corresponding to the consistent label and / or the coloring instance matching strategy corresponding to the consistent identifier are determined as the grayscale instance matching strategy.

[0143] In one embodiment, when the processor executes the microservice processing result generated based on the target instance, it specifically performs the following operations:

[0144] Retrieve instance parameters carried in the resource request;

[0145] Determine the application interface corresponding to the target instance and call the method function of the application interface;

[0146] Input the instance parameters into the method function to obtain an executable service script;

[0147] Run the service script to generate the microservice processing results.

[0148] In this embodiment, the microservice request-response system first receives resource call requests for the microservice architecture and determines a canary instance matching strategy based on the resource call requests. Then, it processes a pre-built list of service instances according to a preset canary instance identifier and the canary instance matching strategy to generate a normal instance list and a canary instance list. Normal instances are service instances that were not configured with a canary strategy during canary release, while canary instances are service instances that were configured with a canary strategy during canary release. Next, it routes based on the normal instance list and the canary instance list to generate a target instance. Finally, it generates a microservice processing result based on the target instance and returns the microservice processing result to the client for display. Because this application processes the pre-built list of service instances according to the preset canary instance identifier and the canary instance matching strategy to generate the normal instance list and the canary instance list for routing operations, it avoids the problem of parallel iteration conflicts between different environments, improves the system's iteration efficiency, reduces unnecessary time costs for request and response, and enhances the user experience.

[0149] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a computer-readable medium, and when executed, it can include the processes of the embodiments of the methods described above. The aforementioned medium can be a non-volatile medium such as a magnetic disk, optical disk, or read-only memory (ROM), or random access memory (RAM).

[0150] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0151] The above embodiments merely illustrate several implementation methods of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this patent should be determined by the appended claims.

Claims

1. A request-response method for microservices, characterized in that, The method includes: Receive resource call requests for microservice architecture, and determine the canary instance matching strategy based on the resource call requests; The pre-built service instance list is processed according to a preset grayscale instance identifier and the grayscale instance matching strategy to generate a normal instance list and a grayscale instance list. This includes: initializing the pre-built service instance list; distinguishing multiple service instances in the service instance list according to the preset grayscale instance identifier to generate a normal service instance set and a grayscale service instance set; matching the grayscale service instance set according to the grayscale instance matching strategy to generate a successfully matched grayscale instance list; and determining the normal service instance set as the normal instance list. Wherein, a normal instance is a service instance that was not configured with a grayscale strategy during grayscale deployment; and a grayscale instance is a service instance that was configured with a grayscale strategy during grayscale deployment. The grayscale instance matching strategy includes a label matching strategy and a colored instance matching strategy; The grayscale service instance matching strategy is used to match service instances in the grayscale service instance set to generate a list of successfully matched grayscale instances. This includes: using a tag matching strategy to match service instances carrying preset tags in the grayscale service instance set, and filtering out grayscale service instances without preset tags, to obtain a first grayscale service instance set; using a coloring instance matching strategy to match service instances carrying preset coloring parameters in the first grayscale service instance set, and filtering out service instances without preset coloring parameters, to obtain a second grayscale service instance set; classifying the second grayscale service instance set into levels to obtain a multi-level grayscale service instance set; and determining the multi-level grayscale service instance set as the list of successfully matched grayscale instances. Routing is performed based on the normal instance list and the grayscale instance list to generate the target instance; The microservice processing result is generated based on the target instance, and the microservice processing result is returned to the client for display.

2. The method according to claim 1, characterized in that, The step of routing based on the normal instance list and the grayscale instance list to generate the target instance includes: Load balancing is performed based on the grayscale instance list to obtain the matching results; Based on the matching results, determine whether the target grayscale instance corresponding to the resource call request exists in the grayscale instance list; If so, then the target grayscale instance is determined as the target instance; or, If not, perform load balancing based on the normal instance list to obtain the target instance.

3. The method according to claim 1, characterized in that, Before receiving resource invocation requests for a microservice architecture, the process also includes: Identify multiple assemblies in the current system that can provide services to the outside world; Build a service instance for each assembly to obtain multiple service instances; Add a service tag to each of the multiple service instances to obtain tagged service instances; The tagging service instances are classified according to service tags to obtain various types of service instances; When a grayscale policy configuration instruction is received for any one of the multiple types of service instances, a grayscale policy is configured for the stated service instance. After the canary deployment strategy is configured, a list of pre-built service instances is generated.

4. The method according to claim 1, characterized in that, The step of determining the grayscale instance matching strategy based on the resource call request includes: Parse the resource request to obtain the parsed data; Extract the policy identifier from the parsed data; When the strategy identifier is consistent with the identifier of the preset label and / or the preset coloring parameter, the label matching strategy corresponding to the consistent label and / or the coloring instance matching strategy corresponding to the consistent identifier are determined as the grayscale instance matching strategy.

5. The method according to claim 1, characterized in that, The step of generating microservice processing results based on the target instance includes: Obtain the instance parameters carried in the resource call request; Determine the application interface corresponding to the target instance, and call the method function of the application interface; Input the instance parameters into the method function to obtain an executable service script; Run the service script to generate the microservice processing results.

6. A request-response system for microservices implemented using the method described in any one of claims 1-5, characterized in that, The system includes: The gray-scale instance matching strategy determination module is used to receive resource call requests for microservice architecture and determine the gray-scale instance matching strategy based on the resource call requests. The instance list generation module is used to process the pre-built service instance list according to the preset grayscale instance identifier and the grayscale instance matching strategy to generate a normal instance list and a grayscale instance list; wherein, the normal instance is a service instance that has not been configured with a grayscale strategy during grayscale release; the grayscale instance is a service instance that has been configured with a grayscale strategy during grayscale release. The target instance generation module is used to generate target instances based on the normal instance list and the grayscale instance list; The microservice processing result display module is used to generate microservice processing results based on the target instance and return the microservice processing results to the client for display.

7. A computer device, characterized in that, It includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the request-response method for the microservice as described in any one of claims 1 to 5.

8. A medium storing computer-readable instructions, characterized in that, When the computer-readable instructions are executed by one or more processors, they cause the one or more processors to perform the steps of the request response of the microservice as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Multi-tenant service gray release method and device, computer equipment and storage medium

    CN112118565A

  • Method and apparatus for specifying API authorization policies and parameters

    US10592302B1