Routing method, device and system of service request, equipment and storage medium

By using the routing forwarding path in the microservice architecture, the service requests are forwarded from the first service node of different container environments to the second service node of the same container environment, the response speed and efficiency problems caused by the restart of the service node are solved, and rapid and efficient are achieved service request routing.

CN118900283APending Publication Date: 2024-11-05TENPAY PAID TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310479454.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-27
Publication Date
2024-11-05

AI Technical Summary

Technical Problem

In the microservice architecture, during the request routing between service nodes, the registration and cancellation of service nodes need to be restarted, resulting in slow response speed, low processing efficiency, and affecting other objects using service nodes.

Method used

By including the specified field in the header information of the service request, the routing forwarding path is obtained, and the service request is forwarded from the first service node to the second service node. The second service node is in the same container environment and is directly routed to the destination service node. Avoid restarting of service nodes.

Benefits of technology

It improves the response speed and processing efficiency of service nodes to service requests, and reduces the availability impact of service nodes and its impact on other objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118900283A_ABST
    Figure CN118900283A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Internet, and provides a service request routing method, device, system and equipment and a storage medium, and the method comprises the steps that a first service node receives a service request, and the service request carries the name of a target service node; when the header information of the service request contains a specified field, obtaining a routing forwarding path for forwarding the service request based on a value of the specified field; and forwarding the service request to a second service node in a container environment where the target service node is located based on the routing forwarding path, and routing the service request to the target service node by the second service node based on the name of the target service node. According to the method, the service request is forwarded from the first service node to the second service node through the routing forwarding path, and then the service request is routed to the target service node, so that the service node does not need to be restarted, the response speed of the service node to the service request is improved, and the processing efficiency of the service node is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of Internet technology, and in particular to a method, apparatus, system, device and storage medium for routing service requests. Background Art

[0002] With the continuous development of Internet informatization, enterprises are paying more and more attention to informatization construction, and are constantly introducing and investing in new technologies and tools. Among many technologies, microservices stand out and are rapidly applied to the field of enterprise informatization with their fine-grained, agile and modular characteristics.

[0003] Microservice architecture, in simple terms, is to split a complete system into independent subsystems according to business functions. In the microservice structure, each subsystem is called a "service". These subsystems can run independently in the global wide area network (World Wide, Web) container environment in the form of service nodes.

[0004] In the current microservice architecture, there is a type of management platform that performs service governance based on name services (such as microservice configuration management platforms such as Nacos and Polaris). Multiple container environments can be deployed in the system, and multiple service nodes run in each container environment. These service nodes join the container environment after registering with the name service center through their names, and leave the container environment after unregistering with the name service center through their names.

[0005] In the above-mentioned management platform, when the target object requests data from a service node in the same container environment, the name of the service node is added to the service request. When other nodes belonging to the same container environment as the service node receive the service request, they can obtain the valid service address of the service node through the name service center, and route the service request to the correct service node for processing based on the valid service address.

[0006] When the target object requests data from a service node in another container environment, the management platform needs to deregister the service node in the original container environment and register it in the container environment where the target object is currently located. Then, when other nodes belonging to the same container environment as the service node receive the service request, they can obtain the valid service address of the service node through the name service center and route the service request to the correct service node for processing based on the valid service address.

[0007] In the above execution process, registration and deregistration of the service node both require restarting the service node. The restart process of the service node not only affects the availability of the service node, but also affects all objects using the service node, resulting in a slower response speed of the service node to service requests and lower processing efficiency of the service node.

[0008] Therefore, a service request routing method needs to be redesigned to overcome the above defects. Summary of the invention

[0009] The embodiments of the present application provide a method, apparatus, system, device and storage medium for routing service requests, so as to improve the response speed of service nodes to service requests and improve the processing efficiency of service nodes.

[0010] In a first aspect, an embodiment of the present application provides a method for routing a service request, comprising:

[0011] The first service node receives a service request, where the service request carries a name of a destination service node, and the first service node and the destination service node are in different container environments;

[0012] When the header information of the service request includes a designated field, based on the value of the designated field, a routing forwarding path for forwarding the service request is obtained, wherein the designated field is used to indicate routing forwarding of the service request;

[0013] Based on the routing forwarding path, the service request is forwarded to a second service node in the container environment where the destination service node is located, and the second service node routes the service request to the destination service node based on the name of the destination service node.

[0014] In a second aspect, an embodiment of the present application provides a routing device for a service request, including:

[0015] A receiving unit, configured to receive a service request, wherein the service request carries a name of a destination service node, and the first service node where the receiving unit is located and the destination service node are in different container environments;

[0016] an acquisition unit, configured to acquire a routing forwarding path for forwarding the service request based on a value of the designated field when the header information of the service request contains a designated field, wherein the designated field is used to indicate routing forwarding of the service request;

[0017] A routing unit is used to forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

[0018] Optionally, the device further includes: a processing unit, configured to obtain identity information of an object that triggers the service request before obtaining a routing forwarding path for forwarding the service request based on the value of the designated field, and when the identity information matches a preset rule, obtain an identification value corresponding to the identity information, and insert the identification value as the value of the designated field into the header information of the service request, wherein the identity information includes: an Internet Protocol (IP) address and an object identifier;

[0019] The acquisition unit is specifically used for:

[0020] A routing forwarding path corresponding to the identification value is obtained, wherein the routing forwarding path includes routing address information of at least one intermediate service node, and the routing address information includes: an IP address and a port address.

[0021] Optionally, the routing unit is specifically used to:

[0022] Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path determines the routing address information of the next intermediate service node based on the identification value in the obtained service request, and forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is obtained based on the routing forwarding path after each intermediate service node obtains the routing forwarding path corresponding to the identification value according to the identification value in the received service request.

[0023] Optionally, the value of the designated field is: routing address information of at least one intermediate service node;

[0024] The acquisition unit is specifically used to: use the value of the designated field as the routing forwarding path.

[0025] Optionally, the routing unit is specifically used to:

[0026] Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is determined by each intermediate service node according to the value of a specified field in the header information of the service request.

[0027] Optionally, the device also includes a script startup unit, which is used to start a script file before obtaining a routing forwarding path for forwarding the service request based on the value of the designated field, and the script file is used to identify the designated field in the service request when the service request contains the designated field, and when the service request does not contain the designated field, determine whether to insert the designated field in the header information of the service request by loading a pre-configured preset rule and a correspondence between a pre-configured identification value and a routing forwarding path.

[0028] Optionally, the first service node is a test service node deployed in a container environment.

[0029] In a third aspect, an embodiment of the present application provides a routing system for service requests, including:

[0030] An interface component, used for receiving a service request, wherein the service request carries a name of a destination service node, and the first service node where the interface component is located and the destination service node are in different container environments;

[0031] A routing strategy component, used for obtaining a routing forwarding path for forwarding the service request based on a value of the specified field when the header information of the service request contains a specified field, wherein the specified field is used to indicate routing forwarding of the service request;

[0032] A gateway component is used to forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

[0033] Optionally, the system further includes: a management component, configured to obtain identity information of an object that triggers the service request before obtaining a routing forwarding path for forwarding the service request based on the value of the designated field, and when the identity information matches a preset rule, obtain an identification value corresponding to the identity information, and insert the identification value as the value of the designated field into the header information of the service request, wherein the identity information includes: an IP address and an object identifier;

[0034] The routing strategy component is specifically used for:

[0035] A routing forwarding path corresponding to the identification value is obtained, wherein the routing forwarding path includes routing address information of at least one intermediate service node, and the routing address information includes: an IP address and a port address.

[0036] Optionally, the gateway component is specifically used to:

[0037] Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path determines the routing address information of the next intermediate service node based on the identification value in the obtained service request, and forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is obtained based on the routing forwarding path after each intermediate service node obtains the routing forwarding path corresponding to the identification value according to the identification value in the received service request.

[0038] Optionally, the value of the designated field is: routing address information of at least one intermediate service node;

[0039] The routing strategy component is specifically used to: use the value of the designated field as the routing forwarding path.

[0040] Optionally, the gateway component is specifically used to:

[0041] Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is determined by each intermediate service node according to the value of a specified field in the header information of the service request.

[0042] Optionally, the system also includes a service component, which is used to start a script file before obtaining a routing forwarding path for forwarding the service request based on the value of the designated field, and the script file is used to identify the designated field in the service request when the service request contains the designated field, and to determine whether to insert the designated field into the header information of the service request by loading pre-configured preset rules and the correspondence between the pre-configured identification value and the routing forwarding path when the service request does not contain the designated field.

[0043] Optionally, the first service node is a test service node deployed in a container environment.

[0044] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of the routing method for service requests provided in the first aspect above.

[0045] In a fifth aspect, an embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the steps of the method for routing service requests provided in the first aspect above.

[0046] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, which includes a program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the routing method for service requests provided in the first aspect above.

[0047] The beneficial effects of this application are as follows:

[0048] In the embodiment of the present application, after the first service node receives the service request, when it is determined that the destination service node carried in the service request is in another container environment and the header information of the service request contains a specified field, the first service node obtains the routing forwarding path, and forwards the service request to the second service node in the container environment where the destination service node is located through each intermediate service node in the routing forwarding path. Since the second service node and the destination service node are in the same container environment, the second service node can route the service request to the destination service node based on the name of the destination service node. In the above process, the service request is forwarded from the first service node to the second service node in the same container environment as the destination service node through the routing forwarding path, and then routed to the destination service node, so as to realize the routing of the service request from the first service node to the destination service node in a different container environment, and there is no need for the destination service node to deregister in the original container environment and re-register in the container environment where the first service node is located. Therefore, there is no need to restart the destination service node, thereby reducing the impact on the availability of the destination service node and reducing the impact on all objects using the destination service node. At the same time, the response speed of the destination service node to the service request can be improved, and the processing efficiency of the destination service node can be improved.

[0049] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0051] Figure 1 A schematic diagram of a service request processing process in a microservice system in the related art;

[0052] Figure 2 An optional schematic diagram of an application scenario in an embodiment of the present application;

[0053] Figure 3 A flowchart of a method for routing a service request in an embodiment of the present application;

[0054] Figure 4 A schematic diagram of a process of inserting a specified field into the header information of a service request in an embodiment of the present application;

[0055] Figure 5A schematic diagram of a specified field in a service request header information in an embodiment of the present application;

[0056] Figure 6 A schematic diagram of a process of forwarding a service request using a routing forwarding path in an embodiment of the present application;

[0057] Figure 7 A flowchart of another method for routing service requests in an embodiment of the present application;

[0058] Figure 8 This is another schematic diagram of a process of forwarding a service request using a routing forwarding path in an embodiment of the present application;

[0059] Fig. 9 A flowchart of another method for routing service requests in an embodiment of the present application;

[0060] Fig.10 This is another schematic diagram of a process of forwarding a service request using a routing forwarding path in an embodiment of the present application;

[0061] Fig.11 A flowchart of a method for routing another service request in an embodiment of the present application;

[0062] Fig.12 A schematic diagram of a service request processing process in a microservice system provided in an embodiment of the present application;

[0063] Fig.13 This is another schematic diagram of a process of forwarding a service request using a routing forwarding path in an embodiment of the present application;

[0064] Fig.14 A schematic diagram of a microservice system provided in an embodiment of the present application applied to a system performance test scenario;

[0065] Fig.15 A schematic diagram of a service node test in a microservice system provided in an embodiment of the present application;

[0066] Fig.16 A schematic diagram of another pair of service node tests in a microservice system provided in an embodiment of the present application;

[0067] Fig.17 A schematic diagram of another pair of service node tests in a microservice system provided in an embodiment of the present application;

[0068] Fig.18 A schematic diagram of the composition structure of a routing device for service requests in an embodiment of the present application;

[0069] Fig.19 A schematic diagram of the composition structure of a routing system for service requests in an embodiment of the present application;

[0070] Fig. 20 A schematic diagram of the structure of a first electronic device according to an embodiment of the present application;

[0071] Fig.21 It is a schematic diagram of the composition structure of the second electronic device in the embodiment of the present application. DETAILED DESCRIPTION

[0072] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.

[0073] It will be understood that in the following specific implementations of the present application, the identity information of the object is involved. When the various embodiments of the present application are applied to specific products or technologies, relevant licenses or consents need to be obtained, and the collection, use and processing of relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0074] The following is an introduction to some concepts involved in the embodiments of the present application.

[0075] Native routing: The default routing solution for service requests when this application is not effective.

[0076] Special routing: The routing plan for service requests when this application is in effect.

[0077] AOP Trace ID: is an identification value used to color service requests that use special routes. It can also be used to obtain the corresponding routing forwarding path from the routing forwarding rule base.

[0078] AOP Trace ID injection rule: a predefined rule is used to insert the corresponding AOP Trace ID (identification value) into the specified field of the header information of the service request when the characteristics of the service request match the rule.

[0079] Routing forwarding path: Each identification value in the routing forwarding rule base corresponds to a routing forwarding path, which includes routing address information of at least one intermediate service node, which is used to determine the routing address of each intermediate service node when forwarding a service request.

[0080] Self-explanatory routing header: Compared with the solution based on AOP Trace ID injection rules + routing forwarding rule library, the service request with self-explanatory routing header does not need to rely on injection rules and routing forwarding rule library. The header information of its service request includes the routing address information of each intermediate service node, that is, the routing address information of each intermediate service node in the routing forwarding path, which can be directly obtained from the header information of the service request, which is simpler and more convenient.

[0081] Mapped Diagnostic Context (MDC) filter: provides a convenient function for recording logs under multi-threaded conditions, ensuring that under multi-process conditions, the values ​​stored in the MDC filter between processes do not affect each other. In this application, it is used to solve the problem of transmitting the identification value of a special route across service nodes. This application can use the MDC implementation of the log4j framework.

[0082] The following is a brief introduction to the design concept of the embodiment of the present application:

[0083] With the continuous development of Internet informatization, enterprises are paying more and more attention to informatization construction, and are constantly introducing and investing in new technologies and tools. Among many technologies, microservices stand out and are rapidly applied to the field of enterprise informatization with their fine-grained, agile and modular characteristics.

[0084] Microservice architecture, in simple terms, is to split a complete system into independent subsystems according to business functions. In the microservice structure, each subsystem is called a "service". These subsystems can run independently in the global wide area network (World Wide, Web) container environment in the form of service nodes.

[0085] In the current microservice architecture, there is a type of management platform that performs service governance based on name services (such as microservice configuration management platforms such as Nacos and Polaris). Multiple container environments can be deployed in the system, and multiple service nodes run in each container environment. These service nodes join the container environment after registering with the name service center through their names, and leave the container environment after unregistering with the name service center through their names.

[0086] In the above-mentioned management platform, when the target object requests data from a service node in the same container environment, the name of the service node is added to the service request. When other nodes belonging to the same container environment as the service node receive the service request, they can obtain the valid service address of the service node through the name service center, and route the service request to the correct service node for processing based on the valid service address.

[0087] When the target object requests data from a service node in another container environment, the management platform needs to deregister the service node in the original container environment and register it in the container environment where the target object is currently located. Then, when other nodes belonging to the same container environment as the service node receive the service request, they can obtain the valid service address of the service node through the name service center and route the service request to the correct service node for processing based on the valid service address.

[0088] In one example, if Figure 1 As shown, container environment 1 and container environment 2 are deployed in the management platform. In container environment 1 and container environment 2, there are four service nodes named svc-1, svc-2, svc-3 and svc-4. Each service node is registered in the name service center Server by name and runs in its own container environment. Each container environment synchronizes the service status with the remote dictionary service (Remote Dictionary Server, Redis) configuration server at regular intervals. Of course, the management platform also includes a Web management terminal for configuring and managing each service node in the management platform.

[0089] If the service request in container environment 1 needs to be routed to the svc-2 service node in container environment 2, you need to first unregister the svc-2 service node in container environment 2 in the current container environment, then unregister the svc-2 service node in container environment 1 in the current container environment, and then register the svc-2 service node in container environment 2 to container environment 1. In this process, the registration and unregistration of the svc-2 service node require restarting the service node.

[0090] In the above execution process, registration and deregistration of the service node both require restarting the service node. The restart process of the service node not only affects the availability of the service node, but also affects all objects using the service node, resulting in a slower response speed of the service node to service requests and lower processing efficiency of the service node.

[0091] In view of this, an embodiment of the present application provides a method, apparatus, system, device and storage medium for routing service requests. After receiving a service request, the first service node obtains a routing forwarding path when it is determined that the destination service node carried in the service request is in another container environment and the header information of the service request contains a specified field, and forwards the service request to a second service node in the container environment where the destination service node is located through each intermediate service node in the routing forwarding path. Since the second service node and the destination service node are in the same container environment, the second service node can route the service request to the destination service node based on the name of the destination service node. In the above process, the service request is forwarded from the first service node to the second service node in the same container environment as the destination service node through the routing forwarding path, and then routed to the destination service node, thereby realizing the routing of the service request from the first service node to the destination service node in a different container environment, and there is no need for the destination service node to be deregistered in the original container environment and re-registered in the container environment where the first service node is located. Therefore, there is no need to restart the destination service node, thereby reducing the impact on the availability of the destination service node and reducing the impact on all objects using the destination service node. At the same time, it can improve the response speed of the destination service node to service requests and improve the processing efficiency of the destination service node.

[0092] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0093] like Figure 2 As shown, it is a schematic diagram of an application scenario of an embodiment of the present application. It is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario diagram includes a terminal device 210 and a server 220. The terminal device 210 and the server 220 can communicate through a communication network. The object can send a service request through the terminal device 210 to test the built microservice management platform or the test environment of the microservice management platform. Of course, the object can also be an ordinary user, who sends a service request through the client in the terminal device 210 to request data in the microservice management platform configured by other objects. Applications related to the microservice management platform can be installed on the terminal device 210. The application involved in the embodiment of the present application can be software, or it can be a client such as a web page or a small program. The background server is a background server corresponding to the software or web page, small program, etc., and the specific type of the client is not limited.

[0094] In an optional implementation, the communication network is a wired network or a wireless network. The terminal device 210 and the server 220 may be directly or indirectly connected via wired or wireless communication, which is not limited in the present application.

[0095] In the embodiment of the present application, the terminal device 210 is an electronic device, which can be a personal computer, a mobile phone, a tablet computer, a notebook, an e-book reader, a smart home, or other computer devices with certain computing capabilities. Each terminal device 210 is connected to a server 220 via a wireless network. The server 220 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.

[0096] Among them, the object sends a service request to the management platform through the terminal device 210, and the first service node receives the service request. After receiving the service request, if it is determined that the destination service node carried in the service request is in other container environments, that is, the destination service node and the first service node are in different container environments, then the first service node obtains the identity information of the object, and when the identity information matches the preset rule, obtains the identification value corresponding to the identity information, and inserts the identification value as the value of the specified field into the header information of the service request to indicate routing forwarding of the service request. At this time, the first service node obtains the routing forwarding path corresponding to the identification value in the routing forwarding rule library, and forwards the service request to the second service node in the container environment where the destination service node is located based on the obtained routing forwarding path, so that the second service node routes the service request to the destination service node in the same container environment based on the name of the destination service node.

[0097] Of course, if the object is a development object or a test object of the management platform, and the service request it sends is generated by the object editor, in this case, the object can add a specified field to the header information of the service request, and use the routing address information of at least one intermediate service node as the value of the above-mentioned specified field. In this way, the object sends a service request to the management platform through the terminal device 210, and the first service node that receives the service request, after receiving the service request, if it is determined that the destination service node carried in the service request is in other container environments, that is, the destination service node and the first service node are in different container environments, then the first service node determines that the service request contains the specified field and needs to route and forward the service request. At this time, the routing address information of at least one intermediate service node is obtained from the value of the specified field, a routing forwarding path is generated, and based on the generated routing forwarding path, the service request is forwarded to the second service node in the container environment where the destination service node is located, so that the second service node routes the service request to the destination service node in the same container environment based on the name of the destination service node.

[0098] It should be noted that the object can also deploy a service node for testing in the management platform or microservice system through the terminal device 210, that is, deploy a test service node in a container environment under the management platform. In this way, by deploying the test service node in a container environment, the routing forwarding path is dynamically adjusted within the life cycle of a test service node, and different routing forwarding paths are used to test the performance of the service nodes in all container environments of the entire management platform. Not only is the deployment of the test service node simple, but the status of each intermediate service node in the routing forwarding path can also be recorded to facilitate performance testing and bottleneck analysis of the microservice system.

[0099] It should be noted that Figure 2 What is shown is just an example. In fact, the number and communication method of terminal devices and servers are not limited. When there are multiple servers, multiple servers can form a blockchain, and the server is a node on the blockchain, which is not specifically limited in the embodiments of the present application.

[0100] The following describes the routing method of service requests provided by the exemplary embodiment of the present application in combination with the application scenarios described above and with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this respect.

[0101] See also Figure 3 As shown, it is an implementation flow chart of a method for routing service requests provided in an embodiment of the present application, which can be applied to each service node in a management platform built based on a microservice architecture. The specific implementation process of the method is as follows:

[0102] S31, a first service node receives a service request, the service request carries a name of a destination service node, and the first service node and the destination service node are in different container environments.

[0103] In specific implementation, after the object triggers a service request through the client of the terminal device, the service request is received by any service node in the container environment to which the client belongs. This service node is referred to as the first service node in this application, and it does not specifically refer to a certain service node.

[0104] Of course, this service request carries the name of the destination service node. After the first service node receives the service request, it determines that the service request needs to be processed by the destination service node, but the destination service node is in other container environments, that is, the destination service node and the first service node are in different container environments. In this case, the first service node cannot directly use the name of the destination service node for routing and send the service request to the destination service node. The first service node needs to first forward the service request to the second service node in the container environment where the destination service node is located through the routing forwarding path, so that the second service node can route the service request to the destination service node in the container environment based on the name of the destination service node.

[0105] In specific implementation, the first service node first determines whether the service request contains the specified field. If it is determined that the service request contains the specified field, S32 can be executed to obtain a routing forwarding path for forwarding the service request based on the value of the specified field.

[0106] If it is determined that the service request does not contain the specified field, the identity information of the object that triggers the service request is further obtained. When the identity information matches the preset rule, the identification value corresponding to the identity information is obtained from the pre-stored mapping relationship table between the identity information and the identification value, and the identification value is inserted into the header information of the service request as the value of the specified field. Then S32 can be executed based on the value of the specified field to obtain the routing forwarding path for forwarding the service request.

[0107] In the specific implementation, the specified field takes AOP Trace ID as an example, see Figure 4 As shown in the figure, the service request does not contain the specified field. The specific process of inserting the AOP Trace ID into the header information of the service request includes:

[0108] S41, obtaining the identity information of the object that triggers the service request.

[0109] S42, querying the AOP Trace ID injection rule. It should be noted that the AOP Trace ID injection rule can be obtained from the Redis configuration, and can be specifically configured by the developer or administrator through the Web client, for example, adding rules, deleting rules, and modifying rules.

[0110] S43, determine whether the obtained identity information matches the AOP Trace ID injection rule, if it matches, execute S44, otherwise, execute S46.

[0111] S44, if the obtained identity information matches the AOP Trace ID injection rule, the identification value corresponding to the identity information is obtained from a mapping relationship table pre-stored between identity information and identification values. The mapping relationship table can also be pre-configured by a developer or administrator and stored in a Redis configuration or in a database of a server.

[0112] S45, inserting the obtained identification value as the value of AOP Trace ID into the header information of the service request, and the identification value is used to indicate that the service request needs to be forwarded using a special route.

[0113] S46, the obtained identity information does not match the AOP Trace ID injection rule. In this case, the native route is used to process the service request.

[0114] It should be noted that although Figure 4 The process of inserting the AOP Trace ID into the header information of the service request is illustrated for the case where the destination service node and the first service node are in different container environments. However, in actual applications, the above process can be performed regardless of whether the destination service node and the first service node are in different container environments. Figure 4 In other words, after receiving the service request, when the first service node determines that the service request does not contain the specified field, it can execute the above Figure 4 The process shown is to determine whether it is necessary to insert the AOP Trace ID into the header information of the service request.

[0115] By inserting a specified field into the header information of the service request, service requests in which the destination service node and the first service node are in different container environments can be effectively marked without affecting the native routing of the microservice system. That is, service requests that need to be forwarded using a routing forwarding path can be effectively marked. Therefore, it can be ensured that such service requests are forwarded using a special route and are processed correctly.

[0116] The identity information of the object may include, but is not limited to, an IP address and an object identifier. The IP address is the address of the terminal device used by the object in the Internet, which is used to uniquely identify the terminal device used by the object in the Internet. The object identifier may be the account number, nickname, etc. of the object. In other embodiments of the present application, the identity information of the object may also include other information that only needs to be able to identify the identity of the object, such as the host name of the terminal device used by the object.

[0117] In an example, taking the object's identity as the object's IP address and object ID, at this time, the AOPTrace ID injection rules can be configured as one or more of the following: Rule 1, the IP address is between 192.168.0.1-192.168.0.255; Rule 2, the IP address is 192.168.0.152, Rule 3, the object ID is "Xiao Ming", Rule 4, the object ID is "2563145", etc.

[0118] S32, when the header information of the service request includes a designated field, based on the value of the designated field, a routing forwarding path for forwarding the service request is obtained, wherein the designated field is used to indicate routing forwarding of the service request.

[0119] In specific implementation, the value of the specified field has the following two cases:

[0120] Case 1: the service request includes a self-explanatory routing header, that is, the initially received service request includes a designated field, and the value of the designated field is the routing address information of at least one intermediate service node.

[0121] In actual applications, the routing address information of at least one intermediate service node in the specified field AOP Trace ID can adopt the following format: AOP Trace ID = svc_name_01#ip_address:port; svc_name_02#ip_address; svc_name_03#ip_address:port, wherein the names of the three intermediate service nodes are separated by a semicolon “;”, the name of the intermediate service node and the corresponding IP address are separated by “#”, and the IP address and the port address are separated by a colon “:”. The port address can also be omitted. When the port address is omitted, the default port address of each service node will be used when forwarding the service request according to the routing address information of the intermediate service node.

[0122] In one example, if Figure 5As shown, the service request includes a self-explanatory routing header, and the header information of the service request includes a specified field AOP Trace ID, and the value of the specified field AOP Trace ID is: Service-01#9.xx.xx.84; Service-02#10.12.0.8:8080.

[0123] Case 2: The service request initially received does not contain the specified field. When the identity information of the object that triggers the service request matches the preset rule, the identification value corresponding to the identity information is obtained, and the identification value is used as the value of the specified field and inserted into the header information of the service request.

[0124] In the above two cases, the values ​​of the designated fields are different. Therefore, based on the values ​​of the designated fields, the methods for obtaining the routing forwarding path for forwarding the service request are also different.

[0125] Specifically, the service request includes a self-explanatory routing header, that is, the service request contains a specified field, and the value of the specified field is the routing address information of at least one intermediate service node. In this case, the routing address information of at least one intermediate service node in the specified value can be directly used as the routing forwarding path. In this way, there is no need to configure preset rules for matching with object identity information, nor is there a need to configure a routing forwarding rule library. The routing forwarding path of the service request can be directly specified in the specified field in the header information of the service request, which is simpler and more convenient to implement.

[0126] If the service request does not contain the specified field, when the identity information of the object that triggers the service request matches the preset rule, the identification value corresponding to the identity information is obtained, and the identification value is used as the value of the specified field and inserted into the header information of the service request. The routing forwarding path corresponding to the identification value is obtained from the pre-configured routing forwarding rule library. This method is applicable to any service request sent by the object, and there is no need to add the routing address information of the intermediate service node in the header information of the service request.

[0127] S33: forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

[0128] In specific implementation, after obtaining the routing forwarding path, when forwarding the service request to the second service node in the container environment where the destination service node is located based on the routing forwarding path, the method of forwarding the service request varies depending on the method of obtaining the routing forwarding path.

[0129] Specifically, when the value of the specified field in the service request is the routing address information of at least one intermediate service node, the routing address information of at least one intermediate service node in the specified value is used as the routing forwarding path. When the service request is forwarded to the second service node in the container environment where the destination service node is located based on the routing forwarding path, first, based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing address information of the next intermediate service node is determined by each intermediate service node according to the value of the specified field in the header information of the service request.

[0130] In actual applications, the routing address information of at least one intermediate service node in the value of the specified field is arranged in sequence according to the routing forwarding order. When forwarding a service request, the first service node forwards the service request to the first intermediate service node based on the routing address information of the first intermediate service node in the routing forwarding path; after receiving the service request, the first intermediate service node determines the routing address information of the second intermediate service node based on the value of the specified field in the service request, and forwards the service request to the second intermediate service node based on the routing address information of the second intermediate service node, and so on, until the service request is forwarded to the second service node.

[0131] The routing address information of the service node includes: an IP address and a port address. If the routing address information of the intermediate service node does not include a port address, the default port address registered by each service node is used.

[0132] As for the case where the identification value is used as the value of the designated field and inserted into the header information of the service request, the routing forwarding path corresponding to the identification value is obtained from the pre-configured routing forwarding rule library. When the service request is forwarded to the second service node in the container environment where the destination service node is located based on the routing forwarding path, first, based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path determines the routing address information of the next intermediate service node based on the identification value in the obtained service request, and forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing address information of the next intermediate service node is obtained based on the routing forwarding path after each intermediate service node obtains the routing forwarding path corresponding to the identification value according to the identification value in the received service request.

[0133] In actual applications, when forwarding a service request, the first service node forwards the service request to the first intermediate service node based on the routing address information of the first intermediate service node in the routing forwarding path; after receiving the service request, the first intermediate service node obtains the value of the specified field, that is, the identification value, from the service request, and the first intermediate service node obtains the routing forwarding path corresponding to the identification value from a pre-configured routing forwarding rule library based on the obtained identification value, and determines the routing address information of the second intermediate service node based on the obtained routing forwarding path, and forwards the service request to the second intermediate service node based on the routing address information of the second intermediate service node, and so on, until the service request is forwarded to the second service node.

[0134] Among them, in the pre-configured routing forwarding rule base, the correspondence between the identification value and the routing forwarding path can be recorded in the form of a key-value structure, where the identification value is the key value and the routing forwarding path is the value value. The routing forwarding path can include the name of each intermediate service node and the corresponding routing address information, such as the IP address and port address.

[0135] It should be noted that the second service node and the destination service node are in the same container environment, and the second service node is an intermediate service node in the routing forwarding path. The second service node may be the last intermediate service node in the routing forwarding path, or may not be the last service node in the routing forwarding path. The embodiment of the present application does not limit this.

[0136] For example, when the second service node is not the last service node in the routing forwarding path, the embodiment of the present application can also make a judgment for each intermediate service node to determine whether the intermediate service node and the destination service node are in the same container environment. If, during the forwarding process of the service request, an intermediate service node and the destination service node are in the same container environment, forwarding is stopped, and the intermediate service node is the second service node.

[0137] In addition, in a possible implementation, in order to implement the special routing of the present application, it is also necessary to start a script file before obtaining the routing forwarding path for forwarding the service request based on the value of the specified field, or before the first service node receives the service request. The script file is used to identify the specified field in the service request when the specified field is included in the service request, and when the specified field is not included in the service request, by loading the pre-configured preset rules and the correspondence between the pre-configured identification value and the routing forwarding path, it is determined whether to insert the specified field in the header information of the service request. That is, in the microservice system, after starting the script file, the special routing in the embodiment of the present application can be implemented, and when the script file is not started, the service request in the microservice system is still forwarded using the native route to reduce the impact on the microservice system.

[0138] In specific implementation, after starting the script file, the running logic of the instance interceptor of an object and a java class in the microservice system can be enhanced. When the service node receives the service request, the interceptor intercepts the service request, and then identifies the specified field in the service request. When the service request does not contain the specified field, by loading the pre-configured preset rules and the correspondence between the pre-configured identification value and the routing forwarding path, it is determined whether to insert the specified field in the header information of the service request, and then the routing forwarding path is obtained by the value of the specified field to realize the routing forwarding of the service request.

[0139] It should be noted that the script file mentioned in the embodiment of the present application can be a jar package of a java agent. When the system starts, the corresponding service startup script needs to be implemented, and the startup parameters are added to the java agent so that the microservice system can identify the specified fields contained in the service request, or when the identity information of the object that triggers the service request matches the preset rules, insert a specified field with an identification value as the value into the service request, and then obtain the routing forwarding path based on the value of the specified field to forward the service request.

[0140] In one example, if Figure 6 As shown, taking the forwarding process of the service request between the svc-1 service node, the svc-2 service node, the svc-3 service node and the destination service node as an example, the forwarding process of the service request when the service request does not contain the specified field is explained.

[0141] For the svc-1 service node:

[0142] 1. When the svc-1 service node receives a service request, the request interceptor class intercepts the service request.

[0143] 2. Determine whether the service request header information contains a specified field with the identification value as the value. If so, execute step 5; otherwise, execute step 3.

[0144] 3. When the service request header information does not contain a designated field with an identification value as its value, obtain the identity information of the object initiating the service request, and determine whether the identity information matches the preset rules. If the match is successful, execute step 4; otherwise, execute step 6.

[0145] 4. When the identity information of the object initiating the service request matches the preset rule, an identification value corresponding to the identity information of the object is obtained.

[0146] 5. The MDC filter obtains the identification value and assigns a thread to record the identification value.

[0147] 6. Encapsulate the service request to generate a service request in the form of Hyper Text Transfer Protocol (HTTP) and send it. This process can be implemented through various Java (computer programming language) to HTTP client binders, such as Feign Client.

[0148] 7. For the service request in HTTP format issued in step 6, the MDC filter determines whether there is a thread record for identifying the identification value for forwarding the service request using a special route. If so, execute step 8; otherwise, execute step 10.

[0149] It should be noted that the absence of a thread record identification value in the MDC filter judgment result here refers to a situation where the MDC filter does not use the thread record identification value when the judgment result in step 3 is negative.

[0150] 8. When the MDC filter obtains the identification value, it inserts the identification value into the header information of the service request as the value of the specified field.

[0151] 9. Obtain the routing forwarding path corresponding to the identification value, and determine the routing address information of the next service node based on the routing forwarding path.

[0152] 10. Based on the routing address information of the next service node, the service request is forwarded to the svc-2 service node.

[0153] It should be noted that if the judgment result in step 7 is no, that is, there is no thread record in the MDC filter judgment result for identifying the identification value used to forward the service request using a special route, then the service request is directly forwarded using the native routing method.

[0154] For the svc-2 service node:

[0155] 11. When the svc-2 service node receives the service request sent by the svc-1 service node, the request interceptor class intercepts the service request.

[0156] 12. Determine whether the service request header information contains a specified field with the identification value as the value. If so, execute step 13.

[0157] It should be noted that, in this example, since the svc-1 service node inserts a designated field with the identification value as the value in the header information of the service request, the service request header information of the judgment result includes the designated field with the identification value as the value. In other examples of the present application, if the svc-2 service node is the first service node, the service request header information of the judgment result may not include the designated field with the identification value as the value.

[0158] 13. The MDC filter obtains the identification value and assigns a thread to record the identification value.

[0159] 14. Encapsulate the service request to generate a service request in HTTP format and send it.

[0160] 15. For the service request in HTTP format issued in step 14, the MDC filter determines whether there is a thread record for identifying an identification value for forwarding the service request using a special route. If so, execute step 16.

[0161] It should be noted that, in this example, since the MDC filter in step 13 has allocated a thread record for identifying the identification value for forwarding the service request using a special route, the judgment result of step 15 is that the MDC filter has a thread record identification value. Of course, in other examples of the present application, the judgment result of step 15 may also be that the MDC filter does not have a thread record identification value.

[0162] 16. When the MDC filter obtains the identification value, it inserts the identification value into the header information of the service request.

[0163] 17. Obtain the routing forwarding path corresponding to the identification value, and determine the routing address information of the next service node based on the routing forwarding path.

[0164] 18. Based on the routing address information of the next service node, the service request is forwarded to the svc-3 service node.

[0165] For the svc-3 service node:

[0166] 19. When the svc-3 service node receives the service request sent by the svc-2 service node, the request interceptor class intercepts the service request.

[0167] 20. Determine whether the service request header information contains a designated field with the identification value as the value. If so, execute step 21.

[0168] It should be noted that, in this example, since the svc-2 service node inserts a designated field with the identification value as the value in the header information of the service request, the service request header information of the judgment result includes the designated field with the identification value as the value. In other examples of the present application, if the svc-3 service node is the first service node, the service request header information of the judgment result may not include the designated field with the identification value as the value.

[0169] 21. The MDC filter obtains the identification value and assigns a thread to record the identification value.

[0170] 22. Encapsulate the service request to generate a service request in HTTP format and send it.

[0171] 23. For the service request in HTTP format issued in step 22, the MDC filter determines whether there is a thread record for identifying an identification value for forwarding the service request using a special route. If so, execute step 24.

[0172] It should be noted that, in this example, since the MDC filter in step 21 has allocated a thread record for identifying an identification value for forwarding service requests using a special route, the judgment result of step 23 is that the MDC filter has a thread record identification value. Of course, in other examples of the present application, the judgment result of step 23 may also be that the MDC filter does not have a thread record identification value.

[0173] 24. When the MDC filter obtains the identification value, it inserts the identification value into the header information of the service request.

[0174] 25. Obtain the routing forwarding path corresponding to the identification value, and determine the routing address information of the next service node based on the routing forwarding path. If it is determined that there is no next service node in the routing forwarding path, use the name of the destination service node carried in the service request for routing forwarding.

[0175] 26. Perform routing forwarding based on the name of the destination service node and route the service request to the destination service node.

[0176] Combine the following Figure 7 , for a detailed description of the specific process of the routing method for a service request when a service request includes a self-explanatory routing header in an embodiment of the present application, refer to Figure 7 As shown, the specific implementation process of this method is as follows:

[0177] S71, when the microservice system is started, the script file is started. Of course, in other embodiments of the present application, when applied to the test service, the script file can also be started when the test service is started, and the embodiments of the present application do not limit this.

[0178] S72, the first service node receives a service request, which carries the name of the destination service node. The first service node determines that the destination service node is in another container environment, that is, the first service node and the destination service node are in different container environments, and the different container environments are isolated from each other.

[0179] S73, identify whether the service request contains a specified field. If the service request contains a self-explanatory routing header, the service request contains the specified field, and the value of the specified field is the routing address information of at least one intermediate service node, then execute S74. If the service request does not contain a self-explanatory routing header, the service request does not contain the specified field, then execute S77.

[0180] S74, when the service request contains a specified field, obtain the routing address information of at least one intermediate service node in the specified field to obtain the routing forwarding path. The routing address information of the intermediate service node at least includes an IP address and a port address. Of course, if the port address is omitted, the system uses the default port address when the service node is registered.

[0181] S75: forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, so that the second service node can route the service request to the destination service node in the same container environment.

[0182] Specifically, based on the routing forwarding path, the service request is forwarded to the second service node, such as Figure 8 As shown in the figure, the specific forwarding process includes:

[0183] 1. The first service node forwards the service request to the first intermediate service node based on the routing address information of the first intermediate service node in the routing forwarding path.

[0184] 2. The first intermediate service node determines the routing address information of the second intermediate service node based on the value of the specified field in the service request.

[0185] 3. The first intermediate service node forwards the service request to the second intermediate service node based on the routing address information of the second intermediate service node.

[0186] 4. The second intermediate service node determines the routing address information of the Nth intermediate service node based on the value of the specified field in the service request, where N is a natural number greater than 2.

[0187] 5. The second intermediate service node forwards the service request to the Nth intermediate service node based on the routing address information of the Nth intermediate service node.

[0188] 6. The Nth intermediate service node determines the routing address information of the second service node based on the value of the specified field in the service request.

[0189] 7. The Nth intermediate service node forwards the service request to the second service node based on the routing address information of the second service node.

[0190] S76: The second service node routes the service request to the destination service node for processing in the same container environment.

[0191] S77, when the service request does not contain the specified field, the service request is processed using native routing.

[0192] Combine the following Fig. 9 , for a detailed description of the specific process of the routing method for service requests in the case of inserting a specified field in a service request in an embodiment of the present application, refer to Fig. 9 As shown, the specific implementation process of this method is as follows:

[0193] S91, when the microservice system is started, the script file is started. Of course, in other embodiments of the present application, when applied to the test service, the script file can also be started when the test service is started, and the embodiments of the present application do not limit this.

[0194] S92, the first service node receives a service request, which carries the name of the destination service node. The first service node determines that the destination service node is in another container environment, that is, the first service node and the destination service node are in different container environments, and the different container environments are isolated from each other.

[0195] S93, obtaining the identity information of the object that triggers the service request.

[0196] S94, querying the AOP Trace ID injection rule. It should be noted that the AOP Trace ID injection rule can be obtained from the Redis configuration, and can be specifically configured by the developer or administrator through the Web client, for example, adding rules, deleting rules, and modifying rules.

[0197] S95, determine whether the obtained identity information matches the AOP Trace ID injection rule, if it matches, execute S96, otherwise, execute S911.

[0198] S96, if the obtained identity information matches the AOP Trace ID injection rule, the identification value corresponding to the identity information is obtained from a mapping relationship table pre-stored between identity information and identification values. The mapping relationship table can also be pre-configured by a developer or administrator and stored in a Redis configuration or in a database of a server.

[0199] S97: Use the obtained identification value as the value of AOP Trace ID and insert it into the header information of the service request.

[0200] S98, obtaining the value of the specified field in the service request, that is, the identification value, and the corresponding routing forwarding path from the pre-stored routing forwarding rule library.

[0201] S99: forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, so that the second service node can route the service request to the destination service node in the same container environment.

[0202] Specifically, based on the routing forwarding path, the service request is forwarded to the second service node, such as Fig.10 As shown in the figure, the specific forwarding process includes:

[0203] 1. The first service node forwards the service request to the first intermediate service node based on the routing address information of the first intermediate service node in the routing forwarding path.

[0204] 2. The first intermediate service node obtains the routing forwarding path corresponding to the identification value from the pre-stored routing forwarding rule library based on the value of the specified field in the service request, that is, the identification value, and then determines the routing address information of the second intermediate service node based on the obtained routing forwarding path.

[0205] 3. The first intermediate service node forwards the service request to the second intermediate service node based on the routing address information of the second intermediate service node.

[0206] 4. The second intermediate service node obtains the routing forwarding path corresponding to the identification value from the pre-stored routing forwarding rule library based on the value of the specified field in the service request, that is, the identification value, and then determines the routing address information of the Nth intermediate service node based on the obtained routing forwarding path, where N is a natural number greater than 2.

[0207] 5. The second intermediate service node forwards the service request to the Nth intermediate service node based on the routing address information of the Nth intermediate service node.

[0208] 6. The Nth intermediate service node obtains the routing forwarding path corresponding to the identification value from the pre-stored routing forwarding rule library based on the value of the specified field in the service request, that is, the identification value, and then determines the routing address information of the second service node based on the obtained routing forwarding path.

[0209] 7. The Nth intermediate service node forwards the service request to the second service node based on the routing address information of the second service node.

[0210] It should be noted that the pre-stored routing forwarding rule base does not need to be stored in each service node, but can be stored in the Resis configuration. When each service node needs to obtain the routing forwarding path corresponding to the identification value based on the identification value, it can obtain it in the Resis configuration.

[0211] S910: The second service node routes the service request to the destination service node for processing in the same container environment.

[0212] S911: The obtained identity information does not match the AOP Trace ID injection rule. In this case, the native route is used to process the service request.

[0213] Combine the following Fig.11 , the specific process of the routing method for service requests provided in the embodiment of the present application is described in detail, see Fig.11 As shown, the specific implementation process of this method is as follows:

[0214] S111, when the microservice system is started, the script file is started. Of course, in other embodiments of the present application, when applied to the test service, the script file can also be started when the test service is started, and the embodiments of the present application do not limit this.

[0215] S112, the first service node receives a service request, which carries the name of the destination service node. The first service node determines that the destination service node is in another container environment, that is, the first service node and the destination service node are in different container environments, and the different container environments are isolated from each other.

[0216] S113, identify whether the service request contains a specified field. If the service request contains a self-explanatory routing header, the service request contains the specified field, and the value of the specified field is the routing address information of at least one intermediate service node, then execute S114. If the service request does not contain a self-explanatory routing header, the service request does not contain the specified field, then execute S115.

[0217] S114, when the service request contains a specified field, obtain routing address information of at least one intermediate service node in the specified field, obtain a routing forwarding path, and use the routing forwarding path to forward the service request.

[0218] S115, obtaining the identity information of the object that triggers the service request.

[0219] S116, querying the AOP Trace ID injection rule.

[0220] S117, determine whether the obtained identity information matches the AOP Trace ID injection rule, if it matches, execute S118, otherwise, execute S119.

[0221] S118, if the obtained identity information matches the AOP Trace ID injection rule, the identification value corresponding to the identity information is obtained from the pre-stored mapping relationship table between identity information and identification values. The obtained identification value is used as the value of AOPTrace ID and inserted into the header information of the service request. Then, based on the identification value, the routing forwarding path corresponding to the identification value is obtained from the pre-stored routing forwarding rule library, and the service request is forwarded using the routing forwarding path.

[0222] S119: The obtained identity information does not match the AOP Trace ID injection rule. In this case, the native route is used to process the service request.

[0223] Combine the following Fig.12 , the system architecture of the method for routing service requests provided in the embodiment of the present application is described, such as Fig.12 As shown, there are four container environments deployed in the microservice system. The four service nodes svc-1, svc-2, svc-3 and svc-4 run in container environment 1 through registration in the name service center, svc-2 and svc-3 run in container environment 2 through registration in the name service center, svc-5 and svc-6 run in container environment 3 through registration in the name service center, and svc-7, svc-8 and svc-9 run in container environment 4 through registration in the name service center.

[0224] The microservice system also includes a Redis configuration service, which is used to store pre-configured injection rules and routing forwarding rule libraries, so that when the identity information of the object that triggers the service request matches the injection rule, an identification value is inserted into the header information of the service request to color the service request, indicating that the service request is forwarded using a special route.

[0225] The microservice system also includes a Web management terminal for configuring the injection rules and routing forwarding rules in the Redis configuration service, including but not limited to adding, deleting and modifying the injection rules and routing forwarding rules.

[0226] In an example, based on the system architecture of the above-mentioned microservice system, if the service request received by the svc-1 service node in container environment 1 is destined for the svc-9 service node in container environment 4, a routing forwarding path can be set: svc-2 in container environment 2 -- svc-6 in container environment 3 -- svc-8 in container environment 4. The svc-1 service node in container environment 1 forwards the service request to the svc-8 service node in container environment 4 through the routing forwarding path, so that the svc-8 service node in container environment 4 can route the service request to the svc-9 service node based on the name of the svc-9 service node.

[0227] In the process of inserting the identification value as the value of the specified field into the header information of the service request, and then obtaining the routing forwarding path corresponding to the identification value, in order to ensure the accurate transmission of the identification value between different service nodes, the MDC filter can be used for transmission in the specific implementation. The specific transmission process takes the forwarding process of the service request from the svc-1 service node to the svc-2 service node to the svc-6 service node as an example. Fig.13 As shown, including:

[0228] 1. After receiving the service request, the svc-1 service node determines that the service request does not contain the specified field.

[0229] 2. The svc-1 service node obtains the identity information of the object that triggers the service request, and determines that the identity information of the object matches the preset rule, and then obtains the identification value corresponding to the identity information.

[0230] 3. The MDC filter obtains the identification value.

[0231] 4. The MDC filter inserts the identification value into the header information of the service request.

[0232] 5. Based on the identification value, the svc-1 service node obtains the routing forwarding path corresponding to the identification value, and determines the routing address information of the svc-2 service node according to the routing forwarding path.

[0233] 6. The svc-1 service node forwards the service request to the svc-2 service node based on the routing address information of the svc-2 service node.

[0234] 7. The svc-2 service node receives the service request and determines that the service request contains the specified field.

[0235] 8. The MDC filter obtains the identification value.

[0236] 9. The MDC filter reinserts the identification value of the current record into the header information of the service request and reassigns the value of the specified field in the service request.

[0237] 10. Based on the identification value, the svc-2 service node obtains the routing forwarding path corresponding to the identification value, and determines the routing address information of the svc-6 service node according to the routing forwarding path.

[0238] 11. The svc-2 service node forwards the service request to the svc-6 service node based on the routing address information of the svc-6 service node.

[0239] Thread context features based on MDC filters, such as Fig.13 As shown, the MDC filter can effectively pass the identification value generated at the first service node, thereby accurately coloring the entire routing forwarding path and realizing the forwarding of service requests. It should be noted that most application scenarios in the actual implementation of the MDC filter are implemented in the thread pool, so in the specific implementation, it is necessary to pay attention to the identification and cleaning of the currently used threads to ensure that the records of the current thread are initialized when in use to avoid the misuse of the remaining identification value.

[0240] In addition, the application scenario of this application is a system performance test scenario. Fig.12 Take the system architecture shown in the figure as an example. If the test object needs to test the performance of each service node in the system, Fig.14 As shown, it only needs to register a test service node through the name service center and run it in any container environment (such as container environment 4) to test the performance of each service node in the microservice system. Specifically, by dynamically adjusting the routing forwarding path and using different routing forwarding paths, the performance of service nodes in all container environments can be tested.

[0241] In one example, if Fig.15 As shown, in Fig.14 In the system performance test scenario shown, by receiving a service request through a test service node, the service request can be routed to the service node in container environment 2 through a routing forwarding path: svc-5 in container environment 3--svc-2 in container environment 2, so as to test the service node in container environment 2. Alternatively, the service request can be routed to the service node in container environment 2 through a routing forwarding path: svc-2 in container environment 1--svc-3 in container environment 2, so as to test the service node in container environment 2. Of course, other routing forwarding paths can also be used, which are not given examples one by one here.

[0242] In another example, if Fig.16 As shown, in Fig.14 In the system performance test scenario shown, by receiving a service request through a test service node, the service request can be routed to a service node in container environment 3 through a routing forwarding path: svc-2 in container environment 1 -- svc-3 in container environment 2 -- svc-6 in container environment 3, thereby testing the service node in container environment 3. Of course, other routing forwarding paths can also be used, which will not be given one by one here.

[0243] In another example, Fig.17 As shown, in Fig.14 In the system performance test scenario shown, by receiving a service request through a test service node, the service request can be routed to the service node in the container environment through a routing forwarding path: svc-5 in container environment 3 -- svc-2 in container environment 2 -- svc-3 in container environment 1, thereby testing the service node in the container environment. Of course, other routing forwarding paths can also be used, which will not be given one by one here.

[0244] In this way, when the performance test is performed on the service nodes in the system, not only is the deployment of the test service nodes simple, but the status of each intermediate service node in the routing forwarding path can also be recorded to facilitate performance testing and bottleneck analysis of the system.

[0245] Based on the same inventive concept, the embodiment of the present application also provides a routing device for service requests. Fig.18 As shown, it is a schematic diagram of the structure of a routing device 1800 for service requests, which may include:

[0246] The receiving unit 1801 is used to receive a service request, which carries the name of a destination service node. The first service node where the receiving unit is located and the destination service node are in different container environments.

[0247] The acquisition unit 1802 is used to acquire a routing forwarding path for forwarding the service request based on the value of the designated field when the header information of the service request contains a designated field, and the designated field is used to indicate routing forwarding of the service request.

[0248] The routing unit 1803 is used to forward the service request to the second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

[0249] Optionally, the device further includes: a processing unit 1804, configured to obtain identity information of an object that triggers the service request before obtaining a routing forwarding path for forwarding the service request based on a value of a specified field, and when the identity information matches a preset rule, obtain an identification value corresponding to the identity information, and insert the identification value as a value of the specified field into the header information of the service request, wherein the identity information includes: an IP address and an object identifier;

[0250] The acquisition unit 1802 is specifically used to: acquire a routing forwarding path corresponding to the identification value, wherein the routing forwarding path includes routing address information of at least one intermediate service node, and the routing address information includes: an IP address and a port address.

[0251] Optionally, routing unit 1803 is specifically used to: forward the service request to the first intermediate service node based on the routing address information of the first intermediate service node in the routing forwarding path, so that each intermediate service node in the routing forwarding path determines the routing address information of the next intermediate service node based on the identification value in the obtained service request, and forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path includes the routing address information of the second service node, and the routing address information of the next intermediate service node is obtained based on the routing forwarding path after each intermediate service node obtains the routing forwarding path corresponding to the identification value according to the identification value in the received service request.

[0252] Optionally, the value of the designated field is: routing address information of at least one intermediate service node; the acquisition unit 1802 is specifically used to: use the value of the designated field as the routing forwarding path.

[0253] Optionally, routing unit 1803 is specifically used to: forward the service request to the first intermediate service node based on the routing address information of the first intermediate service node in the routing forwarding path, so that each intermediate service node in the routing forwarding path forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path includes the routing address information of the second service node, and the routing address information of the next intermediate service node is determined by each intermediate service node according to the value of a specified field in the header information of the service request.

[0254] Optionally, the device also includes a script startup unit 1805, which is used to start a script file before obtaining a routing forwarding path for forwarding a service request based on the value of a specified field, and the script file is used to identify the specified field in the service request when the service request contains the specified field, and when the service request does not contain the specified field, determine whether to insert the specified field in the header information of the service request by loading a pre-configured preset rule and a correspondence between a pre-configured identification value and a routing forwarding path.

[0255] Optionally, the first service node is a test service node deployed in a container environment.

[0256] Based on the same inventive concept, the embodiment of the present application also provides a routing system for service requests. Fig.19 As shown, it is a schematic diagram of the structure of a routing device 1900 for service requests, which may include:

[0257] The interface component 1901 is used to receive a service request, the service request carries the name of a destination service node, and the first service node where the interface component is located and the destination service node are in different container environments;

[0258] The routing policy component 1902 is used to obtain a routing forwarding path for forwarding the service request based on the value of the specified field when the header information of the service request contains a specified field, and the specified field is used to indicate routing forwarding of the service request;

[0259] The gateway component 1903 is used to forward the service request to the second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

[0260] Optionally, the system further includes: a management component 1904, which is used to obtain the identity information of the object that triggers the service request before obtaining the routing forwarding path for forwarding the service request based on the value of the specified field, and when the identity information matches the preset rule, obtain the identification value corresponding to the identity information, and insert the identification value as the value of the specified field into the header information of the service request, wherein the identity information includes: an IP address and an object identifier;

[0261] The routing policy component 1902 is specifically used for:

[0262] A routing forwarding path corresponding to the identification value is obtained, where the routing forwarding path includes routing address information of at least one intermediate service node, and the routing address information includes: an IP address and a port address.

[0263] Optionally, the gateway component 1903 is specifically used for:

[0264] Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path determines the routing address information of the next intermediate service node based on the identification value in the obtained service request, and forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is obtained based on the routing forwarding path after each intermediate service node obtains the routing forwarding path corresponding to the identification value according to the identification value in the received service request.

[0265] Optionally, the value of the specified field is: routing address information of at least one intermediate service node;

[0266] The routing policy component 1902 is specifically used to: use the value of the specified field as a routing forwarding path.

[0267] Optionally, the gateway component 1903 is specifically used for:

[0268] Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is determined by each intermediate service node according to the value of the specified field in the header information of the service request.

[0269] Optionally, the system also includes a service component 1905, which is used to start a script file before obtaining a routing forwarding path for forwarding a service request based on the value of a specified field, and the script file is used to identify the specified field in the service request when the service request contains the specified field, and when the service request does not contain the specified field, determine whether to insert the specified field in the header information of the service request by loading pre-configured preset rules and the correspondence between the pre-configured identification value and the routing forwarding path.

[0270] Optionally, the first service node is a test service node deployed in a container environment.

[0271] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. The electronic device can be used for routing and forwarding service requests. In one embodiment, the electronic device can be a terminal device, such as Figure 2 The terminal device 210 shown in FIG. 1 is a terminal device 210 shown in FIG. 1 . In this embodiment, the structure of the electronic device can be as follows: Fig. 20 As shown, it includes a memory 2001 , a communication module 2003 and one or more processors 2002 .

[0272] The memory 2001 is used to store computer programs executed by the processor 2002. The memory 2001 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0273] The memory 2001 may be a volatile memory, such as a random-access memory (RAM); the memory 2001 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 2001 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 2001 may be a combination of the above memories.

[0274] The processor 2002 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 2002 is used to implement the above-mentioned routing method of the service request when calling the computer program stored in the memory 2001 .

[0275] The communication module 2003 is used to communicate with terminal devices and other servers.

[0276] The specific connection medium between the memory 2001, the communication module 2003 and the processor 2002 is not limited in the embodiment of the present application. Fig. 20 In the embodiment, the memory 2001 and the processor 2002 are connected via a bus 2004. The bus 2004 is Fig. 20 The connections between other components are shown in bold lines, which are only for illustration and are not intended to be limiting. Bus 2004 can be divided into address bus, data bus, control bus, etc. For ease of representation, Fig. 20 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0277] The memory 2001 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the routing method of the service request of the embodiment of the present application. The processor 2002 is used to execute the routing method of the service request, such as Figure 3 shown.

[0278] In another embodiment, the electronic device may also be other electronic devices, such as Figure 2 The terminal device 210 shown in FIG. 1 is a terminal device 210 shown in FIG. 1 . In this embodiment, the structure of the electronic device can be as follows: Fig.21 As shown, it includes: a communication component 2110, a memory 2120, a display unit 2130, a camera 2140, a sensor 2150, an audio circuit 2160, a Bluetooth module 2170, a processor 2180 and other components.

[0279] The communication component 2110 is used to communicate with the server. In some embodiments, a wireless fidelity (WiFi) module may be included. The WiFi module belongs to a short-range wireless transmission technology. The electronic device can help the user to send and receive information through the WiFi module.

[0280] The memory 2120 can be used to store software programs and data. The processor 2180 executes various functions and data processing of the terminal device 210 by running the software programs or data stored in the memory 2120. The memory 2120 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The memory 2120 stores an operating system that enables the terminal device 210 to run. In the present application, the memory 2120 can store an operating system and various application programs, and can also store the code for executing the routing method of the service request of the embodiment of the present application.

[0281] The display unit 2130 can also be used to display information input by the user or information provided to the user and a graphical user interface (GUI) of various menus of the terminal device 210. Specifically, the display unit 2130 may include a display screen 2132 disposed on the front of the terminal device 210. The display screen 2132 may be configured in the form of a liquid crystal display, a light emitting diode, etc. The display unit 2130 may be used to present the return data of the service request in the embodiment of the present application or the configuration page of the Web management terminal.

[0282] The display unit 2130 can also be used to receive input digital or character information and generate signal input related to user settings and function control of the terminal device 210. Specifically, the display unit 2130 may include a touch screen 2131 arranged on the front of the terminal device 210, which can collect user touch operations on or near it, such as clicking a button, dragging a scroll box, etc.

[0283] The touch screen 2131 can be covered on the display screen 2132, or the touch screen 2131 and the display screen 2132 can be integrated to realize the input and output functions of the terminal device 210, and the integrated touch screen can be referred to as a touch display screen. In this application, the display unit 2130 can display the application and the corresponding operation steps.

[0284] Camera 2140 can be used to capture static images, and the user can send the image taken by camera 2140 to the user of the other chat partner through the client. Camera 2140 can be one or more. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the processor 2180 to convert it into a digital image signal.

[0285] The terminal device may further include at least one sensor 2150, such as an acceleration sensor 2151, a distance sensor 2152, a fingerprint sensor 2153, and a temperature sensor 2154. The terminal device may also be configured with other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, a light sensor, and a motion sensor.

[0286] The audio circuit 2160, the speaker 2161, and the microphone 2162 can provide an audio interface between the user and the terminal device 210. The audio circuit 2160 can transmit the electrical signal converted from the received audio data to the speaker 2161, which is converted into a sound signal for output. The terminal device 210 can also be configured with a volume button for adjusting the volume of the sound signal. On the other hand, the microphone 2162 converts the collected sound signal into an electrical signal, which is received by the audio circuit 2160 and converted into audio data, and then the audio data is output to the communication component 2110 to be sent to, for example, another terminal device 210, or the audio data is output to the memory 2120 for further processing.

[0287] The Bluetooth module 2170 is used to exchange information with other Bluetooth devices having Bluetooth modules through the Bluetooth protocol. For example, the terminal device can establish a Bluetooth connection with a wearable electronic device (such as a smart watch) that also has a Bluetooth module through the Bluetooth module 2170 to exchange data.

[0288] The processor 2180 is the control center of the terminal device. It uses various interfaces and lines to connect various parts of the entire terminal. It executes various functions of the terminal device and processes data by running or executing software programs stored in the memory 2120 and calling data stored in the memory 2120. In some embodiments, the processor 2180 may include one or more processing units; the processor 2180 may also integrate an application processor and a baseband processor, wherein the application processor mainly processes an operating system, a user interface, and an application program, and the baseband processor mainly processes wireless communications. It is understandable that the above-mentioned baseband processor may not be integrated into the processor 2180. In the present application, the processor 2180 can run an operating system, an application program, a user interface display and a touch response, as well as a routing method for a service request in an embodiment of the present application. In addition, the processor 2180 is coupled to the display unit 2130.

[0289] In some possible implementations, various aspects of the method for routing service requests provided in the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the method for routing service requests according to various exemplary implementations of the present application described above in this specification. For example, the computer device may execute the following steps: Figure 3 Steps shown.

[0290] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0291] The program product of the embodiment of the present application may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a computing device. However, the program product of the present application is not limited thereto. In the embodiment of the present application, the readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with a command execution system, device or device.

[0292] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.

[0293] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0294] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user equipment, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0295] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.

[0296] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0297] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0298] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program commands. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the commands executed by the processor of the computer or other programmable data processing device generate commands for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0299] These computer program commands may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the commands stored in the computer readable memory produce an article of manufacture comprising a command device, the command device implementing the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0300] These computer program commands can also be loaded onto a computer or other programmable data processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the commands executed on the computer or other programmable device provide the instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0301] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0302] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for routing a service request, characterized in that: The method comprises: The first service node receives a service request, where the service request carries a name of a destination service node, and the first service node and the destination service node are in different container environments; When the header information of the service request includes a designated field, based on the value of the designated field, a routing forwarding path for forwarding the service request is obtained, wherein the designated field is used to indicate routing forwarding of the service request; Based on the routing forwarding path, the service request is forwarded to a second service node in the container environment where the destination service node is located, and the second service node routes the service request to the destination service node based on the name of the destination service node.

2. The method according to claim 1, characterized in that Before acquiring the routing forwarding path for forwarding the service request based on the value of the designated field, the method further includes: Acquire identity information of the object that triggers the service request, and when the identity information matches a preset rule, acquire an identification value corresponding to the identity information, and insert the identification value into the header information of the service request as the value of the designated field, wherein the identity information includes: an Internet Protocol IP address and an object identifier; The acquiring, based on the value of the designated field, a routing forwarding path for forwarding the service request includes: A routing forwarding path corresponding to the identification value is obtained, wherein the routing forwarding path includes routing address information of at least one intermediate service node, and the routing address information includes: an IP address and a port address.

3. The method according to claim 2, characterized in that The forwarding the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path includes: Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path determines the routing address information of the next intermediate service node based on the identification value in the obtained service request, and forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is obtained based on the routing forwarding path after each intermediate service node obtains the routing forwarding path corresponding to the identification value according to the identification value in the received service request.

4. The method according to claim 1, characterized in that: The value of the designated field is: routing address information of at least one intermediate service node; The acquiring, based on the value of the designated field, a routing forwarding path for forwarding the service request includes: using the value of the designated field as the routing forwarding path.

5. The method according to claim 4, characterized in that The forwarding the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path includes: Based on the routing address information of the first intermediate service node in the routing forwarding path, the service request is forwarded to the first intermediate service node, so that each intermediate service node in the routing forwarding path forwards the service request based on the routing address information of the next intermediate service node, and forwards the service request to the second service node; wherein the routing forwarding path contains the routing address information of the second service node, and the routing address information of the next intermediate service node is determined by each intermediate service node according to the value of a specified field in the header information of the service request.

6. The method according to any one of claims 1 to 5, characterized in that Before acquiring the routing forwarding path for forwarding the service request based on the value of the designated field, the method further includes: A startup script file is used to identify the specified field in the service request when the service request contains the specified field, and to determine whether to insert the specified field into the header information of the service request by loading pre-configured preset rules and the correspondence between the pre-configured identification value and the routing forwarding path when the service request does not contain the specified field.

7. The method according to any one of claims 1 to 5, characterized in that The first service node is a test service node deployed in a container environment.

8. A routing device for service requests, characterized in that: The device comprises: A receiving unit, configured to receive a service request, wherein the service request carries a name of a destination service node, and the first service node where the receiving unit is located and the destination service node are in different container environments; an acquisition unit, configured to acquire a routing forwarding path for forwarding the service request based on a value of the designated field when the header information of the service request contains a designated field, wherein the designated field is used to indicate routing forwarding of the service request; A routing unit is used to forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

9. A routing system for service requests, characterized in that: include: An interface component, used for receiving a service request, wherein the service request carries a name of a destination service node, and the first service node where the interface component is located and the destination service node are in different container environments; A routing strategy component, used for obtaining a routing forwarding path for forwarding the service request based on a value of the specified field when the header information of the service request contains a specified field, wherein the specified field is used to indicate routing forwarding of the service request; A gateway component is used to forward the service request to a second service node in the container environment where the destination service node is located based on the routing forwarding path, and the second service node routes the service request to the destination service node based on the name of the destination service node.

10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores program codes, and when the program codes are executed by the processor, the processor executes the steps of any one of the methods in claims 1 to 7.

11. A computer-readable storage medium, characterized in that: It includes program codes. When the program product is run on an electronic device, the program codes are used to enable the electronic device to execute the steps of any method described in claims 1 to 7.

12. A computer program product, characterized in that The method comprises a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps of any one of the methods described in claims 1 to 7.