Request distribution method and device, equipment, medium and program product
By assigning service node processing capabilities and index values in the data table and allocating business processing requests, the problems of load balancing and response content matching are solved, and efficient traffic balancing allocation and dynamic weight adjustment are achieved.
Patent Information
- Application Number
- CN202411118575.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-12-13
AI Technical Summary
The existing load balancing technology is difficult to achieve efficient allocation of service processing requests, resulting in unbalanced load of service nodes, unable to set weights for specific nodes, unable to process requests from S2S fixed network agents, and may lead to mismatch in response content context.
In the pre-constructed data table, the number of index values is associated with its device identification according to the processing capabilities of the service nodes, and the service processing request is allocated according to the index values, thereby improving the allocation probability of service nodes with strong processing capabilities and realizing load balancing of traffic. It also supports weight balance strategy based on business primary keys and dynamically adjusts weights.
Effectively improve the processing efficiency of business requests, realize the load balancing of traffic, solve the problems of service node load imbalance and mismatch in response content context. It is suitable for a variety of traffic balance allocation scenarios, supports custom service primary keys and multiple Weight acquisition method.
Smart Images

Figure CN119127465A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and relates to, but is not limited to, methods and devices, equipment, media, and program products for allocating requests. Background Art
[0002] Load Balancing is a key computer network technology, whose core purpose is to distribute workloads (such as network traffic, data requests, computing tasks, etc.) among multiple computing resources (such as servers, virtual machines, containers, etc.) to achieve optimal use of resources, maximize system throughput, minimize response time, and avoid overloading of any single resource. Each service node can process the assigned business processing requests according to a certain algorithm or strategy. However, how to achieve load balancing to improve the processing efficiency of business processing requests is a problem to be solved. Summary of the invention
[0003] The method, apparatus, device, medium, and program product for allocating requests provided by the present application include:
[0004] In a first aspect, an embodiment of the present application provides a method for allocating requests, the method comprising: determining a business identifier corresponding to a business processing request to be allocated; determining a first index value of the business identifier in a pre-constructed data table; recording a device identifier of the same service node at a position associated with one or more index values in the data table, and the number of index values corresponding to different service nodes in the data table is positively correlated with a first processing capability of the corresponding service node; according to the first index value, obtaining the first device identifier recorded at the associated position from the data table; and allocating the business processing request to the service node corresponding to the first device identifier.
[0005] In this way, since the number of index values corresponding to different service nodes in the data table is positively correlated with the first processing capability of the corresponding service node, that is, the greater the first processing capability of the service node, the greater the number of index values corresponding to the service node. Therefore, according to the first index value, the probability that the first device identifier recorded at the associated position obtained from the data table belongs to the service node with the greater first processing capability is greater, thereby ultimately allocating more business processing requests to the service node with stronger processing capability, which is beneficial to improving the processing efficiency of business processing requests and achieving the purpose of load balancing of traffic. Conversely, the smaller the first processing capability of the service node, the fewer the number of index values corresponding to the service node, thereby ultimately allocating fewer business processing requests to the service node with stronger processing capability, which is beneficial to improving the processing efficiency of business processing requests and achieving the purpose of load balancing of traffic. Conversely, the smaller the first processing capability of the service node, the fewer the number of index values corresponding to the service node, thereby ultimately allocating fewer business processing requests to the service node with stronger processing capability, which is beneficial to improving the processing efficiency of business processing requests and achieving the purpose of load balancing of traffic.
[0006] In a second aspect, an embodiment of the present application provides a device for allocating requests, the device comprising: a first determination module, configured to determine a business identifier corresponding to a business processing request to be allocated; a second determination module, configured to determine a first index value of the business identifier in a pre-constructed data table; one or more index value associated positions in the data table record device identifiers of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with the first processing capability of the corresponding service node; an acquisition module, configured to acquire the first device identifier recorded in the associated position from the data table according to the first index value; and an allocation module, configured to allocate the business processing request to the service node corresponding to the first device identifier.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the method described in the embodiment of the present application is implemented.
[0008] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the embodiment of the present application.
[0009] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implements the method provided in the embodiment of the present application.
[0010] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0012] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0013] Figure 1 An example diagram of a traffic load balancing strategy based on random allocation provided in an embodiment of the present application;
[0014] Figure 2 An example diagram of a traffic load balancing strategy based on IP allocation carried by a business processing request to be allocated provided in an embodiment of the present application;
[0015] Figure 3 An example diagram of a traffic load balancing strategy based on weight allocation provided in an embodiment of the present application;
[0016] Figure 4 Schematic diagram of the implementation process of the method for allocating requests provided in the embodiment of the present application Figure 1 ;
[0017] Figure 5 Schematic diagram of the implementation process of the method for allocating requests provided in the embodiment of the present application Figure 2 ;
[0018] Figure 6 Example of traffic load balancing strategy based on business primary key weight balancing provided in the embodiment of the present application Figure 1 ;
[0019] Figure 7 Example of traffic load balancing strategy based on business primary key weight balancing provided in the embodiment of the present application Figure 2 ;
[0020] Figure 8 A schematic diagram of the implementation flow of the method for obtaining weights provided in an embodiment of the present application;
[0021] Fig. 9 A schematic diagram of a curve showing the change in the number of requests to be allocated provided in an embodiment of the present application;
[0022] Fig.10 A statistical chart of the success rate of allocation requests provided in an embodiment of the present application;
[0023] Fig.11 A statistical graph of the number of errors in allocation requests provided in an embodiment of the present application;
[0024] Fig.12 A schematic diagram of the structure of an apparatus for allocating requests provided in an embodiment of the present application;
[0025] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0028] In the following description, reference is made to “some embodiments”, “this embodiment”, “embodiments of the present application” and examples, etc., which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0029] The descriptions of “first, second, third” etc. that appear in the embodiments of the present application are only for illustration and distinction of the description objects. There is no distinction of order, nor do they indicate any special limitation on the number of devices in the embodiments of the present application, and cannot constitute any limitation on the embodiments of the present application.
[0030] To facilitate understanding of the technical solutions of the embodiments of the present application, the following describes the related technologies or terms of the embodiments of the present application. The following related technologies or related terms as optional solutions can be combined with the technical solutions of the embodiments of the present application at will, and they all belong to the protection scope of the embodiments of the present application.
[0031] In the related art, the allocation strategies of traffic load balancing include: random allocation, allocation based on the Internet Protocol address (IP) carried by the service processing request to be allocated, allocation based on weight, etc.
[0032] Among them, the random allocation traffic load balancing strategy means that the business processing requests to be allocated will be randomly allocated to any service node, so it cannot be predicted in advance. The traffic load balancing strategy based on random allocation is suitable for simple businesses with relatively stable and smooth traffic, and the logic is simple; however, the service nodes allocated to the business processing requests to be allocated for the same business by this allocation strategy are not fixed, so the number of business processing requests processed by each service node is unstable and uncontrollable.
[0033] Figure 1 An example diagram of a traffic load balancing strategy based on random allocation provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, 101 represents a device that issues a service processing request to be allocated; 102 represents a service node, wherein the service node is used to process the service processing request allocated to it; 103 represents a device that allocates the service processing request to be allocated, Figure 1 In the embodiment, the device 103 for allocating the service processing request to be allocated allocates a service node to the service processing request to be allocated based on a randomly allocated traffic load balancing strategy.
[0034] The traffic load balancing strategy based on the IP allocation carried by the business processing request to be allocated means that the business processing requests to be allocated carrying the same IP will be allocated to a fixed service node. When the service node is allocated for the business processing request to be allocated for the first time, there will be an initial allocation strategy, such as hash allocation. The traffic load balancing strategy based on the IP allocation carried by the business processing request to be allocated is suitable for the client (Client, C) side business of the client to the server (Client To Service, C2S), and the resources of each service node are consistent. The traffic load balancing strategy based on the IP allocation carried by the business processing request to be allocated is fixed for the service node responding to the same IP, that is, it is impossible to set weights for specific nodes, nor can it process the business processing requests to be allocated from the fixed network agent of the server to the server (Service To Service, S2S).
[0035] Among them, the client device usually refers to a computer or device that uses client software or applications such as a browser to initiate a request to the server device; the server device refers to a computer or device that provides services, which receives requests sent by the client device, processes the requests and returns corresponding data or services.
[0036] Hash refers to converting data of any length into data of fixed length through a hash function. The fixed-length data is usually called a hash value or hash value. A hash function is a special algorithm that can map input data to an output of a fixed size.
[0037] Figure 2 An example diagram of a traffic load balancing strategy based on IP allocation carried by a business processing request to be allocated provided in an embodiment of the present application, such as Figure 2 As shown, 101 represents a device that issues a service processing request to be allocated; 102 represents a service node, wherein the service node is used to process the service processing request allocated to it; 201 represents a device that allocates the service processing request to be allocated, Figure 2 In the embodiment, the device 201 for allocating the service processing request to be allocated allocates a service node to the service processing request to be allocated based on the traffic load balancing strategy allocated by the IP address carried by the service processing request to be allocated.
[0038] The traffic load balancing strategy based on weight allocation means that the business processing requests to be allocated will be allocated to a certain service node according to a certain probability, but the probability of each service node is different and has a certain weight. The traffic load balancing strategy based on weight allocation is suitable for scenarios where the service node content is inconsistent, the business focus ratio is inconsistent, or the resource configuration is inconsistent, and different weight allocations are required. The traffic load balancing strategy based on weight allocation can adjust the weight of each service node, allowing service nodes with sufficient resources to handle more business processing requests to be allocated, but the service node allocated to a single individual business processing request to be allocated is not fixed, which may lead to the problem of response content context mismatch.
[0039] Figure 3 An example diagram of a traffic load balancing strategy based on weight allocation provided in an embodiment of the present application is shown in FIG. Figure 3 As shown, 101 represents a device that issues a business processing request to be allocated, 102 represents a service node, wherein the service node is used to process the business processing request allocated to it; 301 represents a device that allocates the business processing request to be allocated, Figure 3 In the process, the device 201 for allocating the service processing request to be allocated allocates a service node for the service processing request to be allocated based on the traffic load balancing strategy of weight allocation; Figure 3 The 60% and 40% are examples of weight ratios of service nodes.
[0040] Based on the above analysis, the relevant technology has the following problems:
[0041] (1) The service node allocated to the service processing request to be allocated corresponding to the same IP address is not fixed;
[0042] (2) It is not possible to set weights for specific nodes;
[0043] (3) Unable to process requests from S2S fixed network proxies;
[0044] (4) Requests to a single individual may result in the content of the response from the assigned service node not matching the context.
[0045] Based on this, an embodiment of the present application provides a method for allocating requests. Figure 4 Schematic diagram of the implementation process of the method for allocating requests provided in the embodiment of the present application Figure 1 ,like Figure 4 As shown, the method may include the following steps 401 to 404:
[0046] Step 401, determining the service identifier corresponding to the service processing request to be allocated;
[0047] Step 402, determining a first index value of a service identifier in a pre-constructed data table; a position associated with one or more index values in the data table records a device identifier of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with a first processing capability of the corresponding service node;
[0048] Step 403, obtaining the first device identifier recorded at the associated position from the data table according to the first index value;
[0049] Step 404: Allocate the service processing request to the service node corresponding to the first device identifier.
[0050] It can be understood that in an embodiment of the present application, the business identifier corresponding to the business processing request to be assigned is determined, and the first index value of the business identifier in a pre-constructed data table is determined; the position records associated with one or more index values in the data table have the device identifier of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with the first processing capacity of the corresponding service node; according to the first index value, the first device identifier of the associated position record is obtained from the data table; and the business processing request is assigned to the service node corresponding to the first device identifier.
[0051] In this way, since the number of index values corresponding to different service nodes in the data table is positively correlated with the first processing capability of the corresponding service node, that is, the greater the first processing capability of the service node, the greater the number of index values corresponding to the service node. Therefore, according to the first index value, the probability that the first device identifier recorded at the associated position obtained from the data table belongs to the service node with the greater first processing capability is greater, thereby ultimately allocating more business processing requests to the service node with stronger processing capability, which is beneficial to improving the processing efficiency of business processing requests and achieving the purpose of load balancing of traffic. Conversely, the smaller the first processing capability of the service node, the fewer the number of index values corresponding to the service node, thereby ultimately allocating fewer business processing requests to the service node with stronger processing capability, which is beneficial to improving the processing efficiency of business processing requests and achieving the purpose of load balancing of traffic. Conversely, the smaller the first processing capability of the service node, the fewer the number of index values corresponding to the service node, thereby ultimately allocating fewer business processing requests to the service node with stronger processing capability, which is beneficial to improving the processing efficiency of business processing requests and achieving the purpose of load balancing of traffic.
[0052] The following describes further optional implementations and related terms of each of the above steps.
[0053] In step 401, a service identifier corresponding to a service processing request to be allocated is determined.
[0054] It should be understood that in the embodiments of the present application, the business processing request to be allocated is not limited; the request can be any business processing request to be allocated. In some embodiments, the business processing request to be allocated can be at least one of the following: session request, web page request, program interface request, online game request, video live broadcast request, static resource request (for example: photo, web page structure, web page style, etc.), security-related request, etc.
[0055] In the embodiments of the present application, the service identifier is not limited, and the method for determining the service identifier is not limited. In some embodiments, the service identifier is customized, and the service identifier includes one of the following: customer number, mobile phone number or order number.
[0056] In some embodiments, the service identifiers of multiple service processing requests to be allocated for the same service are the same, and the first index value of the same service identifier is the same.
[0057] It can be understood that in the embodiment of the present application, the service identifiers of multiple service processing requests to be allocated for the same service are the same, and the first index value of the same service identifier is the same. In this way, it can be ensured that the service nodes allocated to multiple service processing requests to be allocated for the same service are the same, which can avoid the problem of context mismatch of response content when the service node processes the service processing request due to inconsistent service nodes allocated to the same service.
[0058] For example, suppose the content of the business processing request to be allocated is to interact with artificial intelligence voice assistant A. During the interaction process, the interaction content has context, that is, it has continuity. However, if the business processing request to be allocated is allocated to the service node that supports artificial intelligence voice assistant B when the business processing request to be allocated is allocated next time, the interaction will be interrupted or the result of the interaction will not meet expectations. This is an example of context mismatch of the response content.
[0059] In step 402, determine the first index value of the service identifier in a pre-constructed data table; one or more index value associated positions in the data table record the device identifier of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with the first processing capacity of the corresponding service node.
[0060] In some embodiments, determining the first index value of the business identifier in a pre-constructed data table includes: determining a first hash value of the business identifier; using the first hash value to modulo the number of index values in the data table to obtain the first index value of the business identifier in the pre-constructed data table.
[0061] It can be understood that in an embodiment of the present application, the first hash value of the business identifier is determined, and the first hash value is used to take the modulus of the number of index values in the data table, so that the first hash value can be mapped to the value range of the index value in the pre-constructed data table, thereby obtaining the first index value of the business identifier in the pre-constructed data table.
[0062] It should be understood that in the embodiments of the present application, the number of index values in the data table is not limited. In some embodiments, the number of index values in the data table is recommended to be fixed to 100, so that no matter how the processing capacity of the service node changes, the first index value is ultimately distributed on 100 virtual nodes, which is more stable for specific business identification individuals.
[0063] In some embodiments, the data table is a hash table, which includes a plurality of hash buckets, and the plurality of hash buckets are respectively associated with corresponding index values; wherein the hash buckets are used to record device identifiers of service nodes.
[0064] It should be understood that a hash bucket is a data structure, which is a basic unit of a hash table for storing data, also known as a hash slot or a hash bucket. In the embodiment of the present application, the hash bucket is used to record the device identification of the service node.
[0065] In some embodiments, the first processing capacity is determined based on one or more of load information, revenue information, and working time information of the corresponding service node.
[0066] It should be understood that in the embodiments of the present application, the load information of the service node is not limited. In some embodiments, the load information refers to the usage or pressure status of system or network resources, which covers the occupancy of various resources, including but not limited to central processing unit (CPU), memory, disk input output (I / O) operations and network bandwidth.
[0067] In some embodiments, the load information of the service node may also be the load capacity of the service node, wherein the load capacity of the service node refers to the maximum capacity of the number of services and workload that the service node can handle within a specific time. The load capacity of the service node usually includes multiple aspects, such as CPU processing power, memory capacity, disk I / O performance, network bandwidth, etc.
[0068] In the embodiments of the present application, the revenue information of the service node refers to the economic benefits generated by the service node in the process of providing services. In some embodiments, the revenue information of the service node is related to the processing capacity of the service node, and the processing capacity of the service node can directly affect the quality and quantity of services it can provide. The service node with higher processing capacity can usually generate more revenue.
[0069] In an embodiment of the present application, the revenue information of the service node refers to the revenue information of the service node within a period of time. The embodiment of the present application does not limit the length of the time period for determining the revenue information. In some embodiments, the revenue information of the service node may be the revenue information generated by the service node in the last week.
[0070] In the embodiment of the present application, the working time of the service node is not limited. In some embodiments, if a service node does not work for a period of time, then during this period of time, the processing capacity of the service node is 0.
[0071] It can be understood that in the embodiment of the present application, the first processing capacity is determined based on one or more of the load information, revenue information, and working time information. This is beneficial to determine the first processing capacity that is more in line with the actual situation, thereby helping to improve the processing efficiency of business processing requests and achieve the purpose of traffic load balancing.
[0072] In some embodiments, the revenue information of a service node is related to the service content of the service node, and the service content of the service node can directly affect the number of services it can provide. A service node with more services can usually generate more revenue.
[0073] For example, in some embodiments, the first processing capacity is determined based on the revenue information. This is because the service content that each service node is responsible for is not necessarily the same. For example, service node A may request the content of supplier A, and service node B may request the content of supplier B. If the user is accustomed to the service content of supplier A, then service node A will generate more revenue.
[0074] In some embodiments, when the first processing capacity is determined based on multiple items of load information, revenue information, and working time information, for example: the first processing capacity is determined based on load information, revenue information, and working time information, the first processing capacity can be determined based on the normalized values of the load information, revenue information, and working time information.
[0075] It should be understood that in the embodiments of the present application, the information for determining the first processing capability is not limited. In the embodiments of the present application, it is impossible to exhaustively list all the information that can determine the first processing capability. Therefore, all the information that can determine the first processing capability, even if not listed in the embodiments of the present application, should also belong to the protection scope of the present application.
[0076] In some embodiments, Figure 5 Schematic diagram of the implementation process of the method for allocating requests provided in the embodiment of the present application Figure 2 ,like Figure 5 As shown, the method includes the following steps 501 to 503:
[0077] Step 501, determining the second processing capacity of the i-th service node; wherein i is greater than 0 and less than or equal to the number of service nodes in the data table;
[0078] Step 502, determining a capacity change value of the i-th service node according to the second processing capacity and the first processing capacity of the i-th service node;
[0079] It should be understood that in the embodiment of the present application, the capacity change value of any service node within a period of time can be determined through steps 501 and 502.
[0080] Step 503: Update the number of index values corresponding to the service nodes in the data table according to the capacity change values of the service nodes in the data table and the second processing capabilities respectively corresponding to the service nodes.
[0081] It can be understood that in the embodiment of the present application, if the processing capacity of a certain service node changes, the number of index values corresponding to the second processing capacity of the service node at this time may not be consistent with the number of index values corresponding to the service node in the pre-built data table, and may also differ greatly. Then, according to the capacity change value of the service node in the data table and the corresponding second processing capacity, the number of index values corresponding to the service node in the data table is updated. In this way, it is beneficial to make the number of index values corresponding to different service nodes in the data table positively correlated with the second processing capacity of the corresponding service node, thereby helping to improve the processing efficiency of business processing requests and achieve the purpose of load balancing of traffic.
[0082] For example, if the first processing capability of service node A is to process 50 requests, the first processing capability of service node B is to process 30 requests, and the first processing capability of service node C is to process 20 requests. The second processing capability of service node A is to process 10 requests, the second processing capability of service node B is to process 20 requests, and the second processing capability of service node C is to process 20 requests.
[0083] Then, if the first index value of the service identifier in the pre-built data table is further determined, the first device identifier recorded at the associated position is obtained from the data table according to the first index value, and the service processing request is allocated to the service node corresponding to the first device identifier. This may cause service node A to be overloaded, that is, the number of service processing requests allocated to service node A exceeds the processing capacity of service node A, resulting in untimely response to the service processing request, that is, the purpose of traffic load balancing cannot be achieved.
[0084] Therefore, if the processing capacity of a service node changes, updating the number of index values corresponding to the service node in the data table according to the capacity change value of the service node in the data table and the corresponding second processing capacity will help improve the processing efficiency of business processing requests and achieve the purpose of traffic load balancing.
[0085] It should be noted that in the above examples, the numerical values of the first processing capacity and the second processing capacity examples of service node A, service node B and service node C are intended to illustrate the problem that "if the processing capacity of a service node changes, the number of index values corresponding to the second processing capacity of the service node may not be consistent with the number of index values corresponding to the service node in the pre-built data table, and may also differ greatly", and do not represent a limitation on the actual processing capacity of the service nodes described in the embodiments of the present application.
[0086] It should be understood that in the embodiments of the present application, the information for determining the second processing capacity of the i-th service node is not limited. The second processing capacity refers to the processing capacity of the service node acquired at a different time than the first processing capacity. In some embodiments, the second processing capacity can be determined based on one or more of the load information, revenue information, and working time information of the corresponding service node.
[0087] In an embodiment of the present application, the information for determining the first processing capacity and the second processing capacity of the same service node may be the same or different. For example, if the information for determining the first processing capacity and the second processing capacity of the same service node is different, and the service node corresponding to the first processing capacity is not working during the time period for obtaining the first processing capacity, then the first processing capacity is based on the working time information. If the service node works during the time period for obtaining the second processing capacity, then the second processing capacity can be determined based on one or more of the load information, revenue information, and working time information of the service node.
[0088] In the embodiment of the present application, the information for determining the first processing capability and the second processing capability of different service nodes may be the same or different, and the embodiment of the present application does not limit this.
[0089] It should be understood that in the embodiment of the present application, the time interval between determining the first processing capability and determining the second processing capability is not limited. The time interval between determining the first processing capability and determining the second processing capability can be fixed, or can be dynamically configured based on the service time of the service node, the number of business processing requests, and the data flow information of the business processing request.
[0090] Regarding "updating the number of index values corresponding to the service nodes in the data table according to the capacity change values of the service nodes in the data table and the corresponding second processing capabilities", in some embodiments, if the second processing capability of a service node cannot be obtained, the first processing capability of the service node in the data table is used as the second processing capability of the service node.
[0091] In some embodiments, the number of index values corresponding to the service nodes in the data table is updated according to the capacity change values of the service nodes in the data table and the corresponding second processing capabilities, including: when there are N capacity change values greater than or equal to the first threshold, according to the second processing capabilities corresponding to the service nodes in the data table, determining the proportion of the number of index values corresponding to the service nodes; wherein N is greater than or equal to 1; according to the proportion of the number of service nodes, updating the number of index values corresponding to the corresponding service nodes in the data table.
[0092] It can be understood that in the embodiment of the present application, when at least one capability change value is greater than or equal to the first threshold value, the number of index values corresponding to the second processing capability of the service node at this time is not necessarily consistent with the number of index values corresponding to the service node in the pre-constructed data table, and may also differ greatly. Then, according to the second processing capabilities corresponding to the service nodes in the data table, the proportion of the number of index values corresponding to the service nodes is determined, and according to the proportion of the number corresponding to the service nodes, the number of index values corresponding to the corresponding service nodes in the data table is updated. In this way, it is beneficial to make the number of index values corresponding to different service nodes in the data table positively correlated with the second processing capability of the corresponding service node, thereby helping to improve the processing efficiency of business processing requests and achieve the purpose of load balancing of traffic.
[0093] It should be understood that in the embodiment of the present application, the first threshold is not limited, and the first threshold can be configured according to the content of the service node service or the processing of the service node.
[0094] Regarding “determining the proportion of the number of index values corresponding to the service nodes according to the second processing capabilities corresponding to the service nodes in the data table”, it should be understood that in the embodiment of the present application, the proportion of the number of index values corresponding to the service nodes refers to the proportion of the index value of the service node in the number of index values of all service nodes in the data table.
[0095] For example, assume that the data table includes service node A, service node B, and service node C; if the second processing capacity corresponding to service node A is 20%, the second processing capacity of service node B is 30%, and the second processing capacity of service node C is 50%, then it is determined that the number of index values corresponding to service node A accounts for two-fifths, the number of index values corresponding to service node B accounts for three-tenths, and the number of index values corresponding to service node C accounts for one-half.
[0096] In step 403, according to the first index value, the first device identifier recorded at the associated position is obtained from the data table.
[0097] It should be understood that in the embodiment of the present application, according to the first index value, the first device identifier recorded at the position associated with the first index value is obtained from the data table.
[0098] In step 404, the service processing request is allocated to the service node corresponding to the first device identifier.
[0099] In some embodiments, based on the first index value, the storage address of the hash bucket associated with the first index value in the hash table is determined, the first device identifier is obtained from the storage address of the hash bucket, and the business processing request corresponding to the first index value is assigned to the service node corresponding to the first device identifier.
[0100] The following examples describe possible implementations of the shooting methods described in one or more of the above embodiments.
[0101] The business primary key in the weighted balanced traffic load strategy (i.e., an example of a method for allocating requests) based on the business primary key (i.e., an example of a business identifier) refers to a customizable business primary key, such as a customer number, a mobile phone number, or an order number. Taking the hash value of the specified business primary key can make the service node assigned to the business processing request to be assigned for the same business fixed, because the hash value of a specific customer number, mobile phone number, or order number is fixed. Then, the Hash bucket of the service node is configured according to the obtained weight (i.e., an example of the proportion of the number of index values corresponding to the service node). For example, the weight of service node A (referred to as A node) is 60%, and the weight of service node B (referred to as B node) is 40%. Then, in the Hash bucket, 60 buckets record the device identifier of service node A, and 40 buckets record the device identifier of service node B. Then, based on the hash value of the business primary key, the service node of the business processing request corresponding to the business primary key is determined from 100 Hash buckets. In this way, the proportion of the overall traffic is still based on the weight, but the service node assigned to each business individual is fixed until the next weight change. It should be noted that the number of virtual hash buckets is recommended to be fixed at 100. In this way, no matter how the weight ratio changes, the hash value will eventually be distributed on 100 virtual nodes, which is more stable for business individuals.
[0102] Figure 6 Example of traffic load balancing strategy based on business primary key weight balancing provided in the embodiment of the present application Figure 1 ,like Figure 6As shown, 101 represents a device that issues a request, 102 represents a service node assigned to the request, 601 represents a traffic load balancing strategy based on weight balancing of business primary keys, and 60% and 40% respectively identify an example of a weight ratio of a service node.
[0103] Figure 7 Example of traffic load balancing strategy based on business primary key weight balancing provided in the embodiment of the present application Figure 2 ,like Figure 7 As shown, 701 represents weight acquisition; 702 represents business primary key Hash calculation; 703 represents obtaining the service node for the business processing request corresponding to the business primary key from the hash bucket according to the business primary key Hash, and 704 represents the service node allocated to the business processing request corresponding to the business primary key.
[0104] In some embodiments, firstly, a node set of a service node, a default value of a weight, identification information of the default value of the weight, and a specified business primary key are obtained. A hash table is constructed based on the node set of the service node, the default value of the weight, and the identification information of the default value of the weight; wherein the hash table includes one hundred hash buckets; a first hash value is calculated for the specified business primary key, and the hash value is used to modulo the number of hash buckets to obtain a first index value; according to the first index value, a service node assigned to a processing request corresponding to the specified business primary key is obtained from the hash table.
[0105] In the embodiment of the present application, weight acquisition is an optional extension point. Three optional weight acquisition schemes are listed below: Scheme 1, dynamically configurable weight ratio: manually configured by the operator and can take effect in real time; Scheme 2, self-adaptive weight ratio according to the physical load condition (i.e., an example of load information, hereinafter referred to as load): the program queries the physical load condition of the service node, and then calculates the weight according to the load; Scheme 3, self-adaptive weight ratio according to backward custom indicators (taking revenue receipts as an example): the revenue receipts generated by each node in a period of time are calculated based on backward statistical data, and then the weights of each node are calculated based on the revenue receipts.
[0106] The traffic load balancing strategy based on business primary key weight balancing solves the following problems: (1) Not only the source IP, but also the specific request business individuals can have a fixed service node; (2) Different weights can be set according to different service nodes or service contents; (3) The weights can be adjusted dynamically in real time or can be customized and extended.
[0107] Figure 8 A schematic diagram of the implementation flow of the method for obtaining weights provided in the embodiment of the present application is shown in FIG. Figure 8As shown, 801 represents solution one, in which the operation personnel dynamically configure the weights on the operation computer and send them to the configuration center; 802 represents solution two, in which the load of each service node (service node A to service node N) is queried and the weight is calculated according to the load; 803 represents solution three, in which the revenue data of each service node (service node A to service node N) is calculated and the weight is calculated according to the revenue data of the past seven days; 701 represents obtaining the weight.
[0108] It should be noted that the existence of schemes 1 and 3 is because the functional content of each service node is not necessarily the same. For example, service node A may request the content of supplier A, and service node B may request the content of supplier B. The specific weight acquisition scheme can be freely selected or expanded according to its own business.
[0109] It can be understood that the method for allocating requests provided in the embodiment of the present application solves the problem of "unable to process requests from S2S fixed network agents" in the IP allocation scheme, because the scheme calculates the business primary key; the method for allocating requests provided in the embodiment of the present application integrates the characteristics of weight-based allocation, supports weight-based allocation, and supports a variety of ways to obtain weights; the method for allocating requests provided in the embodiment of the present application is applicable to all traffic balancing distribution scenarios where business primary keys exist, and supports custom business primary keys.
[0110] The method for allocating requests provided in the embodiment of the present application can undertake balanced traffic distribution in multiple business scenarios, and the balancing effect is stable regardless of whether the traffic is increasing or smoothing. Fig. 9 A schematic diagram of a curve showing the change in the number of requests to be allocated provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the vertical axis represents the number of requests, the horizontal axis represents time, and 901 represents a curve of changes in the number of requests.
[0111] Fig.10 The success rate statistics of the allocation request provided in the embodiment of the present application are as follows: Fig.10 As shown, the vertical axis represents the success rate, the horizontal axis represents time, and 1001 represents the change curve of the success rate on the time axis. Fig.11 The error statistics of the allocation request provided in the embodiment of the present application are as follows: Fig.11 As shown, the vertical axis represents the number of errors, the horizontal axis represents time, and 1101 represents the variation curve of the number of errors on the time axis. It can be seen that using the method for allocating requests provided in the embodiment of the present application, the success rate of allocating requests is 100% and the number of errors is 0.
[0112] The traffic load static strategy based on weighted balancing of business primary keys realizes stable dynamic and variable traffic balancing distribution for individual business entities, and creates virtual hash bucket nodes according to weights. This combines the advantages of weighted distribution while obtaining stable service nodes for individual business entities.
[0113] In some embodiments, the business primary key may be selected according to the specific circumstances of the business, and the method for obtaining the weight may also be selected according to the actual circumstances of the business.
[0114] It should be noted that although the steps of the method in the present application are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.; or, steps in different embodiments may be combined into a new technical solution.
[0115] Based on the foregoing embodiments, an embodiment of the present application provides a device for allocating requests, which includes the modules included and the units included in the modules, and can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be an AI acceleration engine (such as NPU, etc.), GPU, central processing unit (CPU), microprocessor (MPU), digital signal processor (DSP) or field programmable gate array (FPGA), etc.
[0116] Fig.12 A schematic diagram of the structure of the device for allocating requests provided in an embodiment of the present application, such as Fig.12 As shown, the device 1200 for allocating a request includes a first determining module 1201, a second determining module 1202, an acquiring module 1203 and an allocating module 1204, wherein:
[0117] A first determining module 1201 is configured to determine a service identifier corresponding to a service processing request to be allocated;
[0118] The second determination module 1202 is configured to determine a first index value of the service identifier in a pre-constructed data table; the position associated with one or more index values in the data table records the device identifier of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with the first processing capacity of the corresponding service node;
[0119] The acquisition module 1203 is configured to acquire the first device identifier recorded at the associated position from the data table according to the first index value;
[0120] The allocation module 1204 is configured to allocate the service processing request to the service node corresponding to the first device identifier.
[0121] In some embodiments, the service identifiers of multiple service processing requests to be allocated for the same service are the same, and the first index value of the same service identifier is the same.
[0122] In some embodiments, the first processing capacity is determined based on one or more of load information, revenue information, and working time information of the corresponding service node.
[0123] In some embodiments, the device 120 for allocating requests also includes a third determination module, a fourth determination module and an update module; wherein the third determination module is configured to determine the second processing capacity of the i-th service node; wherein i is greater than 0 and less than or equal to the number of service nodes in the data table; the fourth determination module is configured to determine the capacity change value of the i-th service node based on the second processing capacity and the first processing capacity of the i-th service node; the update module is configured to update the number of index values corresponding to the service nodes in the data table according to the capacity change values of the service nodes in the data table and the respectively corresponding second processing capacities.
[0124] In some embodiments, the update module is configured to determine the proportion of the number of index values corresponding to the service nodes in the data table according to the second processing capabilities corresponding to the service nodes in the data table when there are N capability change values greater than or equal to the first threshold; wherein N is greater than or equal to 1; and update the number of index values corresponding to the corresponding service nodes in the data table according to the proportion of the number of service nodes.
[0125] In some embodiments, the data table is a hash table, which includes a plurality of hash buckets and the plurality of hash buckets are respectively associated with corresponding index values; wherein the hash bucket is used to record a device identifier of a service node.
[0126] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0127] It should be noted that the division of modules in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit. It may also be implemented in the form of a combination of software and hardware.
[0128] It should be noted that in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0129] An embodiment of the present application provides an electronic device, Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Fig.13 As shown, the electronic device 130 includes a memory 1301 and a processor 1302, wherein the memory 1301 stores a computer program that can be run on the processor 1302, and the processor 1302 implements the steps in the method provided in the above embodiment when executing the program.
[0130] It should be noted that the memory 1301 is configured to store instructions and applications executable by the processor 1302, and can also cache data to be processed or already processed by the processor 1302 and various modules in the electronic device 130 (for example, image data, audio data, voice communication data, and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
[0131] In the embodiment of the present application, the electronic device 130 may be a mobile phone, a tablet computer, a laptop computer, a PDA, a wearable device, etc., which is not specifically limited here.
[0132] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the method provided in the above embodiment are implemented.
[0133] An embodiment of the present application provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps of the method provided in the above method embodiment.
[0134] It should be noted here that the description of the above electronic device, storage medium and computer program product embodiments is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the electronic device, storage medium and computer program product embodiments of this application, please refer to the description of the method embodiment of this application for understanding.
[0135] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.
[0136] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0137] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0138] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.
[0139] The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed on multiple network units; some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0140] In addition, all functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may be a separate unit, or two or more modules may be integrated into one unit; the above-mentioned integrated modules may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0141] A person skilled in the art can understand that all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0142] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0143] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0144] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0145] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0146] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for allocating a request, characterized in that: The method comprises: Determine the service identifier corresponding to the service processing request to be allocated; Determine a first index value of the service identifier in a pre-constructed data table; a position associated with one or more index values in the data table records a device identifier of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with a first processing capability of the corresponding service node; According to the first index value, obtaining the first device identifier recorded at the associated position from the data table; The service processing request is allocated to the service node corresponding to the first device identifier.
2. The method according to claim 1, characterized in that: The first processing capacity is determined based on one or more of the load information, revenue information and working time information of the corresponding service node.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: Determine a second processing capacity of the i-th service node; wherein i is greater than 0 and less than or equal to the number of service nodes in the data table; Determining a capacity change value of the i-th service node according to the second processing capacity of the i-th service node and the first processing capacity; The number of index values corresponding to the service nodes in the data table is updated according to the capacity change values of the service nodes in the data table and the respectively corresponding second processing capacities.
4. The method according to claim 3, characterized in that The updating of the number of index values corresponding to the service nodes in the data table according to the capacity change values of the service nodes in the data table and the second processing capacities respectively corresponding thereto, comprises: In the case where there are N of the capability change values greater than or equal to the first threshold, determining the quantity proportion of the index values corresponding to the service nodes according to the second processing capabilities respectively corresponding to the service nodes in the data table; wherein N is greater than or equal to 1; According to the proportion of the number corresponding to the service nodes, the number of index values corresponding to the corresponding service nodes in the data table is updated.
5. The method according to any one of claims 1 to 4, characterized in that The data table is a hash table, which includes a plurality of hash buckets, each of which is associated with a corresponding index value; wherein the hash bucket is used to record a device identifier of a service node.
6. The method according to any one of claims 1 to 4, characterized in that The service identifiers of multiple service processing requests to be allocated for the same service are the same, and the first index values of the same service identifiers are the same.
7. A device for allocating requests, characterized in that: The device comprises: A first determining module, configured to determine a service identifier corresponding to a service processing request to be allocated; A second determination module is configured to determine a first index value of the service identifier in a pre-constructed data table; a position associated with one or more index values in the data table records a device identifier of the same service node, and the number of index values corresponding to different service nodes in the data table is positively correlated with a first processing capability of the corresponding service node; an acquisition module, configured to acquire, from the data table according to the first index value, a first device identifier recorded at the associated position; The allocation module is configured to allocate the service processing request to the service node corresponding to the first device identifier.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
