Request processing method, system and device, medium and program product
By calculating slot values based on request key values on the client side and aggregating requests to a distributed cluster, the load imbalance caused by request processing in the distributed cluster is solved, and the balanced allocation of requests and the improvement of system performance is achieved.
Patent Information
- Application Number
- CN202411522141.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-14
AI Technical Summary
The batch processing of requests in a distributed cluster results in load imbalance, and requests with the same tag are transmitted to the same node, resulting in unbalanced resource allocation.
On the client side, the slot value is calculated based on the requested key value, the target node is determined, and multiple requests are aggregated into the pipeline under the target communication connection to transmit, realizing the balanced allocation of the request.
By aggregating requests to different nodes, load balancing of distributed clusters is realized, system performance and efficiency are improved, and network overhead is reduced.
Smart Images

Figure CN119311421A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a request processing method, system, device, medium and program product. Background Art
[0002] Currently, in order to implement batch processing of requests, the same label can be added to the requests. Requests with the same label will be transmitted to the same node in the distributed cluster, resulting in unbalanced load in the distributed cluster. Summary of the invention
[0003] In view of this, the purpose of this application is to provide a request processing method, system, device, medium and program product to achieve load balancing of distributed clusters. The specific scheme is as follows:
[0004] To achieve the above objectives, on the one hand, the present application provides a request processing method, which is applied to a client and includes:
[0005] Determine the slot value corresponding to each request according to the key value in each request to be sent;
[0006] Determine, based on the slot value corresponding to each of the requests, the node corresponding to each of the requests in the distributed cluster;
[0007] In each of the requests, N target requests corresponding to the same target node are aggregated into a target pipe under a target communication connection; wherein N is a positive integer; and the target communication connection is a communication connection between the client and the target node;
[0008] The N target requests are transmitted to the target node in the target communication connection using the target pipe.
[0009] Optionally, determining the slot value corresponding to each request according to the key value in each request to be sent includes:
[0010] For each request, the target verification algorithm is used to process the key value in the current request to obtain the slot value corresponding to the current request.
[0011] Optionally, determining a node corresponding to each request in a distributed cluster based on a slot value corresponding to each request includes:
[0012] Query a preset mapping relationship table to obtain the node corresponding to each request in the distributed cluster;
[0013] The mapping relationship table records: the mapping relationship between each of the nodes and the corresponding slot value range.
[0014] Optionally, aggregating N target requests corresponding to N slot values that map the same target communication connection to the same target pipeline under the target communication connection includes:
[0015] Determine N target requests corresponding to N slot values corresponding to the same target node;
[0016] Determining N key values in the N target requests;
[0017] Push the N key values into the target pipeline.
[0018] Optionally, it also includes:
[0019] Create a send buffer queue locally;
[0020] Recording the N target requests in the sending buffer queue;
[0021] Correspondingly, after transmitting the N target requests to the target node in the target communication connection by using the target pipe, the method further includes:
[0022] Create a receive cache queue locally;
[0023] Receiving N response data from the target node for the N target requests;
[0024] The N response data are recorded in the receiving buffer queue.
[0025] Optionally, different communication connections are provided between the client and different nodes in the distributed cluster;
[0026] Accordingly, it also includes:
[0027] Pipelines under different communication connections are used to transmit requests aggregated to corresponding pipelines in parallel to different nodes in different communication connections.
[0028] On the other hand, the present application also provides a request processing method, which is applied to a target node in a distributed cluster, comprising:
[0029] receiving N target requests transmitted via the target pipe in the target communication connection;
[0030] Among them, N is a positive integer, the target communication connection is a communication connection between the client and the target node; the slot values corresponding to the N target requests correspond to the target node and are aggregated to the target pipeline under the target communication connection, and the slot values corresponding to the N target requests are determined according to the key values in the N target requests.
[0031] In yet another aspect, the present application further provides a request processing system, comprising: a client and a distributed cluster, wherein the distributed cluster comprises a plurality of nodes;
[0032] The client is used to implement the method performed by the client;
[0033] Any node in the distributed cluster is used to implement the method executed by the node.
[0034] On the other hand, the present application also provides an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the aforementioned request processing method.
[0035] On the other hand, the present application further provides a storage medium, in which computer executable instructions are stored. When the computer executable instructions are loaded and executed by a processor, the aforementioned request processing method is implemented.
[0036] On the other hand, the present application also provides a computer program product, including a computer program / instruction, which implements any of the aforementioned methods when executed by a processor.
[0037] This application aggregates N requests to the same target pipeline under a communication connection on the client side, and uses the pipeline to transmit these N requests to a node in the distributed cluster in the communication connection, thereby aggregating the requests to be sent in a pipeline manner. Since the aggregation process depends on the key value in the request to determine the corresponding slot value, it is possible to achieve balanced sending of each request to different nodes in the distributed cluster, and load balancing of the distributed cluster can be achieved. Among them, the slot value is used to realize the mapping of requests to different nodes in the distributed cluster, for example: the slot value of 1-16000 is mapped to node 1 in the distributed cluster. If the slot value calculated by the key value in a node is between 1-16000, then the request is sent to node 1 for processing; according to this application, the request will be aggregated to the pipeline under the communication connection corresponding to node 1.
[0038] Correspondingly, a request processing system, device, storage medium and program product provided by the present application also have the above-mentioned technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0040] Figure 1 A flow chart of a request processing method provided for this application;
[0041] Figure 2 A schematic diagram of a request processing process provided for this application;
[0042] Figure 3 A pipeline concurrency diagram provided for this application;
[0043] Figure 4 A server structure diagram provided for this application;
[0044] Figure 5 A terminal structure diagram provided for this application. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. In addition, in the embodiments of the present application, "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.
[0046] Currently, in order to implement batch processing of requests, the same label can be added to the requests. Requests with the same label will be transmitted to the same node in the distributed cluster, resulting in unbalanced load in the distributed cluster.
[0047] In view of the above-mentioned problems currently existing, the present application proposes a request processing solution, which aggregates N requests to the same target pipeline under a communication connection on the client side, and uses the pipeline to transmit these N requests to a node in a distributed cluster in the communication connection, thereby enabling the requests to be sent to be aggregated in a pipeline manner. Since the aggregation process relies on the key value calculation in the request to obtain the corresponding slot value, it is possible to achieve balanced sending of each request to different nodes in the distributed cluster, thereby achieving load balancing of the distributed cluster.
[0048] See also Figure 1 , Figure 1 A flowchart of a request processing method provided in an embodiment of the present application. Figure 1 As shown, the request processing method is applied to the client and may include the following steps:
[0049] S101. Determine the slot value corresponding to each request according to the key value in each request to be sent.
[0050] In one implementation, the corresponding slot value is calculated based on the key value in each request to be sent, including: for each request, using the target verification algorithm to process the key value (key value) in the current request to obtain the slot value (Slot value) corresponding to the current request. The request can be a data acquisition request (GET request), etc. The key value in the request can be obtained through the SDK encapsulation method: Map<String,Object> batchGet(List <string>The target verification algorithm can be a CRC (Cyclic Redundancy Check) algorithm. The key value in the request is input as a parameter into the CRC algorithm to calculate the corresponding Slot value.
[0051] S102: Determine the node corresponding to each request in the distributed cluster based on the slot value corresponding to each request.
[0052] Among them, the communication connection is used for communication between the client and the nodes in the distributed cluster. Specifically, a communication connection is set between a client and a node in the distributed cluster, and the communication connection is mapped to a slot value range. That is: there is a mapping relationship between the node and the slot value, and there is also a mapping relationship between the node and the communication connection. Since the node and the corresponding communication connection correspond to each other, the node, key value, slot value and corresponding communication connection, these four correspond to each other. For example: the slot value range 20000-30000 is mapped to the communication connection 1 corresponding to the node 1, and the communication connection 1 is the communication connection between the client 1 and the node 1 in the distributed cluster. If the key value in a request is calculated to obtain the slot value 21000, then the request is aggregated to the pipeline under the communication connection 1. The pipeline can package multiple requests into one request action, thereby reducing network overhead and improving the performance of the distributed cluster. For another example, the cluster has a total of 16384 slot values. Assuming the cluster has 3 nodes, then we can have: [0-5460] on node 1, [5461-10922] on node 2, and [10923-16383] on node 3, so that the distribution of slot values follows the principle of uniform distribution.
[0053] In one embodiment, determining the communication connection of the slot value mapping corresponding to each request includes: querying a preset mapping relationship table to obtain the node corresponding to each request in the distributed cluster; wherein the mapping relationship table records: the mapping relationship between each of the nodes and the corresponding slot value range.
[0054] S103. In each request, N target requests corresponding to the same target node are aggregated to the target pipe under the target communication connection.
[0055] Wherein, N is a positive integer, N is less than or equal to M, M is the maximum value of the maximum number of requests allowed by the target pipeline, the target communication connection is used for communication between the client and the target node in the distributed cluster, and the target node is any one of the multiple nodes included in the distributed cluster.
[0056] In one embodiment, N target requests corresponding to N slot values mapped to the same target communication connection are aggregated to the same target pipeline under the target communication connection, including: determining N target requests corresponding to N slot values corresponding to the same target node; determining N key values in the N target requests; and pushing the N key values into the target pipeline.
[0057] S104. Transmit N target requests to the target node in the target communication connection using the target pipe.
[0058] In this embodiment, the client also creates a sending buffer queue locally; records N target requests in the sending buffer queue; accordingly, after the client transmits the N target requests to the target node in the target communication connection using the target pipe, it also includes: creating a receiving buffer queue locally; receiving N response data from the target node for the N target requests; and recording the N response data in the receiving buffer queue. The response data is success or failure.
[0059] In one embodiment, different communication connections are set between the client and different nodes in the distributed cluster; accordingly, the client also uses pipelines under different communication connections to transmit requests aggregated to corresponding pipelines in parallel to different nodes in different communication connections.
[0060] It can be seen that this embodiment aggregates N requests to the same target pipeline under a communication connection on the client side, and uses the pipeline to transmit these N requests to a node in the distributed cluster in the communication connection, so that the requests to be sent can be aggregated in a pipeline manner. Since the aggregation process relies on the key value calculation in the request to obtain the corresponding slot value, it is possible to achieve balanced sending of each request to different nodes in the distributed cluster, and realize load balancing of the distributed cluster.
[0061] It should be noted that this application is used for the interaction between the client-side backend service and the distributed cluster. It implements front-end routing and pipeline enhancements through the underlying code on the client side, provides efficient batch processing capabilities, and can be packaged into a client-level SDK so that the access party can use it at a low cost by simply introducing the corresponding Jar package.
[0062] In one example, suppose there are three nodes deployed in a distributed cluster. Before a client initiates a batch GET request, it first calculates the Slot value of the Key of the batch GET request, that is, Slot=CRC16(key), where CRC is the verification algorithm. Then, through the connection pool object of Redis Client Socker, the mapping relationship between Slot and Client Socket connection is obtained, that is, the mapping path is determined: Key->Slot->Client Socket. Among them, the mapping relationship between Slot and Client Socket connection is recorded in advance and obtained by the client from the cluster. A client has a Socket connection with each node. After that, multiple keys belonging to the same Client Socket are pushed into the pipeline corresponding to this Client Socket, thereby completing the pre-routing grouping of the corresponding keys.
[0063] Among them, SDK provides a method Map for encapsulating pipelines.<String,Object> batchGet(List <string>keys), each key will return the corresponding Object. Object is the value corresponding to the key. If an exception occurs, Object is JedisDataException. You can use Object instanceof Jedis DataException to determine whether the key has an exception.
[0064] See also Figure 2 , a client has a socket connection with any node. If the client wants to query 100 keys, and 33 of them are grouped into the same node through the above method, then these 33 keys are pushed into the same pipeline, and then the pipeline initiates a batch GET request to the corresponding node of the cluster through the socket connection of this node. If a native batch GET request is executed, the cluster needs to be requested 100 times, but according to this example, the number of requests to the Redis cluster is equal to the number of nodes deployed in the Redis cluster, such as only 3 requests in this example. In order to avoid executing too many commands in one pipeline, a pipeline is recommended to have a maximum of 100 keys.
[0065] Since there is no dependency between the three pipelines, we can further improve the overall request efficiency by using multi-threaded concurrency. The final overall time consumption depends only on the time consumption of the slowest pipeline. For details, please refer to Figure 3 , the three pipeline operations are processed in parallel by three threads in the thread pool.
[0066] If the client's request to Redis takes 5ms (including the network round-trip time RTT), then 100 requests require 5×100=500ms. According to this embodiment, i.e., pre-routing grouping + pipeline + concurrent requests, the total request time ultimately depends only on the slowest pipeline. Although pipeline batch commands will increase the execution time (mainly the time spent in Redis internal execution), the online test shows that the slowest pipeline only takes about 10ms, which is 50 times less time.
[0067] This embodiment innovatively introduces the logic of front-end routing on the client side, solving the addressing problem of pipeline in cluster mode. Specifically, it senses the number of cluster nodes, intelligently and automatically front-groups a series of commands, and packages each grouped command set into a pipeline operation. By maintaining the mapping relationship between the pipeline and the underlying nodes, it not only realizes the pipeline in cluster mode, but also uses the concurrent operation of the thread pool to achieve the shortest request latency of multiple pipelines.
[0068] Another request processing method provided in an embodiment of the present application is introduced below. The other request processing method described below and the related implementation steps of the above embodiment can be referenced to each other.
[0069] Another request processing method provided by an embodiment of the present application is applied to a target node in a distributed cluster, including: receiving N target requests transmitted in a target communication connection using a target pipeline. Wherein, N is a positive integer, and the target communication connection is a communication connection between a client and the target node; the slot values corresponding to the N target requests correspond to the target node and are aggregated to the target pipeline under the target communication connection, and the slot values corresponding to the N target requests are determined according to the key values in the N target requests. In one example, N is the maximum number of requests allowed by the target pipeline; the N slot values corresponding to the N target requests are mapped to the target communication connection, and the N slot values are calculated according to the key values in the N target requests.
[0070] In this embodiment, the client can calculate the corresponding slot value based on the key value in each request to be sent; determine the communication connection mapped by the slot value corresponding to each request; aggregate the N target requests corresponding to the N slot values mapped to the same target communication connection to the same target pipeline under the target communication connection; and use the target pipeline to transmit the N target requests to the target node in the target communication connection.
[0071] In this embodiment, the client can use the target verification algorithm to process the key value in the current request for each request to obtain the slot value corresponding to the current request.
[0072] In this embodiment, the client can query a preset mapping relationship table to obtain the node corresponding to each request in the distributed cluster; wherein the mapping relationship table records: the mapping relationship between each of the nodes and the corresponding slot value range.
[0073] In this embodiment, the client can determine N target requests corresponding to N slot values corresponding to the same target node; determine N key values in the N target requests; and push the N key values into the target pipeline.
[0074] In this embodiment, the client can create a sending cache queue locally; record N target requests in the sending cache queue; accordingly, the client can create a receiving cache queue locally; receive N response data from the target node for the N target requests; and record N response data in the receiving cache queue.
[0075] In this embodiment, different communication connections are set between the client and different nodes in the distributed cluster; accordingly, the client uses pipelines under different communication connections to transmit requests aggregated to corresponding pipelines in parallel in different communication connections to different nodes.
[0076] In this embodiment, N requests are aggregated to the same target pipeline under a communication connection on the client side, and the pipeline is used to transmit the N requests to a node in the distributed cluster in the communication connection. Thus, the requests to be sent can be aggregated in a pipeline manner. Since the aggregation process relies on the key value in the request to calculate the corresponding slot value, it is possible to achieve balanced sending of each request to different nodes in the distributed cluster, thereby achieving load balancing of the distributed cluster.
[0077] A request processing system provided in an embodiment of the present application is introduced below. The request processing system described below and the related implementation steps of the above embodiment can be referenced to each other.
[0078] A request processing system provided in an embodiment of the present application includes: a client and a distributed cluster, wherein the distributed cluster includes multiple nodes.
[0079] The client is used to implement the method executed by the client, and any node in the distributed cluster is used to implement the method executed by the target node. Any node in the distributed cluster receives N target requests transmitted in the target communication connection using the target pipeline.
[0080] In this embodiment, the client determines the slot value corresponding to each request based on the key value in each request to be sent; based on the slot value corresponding to each request, determines the node corresponding to each request in the distributed cluster; in each request, aggregates N target requests corresponding to the same target node to the target pipe under the target communication connection; wherein N is a positive integer; the target communication connection is the communication connection between the client and the target node; and transmits N target requests to the target node in the target communication connection using the target pipe.
[0081] In this embodiment, the client can calculate the corresponding slot value based on the key value in each request to be sent; determine the communication connection mapped by the slot value corresponding to each request; aggregate the N target requests corresponding to the N slot values mapped to the same target communication connection to the same target pipeline under the target communication connection; and use the target pipeline to transmit the N target requests to the target node in the target communication connection.
[0082] In this embodiment, the client can use the target verification algorithm to process the key value in the current request for each request to obtain the slot value corresponding to the current request.
[0083] In this embodiment, the client can query a preset mapping relationship table to obtain the node corresponding to each request in the distributed cluster; wherein the mapping relationship table records: the mapping relationship between each of the nodes and the corresponding slot value range.
[0084] In this embodiment, the client can determine N target requests corresponding to N slot values corresponding to the same target node; determine N key values in the N target requests; and push the N key values into the target pipeline.
[0085] In this embodiment, the client can create a sending cache queue locally; record N target requests in the sending cache queue; accordingly, the client can create a receiving cache queue locally; receive N response data from the target node for the N target requests; and record N response data in the receiving cache queue.
[0086] In this embodiment, different communication connections are set between the client and different nodes in the distributed cluster; accordingly, the client uses pipelines under different communication connections to transmit requests aggregated to corresponding pipelines in parallel in different communication connections to different nodes.
[0087] In this embodiment, N requests are aggregated to the same target pipeline under a communication connection on the client side, and the pipeline is used to transmit the N requests to a node in the distributed cluster in the communication connection. Thus, the requests to be sent can be aggregated in a pipeline manner. Since the aggregation process relies on the key value in the request to calculate the corresponding slot value, it is possible to achieve balanced sending of each request to different nodes in the distributed cluster, thereby achieving load balancing of the distributed cluster.
[0088] An electronic device provided in an embodiment of the present application is introduced below. The electronic device described below and related implementation steps of the above embodiment can be referenced to each other.
[0089] Furthermore, the present application also provides an electronic device. The electronic device can be Figure 4 The server 50 shown may also be Figure 5 Terminal 60 is shown. Figure 4 and Figure 5 All of them are structural diagrams of electronic devices according to an exemplary embodiment, and the contents in the diagrams cannot be regarded as any limitation on the scope of use of the present application.
[0090] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present application. The server 50 may specifically include: at least one processor 51, at least one memory 52, a power supply 53, a communication interface 54, an input / output interface 55, and a communication bus 56. The memory 52 is used to store a computer program, which is loaded and executed by the processor 51 to implement the relevant steps in the request processing disclosed in any of the aforementioned embodiments.
[0091] In this embodiment, the power supply 53 is used to provide working voltage for each hardware device on the server 50; the communication interface 54 can create a data transmission channel between the server 50 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 55 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0092] In addition, the memory 52, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 521, a computer program 522 and data 523, etc. The storage method can be temporary storage or permanent storage.
[0093] The operating system 521 is used to manage and control the hardware devices and computer programs 522 on the server 50, so as to realize the operation and processing of the data 523 in the memory 52 by the processor 51, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the request processing method disclosed in any of the aforementioned embodiments, the computer program 522 can also further include a computer program that can be used to complete other specific tasks. In addition to including data such as application update information, the data 523 can also include data such as application developer information.
[0094] Figure 5 This is a schematic diagram of the structure of a terminal provided in an embodiment of the present application. The terminal 60 may specifically include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0095] Generally, the terminal 60 in this embodiment includes: a processor 61 and a memory 62 .
[0096] Among them, the processor 61 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 61 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 61 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 61 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 61 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0097] The memory 62 may include one or more computer-readable storage media, which may be non-transitory. The memory 62 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 62 is at least used to store the following computer program 621, wherein, after the computer program is loaded and executed by the processor 61, it can implement the relevant steps in the request processing method executed by the terminal side disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 62 may also include an operating system 622 and data 623, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 622 may include Windows, Unix, Linux, etc. Data 623 may include, but is not limited to, update information of the application.
[0098] In some embodiments, the terminal 60 may further include a display screen 63 , an input / output interface 64 , a communication interface 65 , a sensor 66 , a power supply 67 , and a communication bus 68 .
[0099] Those skilled in the art will understand that Figure 5 The structure shown in the figure does not constitute a limitation on the terminal 60, and the terminal 60 may include more or less components than those shown in the figure.
[0100] A storage medium provided in an embodiment of the present application is introduced below. The storage medium described below and the related implementation steps of the above embodiment can be referenced to each other.
[0101] Furthermore, the embodiment of the present application also discloses a storage medium, in which computer executable instructions are stored, and when the computer executable instructions are loaded and executed by the processor, the request processing method disclosed in any of the above embodiments is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0102] A computer program product provided in an embodiment of the present application is introduced below. The computer program product described below and the related implementation steps of the above embodiment can be referenced to each other.
[0103] Furthermore, the embodiments of the present application also disclose a computer program product, including a computer program / instruction, which implements the method described in any of the above embodiments when executed by a processor. The specific steps of the method can refer to the corresponding contents disclosed in the above embodiments, and will not be repeated here.
[0104] It should be pointed out that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.
[0105] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0106] Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.< / string> < / string>
Claims
1. A request processing method, characterized in that: Applied to the client, including: Determine the slot value corresponding to each request according to the key value in each request to be sent; Determine, based on the slot value corresponding to each of the requests, the node corresponding to each of the requests in the distributed cluster; In each of the requests, N target requests corresponding to the same target node are aggregated into a target pipe under a target communication connection; wherein N is a positive integer; and the target communication connection is a communication connection between the client and the target node; The N target requests are transmitted to the target node in the target communication connection using the target pipe.
2. The method according to claim 1, characterized in that Determine the slot value corresponding to each request according to the key value in each request to be sent, including: For each request, the target verification algorithm is used to process the key value in the current request to obtain the slot value corresponding to the current request.
3. The method according to claim 1, characterized in that Determining a node corresponding to each request in a distributed cluster based on a slot value corresponding to each request includes: Query a preset mapping relationship table to obtain the node corresponding to each request in the distributed cluster; The mapping relationship table records: the mapping relationship between each of the nodes and the corresponding slot value range.
4. The method according to claim 1, characterized in that Aggregate N target requests corresponding to the same target node to the target pipeline under the target communication connection, including: Determine N target requests corresponding to N slot values corresponding to the same target node; Determining N key values in the N target requests; Push the N key values into the target pipeline.
5. The method according to claim 1, characterized in that Also includes: Create a send buffer queue locally; Recording the N target requests in the sending buffer queue; Correspondingly, after transmitting the N target requests to the target node in the target communication connection by using the target pipe, the method further includes: Create a receive cache queue locally; Receiving N response data from the target node for the N target requests; The N response data are recorded in the receiving buffer queue.
6. The method according to any one of claims 1 to 5, characterized in that: Different communication connections are set between the client and different nodes in the distributed cluster; Accordingly, it also includes: Pipelines under different communication connections are used to transmit requests aggregated to corresponding pipelines in parallel to different nodes in different communication connections.
7. A request processing method, characterized in that: Applicable to target nodes in a distributed cluster, including: receiving N target requests transmitted via the target pipe in the target communication connection; Among them, N is a positive integer, the target communication connection is a communication connection between the client and the target node; the slot values corresponding to the N target requests correspond to the target node and are aggregated to the target pipeline under the target communication connection, and the slot values corresponding to the N target requests are determined according to the key values in the N target requests.
8. A request processing system, characterized in that: include: A client and a distributed cluster, wherein the distributed cluster includes a plurality of nodes; The client is used to implement the method according to any one of claims 1 to 6; Any node in the distributed cluster is used to implement the method as claimed in claim 7.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the method according to any one of claims 1 to 7 is implemented.
11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
