Service mesh based data request method, apparatus and electronic device

By introducing service mesh technology into the distributed microservice architecture, the control plane is deployed in the sidecar container of the service node, optimizing the data request path and reducing redundant deployment. This solves the problems of long data request response time and low deployment efficiency, and achieves faster response and efficient system operation.

CN116319793BActive Publication Date: 2025-11-18INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310348373.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-03
Publication Date
2025-11-18
Estimated Expiration
2043-04-03

Smart Images

  • Figure CN116319793B_ABST
    Figure CN116319793B_ABST
Patent Text Reader

Abstract

The application discloses a data request method and device based on a service grid and electronic equipment, the method is applied to the technical field of cloud computing, and the method comprises the following steps: receiving a data request initiated by a client; determining a service node which needs to be called from a service node in which a service grid is in a running state according to the data request, and obtaining a target service node; accessing the target service node through a target control plane, and obtaining request data corresponding to the data request. Through the application, the problem that the response time of a data request is relatively long due to a long calling link when a service is called through a distributed micro-service architecture in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and more specifically, to a data request method, apparatus, and electronic device based on a service mesh. Background Technology

[0002] Currently, the traffic routing requirements under a distributed microservice architecture have led to the introduction of a control plane to achieve various functions such as service call routing, traffic distribution, unified rate limiting, and transaction access control in distributed scenarios. However, when responding to customer data requests in a distributed microservice architecture, each data request needs to be forwarded from the control plane to the corresponding service node, and then the requested data needs to be retrieved from that service node. This long forwarding chain results in a significant amount of time being spent responding to customer data requests. Furthermore, the high degree of code duplication across multiple control planes causes staff to spend a considerable amount of time repeatedly executing the same deployment process when deploying the system, reducing staff efficiency.

[0003] There is currently no effective solution to the problem of long response times for data requests caused by excessively long call chains when calling services through a distributed microservice architecture in related technologies. Summary of the Invention

[0004] The main objective of this application is to provide a data request method, apparatus, and electronic device based on a service mesh, in order to solve the problem in related technologies where the long call chain leads to a long response time for data requests when calling services through a distributed microservice architecture.

[0005] To achieve the above objectives, according to one aspect of this application, a data request method based on a service mesh is provided. The method includes: receiving a data request initiated by a client; determining, based on the data request, a target service node to be invoked from service nodes in the service mesh that are in operation; and accessing the target service node through a target control plane to obtain request data corresponding to the data request, wherein the target control plane is deployed in a sidecar container of the target service node.

[0006] Furthermore, before receiving a data request initiated by a client, the method further includes: obtaining a base image, wherein the base image is a collection of code; deploying the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; configuring parameters corresponding to each control plane on each target image to obtain M control plane containers, and configuring parameters corresponding to each service node on each target image to obtain M service node containers; starting the M service node containers and the M control plane containers to run the M service nodes and the M control planes.

[0007] Furthermore, accessing the target service node through the target control plane to obtain the request data corresponding to the data request includes: randomly selecting from the M control planes to obtain the target control plane; calculating the path to access the target service node through the target control plane to obtain the target path; and accessing the target service node according to the target path to obtain the request data corresponding to the data request.

[0008] Further, accessing the target service node according to the target path to obtain the request data corresponding to the data request includes: sequentially accessing each service node along the target path, determining whether each accessed service node is the target service node; if the target service node is accessed, then obtaining the data required for the data request through the target service node to obtain the request data corresponding to the data request.

[0009] Furthermore, obtaining the base image includes: packaging the control plane code into an image to obtain a first image, wherein the control plane includes at least the node information of the service node; and deploying the first image on each service node in the form of a sidecar container to obtain the base image.

[0010] Furthermore, before packaging the control plane code into an image to obtain the first image, the method further includes: if there are M service nodes in the service mesh, configuring each control plane so that each control plane includes at least the node information of the M service nodes; after configuring the control plane, packaging the control plane code into an image to obtain the first image.

[0011] Furthermore, after accessing the target service node according to the target path and obtaining the request data corresponding to the data request, the method further includes: returning the request data to the target terminal; and displaying it in the target terminal in a preset style.

[0012] To achieve the above objectives, according to another aspect of this application, a service mesh-based data request apparatus is provided. The apparatus includes: a receiving unit for receiving a data request initiated by a client; a determining unit for determining, based on the data request, a service node to be invoked from service nodes in the service mesh that are in operation, thereby obtaining a target service node; and a first obtaining unit for accessing the target service node through a target control plane to obtain request data corresponding to the data request, wherein the target control plane is deployed in a sidecar container of the target service node.

[0013] Furthermore, the apparatus further includes: a second acquisition unit, configured to acquire a base image before receiving a data request initiated by a client, wherein the base image is a collection of code; a deployment unit, configured to deploy the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; a configuration unit, configured to configure parameters corresponding to each control plane on each target image to obtain M control plane containers, and configure parameters corresponding to each service node on each target image to obtain M service node containers; and a startup unit, configured to start the M service node containers and the M control plane containers to run the M service nodes and the M control planes.

[0014] Further, the first acquisition unit includes: a selection subunit, used to randomly select from the M control planes to obtain a target control plane; a first acquisition subunit, used to calculate the path to access the target service node through the target control plane to obtain a target path; and a second acquisition subunit, used to access the target service node according to the target path to obtain the request data corresponding to the data request.

[0015] Further, the second acquisition subunit includes: a judgment module, used to sequentially access each service node of the target path and determine whether the service node accessed each time is the target service node; and an acquisition module, used to, if the target service node is accessed, obtain the data required for the data request through the target service node and obtain the request data corresponding to the data request.

[0016] Further, the second acquisition unit includes: a third acquisition subunit, used to package the control plane code into an image to obtain a first image, wherein the control plane includes at least the node information of the service node; and a deployment subunit, used to deploy the first image on each service node in the form of a sidecar container to obtain the base image.

[0017] Further, the second acquisition unit includes: a configuration subunit, used to package the control plane code into an image before obtaining the first image; if there are M service nodes in the service mesh, then each control plane is configured so that each control plane includes at least the node information of the M service nodes; and a fourth acquisition subunit, used to package the control plane code into an image after the control plane is configured to obtain the first image.

[0018] Furthermore, the first acquisition unit includes: an output subunit, configured to output the request data to the target terminal after accessing the target service node according to the target path and obtaining the request data corresponding to the data request; and a display subunit, configured to display the data in the target terminal in a preset style.

[0019] To achieve the above objectives, according to one aspect of this application, a processor is provided for running a program, wherein the program executes the service mesh-based data request method described in any of the above-mentioned embodiments.

[0020] To achieve the above objectives, according to one aspect of this application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the service mesh-based data request method described in any of the above.

[0021] This application employs the following steps: receiving a data request initiated by a client; determining the target service node from the running service nodes in the service mesh based on the data request; and accessing the target service node through the target control plane to obtain the request data corresponding to the data request. The target control plane is deployed in a sidecar container of the target service node. This solves the problem in related technologies where long call chains lead to long response times for data requests when calling services through a distributed microservice architecture. By deploying the control plane in a sidecar container of the service node corresponding to the control plane, data requests can be directly transmitted from the control plane to the corresponding service node, saving time spent transmitting data requests over the network and avoiding situations where client data requests cannot be responded to during network congestion, thus reducing the response time of client data requests. Attached Figure Description

[0022] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0023] Figure 1This is a flowchart of a service mesh-based data request method provided according to Embodiment 1 of this application;

[0024] Figure 2 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 1 ;

[0025] Figure 3 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 2 ;

[0026] Figure 4 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 3 ;

[0027] Figure 5 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 4 ;

[0028] Figure 6 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 5 ;

[0029] Figure 7 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 6 ;

[0030] Figure 8 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 7 ;

[0031] Figure 9 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 8 ;

[0032] Figure 10 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 9 ;

[0033] Figure 11 This is an illustration of an optional service mesh-based data request method provided according to Embodiment 1 of this application. Figure 10 ;

[0034] Figure 12 This is a schematic diagram of a service mesh-based data request device provided according to Embodiment 2 of this application;

[0035] Figure 13This is a schematic diagram of a service mesh-based data request electronic device provided according to Embodiment 5 of this application. Detailed Implementation

[0036] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0037] It should be noted that the user information (including but not limited to user device information, user personal information, information sent by the user, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, data requested by the user, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0038] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0039] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0040] Example 1

[0041] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a service mesh-based data request method provided in Embodiment 1 of this application, as follows: Figure 1 As shown, the method includes the following steps:

[0042] Step S101: Receive a data request initiated by the customer.

[0043] For example, customer A clicks the transfer button in the mobile banking app, fills in the transfer information, and clicks confirm to initiate a data request to the bank for the transfer; or, customer A clicks the check balance button in the mobile banking app to initiate a data request to the bank for checking the account deposits.

[0044] Step S102: Based on the data request, determine the service node to be invoked from the service nodes that are in operation in the service mesh, and obtain the target service node.

[0045] In this first embodiment, the data request initiated by the customer is processed by calling services in different service nodes to obtain the data required by the customer. For example, after customer A initiates a data request A1 to query the account balance, at least one service node A2 with query function is determined, and service node A2 is called to query customer A's account balance.

[0046] Step S103: Access the target service node through the target control plane to obtain the request data corresponding to the data request. The target control plane is deployed in the sidecar container of the target service node.

[0047] Introducing a control plane into a distributed microservice architecture can not only identify and intercept unauthorized users in advance, protecting the core services of the system, but also send client data requests to the service node corresponding to the data request, and reasonably control the global traffic of the system, ensuring the normal operation of the system. Figure 2 This is a diagram illustrating the traditional monolithic architecture and the distributed microservice architecture. For example... Figure 2 As shown, in a traditional monolithic architecture, services on the host machine are directly invoked to handle customer data requests. However, during peak data request periods, handling multiple customer requests may become unresponsive due to network statistics, preventing customers from obtaining their data. By transitioning from a traditional monolithic architecture to a distributed microservice architecture, enterprises can distribute data requests from multiple customers through the control plane, distributing them across different service nodes (such as...). Figure 2 Service nodes 1, 2, and 3 in the system simultaneously process customer data requests, improving the company's work efficiency.

[0048] In a distributed microservice architecture, after introducing a control plane, data requests need to be forwarded over the network to the service node corresponding to that control plane in order to process them. Then, the data request is forwarded from that service node to the next control plane, and so on, until the required data is obtained. In a distributed microservice architecture, the forwarding of data requests involves multiple network transmissions, resulting in a long forwarding chain and consequently, a longer response time. Figure 3 This is a diagram illustrating the process of accessing service nodes through the control plane. For example... Figure 3As shown, the control plane is responsible for determining the forwarding path of client data requests, while the service nodes are responsible for processing data requests transmitted from the control plane. The addition of the control plane results in an extra data request forwarding process for each request. If a data request requires multiple forwardings, this increases the number of forwarding attempts, leading to a significant increase in response time.

[0049] In this first embodiment, in order to reduce the response time of data requests, service mesh technology is introduced into the distributed microservice architecture. The control plane is deployed in the sidecar container of the service node corresponding to the control plane, so that data requests can be directly transmitted to the service node corresponding to the control plane through the memory interaction of the same physical machine. Figure 4 This is a diagram illustrating the functionality of a service mesh. A service mesh is an infrastructure layer specifically designed to handle service communication. It is responsible for the reliable transmission of data requests within a complex topology composed of multiple service nodes in a cloud-native, distributed microservice architecture. For example... Figure 4 As shown, the service mesh contains service nodes and sidecar containers. Service nodes are used to execute the business logic of specific services provided by the enterprise, and also include lightweight development tools. Sidecar containers have the ability to discover multiple service nodes, as well as functions such as traffic circuit breaking, user authentication, and traffic control. Figure 5 This is a schematic diagram of the service mesh's operational flow. For example... Figure 5 As shown, the sidecar container is responsible for determining the transmission path of the data request in the topology composed of multiple service nodes, and transmitting the data request to the corresponding service node; the service node is responsible for receiving the data request sent by the sidecar container, processing the data request, and obtaining the data required by the data request.

[0050] In summary, the service mesh-based data request method provided in Embodiment 1 of this application receives a data request initiated by a client; based on the data request, it determines the service node to be invoked from the running service nodes in the service mesh, thus obtaining the target service node; and accesses the target service node through the target control plane to obtain the request data corresponding to the data request. The target control plane is deployed in a sidecar container of the target service node, solving the problem in related technologies where long call chains lead to long response times for data requests when invoking services through a distributed microservice architecture. By deploying the control plane in a sidecar container of the service node corresponding to the control plane, data requests can be directly transmitted from the control plane to the corresponding service node, saving time spent transmitting data requests over the network and avoiding situations where client data requests cannot be responded to during network congestion periods, thereby reducing the response time of client data requests.

[0051] Optionally, in the service mesh-based data request method provided in Embodiment 1 of this application, before receiving the data request initiated by the client, the method further includes: obtaining a base image, wherein the base image is a collection of code; deploying the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; configuring the parameters corresponding to each control plane on each target image to obtain M control plane containers, and configuring the parameters corresponding to each service node on each target image to obtain M service node containers; starting the M service node containers and the M control plane containers to run the M service nodes and the M control planes.

[0052] Figure 6 This is a schematic diagram of the traditional deployment process for system A. For example... Figure 6 As shown, the traditional system deployment process involves several steps. First, the base image A1 of system A is obtained, and the control plane code is written and tested to obtain the target image A2. Next, target image A2 is deployed to system A, the parameters corresponding to the control plane are configured, and the control plane container is started. Then, based on the base image A1, the code for the core services of system A is written and tested to obtain the target image A3. Finally, target image A3 is deployed to system A, the parameters corresponding to the service nodes are configured, and the service node containers are started. In this process, the deployment of the control plane and service nodes is highly repetitive, resulting in significant time wasted performing repetitive operations and reducing worker efficiency. Furthermore, since the control plane code for different service nodes is essentially the same, repeatedly processing the control plane code not only wastes considerable time but also increases the probability of operational errors.

[0053] To improve the efficiency of staff deploying the system, in this first embodiment, the control plane code is packaged into a base image, then the service node code is deployed on the base image, the parameters of the service node and the control plane are configured, and the control plane container and the service node container are started. Figure 7 This is a schematic diagram illustrating the process of deploying System A for this solution. Specifically, as follows... Figure 7 As shown, first, the control plane code is packaged into a base image A1; then, the code for the core services of system A is written and tested to obtain the target image A2; next, the target image A2 is deployed in system A, and the control plane parameters and service node parameters corresponding to system A are configured; finally, the control plane container and service node container are started.

[0054] By packaging the highly reusable control plane code into a base image, and configuring the corresponding service node code on the base image, the workload and time of deploying service nodes and control planes separately for each system are eliminated, reducing the deployment time for staff and improving their work efficiency.

[0055] Optionally, in the service mesh-based data request method provided in Embodiment 1 of this application, accessing the target service node through the target control plane to obtain the request data corresponding to the data request includes: randomly selecting from M control planes to obtain the target control plane; calculating the path to access the target service node through the target control plane to obtain the target path; and accessing the target service node according to the target path to obtain the request data corresponding to the data request.

[0056] Because a distributed microservice architecture deploys multiple service nodes with different functions, when processing a client's data request, it is necessary to determine which service node will handle the request. In this embodiment, when a client's data request is received, a control plane is randomly selected from multiple control planes. The control plane determines the service node to be invoked based on the data request, and determines the forwarding path (i.e., the target path) to send the data request to that service node, so that the service node receives the data request and obtains the data requested by the client.

[0057] By introducing service mesh technology into a distributed microservice architecture, and determining the forwarding path of data requests based on the control plane, the data request processing process can be broken down into calling service nodes to process data requests and routing data requests to the corresponding service nodes. This facilitates load balancing of multiple service nodes through the control plane, thereby reducing the response time of customer data requests and further improving the system's efficiency.

[0058] Optionally, in the data request method based on service mesh provided in Embodiment 1 of this application, accessing the target service node according to the target path to obtain the request data corresponding to the data request includes: sequentially accessing each service node along the target path, determining whether the service node accessed each time is the target service node; if the target service node is accessed, then obtaining the data required for the data request through the target service node to obtain the request data corresponding to the data request.

[0059] In this first embodiment, the forwarding path of a data request is determined by the control plane, and the service node that processes the data request is accessed according to the forwarding path to obtain the requested data. For example, after customer A initiates a data request A1 to inquire about their balance, the control plane determines that service node D1 needs to process data request A1, and determines that the target path for forwarding data request A1 is service node B1, service node C1, and service node D1. To obtain the data requested by data request A1, data request A1 is first forwarded from service node B1 (corresponding to control plane B) to service node C1 (corresponding to control plane C), and then from service node C1 to service node D1 (corresponding to control plane D). Furthermore, this solution can also obtain more data required by the customer through multiple service nodes to fulfill the customer's data request. Specifically, when customer A initiates a payment order data request A2, data request A2 is first forwarded to service node C. Service node C then forwards data request A2 to service node D. Service node D then obtains the payment contract A3 corresponding to data request A2 and forwards data request A2 and payment contract A3 to service node E. Finally, service node E completes the payment operation for data request A2 based on data request A2 and payment contract A3. By determining the forwarding path of data requests through the control plane, service nodes can focus on processing data requests, reducing their workload and improving their efficiency in handling service requests. This reduces the response time for customer data requests and further improves the overall system efficiency.

[0060] Optionally, in the data request method based on service mesh provided in Embodiment 1 of this application, obtaining the base image includes: packaging the control plane code into an image to obtain a first image, wherein the control plane includes at least the node information of the service nodes; and deploying the first image on each service node in the form of a sidecar container to obtain the base image.

[0061] To save time in transmitting data requests between the control plane and the service node, in this first embodiment, the code of the control plane with high reusability is packaged into an image and deployed in the service node corresponding to the control plane as a sidecar container, so that data requests can be quickly transmitted from the control plane to the service node corresponding to the control plane in the future.

[0062] Figure 8 This is a schematic diagram illustrating the process of accessing a service node through the control plane in existing technologies. For example... Figure 8 As shown, firstly, the control plane A1 of system A sends data request C to the service node A2 of system A via the network. Then, the service node A2 of system A sends data request C to the control plane B1 of system B via the network. The control plane B1 of system B then sends data request B to the service node B2 of system B. Figure 8 As shown, during the forwarding of data request C, it undergoes multiple network transmissions, taking a considerable amount of time. Furthermore, if data request C is transmitted over the network during peak transaction periods, it will take even longer.

[0063] Figure 9 This is a schematic diagram illustrating the process of accessing service nodes through the control plane after introducing service mesh technology in this solution. For example... Figure 9 As shown, firstly, the control plane A1 of system A sends data request C to the service node A2 of system A via kernel interaction or memory interaction. Then, the service node A2 of system A sends data request C to the control plane B1 of system B via network transmission. The control plane B1 of system B then sends data request C to the service node B2 of system B via kernel interaction or memory interaction. Figure 9 During the forwarding process of data request C shown, the transmission of data request C from control plane A1 to service node B2 is changed from network transmission to memory transmission on the same device, which reduces the number of network transmissions and reduces the time for transmitting data requests.

[0064] By introducing service mesh technology and deploying the control plane in the sidecar container of the service node, data requests are transmitted from the control plane to the corresponding service node through physical transmission. This saves the time of transmitting data requests over the network, thereby reducing the transmission time of data requests and further reducing the response time of customer data requests.

[0065] Optionally, in the data request method based on service mesh provided in Embodiment 1 of this application, before packaging the control plane code into an image to obtain the first image, the method further includes: if there are M service nodes in the service mesh, configuring each control plane so that each control plane includes node information of at least M service nodes; after the control plane is configured, packaging the control plane code into an image to obtain the first image.

[0066] In this first embodiment, when deploying the control plane image, it is necessary to configure the control plane image to include node information of at least several running service nodes. This ensures that each control plane can determine the forwarding path corresponding to a data request. By storing the node information of several running service nodes in each control plane, each control plane can calculate the forwarding path corresponding to a data request. This facilitates the adjustment of the traffic load of multiple service nodes through multiple control planes, ensuring that the traffic load of multiple service nodes is in a load-balanced state. This improves the efficiency of multiple service nodes in processing data requests and reduces the response time of customer data requests.

[0067] Optionally, in the data request method based on service mesh provided in Embodiment 1 of this application, after accessing the target service node according to the target path and obtaining the request data corresponding to the data request, the above method further includes: returning the request data to the target terminal; and displaying it in the target terminal in a preset style.

[0068] In this first embodiment, after the service node obtains the data requested by the customer, it needs to transmit the requested data to the customer's corresponding terminal and display the data to the customer in a preset format. By displaying the data requested by the customer in a preset format on the customer's terminal, the customer can intuitively view the data they need, thus fulfilling the customer's data request.

[0069] Optionally, in this first embodiment, the process of accessing service nodes between multiple systems through the control plane can be as follows: Figure 10 As shown. Figure 10 As shown, after receiving a data request from a client, firstly, the control plane A1 of system A receives the client's data request, then sends the data request from physical machine A2 to service node A3 of physical machine A4 via the network, then from physical machine A4 to the control plane B1 of system B on physical machine B2 via the network, and finally from physical machine B2 to service node B2 of physical machine B4 via the network. Introducing a control plane speeds up the processing of data requests by multiple service nodes, but still requires a significant amount of time to transmit data requests. Furthermore, deploying systems using traditional methods (such as...) Figure 10 When deploying system A or system B, it is necessary to deploy the control plane and service nodes of each system one by one, which results in a lot of deployment time.

[0070] Optionally, in this first embodiment, after introducing service mesh technology, the process of accessing service nodes between multiple systems through the control plane can be as follows: Figure 11 As shown. Figure 11 As shown, after receiving a data request from a client, firstly, the control plane A1 of system A receives the client's data request and sends it to service node A3 via memory interaction within the same physical machine A2. Then, the data request is sent from service node A3 to the control plane B1 of system B via the network. Finally, the data request is sent to service node B3 of system B via memory interaction. By introducing service mesh technology, some data request transmission processes that previously involved network transmission are transformed into memory-interactive transmission processes, reducing the number of network data request transmissions and lowering the data request response time. Furthermore, this solution is applicable to deployed systems (such as...) Figure 11When deploying system A or system B, only the control plane code needs to be packaged into an image and deployed to the sidecar container of the service node. This allows the image to be reused multiple times when deploying the system in the future, thus reducing the need for staff to repeatedly perform deployment work.

[0071] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0072] Example 2

[0073] This application also provides a service mesh-based data request apparatus in Embodiment 2. It should be noted that the service mesh-based data request apparatus in Embodiment 2 can be used to execute the service mesh-based data request method provided in Embodiment 1. The service mesh-based data request apparatus provided in Embodiment 2 is described below.

[0074] Figure 12 This is a schematic diagram of a service mesh-based data request apparatus according to Embodiment 2 of this application. Figure 12 As shown, the device includes: a receiving unit 1201, a determining unit 1202, and a first acquiring unit 1203.

[0075] Specifically, the receiving unit 1201 is used to receive data requests initiated by the client.

[0076] The determining unit 1202 is used to determine the service node to be called from the service nodes in the service mesh that are in operation, based on the data request, and obtain the target service node.

[0077] The first acquisition unit 1203 is used to access the target service node through the target control plane to obtain the request data corresponding to the data request, wherein the target control plane is deployed in the sidecar container of the target service node.

[0078] The service mesh-based data request apparatus provided in Embodiment 2 of this application receives a data request initiated by a client through a receiving unit 1201; a determining unit 1202 determines the service node to be invoked from the running service nodes of the service mesh according to the data request, thus obtaining the target service node; and a first obtaining unit 1203 accesses the target service node through the target control plane to obtain the request data corresponding to the data request. The target control plane is deployed in a sidecar container of the target service node, solving the problem in related technologies where long call chains lead to long response times for data requests when invoking services through a distributed microservice architecture. By deploying the control plane in a sidecar container of the service node corresponding to the control plane, data requests can be directly transmitted from the control plane to the service node corresponding to the control plane, saving time spent transmitting data requests over the network and avoiding situations where client data requests cannot be responded to during network congestion, thereby reducing the response time of client data requests.

[0079] Optionally, in the service mesh-based data request apparatus provided in Embodiment 2 of this application, the apparatus further includes: a second acquisition unit, configured to acquire a base image before receiving a data request initiated by a client, wherein the base image is a collection of code; a deployment unit, configured to deploy the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; a configuration unit, configured to configure the parameters corresponding to each control plane on each target image to obtain M control plane containers, and configure the parameters corresponding to each service node on each target image to obtain M service node containers; and a startup unit, configured to start the M service node containers and the M control plane containers to run the M service nodes and the M control planes.

[0080] Optionally, in the data request apparatus based on service mesh provided in Embodiment 2 of this application, the first acquisition unit 1203 includes: a selection subunit, used to randomly select from M control planes to obtain a target control plane; a first acquisition subunit, used to calculate the path to access the target service node through the target control plane to obtain a target path; and a second acquisition subunit, used to access the target service node according to the target path to obtain the request data corresponding to the data request.

[0081] Optionally, in the data request apparatus based on service mesh provided in Embodiment 2 of this application, the second acquisition subunit includes: a judgment module, used to sequentially access each service node along the target path and determine whether the service node accessed each time is the target service node; and an acquisition module, used to obtain the data required for the data request through the target service node if the target service node is accessed, and obtain the request data corresponding to the data request.

[0082] Optionally, in the data request device based on service mesh provided in Embodiment 2 of this application, the second acquisition unit mentioned above includes: a third acquisition subunit, used to package the control plane code into an image to obtain a first image, wherein the control plane includes at least the node information of the service nodes; and a deployment subunit, used to deploy the first image on each service node in the form of a sidecar container to obtain a base image.

[0083] Optionally, in the data request apparatus based on service mesh provided in Embodiment 2 of this application, the second acquisition unit mentioned above includes: a configuration subunit, used to package the control plane code into an image before obtaining the first image, if there are M service nodes in the service mesh, then each control plane is configured so that each control plane includes at least the node information of the M service nodes; and a fourth acquisition subunit, used to package the control plane code into an image after the control plane is configured to obtain the first image.

[0084] Optionally, in the data request device based on service mesh provided in Embodiment 2 of this application, the first acquisition unit 1203 includes: an output subunit, used to output the request data to the target terminal after accessing the target service node according to the target path and obtaining the request data corresponding to the data request; and a display subunit, used to display the data in the target terminal in a preset style.

[0085] The data request device based on the service mesh includes a processor and a memory. The receiving unit 1201, the determining unit 1202, and the first acquiring unit 1203 are all stored in the memory as program units. The processor executes the program units stored in the memory to realize the corresponding functions.

[0086] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured, and kernel parameters can be adjusted to reduce the response time for client data requests.

[0087] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0088] Embodiment 3 of the present invention provides a computer-readable storage medium having a program stored thereon, which, when executed by a processor, implements a service mesh-based data request method.

[0089] Embodiment 4 of the present invention provides a processor for running a program, wherein the program executes a service mesh-based data request method during runtime.

[0090] like Figure 13As shown, Embodiment 5 of the present invention provides an electronic device, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: receiving a data request initiated by a client; determining the service node to be invoked from the service nodes in the running state of the service mesh according to the data request, and obtaining the target service node; accessing the target service node through the target control plane to obtain the request data corresponding to the data request, wherein the target control plane is deployed in the sidecar container of the target service node.

[0091] When the processor executes the program, it also performs the following steps: Before receiving a data request initiated by a client, the above method further includes: obtaining a base image, wherein the base image is a collection of code; deploying the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; configuring the parameters corresponding to each control plane on each target image to obtain M control plane containers, and configuring the parameters corresponding to each service node on each target image to obtain M service node containers; starting the M service node containers and the M control plane containers to run the M service nodes and the M control planes.

[0092] When the processor executes the program, it also performs the following steps: accessing the target service node through the target control plane to obtain the request data corresponding to the data request, including: randomly selecting from M control planes to obtain the target control plane; calculating the path to access the target service node through the target control plane to obtain the target path; and accessing the target service node according to the target path to obtain the request data corresponding to the data request.

[0093] When the processor executes the program, it also performs the following steps: accessing the target service node according to the target path and obtaining the request data corresponding to the data request, including: accessing each service node along the target path in sequence and determining whether the service node accessed each time is the target service node; if the target service node is accessed, then obtaining the data required for the data request through the target service node and obtaining the request data corresponding to the data request.

[0094] When the processor executes the program, it also performs the following steps: obtaining the base image includes: packaging the control plane code into an image to obtain the first image, wherein the control plane includes at least the node information of the service nodes; deploying the first image as a sidecar container on each service node to obtain the base image.

[0095] When the processor executes the program, it also performs the following steps: Before packaging the control plane code into an image to obtain the first image, the above method also includes: if there are M service nodes in the service mesh, then each control plane is configured so that each control plane includes node information of at least M service nodes; after the control plane is configured, the control plane code is packaged into an image to obtain the first image.

[0096] When the processor executes the program, it also performs the following steps: After accessing the target service node according to the target path and obtaining the request data corresponding to the data request, the above method also includes: returning the request data to the target terminal; and displaying it in the target terminal in a preset style.

[0097] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0098] This application also provides a computer program product that, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: receiving a data request initiated by a client; determining the service node to be invoked from the service nodes in the running state of the service mesh according to the data request, and obtaining the target service node; accessing the target service node through the target control plane to obtain the request data corresponding to the data request, wherein the target control plane is deployed in the sidecar container of the target service node.

[0099] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: Before receiving a data request initiated by a client, the above method further includes: obtaining a base image, wherein the base image is a collection of code; deploying the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; configuring the parameters corresponding to each control plane on each target image to obtain M control plane containers, and configuring the parameters corresponding to each service node on each target image to obtain M service node containers; starting the M service node containers and the M control plane containers to run the M service nodes and the M control planes.

[0100] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: accessing the target service node through the target control plane to obtain the request data corresponding to the data request, including: randomly selecting from M control planes to obtain the target control plane; calculating the path to access the target service node through the target control plane to obtain the target path; and accessing the target service node according to the target path to obtain the request data corresponding to the data request.

[0101] When executed on a data processing device, it is also suitable to execute an initialization program with the following steps: accessing the target service node according to the target path and obtaining the request data corresponding to the data request, including: sequentially accessing each service node along the target path and determining whether the service node accessed each time is the target service node; if the target service node is accessed, then obtaining the data required for the data request through the target service node and obtaining the request data corresponding to the data request.

[0102] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: obtaining the base image includes: packaging the control plane code into an image to obtain a first image, wherein the control plane includes at least the node information of the service nodes; deploying the first image as a sidecar container on each service node to obtain the base image.

[0103] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: before packaging the control plane code into an image to obtain the first image, the above method further includes: if there are M service nodes in the service mesh, configuring each control plane so that each control plane includes node information of at least M service nodes; after the control plane is configured, packaging the control plane code into an image to obtain the first image.

[0104] When executed on a data processing device, it is also suitable to execute an initialization program with the following method steps: after accessing the target service node according to the target path and obtaining the request data corresponding to the data request, the above method further includes: returning the request data to the target terminal; and displaying it in the target terminal in a preset style.

[0105] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0106] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0107] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0108] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0109] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0110] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0111] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0112] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0113] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0114] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A data request method based on service mesh, characterized in that, include: Receive data requests initiated by customers; Based on the data request, the service node to be invoked is determined from the service nodes in the service mesh that are in operation, and the target service node is obtained. The service mesh includes service nodes and sidecar containers. The sidecar containers of the service nodes deploy corresponding control planes so that the data request can be directly transmitted to the service node corresponding to the control plane through memory interaction of the same physical machine. Access the target service node through the target control plane to obtain the request data corresponding to the data request; Before receiving a data request initiated by a client, the method further includes: Obtain the base image, where the base image is a collection of code; Deploy the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; Configure the parameters corresponding to each control plane on each target image to obtain M control plane containers, and configure the parameters corresponding to each service node on each target image to obtain M service node containers; Start the M service node containers and the M control plane containers to run the M service nodes and the M control planes; Accessing the target service node through the target control plane yields the following request data corresponding to the data request: The target control surface is obtained by randomly selecting from the M control surfaces; The target path is obtained by calculating the path to access the target service node through the target control plane; Access the target service node according to the target path to obtain the request data corresponding to the data request.

2. The method according to claim 1, characterized in that, Accessing the target service node according to the target path, the request data corresponding to the data request obtained includes: Visit each service node along the target path sequentially, and determine whether each visited service node is the target service node; If the access reaches the target service node, the data required for the data request is obtained through the target service node, and the request data corresponding to the data request is obtained.

3. The method according to claim 1, characterized in that, Obtaining the base image includes: Package the control plane code into an image to obtain the first image; The first image is deployed as a sidecar container on each service node to obtain the base image; Before packaging the control plane code into an image to obtain the first image, the method further includes: If there are M service nodes in the service mesh, then each control plane is configured so that each control plane includes at least the node information of the M service nodes; After configuring the control plane, the control plane code is packaged into an image to obtain the first image.

4. The method according to claim 1, characterized in that, After accessing the target service node according to the target path and obtaining the request data corresponding to the data request, the method further includes: The requested data is returned to the target terminal; The content is displayed in a preset style on the target terminal.

5. A data request device based on a service mesh, characterized in that, include: The receiving unit is used to receive data requests initiated by clients; The determining unit is used to determine the service node to be invoked from the service nodes in the running state of the service mesh according to the data request, and obtain the target service node. The service mesh includes service nodes and sidecar containers. The sidecar containers of the service nodes are deployed with corresponding control planes so that the data request can be directly transmitted to the service node corresponding to the control plane through memory interaction of the same physical machine. The first acquisition unit is used to access the target service node through the target control plane to obtain the request data corresponding to the data request; The apparatus further includes: a second acquisition unit, configured to acquire a base image before receiving a data request initiated by a client, wherein the base image is a collection of code; a deployment unit, configured to deploy the code of each service node on the base image to obtain M target images, wherein the number of target images is the same as the number of service nodes, and M is a positive integer; a configuration unit, configured to configure the parameters corresponding to each control plane on each target image to obtain M control plane containers, and configure the parameters corresponding to each service node on each target image to obtain M service node containers; and a startup unit, configured to start the M service node containers and the M control plane containers to run the M service nodes and the M control planes. The first acquisition unit includes: a selection subunit, used to randomly select from M control planes to obtain a target control plane; a first acquisition subunit, used to calculate the path to access the target service node through the target control plane to obtain the target path; and a second acquisition subunit, used to access the target service node according to the target path to obtain the request data corresponding to the data request.

6. A processor, characterized in that, The processor is used to run a program, wherein the program executes the service mesh-based data request method according to any one of claims 1 to 4.

7. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the service mesh-based data request method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Decentralized processing method, communication agent, host and storage medium

    CN110401696A