Flow Allocation Method, Device, Storage Medium and Equipment
By analyzing the client's service requests and calculating weights based on the service quality factors of the service provider, determining the target service provider to allocate traffic, the problem of difficulty in ensuring high-quality services in the existing technology is solved, and a more objective and reliable service provider selection is achieved.
Patent Information
- Application Number
- CN202211272986.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2042-10-18
AI Technical Summary
The prior art is difficult to ensure that clients can obtain high-quality services after traffic allocation, mainly because manual experience is difficult to cover variable service quality factors.
By analyzing the client's service request, obtain the list of service providers of the target service items, and calculate the weight of the service provider based on the influencing factors associated with the service provider's service quality, and determine the target service provider to allocate traffic.
A more objective choice of service providers is achieved to ensure that clients receive high-quality services. Compared with manual selection, the process is more automated and reliable.
Smart Images

Figure CN115633001B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technologies, and in particular, to a traffic allocation method, apparatus, storage medium, and device. Background Art
[0002] Currently, most of the Internet industry requires capabilities such as cloud services, SMS, and advertising placement. There are many manufacturers in the market that can provide the same capabilities. If multiple service providers are shortlisted, a traffic allocation problem will arise.
[0003] Existing traffic allocation methods usually require manually setting the traffic proportion of each service provider. However, simply relying on manual experience for traffic allocation makes it difficult to ensure that the client obtains high-quality services.
[0004] Therefore, how to ensure that the client can obtain high-quality services after traffic allocation has become an urgent problem to be solved in this field. Summary of the Invention
[0005] This application provides a traffic allocation method, apparatus, storage medium, and device, aiming to ensure that the client can obtain high-quality services after traffic allocation.
[0006] To achieve the above objective, this application provides the following technical solutions:
[0007] A traffic allocation method includes:
[0008] Analyze a service request sent by a client to obtain a target service item;
[0009] Obtain a service provider list of the target service item from a preset database; the service provider list includes multiple service providers that provide service capabilities for the target service item, as well as the weight and serial number of each service provider; the weight is calculated based on influencing factors related to the service quality of the service provider;
[0010] Determine a target service provider based on the weights of the service providers in the service provider list;
[0011] Allocate the traffic of the target service item to the target service provider.
[0012] Optionally, the analyzing a service request sent by a client to obtain a target service item includes:
[0013] Save one or more service requests sent by different types of clients to a preset request queue, and record the request time of each service request;
[0014] Analyze each service request in the preset request queue in order of the request time from earliest to latest to obtain each target service item;
[0015] For each of the target service items, obtain a list of service providers for the target service item from a preset database.
[0016] Optionally, the process of calculating the weight based on influencing factors associated with the service quality of the service provider includes:
[0017] Pre-configure basic information of multiple influencing factors associated with the service quality of the service provider; the basic information includes at least an influence coefficient and an influence index;
[0018] Configure a list of service providers for multiple service items; the list of service providers includes multiple service providers with service capabilities for the service item, the serial number of each service provider, and the values of each influencing factor associated with each service provider;
[0019] For each of the lists of service providers, calculate the weight of each service provider in the list of service providers based on the values of each influencing factor associated with each service provider in the list of service providers, and the influence coefficient and influence index of each influencing factor associated with each service provider in the list of service providers.
[0020] Optionally, determining the target service provider based on the weights of the service providers in the list of service providers includes:
[0021] Obtain a target value based on the weights of the service providers in the list of service providers;
[0022] Initialize a starting number variable; wherein, the initial value of the starting number variable is set to 0;
[0023] Traverse each service provider in the list of service providers, and when reading each service provider, adjust the value of the starting number variable so that the adjusted value of the starting number variable is equal to the target sum value; the target sum value includes: the sum value of the weight of the currently read service provider and the value of the starting number variable before adjustment;
[0024] For each service provider read, determine whether the adjusted value of the starting number variable is not greater than the target value, and whether the sum value of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value;
[0025] In the case where the adjusted value of the starting number variable is not greater than the target value, and the sum value of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value, identify the currently read service provider as the target service provider.
[0026] Optionally, it further includes:
[0027] In the case where the value of the adjusted starting number variable is greater than the target value, and the sum of the weight of the service provider and the value of the adjusted starting number variable is not greater than the target value, the currently read service provider is identified as a non-target service provider.
[0028] Optionally, it further includes:
[0029] After reading all service providers in the service provider list and not obtaining the target service provider, the service provider with the first serial number in the service provider list is identified as the target service provider.
[0030] Optionally, obtaining the target value based on the weights of the service providers in the service provider list includes:
[0031] Calculating the total sum of the weights of the service providers in the service provider list to obtain the total weight value;
[0032] Based on the total weight value as the upper limit of the interval and a preset value as the lower limit of the interval, generating a random number value interval;
[0033] Randomly selecting a random number from the random number value interval as the target value.
[0034] A traffic distribution device includes:
[0035] A request parsing unit for parsing a service request sent by a client to obtain a target service item;
[0036] A list acquisition unit for acquiring a service provider list of the target service item from a preset database; the service provider list includes multiple service providers providing service capabilities for the target service item, as well as the weight and serial number of each service provider; the weight is calculated based on influencing factors related to the service quality of the service provider;
[0037] A service provider screening unit for determining a target service provider based on the weights of the service providers in the service provider list;
[0038] A traffic distribution unit for distributing the traffic of the target service item to the target service provider.
[0039] A computer-readable storage medium, the computer-readable storage medium includes a stored program, wherein the program is the traffic distribution method when being run by a processor.
[0040] A traffic distribution device includes: a processor, a memory, and a bus; the processor is connected to the memory through the bus;
[0041] The memory is used to store a program, and the processor is used to run the program. When the program is run by the processor, the traffic allocation method described above is executed.
[0042] The technical solution provided by this application parses the service request sent by the client to obtain the target service item, and obtains the service provider list of the target service item from the preset database. Based on the weights of the service providers in the service provider list, the target service provider is determined. The traffic of the target service item is allocated to the target service provider. This application can determine the weights of the service providers in the service provider list based on the influencing factors related to the service quality of the service providers, and screen out the target service provider from the service provider list according to the weights of the service providers as the traffic allocation object of the target service item. Compared with the prior art, the selection of the target service provider is more objective, and it can effectively ensure that the client can obtain high-quality services after traffic allocation. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0044] Figure 1a It is a schematic flowchart of a traffic allocation method provided by an embodiment of this application;
[0045] Figure 1b It is a schematic flowchart of a traffic allocation method provided by an embodiment of this application;
[0046] Figure 2 It is a schematic flowchart of another traffic allocation method provided by an embodiment of this application;
[0047] Figure 3 It is a schematic architecture diagram of a traffic allocation device provided by an embodiment of this application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0048] The following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the drawings in the embodiments of this application. Obviously, the described embodiments are only some embodiments of this application, rather than all embodiments. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of this application.
[0049] Such as Figure 1a and Figure 1bAs shown, it is a schematic flowchart of a traffic allocation method provided by an embodiment of the present application, which is applied to a server and includes the following steps.
[0050] S101: Pre-configure the basic information of multiple influencing factors associated with the service quality of service providers.
[0051] Among them, the basic information includes but is not limited to: code, name, description, type, influence coefficient, influence index.
[0052] The so-called code is used to indicate the foreign name of the influencing factor.
[0053] The so-called name is used to indicate the Chinese name of the influencing factor.
[0054] The so-called description is used to indicate the association between the influencing factor and the service quality. For example, efficiency (a specific manifestation of the influencing factor) is directly proportional to the service quality (that is, the higher the efficiency, the better the service quality).
[0055] The so-called type is also used to indicate the association between the influencing factor and the service quality. For example, if the type is positively correlated, it means that the influencing factor is directly proportional to the service quality.
[0056] The so-called influence coefficient is used to indicate the ratio of any influencing factor to the sum of all influencing factors. Specifically, assuming that the ratio of price (a specific manifestation of the influencing factor) to the sum of all influencing factors is 0.4, then the influence coefficient of price is 0.4.
[0057] The so-called influence index is used to indicate the intensity of the impact of the differences between different influencing factors on the weight. The larger the influence index, the greater the impact on the weight. Specifically, the influence index is usually the exponent mentioned in the power operation. Assuming that the price (a specific manifestation of the influencing factor) is 10 and the influence index is 2, then the value obtained after performing the power operation on the price is 100.
[0058] Specifically, the basic information of each influencing factor can be seen in Table 1 as follows.
[0059] Table 1
[0060]
[0061]
[0062] It should be noted that the content shown in Table 1 above is only for illustrative purposes. Generally speaking, the content shown in Table 1 is the specific configuration scenario of the basic information of each influencing factor.
[0063] Specifically, in the specific usage scenario of the SMS service (a specific manifestation of a service item), assume that the influencing factors include price ratio, arrival rate, success rate of stealing volume detection, and verification code cancellation rate. Among them, the price ratio is 60%, the influence coefficient = 0.6, the influence index = 1, and it is negatively correlated. The lower the price, the higher the weight calculated in subsequent S103; the arrival rate accounts for 10%, the influence coefficient = 0.1, the influence index = 10, and it is positively correlated. The higher the arrival rate, the higher the weight calculated in subsequent S103; the success rate of stealing volume detection accounts for 20%, the influence coefficient = 0.2, the influence index = 10, and it is positively correlated. The higher the success rate, the higher the weight calculated in subsequent S103; the verification code cancellation rate accounts for 10%, the influence coefficient = 0.1, the influence index = 10, and it is positively correlated. The higher the cancellation rate, the higher the weight calculated in subsequent S103.
[0064] S102: Configure the service provider list for multiple service items.
[0065] Among them, the service provider list includes multiple service providers that provide service capabilities for the service item, the serial number of each service provider, and the values of each influencing factor associated with each service provider. Generally speaking, the serial number of the service provider is usually the order in which the service provider writes into the service provider list.
[0066] Specifically, the specific content of the service provider list can be seen in Table 2.
[0067] Table 2
[0068]
[0069]
[0070] It should be noted that the content shown in the above Table 2 is only for illustrative purposes. In addition, the weight column shown in the above Table 2 requires the user to trigger the calculation of weights in the operation to obtain the weight of the service provider, that is, after executing the subsequent S103, the information of the weight item can be obtained.
[0071] S103: For each service provider list, based on the values of each influencing factor associated with each service provider in the service provider list, as well as the influence coefficient and influence index of each influencing factor associated with each service provider in the service provider list, calculate the weight of each service provider in the service provider list.
[0072] Among them, the specific implementation process of calculating the weight of each service provider in the service provider list based on the values of each influencing factor associated with each service provider in the service provider list, as well as the influence coefficient and influence index of each influencing factor associated with each service provider in the service provider list, can be seen in formula (1).
[0073]
[0074] In formula (1), Wi represents the weight of any service provider, i represents the index of the service provider, Wp represents the positive correlation weight of any service provider, and the specific calculation method of Wp is shown in formula (2), j represents the index of the positive correlation factor (i.e., the influencing factor of the positive correlation type), Wn represents the negative correlation weight, and the specific calculation method of Wn is shown in formula (3), and t represents the index of the negative correlation factor (i.e., the influencing factor of the negative correlation type).
[0075]
[0076] In formula (2), N represents the total number of service providers in the service provider list, Si represents the value of the positive correlation factor, C represents the influence coefficient of the positive correlation factor, and M represents the influence index of the positive correlation factor.
[0077]
[0078] In formula (3), N represents the total number of service providers, Si represents the value of the negative correlation factor, C represents the influence coefficient of the negative correlation factor, and M represents the influence index of the negative correlation factor.
[0079] It should be noted that in the case where any service provider in the service provider list is detected to be unable to provide services, the service provider that is unable to provide services needs to be removed from the service provider list to obtain a new service provider list, and based on the values of the various influencing factors associated with each service provider in the new service provider list, as well as the influence coefficients and influence indexes of the various influencing factors associated with each service provider in the new service provider list, the weights of each service provider in the new service provider list are recalculated.
[0080] Specifically, the specific implementation process of recalculating the weights of each service provider in the new service provider list based on the values of the various influencing factors associated with each service provider in the new service provider list, as well as the influence coefficients and influence indexes of the various influencing factors associated with each service provider in the new service provider list, can be seen in formula (4) shown below
[0081] Wi = W old + W new (4)
[0082] In formula (4), Wi represents the weight of any service provider in the new service provider list, i represents the index of the service provider, W old represents the original weight of any service provider in the new service provider list, W new represents the new weight of any service provider in the new service provider list, and the specific calculation process of W new is shown in formula (5).
[0083] W new = W old(N=Q) * W m (5)
[0084] In formula (5), W old(N=Q) represents the weight assigned to any one service provider under the condition that the total number of service providers is Q (Q = N - 1), and W m represents the weight originally assigned to the service provider that has been excluded from the service provider list, and m represents the index of the excluded service provider. In addition, the specific calculation process of W old(N=Q) can be seen in formula (1), and the only difference between the two is that the total number of service providers is changed to Q.
[0085] It should be emphasized that when the influence coefficient and influence index of any one influencing factor change, as well as when new influencing factors are added or existing influencing factors are deleted, formula (1) needs to be called to recalculate the weights of each service provider in the service provider list.
[0086] S104: Add the weights of each service provider to the service provider list, and save the service provider list of each service item to a preset database.
[0087] Among them, saving the service provider list of each service item to a preset database can facilitate users to query the weights of each service provider at any time.
[0088] S105: Save one or more service requests sent by different types of clients to a preset request queue, and record the request time of each service request.
[0089] Among them, saving each service request to a preset request queue can achieve asynchronous processing of each service request, effectively improving the efficiency of traffic allocation.
[0090] It should be noted that different types of clients include but are not limited to web clients, mobile clients, etc.
[0091] S106: Parse each service request in the preset request queue in ascending order of request time to obtain each target service item.
[0092] Among them, the target service item can be understood as the service item requested by the client.
[0093] S107: For each target service item, obtain the service provider list of the target service item from the preset database.
[0094] S108: Calculate the total sum of the weights of each service provider in the service provider list to obtain the total weight value.
[0095] S109: Generate a random number value range based on the total weight value as the upper limit of the range and a preset value as the lower limit of the range.
[0096] Among them, the preset value can be set to 0.
[0097] S110: Randomly select a random number from the random number value range as the target value.
[0098] S111: Initialize a starting number variable.
[0099] Among them, the initial value of the starting number variable is set to 0.
[0100] S112: Traverse each service provider in the service provider list, and when reading each service provider, adjust the value of the starting number variable so that the adjusted value of the starting number variable is equal to the target sum value.
[0101] Among them, the target sum value includes: the sum of the weight of the currently read service provider and the value of the starting number variable before adjustment.
[0102] S113: For each service provider read, determine whether the adjusted value of the starting number variable is not greater than the target value, and whether the sum of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value.
[0103] If the adjusted value of the starting number variable is not greater than the target value, and the sum of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value, then execute S114.
[0104] If the adjusted value of the starting number variable is greater than the target value, and the sum of the weight of the service provider and the adjusted value of the starting number variable is not greater than the target value, then execute S115.
[0105] Specifically, assume that the weight of service provider A is 400, the weight of service provider B is 300, and the weight of service provider C is 200. When receiving a text message request (i.e., the target service item), a service provider needs to be found to send the text message. The starting number variable m = 0, the target value n is a random number selected randomly between 0 and 900. Assume the target value n is 500, and the reading order of each service provider is service provider A, service provider B, and service provider C. Each time any service provider is read, the judgment process is simplified as: m <= n and n < (m + the weight of the currently read service provider).
[0106] When reading service provider A, the weight of service provider A is 400. First, m <= n is satisfied (because 0 <= 500), and n < (m + the weight of the currently looped service) is not satisfied (because 500 < 0 + 400 does not hold). At this time, m = m + the weight of the currently looped service = 0 + 400 = 400, and then continue to loop 2;
[0107] When service provider B is read, the weight of service provider B is 300. First, m <= n is satisfied (because 400 <= 500), and n < (m + the weight of the currently looped service) is also satisfied (because 500 < 400 + 300 holds). Since both conditions are satisfied, it indicates that service provider B is found to execute the current SMS sending action. Otherwise, continue looping until all service providers have been traversed and no eligible one is found. Then, select the first service provider, i.e., service provider A, to execute the SMS sending action.
[0108] S114: Identify the currently read service provider as the target service provider.
[0109] After executing S114, continue to execute S117.
[0110] Among them, after obtaining the target service provider, other service providers in the service provider list can be stopped from being read to save computing resources.
[0111] S115: Identify the service provider with the first serial number in the service provider list as a non-target service provider.
[0112] After executing S115, continue to execute S116.
[0113] S116: After reading all service providers in the service provider list and not obtaining the target service provider, identify the service provider with the first serial number in the service provider list as the target service provider.
[0114] After executing S116, continue to execute S117.
[0115] S117: Allocate the traffic of the target service item to the target service provider.
[0116] Among them, when selecting the target service provider as the traffic allocation object for the target service item, the weights of each service provider are used as a reference basis for selection, and the weights of each service provider are calculated based on the influencing factors related to the service quality of the service provider. That is to say, the finally selected target service provider is selected based on the influencing factors as a reference basis, so as to be able to provide high-quality services for the target service item. Compared with the existing manual selection method, the traffic allocation result is more objective, ensuring that the client can obtain high-quality services after traffic allocation.
[0117] In summary, this embodiment can determine the weights of each service provider in the service provider list based on the influencing factors associated with the service quality of the service provider, and screen out the target service provider from the service provider list according to the weights of each service provider as the traffic allocation object for the target service item. Compared with the prior art, the selection of the target service provider is more objective, which can effectively ensure that the client can obtain high-quality services after traffic allocation.
[0118] It should be noted that S101 mentioned in the above embodiment is an optional implementation manner of the traffic allocation method shown in the embodiments of the present application. In addition, S115 mentioned in the above embodiment is also an optional implementation manner of the traffic allocation method shown in the embodiments of the present application. Therefore, the processes mentioned in the above embodiments can be summarized as Figure 2 the method shown.
[0119] As Figure 2 shown, it is a schematic flowchart of another traffic allocation method provided by the embodiments of the present application, including the following steps.
[0120] S201: Parse the service request sent by the client to obtain the target service item.
[0121] S202: Obtain the service provider list of the target service item from the preset database.
[0122] Among them, the service provider list includes multiple service providers providing service capabilities for the target service item, as well as the weight and serial number of each service provider; the weight is calculated based on the influencing factors associated with the service quality of the service provider.
[0123] S203: Determine the target service provider based on the weights of each service provider in the service provider list.
[0124] S204: Allocate the traffic of the target service item to the target service provider.
[0125] In summary, this embodiment can determine the weights of each service provider in the service provider list based on the influencing factors associated with the service quality of the service provider, and screen out the target service provider from the service provider list according to the weights of each service provider as the traffic allocation object for the target service item. Compared with the prior art, the selection of the target service provider is more objective, which can effectively ensure that the client can obtain high-quality services after traffic allocation.
[0126] Corresponding to the traffic allocation method provided by the above embodiments of the present application, the embodiments of the present application also provide a traffic allocation device.
[0127] As Figure 3 shown, it is a schematic architecture diagram of a traffic allocation device provided by the embodiments of the present application, including the following units.
[0128] A request parsing unit 100, configured to parse a service request sent by a client to obtain a target service item.
[0129] Optionally, the request parsing unit 100 is specifically configured to: save one or more service requests sent by different types of clients into a preset request queue, and record the request time of each service request; parse each service request in the preset request queue in order from the earliest request time to the latest request time to obtain each target service item; for each target service item, obtain a service provider list of the target service item from a preset database.
[0130] A list obtaining unit 200, configured to obtain a service provider list of a target service item from a preset database; the service provider list includes multiple service providers capable of providing service capabilities for the target service item, as well as the weight and serial number of each service provider; the weight is calculated based on influencing factors associated with the service quality of the service provider.
[0131] Optionally, the list obtaining unit 200 is specifically configured to: pre-configure basic information of multiple influencing factors associated with the service quality of the service provider; the basic information includes at least an influence coefficient and an influence index; configure a service provider list for multiple service items; the service provider list includes multiple service providers capable of providing service capabilities for the service item, the serial number of each service provider, and the values of each influencing factor associated with each service provider; for each service provider list, calculate the weight of each service provider in the service provider list based on the values of each influencing factor associated with each service provider in the service provider list, and the influence coefficient and influence index of each influencing factor associated with each service provider in the service provider list.
[0132] A service provider screening unit 300, configured to determine a target service provider based on the weights of the service providers in the service provider list.
[0133] Optionally, the service provider screening unit 300 is specifically configured to: obtain a target value based on the weights of the service providers in the service provider list; initialize a starting number variable; the initial value of the starting number variable is set to 0; traverse each service provider in the service provider list, and when reading each service provider, adjust the value of the starting number variable so that the adjusted value of the starting number variable is equal to the target sum value; the target sum value includes: the sum value of the weight of the currently read service provider and the value of the starting number variable before adjustment; for each service provider read, determine whether the adjusted value of the starting number variable is not greater than the target value, and whether the sum value of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value; in the case where the adjusted value of the starting number variable is not greater than the target value, and the sum value of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value, identify the currently read service provider as the target service provider.
[0134] The service provider screening unit 300 is further configured to: when the value of the adjusted starting number variable is greater than the target value, and the sum of the weight of the service provider and the value of the adjusted starting number variable is not greater than the target value, mark the currently read service provider as a non-target service provider.
[0135] The service provider screening unit 300 is further configured to: after reading all service providers in the service provider list and not obtaining a target service provider, mark the service provider with the first serial number in the service provider list as the target service provider.
[0136] Specifically, the service provider screening unit 300 is configured to: calculate the total weight of the weights of each service provider in the service provider list to obtain the total weight value; generate a random number value range based on the total weight value as the upper limit of the range and a preset value as the lower limit of the range; randomly select a random number from the random number value range as the target value.
[0137] The traffic allocation unit 400 is configured to allocate the traffic of the target service item to the target service provider.
[0138] In summary, this embodiment can determine the weights of each service provider in the service provider list based on the influencing factors associated with the service quality of the service provider, and screen out the target service provider from the service provider list according to the weights of each service provider as the traffic allocation object of the target service item. Compared with the prior art, the selection of the target service provider is more objective, and it can effectively ensure that the client can obtain high-quality services after traffic allocation.
[0139] This application also provides a computer-readable storage medium. The computer-readable storage medium includes a stored program, wherein the program executes the traffic allocation method provided by this application.
[0140] This application also provides a traffic allocation device, including: a processor, a memory, and a bus. The processor is connected to the memory through the bus. The memory is used to store a program, and the processor is used to run the program. When the program runs, it executes the traffic allocation method provided by this application, including the following steps:
[0141] Parse the service request sent by the client to obtain the target service item;
[0142] Obtain the service provider list of the target service item from the preset database; the service provider list includes multiple service providers with service capabilities for the target service item, as well as the weight and serial number of each service provider; the weight is calculated based on the influencing factors associated with the service quality of the service provider;
[0143] Determine the target service provider based on the weights of each service provider in the service provider list;
[0144] Allocate the traffic of the target service item to the target service provider.
[0145] Specifically, based on the above embodiments, parsing the service request sent by the parsing client to obtain the target service item includes:
[0146] Save one or more service requests sent by different types of clients into a preset request queue, and record the request time of each service request;
[0147] Parse each service request in the preset request queue in the order of the request time from earliest to latest to obtain each target service item;
[0148] For each target service item, obtain the service provider list of the target service item from a preset database.
[0149] Specifically, based on the above embodiments, the process of calculating the weight according to the influencing factors associated with the service quality of the service provider includes:
[0150] Pre-configure the basic information of multiple influencing factors associated with the service quality of the service provider; the basic information includes at least an influence coefficient and an influence index;
[0151] Configure the service provider list of multiple service items; the service provider list includes multiple service providers providing service capabilities for the service item, the serial number of each service provider, and the values of each influencing factor associated with each service provider;
[0152] For each service provider list, calculate the weight of each service provider in the service provider list based on the values of each influencing factor associated with each service provider in the service provider list, and the influence coefficient and influence index of each influencing factor associated with each service provider in the service provider list.
[0153] Specifically, based on the above embodiments, determining the target service provider based on the weights of each service provider in the service provider list includes:
[0154] Obtain a target value based on the weights of each service provider in the service provider list;
[0155] Initialize a starting number variable; wherein, the initial value of the starting number variable is set to 0;
[0156] Traverse each service provider in the service provider list, and when reading each service provider, adjust the value of the starting number variable so that the adjusted value of the starting number variable is equal to the target sum value; the target sum value includes: the sum value of the weight of the currently read service provider and the value of the starting number variable before adjustment;
[0157] For each service provider obtained by each read, determine whether the value of the adjusted starting number variable is not greater than the target value, and whether the sum of the weight of the service provider and the value of the adjusted starting number variable is greater than the target value;
[0158] In the case where the value of the adjusted starting number variable is not greater than the target value, and the sum of the weight of the service provider and the value of the adjusted starting number variable is greater than the target value, mark the currently read service provider as the target service provider.
[0159] Specifically, on the basis of the above embodiments, it further includes:
[0160] In the case where the value of the adjusted starting number variable is greater than the target value, and the sum of the weight of the service provider and the value of the adjusted starting number variable is not greater than the target value, mark the currently read service provider as a non-target service provider.
[0161] Specifically, on the basis of the above embodiments, it further includes:
[0162] After reading all the service providers in the service provider list and not obtaining the target service provider, mark the service provider with the first serial number in the service provider list as the target service provider.
[0163] Specifically, on the basis of the above embodiments, obtaining the target value based on the weights of the service providers in the service provider list includes:
[0164] Calculate the total sum of the weights of all the service providers in the service provider list to obtain the total weight value;
[0165] Based on the total weight value as the upper limit of the interval and a preset value as the lower limit of the interval, generate a random number value interval;
[0166] Randomly select a random number from the random number value interval as the target value.
[0167] If the functions described in the method of the embodiments of this application are implemented in the form of software function units and sold or used as independent products, they can be stored in a storage medium readable by a computing device. Based on this understanding, the part of the embodiments of this application that contributes to the prior art or part of this technical solution can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions for causing a computing device (which can be a personal computer, server, mobile computing device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories, random access memories, magnetic disks, or optical discs.
[0168] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other.
[0169] The above description of the disclosed embodiments enables those skilled in the art to implement or use this application. Various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application will not be limited to these embodiments shown herein, but will be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A traffic allocation method, characterized in that, it includes: Analyze the service request sent by the client to obtain the target service item; Obtain the service provider list of the target service item from the preset database; the service provider list includes multiple service providers with service capabilities for the target service item, as well as the weight and serial number of each service provider; The weight is calculated based on the influencing factors associated with the service quality of the service provider; Based on the weights of each service provider in the service provider list, determine the target service provider, including: based on the weights of each service provider in the service provider list, obtain the target value; initialize a starting number variable; where, the initial value of the starting number variable is set to 0; traverse each service provider in the service provider list, and when reading each service provider, adjust the value of the starting number variable so that the adjusted value of the starting number variable is equal to the target sum value; the target sum value includes: the sum value of the weight of the currently read service provider and the value of the starting number variable before adjustment; for each read service provider, determine whether the adjusted value of the starting number variable is not greater than the target value, and whether the sum value of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value; in the case where the adjusted value of the starting number variable is not greater than the target value, and the sum value of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value, mark the currently read service provider as the target service provider; Allocate the traffic of the target service item to the target service provider.
2. The method according to claim 1, characterized in that, The analyzing the service request sent by the client to obtain the target service item includes: Save one or more service requests sent by different types of clients into a preset request queue, and record the request time of each service request; Parse each service request in the preset request queue in the order from the earliest to the latest request time to obtain each target service item; For each target service item, obtain the service provider list of the target service item from the preset database.
3. The method according to claim 1, characterized in that, The process of calculating the weight based on the influencing factors associated with the service quality of the service provider includes: Pre-configure the basic information of multiple influencing factors associated with the service quality of the service provider; the basic information includes at least the influence coefficient and the influence index; Configure the service provider lists of multiple service items; the service provider lists include multiple service providers with service capabilities for the service items, the serial number of each service provider, and the values of each influencing factor associated with each service provider; For each service provider list, calculate the weight of each service provider in the service provider list based on the values of each influencing factor associated with each service provider in the service provider list, and the influence coefficient and influence index of each influencing factor associated with each service provider in the service provider list.
4. The method according to claim 1, characterized in that, It further includes: In the case where the value of the adjusted starting number variable is greater than the target value, and the sum of the weight of the service provider and the value of the adjusted starting number variable is not greater than the target value, the currently read service provider is identified as a non-target service provider.
5. The method according to claim 1, wherein, further comprising: After reading all service providers in the service provider list and not obtaining the target service provider, the service provider with the first serial number in the service provider list is identified as the target service provider.
6. The method according to claim 1, wherein, obtaining the target value based on the weights of the service providers in the service provider list includes: Calculating the total sum of the weights of the service providers in the service provider list to obtain the total weight value; Based on the total weight value as the upper limit of the interval and a preset value as the lower limit of the interval, generating a random number value interval; Randomly selecting a random number from the random number value interval as the target value.
7. A traffic allocation device, wherein, comprising: A request parsing unit for parsing a service request sent by a client to obtain a target service item; A list acquisition unit for obtaining a service provider list of the target service item from a preset database; the service provider list includes multiple service providers providing service capabilities for the target service item, as well as the weight and serial number of each service provider; the weight is calculated based on influencing factors associated with the service quality of the service provider; A service provider screening unit for determining a target service provider based on the weights of the service providers in the service provider list, including: obtaining a target value based on the weights of the service providers in the service provider list; initializing a starting number variable; wherein, the initial value of the starting number variable is set to 0; traversing each service provider in the service provider list, and when reading each service provider, adjusting the value of the starting number variable so that the adjusted value of the starting number variable is equal to the target sum value; the target sum value includes: the sum of the weight of the currently read service provider and the value of the starting number variable before adjustment; for each read service provider, determining whether the adjusted value of the starting number variable is not greater than the target value, and whether the sum of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value; in the case where the adjusted value of the starting number variable is not greater than the target value, and the sum of the weight of the service provider and the adjusted value of the starting number variable is greater than the target value, the currently read service provider is identified as the target service provider; A traffic allocation unit for allocating the traffic of the target service item to the target service provider.
8. A computer-readable storage medium, wherein, The computer-readable storage medium includes a stored program, wherein the program, when run by a processor, executes the traffic allocation method according to any one of claims 1-6.
9. A traffic allocation device, wherein, comprising: A processor, a memory and a bus; The processor is connected to the memory through the bus; The memory is used to store a program, and the processor is used to run the program. When the program is run by the processor, it executes the flow distribution method according to any one of claims 1-6.
Citation Information
Patent Citations
Virtual resource processing method, device and system, electronic equipment and storage medium
CN113869718A