Service request distribution method, apparatus, device, and computer-readable storage medium
By obtaining the host's system resources and response time parameters, calculating the load rate, and allocating service requests, the problem of not considering server performance and user experience in existing technologies is solved, and a more reasonable and reliable allocation of service requests is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- WEBANK (CHINA)
- Filing Date
- 2021-10-22
- Publication Date
- 2026-05-15
AI Technical Summary
Existing load balancing algorithms do not take into account the performance and service experience metrics of real servers, resulting in unreasonable allocation and scheduling of service requests, which affects the work efficiency and stability of financial institutions.
By obtaining the system resource parameters and response time parameters of each host, the system's remaining resource load rate and response time load rate are calculated. Service requests are distributed to the hosts based on their health scores, and the performance and service experience metrics of the hosts are comprehensively evaluated.
It improves the rationality and reliability of service request allocation and scheduling, thereby enhancing the work efficiency and stability of financial institutions.
Smart Images

Figure CN113992689B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of financial technology (Fintech), and more particularly to a service request distribution method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] With the development of computer technology, more and more technologies (big data, distributed systems, blockchain, artificial intelligence, etc.) are being applied in the financial field. The traditional financial industry is gradually transforming into financial technology (Fintech). However, due to the security and real-time requirements of the financial industry, higher demands are being placed on service request distribution technology.
[0003] LVS (Linux Virtual Server) is a mature open-source product widely used by major internet companies for load balancing. Its principle is that a user's web request is sent to LVS, which then forwards the request to a real server in the backend cluster according to a preset load balancing algorithm. Since the backend server cluster provides the same service, the final result is consistent regardless of which real server the user requests from; therefore, the entire cluster is transparent to the user.
[0004] However, existing load balancing algorithms generally employ mechanical round-robin, manually designated servers, or server scheduling based on the number of requested connections. These methods do not consider the actual performance metrics of the servers or the metrics that affect the service experience provided by the servers, resulting in unreasonable request allocation and scheduling and low reliability. Summary of the Invention
[0005] The main objective of this invention is to provide a service request distribution method, apparatus, device, and computer-readable storage medium, aiming to solve the technical problem of unreasonable allocation and scheduling of service requests in the prior art.
[0006] To achieve the above objectives, the present invention provides a service request distribution method, which includes the following steps:
[0007] Upon receiving a service request, obtain the system resource parameters and response time parameters of each host;
[0008] The system remaining resource load rate is determined based on the system resource parameters, and the response time load rate is determined based on the response time parameters.
[0009] The health score of each host is determined based on the system's remaining resource load rate and response time load rate.
[0010] The service request is distributed to the host based on the health score.
[0011] Optionally, the response time parameter includes the response time for processing each historical service request within each preset time period;
[0012] The step of determining the response time load rate based on the response time parameter includes:
[0013] The average response time within each preset time period is determined based on the response time for processing each historical service request within each preset time period.
[0014] Calculate the standard deviation of the response time within each preset time period based on the average response time, and determine the mean of the standard deviation based on the standard deviation.
[0015] The difference between the standard deviation of the response time within the preset time period in which the current time is located and the mean of the standard deviation is determined as the response time load rate.
[0016] Optionally, the system resource parameters include maximum memory and memory utilization.
[0017] The step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0018] Determine the cluster memory baseline based on the maximum memory of each host;
[0019] Based on a preset first formula, the cluster memory baseline, the maximum memory, and the memory utilization rate, the remaining memory load rate of each host is determined. The preset first formula is as follows:
[0020] Sm = Tm(1-Pm) / Bm,
[0021] Where Sm is the host's remaining memory load rate;
[0022] Tm is the maximum memory of the host;
[0023] Pm represents the host's memory usage.
[0024] Bm is the cluster memory baseline.
[0025] Optionally, the system resource parameters include maximum network bandwidth and network bandwidth utilization.
[0026] The step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0027] Determine the cluster network bandwidth baseline based on the maximum network bandwidth of each host;
[0028] Based on the preset second formula, the cluster network bandwidth baseline, the maximum network bandwidth, and the network bandwidth utilization rate, the remaining network bandwidth load rate of each host is determined. The preset second formula is as follows:
[0029] Sn=Tn(1-Pn) / Bn,
[0030] Where Sn is the host's remaining network bandwidth load rate;
[0031] Tn is the host's maximum network bandwidth;
[0032] Pn represents the network bandwidth utilization of the host;
[0033] Bn represents the baseline bandwidth of the cluster network.
[0034] Optionally, the system resource parameters include maximum disk capacity and disk utilization.
[0035] The step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0036] Determine the cluster disk capacity baseline based on the maximum disk capacity of each host;
[0037] The remaining disk capacity load rate of each host is determined based on the cluster disk capacity baseline, the maximum disk capacity, and the disk utilization rate.
[0038] Optionally, the system resource parameters include CPU time slices and corresponding CPU idle time;
[0039] The step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0040] The idle CPU load rate is determined based on the CPU idle time and the CPU time slice.
[0041] Optionally, the step of distributing the service request to the host based on the health score includes:
[0042] Calculate the sum of the health scores of each host, and determine the ratio of the health score of each host to the sum;
[0043] The service request is distributed to the host according to the ratio.
[0044] Furthermore, to achieve the above objectives, the present invention also provides a service request distribution apparatus, the service request distribution apparatus comprising:
[0045] Furthermore, to achieve the above objectives, the present invention also provides a service request distribution device, the service request distribution device including a memory, a processor, and a service request distribution program stored in the memory and executable on the processor, wherein when the service request distribution program is executed by the processor, it implements the steps of the service request distribution method as described above.
[0046] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium storing a service request dispatch program, which, when executed by a processor, implements the steps of the service request dispatch method as described above.
[0047] This invention, upon receiving a service request, obtains system resource parameters and response time parameters for each host; determines the remaining system resource load rate based on the system resource parameters and the response time load rate based on the response time parameters; determines a health score for each host based on the remaining system resource load rate and the response time load rate; and distributes the service request to the host based on the health score. This achieves a comprehensive evaluation of a host's health score based on both performance metrics and service experience metrics (response time), and then distributes requests to the host based on the health score, thereby improving the rationality and reliability of service request allocation and scheduling. Attached Figure Description
[0048] Figure 1 A schematic diagram of the hardware operating environment of the device involved in the embodiment of the service request distribution device of the present invention;
[0049] Figure 2 This is a flowchart illustrating the first embodiment of the service request distribution method of the present invention;
[0050] Figure 3 This is a schematic diagram of the functional modules of a preferred embodiment of the service request distribution device of the present invention.
[0051] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0052] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0053] It's important to note that LVS (Linux Virtual Server), as a load balancer, has long been used by major internet companies and is a relatively mature open-source product. Its principle is that a user's web request is sent to LVS, which then forwards the request to a real server in the backend cluster according to a preset load balancing algorithm. Since the backend server cluster provides the same service, the final return result is consistent regardless of which real server the user requests from, making the entire cluster transparent to the user. However, existing load balancing algorithms generally use mechanical round-robin, manually assigned servers, or server scheduling based on the number of connection requests. These methods do not consider the performance metrics of the real servers or the metrics affecting the service experience provided by the servers, leading to unreasonable request allocation and scheduling.
[0054] In view of the above-mentioned deficiencies, the present invention provides a service request distribution device, referring to... Figure 1 , Figure 1 This is a schematic diagram of the hardware operating environment of the device involved in the embodiment of the service request distribution device of the present invention.
[0055] like Figure 1 As shown, the service request distribution device may include: a processor 1001, such as a CPU; a communication bus 1002; a user interface 1003; a network interface 1004; and a memory 1005. The communication bus 1002 is used to implement communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The memory 1005 may be high-speed RAM or non-volatile memory, such as a disk drive. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0056] Those skilled in the art will understand that Figure 1 The hardware structure of the service request distribution device shown in the figure does not constitute a limitation on the service request distribution device. It may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0057] The present invention also provides a service request distribution method.
[0058] Before providing a further detailed description of the embodiments of the present invention, the nouns and terms involved in the embodiments of the present invention will be explained, and the nouns and terms involved in the embodiments of the present invention shall be subject to the following interpretations.
[0059] Examples of commonly used load balancing algorithms:
[0060] 1. Round-robin algorithm: All real hosts distribute requests evenly in turn, without considering the performance or service status of the real hosts;
[0061] 2. Weighted Algorithm: Weight values are manually set based on the host load. If a machine with a higher weight fails, it may cause most service requests to fail.
[0062] 3. Source or destination address algorithm: The IP request is fixed to the corresponding real host based on the source or destination address, and the traffic redirection situation when the backend real host is abnormal cannot be changed;
[0063] 4. Connection count algorithm: This method can determine the more active servers based on the number of request connections, and thus increase the distribution of requests to servers with fewer requests. However, the fewer connections to relatively inactive servers may be due to performance issues.
[0064] Reference Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of the service request distribution method of the present invention.
[0065] This invention provides an embodiment of a service request distribution method. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0066] In various embodiments of the service request distribution method, each embodiment is described with the service request distribution device as the execution subject. The service request distribution method includes:
[0067] Step S10: Upon receiving a service request, obtain the system resource parameters and response time parameters of each host;
[0068] LVS (Linux Virtual Server) is a mature open-source product widely used by major internet companies for load balancing. Its principle is that user web requests are sent to LVS, which then forwards the request to real servers in the backend cluster according to a preset load balancing algorithm. Since the backend server cluster provides the same service, the final return result is consistent regardless of which real server the user requests from, making the entire cluster transparent to the user. However, existing load balancing algorithms generally use mechanical round-robin, manually assigned servers, or server scheduling based on the number of connection requests. These methods do not consider the performance metrics of the real servers or the metrics affecting the service experience provided by the servers, leading to unreasonable request allocation and scheduling.
[0069] With the development of internet technology, financial institutions (banks, insurance companies, and securities firms) have increasingly higher requirements for service request distribution technology. However, the current service request distribution method seriously affects the work efficiency and stability of banks and other financial institutions.
[0070] To address the technical problem of low reliability in existing service request distribution schemes, this embodiment provides a service request distribution scheme.
[0071] In this embodiment, when the service request distribution device receives a service request, it needs to obtain the system resource parameters and response time parameters of each host. The system resource parameters refer to parameters reflecting the strength of the host's hardware performance, and these parameters are related to at least one of the following performance indicators: CPU usage, memory capacity, disk capacity, and network bandwidth. The response time parameter refers to the response time of the host in processing historical service requests.
[0072] Step S20: Determine the system remaining resource load rate based on the system resource parameters, and determine the response time load rate based on the response time parameters;
[0073] In this embodiment, after obtaining the system resource parameters, the remaining system resource load rate is determined based on the system resource parameters. The remaining system resource load rate includes at least one of the following: remaining memory load rate Sm, remaining network bandwidth load rate Sn, remaining disk capacity load rate Sd, and idle CPU load rate Sc.
[0074] After obtaining the response time parameters, the response time load rate is determined based on the response time parameters.
[0075] In one implementation scenario, the response time parameter includes the response time for processing each historical service request within each preset time period;
[0076] In step S20 above, the step of determining the response time load rate based on the response time parameter includes:
[0077] Step A1: Determine the average response time within each preset time period based on the response time for processing each historical service request within each preset time period;
[0078] Step A2: Calculate the standard deviation of the response time within each preset time period based on the average response time, and determine the mean of the standard deviation based on the standard deviation.
[0079] Step A3: Determine the difference between the standard deviation of the response time and the mean of the standard deviation within the preset time period in which the current time is located as the response time load rate.
[0080] Because response time metrics differ from system resource metrics, variations in application interface functions and computational loads lead to differences in response time. Response time is dynamic and cannot be judged based on averages or single data points. This embodiment assesses host response time stability based on the dispersion of response time data, innovatively using segmented sampling and standard deviation calculation to evaluate the response time of each host.
[0081] In this implementation scenario, the service request distribution device obtains the response time corresponding to the historical service requests whose start time (or end time) falls within each preset time period, with the response time parameter being the response time for processing each historical service request within each preset time period.
[0082] After obtaining the response time for processing each historical service request within each preset time period, the average response time of historical service requests within each preset time period can be calculated, that is,
[0083]
[0084] Wherein, AVG(T) is the average response time of historical service requests within a preset time period;
[0085] Ti is the response time of the i-th historical service request within the preset time period;
[0086] n represents the number of historical service requests within the preset time period.
[0087] Then, the standard deviation of the response time within each preset time period can be calculated using the standard deviation formula, which is:
[0088]
[0089] Where F(T) is the standard deviation of the response time of historical service requests within the preset time period;
[0090] Ti is the response time of the i-th historical service request within the preset time period;
[0091] AVG(T) is the average response time of historical service requests within the preset time period;
[0092] n represents the number of historical service requests within the preset time period.
[0093] The standard deviation corresponding to each preset time period can be calculated in the above manner. Then, the mean standard deviation AVG(F) is calculated based on the standard deviation corresponding to each preset time period. The difference between the standard deviation of the response time within the preset time period in which the current time is located and the mean of the standard deviation is used as the response time load rate.
[0094] Understandably, the number of preset time periods can be the total number of time periods since the host is powered on; or it can be the N most recent preset time periods calculated backward from the current time, which can reduce the amount of computation.
[0095] For example, if each time period is 5 minutes long, and the number of preset time periods is the three most recent preset time periods calculated backward from the current time, and the host boot time is 15:00, and the current time is 15:23, then the preset time periods are ① 15:00~15:05, ② 15:05~15:10, ③ 15:10~15:15, ④ 15:15~15:20, and ⑤ 15:20~15:23. Then, the standard deviations F(T3), F(T4), and F(T5) corresponding to preset time periods ③, ④, and ⑤ need to be calculated in the above manner. Then, the mean of the standard deviations of these three preset time periods, AVG(F), is calculated as (F(T3) + F(T4) + F(T5)) / 3. The standard deviation of the response time within the preset time period in which the current time is located is F(T5). Then, the response time load factor Q = F(T5) - AVG(F).
[0096] In one implementation scenario, the system resource parameters include maximum memory and memory utilization.
[0097] In step S20 above, the step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0098] Step B1: Determine the cluster memory baseline based on the maximum memory of each host;
[0099] Step B2: Based on the preset first formula, the cluster memory baseline, the maximum memory, and the memory utilization rate, determine the remaining memory load rate of each host. The preset first formula is:
[0100] Sm=Tm(1-Pm) / Bm,
[0101] Where Sm is the host's remaining memory load rate;
[0102] Tm is the maximum memory of the host;
[0103] Pm represents the host's memory usage.
[0104] Bm is the cluster memory baseline.
[0105] In this embodiment, the system resource parameters include the host's maximum memory and memory utilization rate. The host's maximum memory Tm refers to the host's maximum memory capacity, and the memory utilization rate Pm refers to the proportion of the host's currently used memory to the host's maximum memory.
[0106] After obtaining the maximum memory of each host, the average of the maximum memory of all hosts is calculated, which is the cluster memory baseline Bm. The specific formula is as follows:
[0107]
[0108] Where Bm is the cluster memory baseline;
[0109] Tm i Let i be the maximum memory of the i-th host;
[0110] n is the total number of hosts.
[0111] After determining the cluster memory baseline, the remaining memory load rate of each host can be determined based on the cluster memory baseline, maximum memory, memory utilization, and a preset first formula. The preset first formula is as follows:
[0112] Sm=Tm(1-Pm) / Bm,
[0113] Where Sm is the host's remaining memory load rate;
[0114] Tm is the maximum memory of the host;
[0115] Pm represents the host's memory usage.
[0116] Bm is the cluster memory baseline.
[0117] In one implementation scenario, the system resource parameters include maximum network bandwidth and network bandwidth utilization.
[0118] In step S20 above, the step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0119] Step C1: Determine the cluster network bandwidth baseline based on the maximum network bandwidth of each host;
[0120] Step C2: Based on the preset second formula, the cluster network bandwidth baseline, the maximum network bandwidth, and the network bandwidth utilization rate, determine the remaining network bandwidth load rate of each host. The preset second formula is as follows:
[0121] Sn=Tn(1-Pn) / Bn,
[0122] Where Sn is the host's remaining network bandwidth load rate;
[0123] Tn is the host's maximum network bandwidth;
[0124] Pn represents the network bandwidth utilization of the host;
[0125] Bn represents the baseline bandwidth of the cluster network.
[0126] In this embodiment, the system resource parameters include the host's maximum network bandwidth and network bandwidth utilization rate. The maximum network bandwidth Tn refers to the maximum amount of data that the host's network bandwidth can transmit per unit time, and the network bandwidth utilization rate Pn refers to the proportion of the amount of data transmitted by the host per unit time to the maximum network bandwidth.
[0127] After obtaining the maximum network bandwidth of each host, the average of the maximum network bandwidth of all hosts is calculated, which is the cluster network bandwidth baseline Bn. The specific formula is as follows:
[0128]
[0129] Wherein, Bn is the baseline bandwidth of the cluster network;
[0130] Tn i The maximum network bandwidth of the i-th host;
[0131] n is the total number of hosts.
[0132] After determining the cluster network bandwidth baseline, the remaining network bandwidth load rate of each host can be determined based on the cluster network bandwidth baseline, maximum network bandwidth, network bandwidth utilization, and a preset second formula. The preset second formula is as follows:
[0133] Sn=Tn(1-Pn) / Bn,
[0134] Where Sn is the host's remaining network bandwidth load rate;
[0135] Tn is the host's maximum network bandwidth;
[0136] Pn represents the network bandwidth utilization of the host;
[0137] Bn represents the baseline bandwidth of the cluster network.
[0138] In one implementation scenario, the system resource parameters include maximum disk capacity and disk utilization.
[0139] In step S20 above, the step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0140] Step D1: Determine the cluster disk capacity baseline based on the maximum disk capacity of each host;
[0141] Step D2: Determine the remaining disk capacity load rate of each host based on the cluster disk capacity baseline, the maximum disk capacity, and the disk utilization rate.
[0142] In this embodiment, the system resource parameters include the host's maximum disk capacity and disk utilization rate, where the disk utilization rate Pd refers to the proportion of the disk capacity currently used by the host to the maximum disk capacity.
[0143] After obtaining the maximum disk capacity of each host, the average of the maximum disk capacity of all hosts is calculated, which is the cluster disk capacity baseline Bd. The specific formula is as follows:
[0144]
[0145] Wherein, Bd is the baseline of cluster disk capacity;
[0146] Td i Let be the maximum disk capacity of the i-th host;
[0147] n is the total number of hosts.
[0148] After determining the cluster disk capacity baseline, the remaining disk capacity load rate of each host can be determined based on the cluster disk capacity baseline, maximum disk capacity, disk utilization rate, and the preset third formula.
[0149] The third formula is,
[0150] Sd = Td(1-Pd) / Bd,
[0151] Where Sd is the remaining disk capacity load rate of the host;
[0152] Td is the maximum disk capacity of the host;
[0153] Pd represents the host's disk usage.
[0154] Bd represents the baseline for cluster disk capacity.
[0155] In one implementation scenario, the system resource parameters include CPU time slices and corresponding CPU idle time;
[0156] In step S20 above, the step of determining the system's remaining resource load rate based on the system resource parameters includes:
[0157] Step E1: Determine the idle CPU load rate based on the CPU idle time and the CPU time slice.
[0158] In this embodiment, since CPU idle rate is a relatively special indicator, and the CPU's workload can fluctuate significantly in a short period of time, the calculation of CPU idle rate needs to be performed by sampling the indicator as quickly as possible. Therefore, system resource parameters include CPU time slices and corresponding CPU idle times. The CPU time slices and corresponding CPU idle times can be obtained directly through CPU performance monitoring tools, or through commands specific to different operating systems. For Linux systems, the TOP command can be used to visually output a snapshot of the resource usage of each process in the system, i.e., a CPU snapshot, and then the CPU time slice and corresponding CPU idle time can be determined based on the CPU snapshot.
[0159] Specifically, the TOP command is used to collect two sufficiently short CPU snapshots, denoted as C1 and C2 respectively. Both C1 and C2 are 9-tuples (user, nice, system, idle, iowait, irq, softirq, stealstolen, guest). The sum of the 9-tuples in C1 is then calculated to obtain S1, and the sum of the 9-tuples in C2 is calculated to obtain S2. The CPU time slice Ct is the difference between the sums of the two 9-tuple arrays, i.e., Ct = S2 - S1. The CPU idle time Δidle is the difference between the idle items in the two 9-tuple arrays, i.e., Δidle = idle2 - idle1. Finally, the idle CPU load rate Sc is determined based on the CPU idle time, CPU time slice, and the fourth formula, which is:
[0160]
[0161] Wherein, user represents the runtime in user mode accumulated from system startup to the current moment, excluding processes with negative nice values; nice represents the CPU time occupied by processes with negative nice values accumulated from system startup to the current moment; system represents the runtime in kernel mode accumulated from system startup to the current moment; idle represents the waiting time other than I / O waiting time accumulated from system startup to the current moment; iowait represents the I / O waiting time accumulated from system startup to the current moment; irq represents the hard interrupt time accumulated from system startup to the current moment; softirq represents the soft interrupt time accumulated from system startup to the current moment; stealstolen represents the time spent in other operating systems while running in the virtual environment accumulated from system startup to the current moment; and guest represents the time spent in the virtual CPU of the operating system under the control of the Linux kernel accumulated from system startup to the current moment.
[0162] Step S30: Determine the health score of each host based on the system's remaining resource load rate and response time load rate;
[0163] Remaining memory load rate Sm, remaining network bandwidth load rate Sn, remaining disk capacity load rate Sd, idle CPU load rate Sc, response time load rate R,
[0164] In this embodiment, the administrator of the service request distribution device pre-sets corresponding weight coefficients for each system resource parameter and response time parameter based on the different parameter priorities when selecting the host. The health score of the host is the product of the system resource parameter and the corresponding weight coefficient, and the sum of the product of the response time parameter and the corresponding weight coefficient.
[0165] The weighting coefficients for the remaining memory load rate Sm are Wm, the remaining network bandwidth load rate Sn is Wn, the remaining disk capacity load rate Sd is Wd, the idle CPU load rate Sc is Wc, and the response time load rate Q is Wq. If the system resource parameters include Sm, Sn, Sd, and Sc, then the host's health score G = Sm*Wm + Sn*Wn + Sn*Wn + Sd*Wd + Sc*Wc + Q*Wq.
[0166] Optionally, considering that the difference in measurement units between different parameters may lead to a large difference in the calculated load rate values, amplification or reduction coefficients can be added to the corresponding terms in the above formula as needed.
[0167] Step S40: Distribute the service request to the host based on the health score.
[0168] In this embodiment, after determining the health score of each host, service requests can be distributed according to the host's health score. The distribution principle is that the higher the health score, the more service requests are distributed to that host, and the lower the health score, the fewer service requests are distributed to that host.
[0169] This embodiment obtains system resource parameters and response time parameters of each host upon receiving a service request; determines the remaining system resource load rate based on the system resource parameters and the response time load rate based on the response time parameters; determines the health score of each host based on the remaining system resource load rate and the response time load rate; and distributes the service request to the host based on the health score. This achieves a comprehensive evaluation of the host's health score based on both performance metrics and service experience metrics (response time), and then distributes requests to the host based on the health score, thereby improving the rationality and reliability of service request allocation and scheduling.
[0170] Furthermore, a second embodiment of the service request distribution method of the present invention is proposed, wherein step S40 above includes:
[0171] Step F1: Calculate the sum of the health scores of each host, and determine the ratio of the health score of each host to the sum;
[0172] Step F2: Distribute the service request to the host according to the ratio.
[0173] In this embodiment, a method is provided for distributing service requests according to the ratio of the health score of each host to the sum of the health scores of all hosts.
[0174] Specifically, the total number of service requests to be distributed is determined. Based on the ratio and the total number, the number of service requests to be allocated to the responding host is determined. Then, the corresponding number of service requests are distributed to the corresponding host according to this ratio. For example, if the ratios calculated for hosts A, B, and C are 0.23, 0.35, and 0.42, respectively, and the total number of service requests to be distributed is 1000, then the number of requests distributed to hosts A, B, and C will be 230, 350, and 420, respectively.
[0175] The present invention also provides a service request distribution device.
[0176] Reference Figure 3 , Figure 3 This is a functional module diagram of a first embodiment of the service request distribution device of the present invention. The service request distribution device includes:
[0177] The acquisition module 10 is used to acquire the system resource parameters and response time parameters of each host when a service request is received;
[0178] The load rate determination module 20 is used to determine the remaining resource load rate of the system based on the system resource parameters, and to determine the response time load rate based on the response time parameters.
[0179] The score determination module 30 is used to determine the health score of each host based on the system's remaining resource load rate and response time load rate.
[0180] The request distribution module 40 is used to distribute the service request to the host based on the health score.
[0181] Furthermore, the response time parameter includes the response time for processing each historical service request within each preset time period;
[0182] The load rate determination module is also used for:
[0183] The average response time within each preset time period is determined based on the response time for processing each historical service request within each preset time period.
[0184] Calculate the standard deviation of the response time within each preset time period based on the average response time, and determine the mean of the standard deviation based on the standard deviation.
[0185] The difference between the standard deviation of the response time within the preset time period in which the current time is located and the mean of the standard deviation is determined as the response time load rate.
[0186] Furthermore, the system resource parameters include maximum memory and memory utilization.
[0187] The load rate determination module is also used for:
[0188] Determine the cluster memory baseline based on the maximum memory of each host;
[0189] Based on a preset first formula, the cluster memory baseline, the maximum memory, and the memory utilization rate, the remaining memory load rate of each host is determined. The preset first formula is as follows:
[0190] Sm=Tm(1-Pm) / Bm,
[0191] Where Sm is the host's remaining memory load rate;
[0192] Tm is the maximum memory of the host;
[0193] Pm represents the host's memory usage.
[0194] Bm is the cluster memory baseline.
[0195] Furthermore, the system resource parameters include maximum network bandwidth and network bandwidth utilization.
[0196] The load rate determination module is also used for:
[0197] Determine the cluster network bandwidth baseline based on the maximum network bandwidth of each host;
[0198] Based on the preset second formula, the cluster network bandwidth baseline, the maximum network bandwidth, and the network bandwidth utilization rate, the remaining network bandwidth load rate of each host is determined. The preset second formula is as follows:
[0199] Sn=Tn(1-Pn) / Bn,
[0200] Where Sn is the host's remaining network bandwidth load rate;
[0201] Tn is the host's maximum network bandwidth;
[0202] Pn represents the network bandwidth utilization of the host;
[0203] Bn represents the baseline bandwidth of the cluster network.
[0204] Furthermore, the system resource parameters include maximum disk capacity and disk utilization.
[0205] The load rate determination module is also used for:
[0206] Determine the cluster disk capacity baseline based on the maximum disk capacity of each host;
[0207] The remaining disk capacity load rate of each host is determined based on the cluster disk capacity baseline, the maximum disk capacity, and the disk utilization rate.
[0208] Furthermore, the system resource parameters include CPU time slices and corresponding CPU idle times;
[0209] The load rate determination module is also used for:
[0210] The idle CPU load rate is determined based on the CPU idle time and the CPU time slice.
[0211] Furthermore, the request distribution module is also used for:
[0212] Calculate the sum of the health scores of each host, and determine the ratio of the health score of each host to the sum;
[0213] The service request is distributed to the host according to the ratio.
[0214] The specific implementation of the service request distribution device of the present invention is basically the same as the various embodiments of the service request distribution method described above, and will not be repeated here.
[0215] Furthermore, embodiments of the present invention also propose a computer-readable storage medium.
[0216] A service request dispatcher is stored on a computer-readable storage medium, and when the service request dispatcher is executed by a processor, it implements the steps of the service request dispatching method as described above.
[0217] The specific implementation of the computer-readable storage medium of the present invention is basically the same as the embodiments of the service request distribution method described above, and will not be repeated here.
[0218] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many modifications under the guidance of the present invention without departing from the spirit and scope of the claims. All equivalent structural or procedural transformations made using the content of the present invention specification and drawings, or direct or indirect applications in other related technical fields, are within the protection scope of the present invention.
Claims
1. A service request distribution method, characterized in that, The service request distribution method includes the following steps: Upon receiving a service request, the system resource parameters and response time parameters of each host are obtained; the response time parameters include the response time for processing each historical service request within each preset time period; the remaining system resource load rate is determined based on the system resource parameters; wherein, the system resource parameters include maximum memory and memory utilization; determining the remaining system resource load rate based on the system resource parameters includes: determining the cluster memory baseline based on the maximum memory of each host; and determining the remaining memory load rate of each host based on a preset first formula, the cluster memory baseline, the maximum memory, and the memory utilization, wherein the preset first formula is: Where Sm is the host's remaining memory load rate; Tm is the host's maximum memory; Pm is the host's memory utilization rate; and Bm is the cluster memory baseline. The average response time within each preset time period is determined based on the response time for processing each historical service request within each preset time period. Calculate the standard deviation of the response time within each preset time period based on the average response time, and determine the mean of the standard deviation based on the standard deviation. The difference between the standard deviation of the response time within the preset time period in which the current time is located and the mean of the standard deviation is determined as the response time load rate; The health score of each host is determined based on the system's remaining resource load rate and response time load rate. The service request is distributed to the host based on the health score.
2. The service request distribution method as described in claim 1, characterized in that, The system resource parameters include maximum network bandwidth and network bandwidth utilization. The step of determining the system's remaining resource load rate based on the system resource parameters includes: Determine the cluster network bandwidth baseline based on the maximum network bandwidth of each host; Based on the preset second formula, the cluster network bandwidth baseline, the maximum network bandwidth, and the network bandwidth utilization rate, the remaining network bandwidth load rate of each host is determined. The preset second formula is as follows: , Where Sn is the host's remaining network bandwidth load rate; Tn is the host's maximum network bandwidth; Pn represents the network bandwidth utilization of the host; Bn represents the baseline bandwidth of the cluster network.
3. The service request distribution method as described in claim 1, characterized in that, The system resource parameters include maximum disk capacity and disk utilization. The step of determining the system's remaining resource load rate based on the system resource parameters includes: Determine the cluster disk capacity baseline based on the maximum disk capacity of each host; The remaining disk capacity load rate of each host is determined based on the cluster disk capacity baseline, the maximum disk capacity, and the disk utilization rate.
4. The service request distribution method as described in claim 1, characterized in that, The system resource parameters include CPU time slices and corresponding CPU idle time; The step of determining the system's remaining resource load rate based on the system resource parameters includes: The idle CPU load rate is determined based on the CPU idle time and the CPU time slice.
5. The service request distribution method as described in claim 1, characterized in that, The step of distributing the service request to the host based on the health score includes: Calculate the sum of the health scores of each host, and determine the ratio of the health score of each host to the sum; The service request is distributed to the host according to the ratio.
6. A service request distribution device, characterized in that, The service request distribution device includes: The acquisition module is used to acquire system resource parameters and response time parameters of each host when a service request is received; the response time parameters include the response time for processing each historical service request within each preset time period. The load rate determination module is used to determine the remaining resource load rate of the system based on the system resource parameters, determine the average response time within each preset time period based on the response time of processing each historical service request within each preset time period, calculate the standard deviation of the response time within each preset time period based on the average response time, and determine the mean of the standard deviation based on the standard deviation; the difference between the standard deviation of the response time within the preset time period in which the current time is located and the mean of the standard deviation is determined as the response time load rate; wherein, the system resource parameters include maximum memory and memory utilization rate; determining the remaining resource load rate of the system based on the system resource parameters includes: determining the cluster memory baseline based on the maximum memory of each host; determining the remaining memory load rate of each host based on a preset first formula, the cluster memory baseline, the maximum memory, and the memory utilization rate, wherein the preset first formula is: Where Sm is the host's remaining memory load rate; Tm is the host's maximum memory; Pm is the host's memory utilization rate; and Bm is the cluster memory baseline. The score determination module is used to determine the health score of each host based on the system's remaining resource load rate and response time load rate. The request distribution module is used to distribute the service request to the host based on the health score.
7. A service request distribution device, characterized in that, The service request distribution device includes a memory, a processor, and a service request distribution program stored in the memory and executable on the processor. When executed by the processor, the service request distribution program implements the steps of the service request distribution method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a service request dispatch program, which, when executed by a processor, implements the steps of the service request dispatch method as described in any one of claims 1-5.