Load balancing scheduling method and device, electronic equipment, storage medium and computer product
By using the encoding grouping set and backpack problem solving methods determined by historical user information, area coding and source channel coding, the problem of user request failure in dual-center traffic scheduling is solved, and the request success rate during load balancing is improved.
Patent Information
- Application Number
- CN202510255003.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-05
- Publication Date
- 2025-06-20
AI Technical Summary
In dual-center traffic scheduling, the prior art is difficult to effectively solve the problem of request failure caused by user request switching between two data centers, resulting in a low user request success rate.
The historical code grouping set is determined through user information, area encoding and source channel encoding in the historical user service request, and the first and second code grouping sets are constructed using the backpack problem solution method, and the center identifier is set respectively to forward the user service request.
This method can improve the success rate of user requests during load balancing in dual-center traffic scheduling, ensure that requests from the same user are always forwarded to the same center, avoiding the impact of geographical location and network environment.
Smart Images

Figure CN120179392A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technologies, and in particular, to a load balancing scheduling method, apparatus, electronic device, storage medium, and computer product. Background Art
[0002] Dual-center traffic scheduling refers to the rational allocation and scheduling of traffic through specific scheduling strategies and mechanisms in an environment with two data centers (usually hot standby for each other) to ensure the high availability and stability of services. The current traffic scheduling methods include Domain Name System (DNS) global traffic scheduling. Specifically, through DNS resolution, user requests are directed to different data centers. However, the above DNS global traffic scheduling only supports random allocation scheduling of interface traffic or configuration scheduling according to the Internet Protocol (IP) location. In the random allocation scheduling mode, when a user requests for the first time to center A, the second request may be scheduled to center B. For stateful interfaces, since the status information of the user request is not maintained in center B, the user request will fail. In the configuration scheduling mode according to IP location, changes in the user's location or the user's network environment may cause changes in the user's IP location, and there may also be a situation where the user request switches between center A and center B, resulting in request failure. As a result, the success rate of user requests is low when performing load balancing for dual-center traffic scheduling. Summary of the Invention
[0003] This application aims to at least solve one of the technical problems existing in the related art. Therefore, this application provides a load balancing scheduling method, apparatus, electronic device, storage medium, and computer product to solve the problem that user requests are likely to fail in the case of dual-center traffic scheduling, and to improve the success rate of user requests when performing load balancing for dual-center traffic scheduling.
[0004] According to an embodiment of the first aspect of this application, the load balancing scheduling method includes: In response to a user service request, if there is no center identifier in the user service request, determine a to-be-decided packet code according to the user service request; If the to-be-decided packet code matches the code of any packet in the first coding packet set and the second coding packet set, set a target center identifier for the user service request and forward it to the center associated with the target center identifier in the dual centers; the target center identifier is the center identifier associated with the target coding packet set; the target coding packet set is the coding packet set where the code matching the to-be-decided packet code is located; The first set of encoded packets includes the encoded packets obtained by solving the knapsack problem based on the historical set of encoded packets; the second set of encoded packets includes the encoded packets in the historical set of encoded packets other than the first set of encoded packets; the historical set of encoded packets is determined based on the user information, area code, and source channel code in the historical user service requests.
[0005] According to an embodiment of the present application, the first set of encoded packets is determined based on the following method: Obtain historical user service requests; For each service request in the historical user service requests, perform encoding according to the user information, area code, and source channel code, and divide the same encoded packets into the same set of encoded packets. Each set of encoded packets forms a historical set of encoded packets; Determine the resource occupancy weight coefficient of each encoded packet in the historical set of encoded packets, the value coefficient of each encoded packet in the historical set of encoded packets, and the resource allocation weight coefficient of the center; Based on each of the resource occupancy weight coefficients, each of the value coefficients, and the resource allocation weight coefficient, solve the knapsack problem to obtain the first set of encoded packets.
[0006] According to an embodiment of the present application, when determining the resource occupancy weight coefficient of each encoded packet in the historical set of encoded packets, for each encoded packet, perform the following steps: Determine the number of requests for each service request corresponding to each encoded packet in the current encoded packet and the request time for each service request corresponding to each encoded packet; Multiply the number of requests for each service request corresponding to each encoded packet by the request time to obtain the product for each service request corresponding to the encoded packet; Perform a summation operation on each product to obtain the resource occupancy weight coefficient of the current encoded packet.
[0007] According to an embodiment of the present application, the solving the knapsack problem based on each of the resource occupancy weight coefficients, each of the value coefficients, and the resource allocation weight coefficient to obtain the first set of encoded packets includes: Based on each of the resource occupancy weight coefficients, each of the value coefficients, the resource allocation weight coefficient, the single-center maximum capacity, and the state transition equation of the knapsack problem, determine the maximum value when the corresponding number of encoded packets and the single-center maximum capacity in the historical set of encoded packets; Determine, from each encoded packet in the historical set of encoded packets, the set of encoded packets that satisfies the maximum value as the first set of encoded packets.
[0008] According to an embodiment of the present application, the encoding according to the user information, area code, and source channel code includes: Perform a modulo operation based on the user information in the service request to obtain a user information code; Concatenate the user information code of the service request, the area code in the service request, and the source channel code in the service request.
[0009] According to an embodiment of the present application, after responding to a user service request, if there is a center identifier in the user service request, it further includes: Forward the user service request to the center corresponding to the center identifier in the dual centers.
[0010] The load balancing scheduling device according to the embodiment of the second aspect of the present application includes: A determination module, configured to respond to a user service request. If there is no center identifier in the user service request, determine a to-be-decided packet code according to the user service request; A forwarding module, configured to, if the to-be-decided packet code matches the code of any coding packet in the first coding packet set and the second coding packet set, set a target center identifier for the user service request and then forward it to the center associated with the target center identifier in the dual centers; the target center identifier is the center identifier associated with the target coding packet set; the target coding packet set is the coding packet set where the coding that matches the to-be-decided packet code is located; The first coding packet set includes coding packets obtained by solving the knapsack problem based on the historical coding packet set; the second coding packet set includes the coding packets in the historical coding packet set other than the first coding packet set; the historical coding packet set is determined based on the user information, area code, and source channel code in the historical user service request.
[0011] The electronic device according to the embodiment of the third aspect of the present application includes a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the load balancing scheduling method as described in any one of the above.
[0012] According to the storage medium of the embodiment of the fourth aspect of the present application, the storage medium is a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the load balancing scheduling method as described in any one of the above.
[0013] According to the computer program product of the embodiment of the fifth aspect of the present application, it includes a computer program. When the computer program is executed by a processor, it implements the load balancing scheduling method as described in any one of the above.
[0014] One or more of the above technical solutions in the embodiments of the present application have at least the following technical effects: Determine a set of historical coding groups based on user information, regional codes, and source channel codes in historical user service requests, construct a first coding group set according to the coding groups obtained by solving the knapsack problem based on the set of historical coding groups, and construct a second coding group set according to the coding groups in the set of historical coding groups other than the first coding group set. Further, set central identifiers for the first coding group set and the second coding group set respectively, so that after responding to a user service request and when there is no central identifier in the user service request, if the to-be-decided grouping code determined according to the user service request matches the code of any coding group in the first coding group set and the second coding group set, then set the central identifier of the first coding group set or the second coding group set where the coding group with the matching code is located as the target central identifier in the user service request, and forward the user service request to the center associated with the target central identifier in the dual centers. In this application, coding and grouping are performed based on user information, source channel codes, and regional codes that are strongly related to business attributes, and the knapsack problem is solved for each coding group to obtain a load balancing strategy for dual-center traffic scheduling. Since the values of user information, source channel codes, and regional codes for the same user within the request cycle of the same application do not change, the requests of the same user within the request cycle of the same application for the center will not change with the change of the user's location and network switching. Therefore, it can be ensured that each request of the same user can be forwarded to the same center and is not affected by the geographical location and network environment, which can improve the request success rate of users when performing load balancing of dual-center traffic scheduling.
[0015] Additional aspects and advantages of this application will be given in part in the following description, will become apparent in part from the following description, or will be understood through the practice of this application. Brief Description of the Drawings
[0016] To more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0017] Figure 1 It is a flowchart of the load balancing scheduling method provided by the embodiment of this application.
[0018] Figure 2 It is a schematic structural diagram of the electronic device provided by this application. Detailed Embodiments
[0019] The following further describes the implementation manners of the present application in conjunction with the accompanying drawings and embodiments. The following embodiments are used to illustrate the present application, but cannot be used to limit the scope of the present application.
[0020] In the description of the embodiments of the present application, it should be noted that the orientation or positional relationship indicated by the terms "center", "longitudinal", "transverse", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the embodiments of the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus cannot be understood as a limitation on the embodiments of the present application. In addition, the terms "first", "second", and "third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0021] In the description of the embodiments of the present application, it should be noted that unless otherwise clearly specified and limited, the terms "connected" and "connected" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium. For those of ordinary skill in the art, the specific meanings of the above terms in the embodiments of the present application can be understood according to specific situations.
[0022] In the embodiments of the present application, unless otherwise clearly specified and limited, the first feature being "on" or "under" the second feature can be that the first and second features are in direct contact, or the first and second features are indirectly in contact through an intermediate medium. Moreover, the first feature being "above", "over" and "on" the second feature can be that the first feature is directly above or obliquely above the second feature, or simply means that the first feature has a higher horizontal height than the second feature. The first feature being "under", "below" and "beneath" the second feature can be that the first feature is directly below or obliquely below the second feature, or simply means that the first feature has a lower horizontal height than the second feature.
[0023] In the description of this specification, the description with reference to terms such as "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the embodiments of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.
[0024] This application proposes a load balancing scheduling method, device, electronic device, storage medium, and computer product.
[0025] Figure 1 It is a schematic flowchart of the load balancing scheduling method provided by the embodiments of this application. As Figure 1 shown, the load balancing scheduling method includes: Step 110, in response to a user service request, if the central identifier does not exist in the user service request, determine the grouping code to be decided according to the user service request.
[0026] Step 120, if the grouping code to be decided matches the code of any coding group in the first coding group set and the second coding group set, set the target central identifier for the user service request and then forward it to the central associated with the target central identifier in the dual centers; the target central identifier is the central identifier associated with the target coding group set; the target coding group set is the coding group set where the coding that matches the grouping code to be decided is located.
[0027] Among them, the first coding group set includes coding groups obtained by solving the knapsack problem based on the historical coding group set; the second coding group set includes coding groups in the historical coding group set except for the first coding group set; the historical coding group set is determined based on user information, regional codes, and source channel codes in historical user service requests.
[0028] It should be noted that the execution subject of the load balancing scheduling method provided by the embodiments of this application can be a server, a computer device, etc. The computer device can be, for example, a mobile phone, a tablet computer, a notebook computer, a handheld computer, an in-vehicle electronic device, a wearable device, an Ultra-mobile Personal Computer (UMPC), a netbook, or a Personal Digital Assistant (PDA), etc. It should be noted that all data that needs to be obtained in this application is obtained through formal channels after being authorized by relevant users.
[0029] A load balancing scheduling device can be set or connected in the server and computer device of this application, so as to control the load balancing scheduling device to execute the load balancing scheduling method of this application.
[0030] It should be noted that in this application, the execution entity can be connected to two centers, so as to jointly process the user's service requests through the two centers. It should be noted that different from the traditional situation where two data centers are in hot standby with each other, the two centers in this application are in an active-active state, that is, both centers are in a working state at the same time. This application can be described with the server as the execution entity, but it is not limited that the execution entity of this application can only be the server.
[0031] It can be understood that when a user accesses the server through a terminal and requests to use the traffic service, the service request will carry information such as user information, area code, and source channel code. Among them, the user information can be, for example, the user's phone number, the area code can be, for example, the code of the province to which the number belongs, and the source channel code is the code set for different access channels respectively.
[0032] It can be understood that in this application, the relevant information of the user service request can be stored in the service access interface request log.
[0033] Therefore, at the beginning of each time unit, all service requests within the previous time unit can be collected from the service access interface request log according to a specific data structure as historical service requests, and at the same time, information such as the request times and request durations of each service request can also be obtained. Among them, the specific length of the time unit can be set according to actual needs, for example, it can be set to 5 minutes, 10 minutes, 15 minutes, etc.
[0034] Furthermore, this application can encode each service request according to the user information, area code, and source channel code in the historical user service requests, and divide the service requests with the same encoding into the same encoding group. Then, each encoding group obtained after the division constitutes a historical encoding group set.
[0035] Furthermore, this application can solve the problem by combining the knapsack problem according to each encoding group in the historical encoding group set, construct the encoding groups obtained by the solution as the first encoding group set, and construct the encoding groups in the historical encoding group set other than the encoding groups in the first encoding group set as the second encoding group set.
[0036] Furthermore, a dual-center scheduling policy can be generated according to the first encoding group set and the second encoding group set. Specifically, it can be set that the service requests related to the encoding groups in the first encoding group set are scheduled to the same center for processing, while the service requests related to the encoding groups in the second encoding group set are all scheduled to the other center for processing. Therefore, the first encoding group set can be associated with one center identifier, and the second encoding group set can be associated with another center identifier. Among them, the center identifier is used to indicate that the service request is scheduled to the center corresponding to the center identifier for processing.
[0037] Therefore, if a user service request is received within this time unit, the user service request can be responded to, and it is necessary to identify whether there is a central identifier in the user service request. It should be noted that if there is a central identifier in the user service request, it indicates that the user corresponding to the user service request has requested this service at least in the previous time unit. If there is no central identifier in the user service request, it indicates that the user corresponding to the user service request has not requested this service before.
[0038] Therefore, if it is identified that there is no central identifier in the user service request, the user information, area code, and source channel code in the user service request can be encoded, and the obtained encoding can be determined as the to-be-decided grouping encoding.
[0039] For example, the request center identifier of the user unit module can be requested to obtain the H5 interface first, and the user unit module can generate the to-be-decided grouping encoding according to the mobile phone number, province code, and source channel code in the H5 interface input parameters. The H5 interface usually refers to the capability interface related to HTML5 technology. HTML5 is the fifth version of the HyperText Markup Language.
[0040] Furthermore, it is determined whether there is an encoding in the first encoding grouping set and the second encoding grouping set that is the same as the to-be-decided grouping encoding. If there is, the same central identifier as the corresponding encoding grouping set is set for the user service request as the target central identifier, and the user service request is further forwarded to the center associated with the target central identifier. Specifically, the central identifier can be attached to the Head of the HyperText Transfer Protocol (Http) type user service request. Among them, in the Http protocol, the Head usually refers to the Http request header or response header.
[0041] For example, if the to-be-decided grouping encoding is the same as an encoding grouping in the first encoding grouping set, the central identifier A of the first encoding grouping set is set into the user service request as the target central identifier A, and then the user service request is forwarded to the A center associated with the central identifier A for processing.
[0042] It should be noted that if it is determined that any one of the two centers in the dual-center fails at any time unit, the automatic detection mechanism of the intelligent DNS can be used to automatically schedule all requests of the failed center to the other normal working center for processing, realizing the first coarse-grained balanced traffic diversion.
[0043] It should be noted that when this application forwards the user service request to the center for processing, the user service request needs to pass through the ingress layer APISIX, where APISIX is a cloud-native, high-performance, and scalable gateway.
[0044] When a user service request arrives at the ingress layer APISIX, APISIX forwards the requests with the center A identifier in the Head to center A and the requests with the center B identifier in the Head to center B according to the pre-configured shunting policy based on the Head center identifier. It should be noted that there are some cases where user requests directly flow to the ingress layer without the center identifier set. In this case, there is neither the center A identifier nor the center B identifier in the Head of the request. At this time, the request can be forwarded to center A for fallback.
[0045] Thus, through the shunting of APISIX, the balanced load of traffic is achieved.
[0046] Based on the processing of the above process, an equalization adjustment is automatically performed every time unit, so as to achieve the effect of automatic load balancing.
[0047] According to the load balancing scheduling method of the embodiment of the present application, a historical coding group set is determined through user information, regional coding, and source channel coding in historical user service requests, and a first coding group set is constructed according to the coding groups obtained by solving the knapsack problem based on the historical coding group set. A second coding group set is constructed according to the coding groups in the historical coding group set other than the first coding group set. Further, center identifiers are respectively set for the first coding group set and the second coding group set, so that after responding to a user service request and there is no center identifier in the user service request, if the to-be-decided group coding determined according to the user service request matches the coding of any coding group in the first coding group set and the second coding group set, the center identifier of the first coding group set or the second coding group set where the coding group with the matching coding is located is set as the target center identifier in the user service request, and the user service request is forwarded to the center associated with the target center identifier in the dual centers. The present application encodes and groups according to user information, source channel coding, and regional coding that are strongly related to business attributes, and solves each coding group in combination with the knapsack problem to obtain a load balancing policy for dual-center traffic scheduling. Since the values of user information, source channel coding, and regional coding do not change during the request cycle of the same user for the same application, the requests of the same user for the same application in the request cycle of the center will not change with the change of the user's location and network switching. Therefore, it can be ensured that each request of the same user can be forwarded to the same center and is not affected by the geographical location and network environment, and the request success rate of the user during the load balancing of dual-center traffic scheduling can be improved.
[0048] This application effectively avoids many problems existing in the DNS global traffic scheduling strategy, such as long configuration processes, request failures caused by network switching and changes in user geographical locations. At the same time, it can achieve fine-grained scheduling and control of subscribed traffic, introducing an automatic detection algorithm for link anomalies and an intelligent adjustment algorithm for traffic load, thus ensuring the efficient utilization of resources and the high reliability of the system.
[0049] Based on the above embodiments, after responding to a user service request, if a central identifier exists in the user service request, it further includes: Forwarding the user service request to the center in the dual-center corresponding to the central identifier.
[0050] Specifically, after responding to a user service request, if it is recognized that a central identifier exists in the user service request, it indicates that the user corresponding to this user service request has initiated a request for this service at least in the previous time unit. Therefore, this user service request can be directly forwarded to the center in the dual-center corresponding to the central identifier in this user service request.
[0051] For example, if a central identifier A exists in this user service request, then this user service request is forwarded to Center A associated with the central identifier A for processing.
[0052] When this application determines that a central identifier exists in a user service request, it directly forwards the user service request to the center in the dual-center corresponding to its central identifier. Thus, it can ensure that each request of the same user can be routed to the same center, and is not affected by geographical location and network environment, which can improve the success rate of user requests when performing load balancing for dual-center traffic scheduling.
[0053] Based on the above embodiments, the first encoded packet set is determined in the following manner: Obtain historical user service requests; For each service request in the historical user service requests, encode according to user information, regional code, and source channel code, and divide the same encoded requests into the same encoded packet. The historical encoded packet set is composed of each encoded packet; Determine the resource occupancy weight coefficient of each encoded packet in the historical encoded packet set, the value coefficient of each encoded packet in the historical encoded packet set, and the resource allocation weight coefficient of the center; Solve the knapsack problem based on each resource occupancy weight coefficient, each value coefficient, and the resource allocation weight coefficient to obtain the first encoded packet set.
[0054] Specifically, after starting a new time unit, the present application can achieve the expansion of the access log fields by secondary development of the service access interface request logs, and define a specific data structure. Thus, all service requests within the previous time unit (including all service requests of the dual centers) can be collected according to the specific data structure as historical service requests. The specific data structure can be as shown in Table 1 below: Table 1
[0055] Furthermore, decision-making calculations can be performed based on the relevant data of the historical service requests. Since the scheduling load balancing strategy is essentially a combinatorial optimization problem, the present application uses the dynamic programming knapsack problem for calculation and solution to obtain the optimal scheduling strategy. For the data of the historical user service requests, according to the set load balancing division dimensions, three methods are provided to calculate the knapsack problem calculation decision factors. The division dimensions mainly have three types: the last three digits of the mobile phone number, the mobile phone province, and the request source channel.
[0056] Specifically, the present application can determine the interface Http status code of each service request in the historical user service requests, thereby determining whether the corresponding service request is successful or failed. If the request fails, it is determined as an abnormal request.
[0057] If, based on statistics, the index of abnormal requests in any one of the dual centers reaches a specified threshold (such as the total request failure rate of the center), then the abnormal requests in that center are forced to be specified to the other center and recorded in a white list set and the interface traffic in this part does not participate in the load balancing calculation. When the interface returns to normal later, manually remove the interface from the white list set. After removal, the corresponding interface can participate in the load balancing calculation of the next time window.
[0058] For the remaining service requests in the historical user service requests, they can be encoded according to the user information, area code, and source channel code of the corresponding service requests. The service requests with the same encoding (i.e., the service requests with the same encoding) are divided into the same encoding group, and the historical encoding group set is composed of each encoding group. Each encoding group can include one or more encodings.
[0059] Furthermore, for each encoding group in the historical encoding group set, the present application can respectively determine its resource occupancy weight coefficient .
[0060] Furthermore, the resource occupancy weight coefficients of each encoding group in the historical encoding group set can be added up, and the operation result is determined as the total resource weight sum coefficient of the total decision-making group , and specifically, it can be determined by the following formula: ; Among them, X represents the number of coding groups in the historical coding group set.
[0061] Furthermore, for the dual-center architecture, the resource allocation weight coefficient of each center can be determined by the following formula : .
[0062] In addition, the present application can determine the value coefficient of each coding group in the historical coding group set . Specifically, the basic coefficient value of each coding group in the historical coding group set can be determined. The basic coefficient value is configured when configuring the channel information and is divided into multiple levels such as 1, 2, 3, 4, 5, etc. The more important the channel, the larger the configured basic coefficient value.
[0063] Furthermore, the total number of service requests for each coding group in the historical coding group set can be obtained. For each coding group in the historical coding group set, the product of its basic coefficient value and its total number of requests can be used as the value coefficient of the coding group .
[0064] In the present application, it is inclined to drain the decision-making packet traffic with a higher value to the same center, and drain other channels to another center.
[0065] Furthermore, according to each resource occupancy weight coefficient, each value coefficient, the total resource occupancy weight coefficient and the resource allocation weight coefficient, combined with the maximum capacity of a single center, the knapsack problem can be solved, and the coding groups obtained by the solution are constructed into the first coding group set.
[0066] Furthermore, by designating the coding groups in the first coding group set to the same center, and designating the remaining coding groups in the historical coding group set to another center, an optimal scheduling strategy can be obtained, realizing balanced scheduling and ensuring the full and balanced utilization of the resources of both centers.
[0067] Moreover, this application encodes and groups according to user information strongly related to business attributes, source channel codes, and regional codes, and solves the combined knapsack problem for each encoded group to obtain a load balancing strategy for dual-center traffic scheduling. Since the values of user information, source channel codes, and regional codes do not change within the request cycle of the same user for the same application, the requests from the center for the same user within the request cycle of the same application will not change with the change of the user's location or network switching. Therefore, it can ensure that each request of the same user can be forwarded to the same center without being affected by the geographical location and network environment, and can improve the request success rate of users when performing load balancing for dual-center traffic scheduling.
[0068] Based on the above embodiments, when determining the resource occupancy weight coefficient of each encoded group in the historical encoded group set, for each encoded group, the following steps are performed: Determine the number of requests for each service request corresponding to each code in the current encoded group and the request time for each service request corresponding to each code; Multiply the number of requests for each service request corresponding to each code by the request time to obtain the product corresponding to each service request of the corresponding code; Perform a summation operation on the products to obtain the resource occupancy weight coefficient of the current encoded group.
[0069] Specifically, for each encoded group in the historical encoded group set, this application can obtain the number of requests for each service request corresponding to each code in the encoded group and the request time for each service request corresponding to each code.
[0070] Furthermore, for each code, multiply the number of requests for the service request corresponding to the code by the request time to obtain the product corresponding to the service request of the corresponding code.
[0071] For each encoded group in the historical encoded group set, perform a summation operation on the products corresponding to all service requests of the codes in the encoded group, and determine the result of the summation operation as the resource occupancy weight coefficient of the encoded group.
[0072] This application accurately determines the resource occupancy weight coefficient of each encoded group in the historical encoded group set according to the number of requests and request time of the service requests corresponding to the codes. Furthermore, according to the resource occupancy weight coefficients, combined with the value coefficients, the total resource occupancy weight coefficient, the resource allocation weight coefficient, and the maximum capacity of a single center, the knapsack problem is solved to obtain an optimal scheduling strategy, realize balanced scheduling, and ensure the full and balanced utilization of resources on both sides of the center.
[0073] Moreover, the encoding in this application is determined based on user information strongly related to business attributes, source channel encoding, and regional encoding. Since the values of user information, source channel encoding, and regional encoding for the same user within the request cycle of the same application do not change, the requests from the same user within the request cycle of the same application to the center will not change with the change of the user's location or network switching. Therefore, it can be ensured that each request of the same user can be forwarded to the same center without being affected by the geographical location and network environment, and the request success rate of the user can be improved when performing load balancing for dual-center traffic scheduling.
[0074] Based on the above embodiments, the knapsack problem is solved based on each resource occupancy weight coefficient, each value coefficient, and the resource allocation weight coefficient to obtain a first coding packet set, including: Based on each resource occupancy weight coefficient, each value coefficient, the resource allocation weight coefficient, the maximum capacity of a single center, and the state transition equation of the knapsack problem, determine the maximum value when the corresponding coding packet quantity and the maximum capacity of a single center in the historical coding packet set. Determine the coding packet set that meets the maximum value from each coding packet in the historical coding packet set as the first coding packet set.
[0075] Specifically, this application introduces the dynamic programming knapsack problem algorithm, regarding the resource allocation weight coefficient as the knapsack capacity, each decision packet (i.e., the above-mentioned coding packet) as an item, the resource occupancy weight coefficient as the item weight, as the value coefficient representing the importance degree of the decision packet, and obtaining multiple state variables.
[0076] Furthermore, combine the above state variables into the state transition equation of the knapsack problem to determine the maximum value when the corresponding coding packet quantity and the maximum capacity of a single center in the historical coding packet set. Among them, the state transition equation is shown in the following formula: f[i,j]=Max{f[i - 1,j - Wi]+Pi(j >= Wi),f[i - 1,j]}; Among them, i represents the i-th channel in the historical coding packet set Touch, Pi = , Wi = , j = remaining value.
[0077] Specifically, assume there are 10,000 channels. The volume Wi corresponding to each decision packet (i.e., coding packet) is represented by an array w[N], and the corresponding value Pi is represented by an array v[N]. n represents the number of items (initialized to 10,000, assuming there are 10,000 decision packets), and m represents the maximum capacity of the knapsack (the initial value is ) where max_value[i][j] represents the maximum value that can be obtained when the backpack contains i items and has a capacity of j. All values in this array are initially set to 0.
[0078] According to the state transition equation, we can first traverse the backpack and then the items (i.e., with the number of items fixed, the backpack capacity is incremented to the maximum one by one, and then the number of items is incremented by 1), so as to find the maximum value when i = 10000 (total number of decision groups) and j = (maximum capacity of a single center). Thus, the goal of screening out all decision groups with higher value coefficients and putting them into the same center to achieve load balancing is achieved.
[0079] Therefore, the maximum value can be determined when the corresponding number of coded groups in the historical coded group set and the maximum capacity of a single center are known.
[0080] Furthermore, the selected set of decision groups can be obtained.
[0081] Specifically, perform backtracking on the determined f[i, j] results to obtain the set of items (i.e., the set of decision groups) placed in the backpack. The reverse deduction is as follows: when there is f[i, != f[i - 1, , then the (i - 1)-th item is placed in the backpack. Assume the capacity of the (i - 1)-th item is w[i - 1], and then when there is f[j, != f[j - 1, - w[i - 1]], j - 1 is also an item placed in the backpack. Backtrack in this way until f[0, 0].
[0082] Therefore, the coded group set that meets the maximum value can be determined from each coded group in the historical coded group set as the first coded group set.
[0083] This application uses the dynamic programming knapsack problem algorithm to analyze and calculate the historical call performance index data of the previous time window interface, so as to adjust the traffic load balancing scheduling strategy in the next time window. It can highly adapt to the dynamic environment, realize the timely adjustment and optimization of the scheduling strategy, and thus ensure the efficient and balanced use of resources. At the same time, it solves the problem that the traditional dual-center traffic scheduling strategy may schedule each request for the same number to different centers, and the problem that the scheduling strategy is affected by geographical location and network environment.
[0084] Through the above real-time calculation model, rapid adjustment of the minute-level periodic traffic scheduling strategy can be achieved.
[0085] Based on the above embodiments, encoding is performed according to user information, area code, and source channel code, including: Performing a modulo operation on the user information in the service request to obtain the user information code; Encode the user information in the service request, and splice the regional code and the source channel code in the service request.
[0086] Specifically, when encoding according to the user information, regional code, and source channel code in this application, the last three digits of the mobile phone number used as the user information can be modulo 13, and the remainder obtained by the modulo operation is used as the user information code.
[0087] Furthermore, by splicing the user information code of the service request, the regional code in the service request, and the source channel code in the service request, the code of the corresponding service request can be obtained. Specifically, the code can be in the format of remainder (user information code)-province number (regional code)-channel number (source channel code).
[0088] It should be noted that this application can control whether the last three digits of the mobile phone are modulo 13 and whether the province number participates in the load balancing decision among the three dimensions. If the last three digits of the mobile phone do not participate in the decision, the format of the code can be "null-province number-channel number". Similarly, if the province number also does not participate in the decision, the format of the code can be "null-null-channel number".
[0089] This application determines the code of the service request according to the user information, source channel code, and regional code that are strongly related to the business attributes. Since the values of the user information, source channel code, and regional code do not change during the request cycle of the same user in the same application, the requests of the center for the same user in the same application request cycle will not change with the change of the user's location or network switching. Therefore, it can ensure that each request of the same user can be forwarded to the same center and is not affected by the geographical location and network environment, which can improve the request success rate of users when performing load balancing for dual-center traffic scheduling.
[0090] Next, the load balancing scheduling device provided by this application will be described. The load balancing scheduling device described below can be mutually referred to the load balancing scheduling method described above.
[0091] Furthermore, this application also provides a load balancing scheduling device.
[0092] The load balancing scheduling device includes: A determination module, configured to respond to a user service request. If there is no center identifier in the user service request, determine a to-be-decided grouping code according to the user service request; A forwarding module, configured to forward the user service request to the center associated with the target center identifier in the dual centers after setting the target center identifier for the user service request if the encoding of the to-be-decided packet encoding matches the encoding of any encoding packet in the first encoding packet set and the second encoding packet set; the target center identifier is the center identifier associated with the target encoding packet set; the target encoding packet set is the encoding packet set where the encoding packet that matches the to-be-decided packet encoding is located. The first encoding packet set includes encoding packets obtained by solving the knapsack problem based on the historical encoding packet set; the second encoding packet set includes the encoding packets in the historical encoding packet set except the first encoding packet set; the historical encoding packet set is determined based on the user information, area code, and source channel code in the historical user service requests.
[0093] The load balancing scheduling device of the present application determines the historical encoding packet set through the user information, area code, and source channel code in the historical user service requests, constructs the first encoding packet set according to the encoding packets obtained by solving the knapsack problem based on the historical encoding packet set, constructs the second encoding packet set according to the encoding packets in the historical encoding packet set except the first encoding packet set, and further sets the center identifier for the first encoding packet set and the second encoding packet set respectively. So that after responding to the user service request and when there is no center identifier in the user service request, if the to-be-decided packet encoding determined according to the user service request matches the encoding of any encoding packet in the first encoding packet set and the second encoding packet set, the center identifier of the first encoding packet set or the second encoding packet set where the encoding packet with the matching encoding is located is set as the target center identifier in the user service request, and the user service request is forwarded to the center associated with the target center identifier in the dual centers. The present application encodes and groups according to the user information, source channel code, and area code that are strongly related to the service attribute, and solves each encoding packet in combination with the knapsack problem to obtain the load balancing strategy for the dual-center traffic scheduling. Since the values of the user information, source channel code, and area code for the same user within the request cycle of the same application will not change, the requests of the center for the same user within the request cycle of the same application will not change with the change of the user's location and network switching. Therefore, it can ensure that each request of the same user can be forwarded to the same center and is not affected by the geographical location and network environment, and can improve the request success rate of the user when performing load balancing for dual-center traffic scheduling.
[0094] In one embodiment, after responding to the user service request, if there is a center identifier in the user service request, the determining module is further configured to: Forward the user service request to the center corresponding to the center identifier in the dual centers.
[0095] Figure 2 An entity structure schematic diagram of an electronic device is exemplified. As Figure 2 shown, the electronic device may include: a processor 210, a communications interface 220, a memory 230, and a communication bus 240. Among them, the processor 210, the communications interface 220, and the memory 230 complete communication with each other through the communication bus 240. The processor 210 may call logical instructions in the memory 230 to execute the following method: in response to a user service request, if there is no central identifier in the user service request, determine a to-be-decided packet encoding according to the user service request; if the to-be-decided packet encoding matches the encoding of any encoding packet in the first encoding packet set and the second encoding packet set, set a target central identifier for the user service request and forward it to the central associated with the target central identifier in the dual centers; the target central identifier is the central identifier associated with the target encoding packet set; the target encoding packet set is the encoding packet set where the encoding that matches the to-be-decided packet encoding is located; the first encoding packet set includes encoding packets obtained by solving the knapsack problem based on the historical encoding packet set; the second encoding packet set includes the encoding packets in the historical encoding packet set except the first encoding packet set; the historical encoding packet set is determined based on user information, area encoding, and source channel encoding in historical user service requests.
[0096] In addition, when the logical instructions in the above-mentioned memory 230 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the related technology, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk, or an optical disc that can store program codes.
[0097] In another aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the methods provided in the above embodiments. For example, it includes: in response to a user service request, if no central identifier exists in the user service request, determining a to-be-decided packet code according to the user service request; If the to-be-decided packet code matches the code of any coding packet in the first coding packet set and the second coding packet set, setting a target central identifier for the user service request and then forwarding it to the central associated with the target central identifier in the dual centers; the target central identifier is the central identifier associated with the target coding packet set; the target coding packet set is the coding packet set where the coding packet matching the to-be-decided packet code is located; The first coding packet set includes coding packets obtained by solving the knapsack problem based on the historical coding packet set; the second coding packet set includes the coding packets in the historical coding packet set except for the first coding packet set; the historical coding packet set is determined based on user information, regional codes, and source channel codes in historical user service requests.
[0098] In another aspect, an embodiment of the present application further provides a computer program product, on which a computer program is stored. When the computer program is executed by a processor, it is configured to execute the methods provided in the above embodiments. For example, it includes: in response to a user service request, if no central identifier exists in the user service request, determining a to-be-decided packet code according to the user service request; If the to-be-decided packet code matches the code of any coding packet in the first coding packet set and the second coding packet set, setting a target central identifier for the user service request and then forwarding it to the central associated with the target central identifier in the dual centers; the target central identifier is the central identifier associated with the target coding packet set; the target coding packet set is the coding packet set where the coding packet matching the to-be-decided packet code is located; The first coding packet set includes coding packets obtained by solving the knapsack problem based on the historical coding packet set; the second coding packet set includes the coding packets in the historical coding packet set except for the first coding packet set; the historical coding packet set is determined based on user information, regional codes, and source channel codes in historical user service requests.
[0099] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0100] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0101] Finally, it should be noted that the above embodiments are only used to illustrate the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the embodiments, those of ordinary skill in the art should understand that various combinations, modifications, or equivalent replacements of the technical solutions of the present application do not depart from the spirit and scope of the technical solutions of the present application.
Claims
1. A load balancing scheduling method, characterized in that: include: In response to a user service request, if the center identifier does not exist in the user service request, determining the group code to be decided according to the user service request; If the code of the group to be decided matches the code of any code group in the first code group set and the second code group set, a target center identifier is set for the user service request and then forwarded to the center associated with the target center identifier in the dual centers; the target center identifier is a center identifier set in association with the target code group set; the target code group set is a code group set in which the code matching the code of the group to be decided is located; The first coding group set includes coding groups obtained by solving the knapsack problem based on the historical coding group set; the second coding group set includes coding groups in the historical coding group set except the first coding group set; the historical coding group set is determined based on user information, area code and source channel code in historical user service requests.
2. The load balancing scheduling method according to claim 1, characterized in that: The first coding group set is determined based on the following method: Get historical user service requests; For each service request in the historical user service request, encode according to the user information, the area code and the source channel code and classify the same code into the same code group, and form a historical code group set from each code group; Determine a resource occupation weight coefficient of each coding group in the historical coding group set, a value coefficient of each coding group in the historical coding group set, and a resource allocation weight coefficient of the center; A knapsack problem is solved based on each of the resource occupancy weight coefficients, each of the value coefficients and the resource allocation weight coefficient to obtain a first coding group set.
3. The load balancing scheduling method according to claim 2, characterized in that: When determining the resource occupancy weight coefficient of each coding group in the historical coding group set, for each coding group, the following steps are performed: Determine the number of service requests corresponding to each code in the current code group and the request duration of the service request corresponding to each code; Multiply the number of service requests corresponding to each code by the request duration to obtain the product of the service requests corresponding to the corresponding code; The products are added together to obtain the resource occupancy weight coefficient of the current coding group.
4. The load balancing scheduling method according to claim 2, characterized in that: The knapsack problem is solved based on each of the resource occupation weight coefficients, each of the value coefficients and the resource allocation weight coefficient to obtain a first coding group set, including: Based on the resource occupancy weight coefficients, the value coefficients, the resource allocation weight coefficients, the single-center maximum capacity and the state transition equation of the knapsack problem, determining the maximum value at the corresponding number of coding groups in the historical coding group set and the single-center maximum capacity; A coding group set satisfying the maximum value is determined from each coding group of the historical coding group set as a first coding group set.
5. The load balancing scheduling method according to claim 2, characterized in that: The encoding according to the user information, the area code and the source channel code includes: Perform a modulo operation on the user information in the service request to obtain the user information code; The user information code of the service request, the area code in the service request and the source channel code in the service request are concatenated.
6. The load balancing scheduling method according to claim 1, characterized in that: After responding to the user service request, if the user service request contains a center identifier, the method further includes: The user service request is forwarded to the center in the dual centers corresponding to the center identifier.
7. A load balancing scheduling device, characterized in that: include: A determination module, configured to respond to a user service request and, if the center identifier does not exist in the user service request, determine the group code to be decided according to the user service request; A forwarding module, used for setting a target center identifier for the user service request and forwarding it to a center associated with the target center identifier in the dual centers if the code of the group to be decided matches the code of any code group in the first code group set and the second code group set; the target center identifier is a center identifier associated with the target code group set; the target code group set is a code group set in which the code matching the code of the group to be decided is located; The first coding group set includes coding groups obtained by solving the knapsack problem based on the historical coding group set; the second coding group set includes coding groups in the historical coding group set except the first coding group set; the historical coding group set is determined based on user information, area code and source channel code in historical user service requests.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the load balancing scheduling method according to any one of claims 1 to 6 is implemented.
9. A storage medium, the storage medium being a non-transitory computer-readable storage medium, on which a computer program is stored, characterized in that: When the computer program is executed by a processor, the load balancing scheduling method as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the load balancing scheduling method according to any one of claims 1 to 6 is implemented.