Search

CN-122027697-A - Request scheduling method and device

CN122027697ACN 122027697 ACN122027697 ACN 122027697ACN-122027697-A

Abstract

The application provides a request scheduling method and a request scheduling device, the method is applied to a reverse proxy gateway, the reverse proxy gateway is deployed between a client and a plurality of service nodes, the method comprises the steps of collecting multidimensional performance indexes of the plurality of service nodes based on preset trigger conditions, calculating smooth values of the performance indexes based on historical data of the performance indexes in a sliding time window aiming at each multidimensional performance index, calculating dynamic health indexes of the service nodes based on the smooth values of the multidimensional performance indexes, calculating comprehensive scheduling scores of the service nodes according to the dynamic health indexes, real-time concurrent connection numbers and dynamic weight factors aiming at each service node, selecting a target node which is optimal in comprehensive evaluation among health, real-time external loads and historical response feedback among the plurality of service nodes based on the comprehensive scheduling scores, and forwarding the client request to the target node. The application can distribute the client requests to the proper nodes, thereby realizing the comprehensive improvement of service performance and overall stability.

Inventors

  • CHEN YUXIN

Assignees

  • 北京五八信息技术有限公司

Dates

Publication Date
20260512
Application Date
20260129

Claims (10)

  1. 1. A request scheduling method applied to a reverse proxy gateway, wherein the reverse proxy gateway is deployed between a client and a plurality of service nodes, the method comprising: Based on a preset trigger condition, acquiring multidimensional performance indexes of the plurality of service nodes, and calculating a smooth value of the performance indexes based on historical data of the performance indexes in a sliding time window aiming at each dimensional performance index; for each service node, calculating a dynamic health index of the service node based on a smooth value of a multidimensional performance index corresponding to the service node, wherein the dynamic health index comprehensively represents the health state of the service node; For each service node, calculating the comprehensive scheduling score of the service node according to the dynamic health index, the real-time concurrent connection number and the dynamic weight factor of the service node, wherein the dynamic weight factor of the service node is dynamically adjusted based on the historical response result of the service node for processing the client request; And selecting a target node from the service nodes based on comprehensive scheduling scores corresponding to the service nodes respectively, forwarding the received client request to the target node, wherein the target node is determined based on the comprehensive scheduling scores, comprehensively evaluating the optimal service node among health, real-time external load and historical response feedback, and the dynamic weight factor is the quantized representation of the historical response feedback.
  2. 2. The method of claim 1, wherein the integrated scheduling score is inversely related to the dynamic health index, positively related to the number of real-time concurrent connections and the dynamic weight factor, and wherein the dynamic health index of the service node is positively related to the health of the service node; the selecting a target node from the plurality of service nodes based on the comprehensive scheduling scores respectively corresponding to the plurality of service nodes includes: Selecting a service node with the lowest comprehensive scheduling score from the plurality of service nodes, and determining the selected service node as the target node; the adjustment rule of the dynamic weight factor is that if the historical response result fails or overtime, the dynamic weight factor is increased, and if the historical response result indicates continuous success, the dynamic weight factor is decreased.
  3. 3. The method of claim 1, wherein the acquiring the multidimensional performance index of the plurality of service nodes based on the preset trigger condition comprises at least one of: collecting multidimensional performance indexes of the plurality of service nodes according to a preset collection period; Based on a preset trigger event, acquiring multidimensional performance indexes of the plurality of service nodes, wherein the preset trigger event comprises at least one of a service node abnormal event, a service node change event and an external instruction event.
  4. 4. The method of claim 1, wherein calculating a smoothed value of the performance indicator for each dimension of the performance indicator based on historical data of the performance indicator within the sliding time window comprises: Carrying out EWMA index weighted moving average smoothing treatment on each dimension performance index by adopting a formula I to obtain a smoothing value of each dimension performance index: Equation one Wherein, the A smoothed value representing the performance indicator at the current time, Aggregate sample values representing the performance indicators at the current time, Representing the coefficient of smoothing and the coefficient of smoothing, The smoothed value maintained by the performance index before the present calculation is represented, which is obtained by recursive calculation, equivalent to exponentially weighted averaging of the historical data of the performance index in the sliding time window.
  5. 5. The method according to claim 1 or 4, wherein calculating the dynamic health index of the service node based on the smoothed value of the multidimensional performance index corresponding to the service node comprises: mapping the smooth values of the performance indexes of each dimension corresponding to the service nodes to a unified scale interval according to a preset rule; and carrying out weighted summation on index values of the performance indexes of each dimension mapped to the unified scale interval by combining the corresponding weights to obtain the dynamic health index of the service node.
  6. 6. The method of claim 5, wherein the index value of the performance index of each dimension mapped to the uniformly scaled interval is positively correlated with the index quality; The step of carrying out weighted summation on index values of the performance indexes of each dimension mapped to the unified scale interval and combining the corresponding weights to obtain the dynamic health index of the service node comprises the following steps: based on the currently effective weight configuration, weighting and calculating index values of all the dimension performance indexes mapped to the unified scale interval to obtain dynamic health indexes corresponding to the service nodes, wherein the dynamic health indexes are comprehensive indexes for fusing the health evaluation conditions of the multi-dimension performance indexes to the service nodes; The weight support corresponding to each dimension performance index is dynamically adjusted based on at least one of a preset strategy, a historical scheduling effect and a machine learning model, and the dimension performance index comprises at least two of CPU utilization rate, memory utilization rate, request response time, request error rate and network delay.
  7. 7. The method as recited in claim 5, further comprising: In response to monitoring that an abnormal service node occurs in the plurality of service nodes, triggering a decay and recovery process, and updating a dynamic health index of the abnormal service node based on a formula II: Formula II In order to update the dynamic health index, In order to update the pre-update dynamic health index, In order for the attenuation coefficient to be a factor, Is a resume term for smooth back-up; Responding to the abnormal service node to restore normal state and after a period of time, exiting the current attenuation and restoration flow, and restoring the dynamic health index calculation flow based on weighted summation; the abnormal conditions of the abnormal service node comprise at least one of network connection interruption or heartbeat loss, abrupt change of performance index, abrupt change of dynamic health index and node fault warning.
  8. 8. The method of claim 2, wherein calculating the integrated scheduling score for the service node based on the dynamic health index, the number of real-time concurrent connections, and the dynamic weighting factor for the service node comprises: According to the dynamic health index, the real-time concurrent connection number and the dynamic weight factor of the service node, calculating the comprehensive scheduling score of the service node by adopting a formula III: Formula III Wherein, the Representing the integrated scheduling score of the ith serving node, Representing the dynamic health index of the ith service node, Representing a constant that is greater than 0, Representing the number of real-time concurrent connections of the ith serving node, And the dynamic weight factor of the ith service node is represented, the value of i is 1-m, and m is the number of a plurality of service nodes.
  9. 9. The method as recited in claim 1, further comprising: responding to the client request to be forwarded to the target node and completing processing, and receiving a request execution result returned by the target node; Updating the relevant performance indexes of the target node according to the request execution result, wherein the relevant performance indexes are at least part of the multidimensional performance indexes; and recalculating the dynamic health index of the target node based on the latest multidimensional performance index corresponding to the target node so as to be applied to scheduling decisions of subsequent client requests.
  10. 10. A request scheduling apparatus for use in a reverse proxy gateway, the reverse proxy gateway disposed between a client and a plurality of service nodes, the apparatus comprising: The acquisition and calculation module is used for acquiring the multidimensional performance indexes of the service nodes based on preset trigger conditions and calculating the smooth value of the performance indexes based on the historical data of the performance indexes in the sliding time window aiming at each dimensional performance index; the computing module is used for computing a dynamic health index of each service node based on a smooth value of the multidimensional performance index corresponding to the service node, wherein the dynamic health index comprehensively represents the health state of the service node; the calculation processing module is used for calculating the comprehensive scheduling score of each service node according to the dynamic health index, the real-time concurrent connection number and the dynamic weight factor of the service node, wherein the dynamic weight factor of the service node is dynamically adjusted based on the historical response result of the service node for processing the client request; The scheduling module is used for selecting a target node from the service nodes based on comprehensive scheduling scores corresponding to the service nodes respectively, forwarding the received client request to the target node, wherein the target node is determined based on the comprehensive scheduling scores, comprehensively evaluating the optimal service node among health degree, real-time external load and historical response feedback, and the dynamic weight factor is the quantized representation of the historical response feedback.

Description

Request scheduling method and device Technical Field The application belongs to the field of computers, and particularly relates to a request scheduling method and device. Background A distributed system refers to a system formed by interconnecting a plurality of independent computing nodes through a network, wherein the nodes work cooperatively and externally represent a unified system, can share resources, coordinate computing tasks and provide reliable services. The reverse proxy is located between the client and the server, and is used for receiving the client request and forwarding the client request to the middle layer of the internal service node, so that the internal network structure can be hidden and load balancing can be realized. In the existing distributed system and micro-service architecture, the mainstream reverse proxy system is represented by Nginx, HAProxy, and the load balancing scheduling mechanism generally adopts a static or semi-static algorithm. Such algorithms lack real-time sensing and dynamic feedback capabilities of the backend node state at run-time, embodied in the following fixed patterns: 1. And polling, sequentially distributing requests according to a preset sequence, and disregarding the node load difference. 2. The minimum connection is decided only according to the instantaneous connection number, and the processing capacity of the node is not considered. 3. The weighting is random, the flow is distributed according to the preset fixed weight, and the weight cannot be adjusted along with the performance change of the node. The implementation of the simple fixed algorithm lacks the capability of real-time sensing and dynamic feedback of the node running state in a large-scale distributed environment with highly dynamic changes of node states and network conditions (such as real-time fluctuation of factors such as CPU (Central Processing Unit, central processing unit) load, memory occupation, thread pool congestion, link delay and jitter), and the following problems are easily caused: 1. The existing system lacks a continuous acquisition mechanism for node indexes, cannot acquire enough historical data sequences, and the scheduling decision can only be based on instantaneous sampling values, is greatly influenced by instantaneous jitter, and is easy to cause the problem of frequent switching or incorrect judgment of node states, so that the system is unstable. 2. The node priority cannot be automatically corrected according to the real-time performance (such as response timeout or error) of the node, so that the error node is continuously selected. In summary, the static load balancing mechanism of the traditional reverse proxy lacks dynamic sensing and feedback capability, and is easy to distribute the request to unsuitable nodes, so that response delay is increased, the request is piled up, and even avalanche effect is induced, thereby affecting the usability and stability of the system. Disclosure of Invention In view of the foregoing, embodiments of the present application provide a request scheduling method and apparatus that overcomes or at least partially solves the foregoing problems. In a first aspect, an embodiment of the present application provides a request scheduling method, which is applied to a reverse proxy gateway, where the reverse proxy gateway is disposed between a client and a plurality of service nodes, and the method includes: Based on a preset trigger condition, acquiring multidimensional performance indexes of the plurality of service nodes, and calculating a smooth value of the performance indexes based on historical data of the performance indexes in a sliding time window aiming at each dimensional performance index; for each service node, calculating a dynamic health index of the service node based on a smooth value of a multidimensional performance index corresponding to the service node, wherein the dynamic health index comprehensively represents the health state of the service node; For each service node, calculating the comprehensive scheduling score of the service node according to the dynamic health index, the real-time concurrent connection number and the dynamic weight factor of the service node, wherein the dynamic weight factor of the service node is dynamically adjusted based on the historical response result of the service node for processing the client request; And selecting a target node from the service nodes based on comprehensive scheduling scores corresponding to the service nodes respectively, forwarding the received client request to the target node, wherein the target node is determined based on the comprehensive scheduling scores, comprehensively evaluating the optimal service node among health, real-time external load and historical response feedback, and the dynamic weight factor is the quantized representation of the historical response feedback. In a second aspect, an embodiment of the present application provides a r