WO2022183802A1 - 一种负载均衡方法及装置、设备、存储介质、计算机程序产品 - Google Patents

一种负载均衡方法及装置、设备、存储介质、计算机程序产品 Download PDF

Info

Publication number
WO2022183802A1
WO2022183802A1 PCT/CN2021/136449 CN2021136449W WO2022183802A1 WO 2022183802 A1 WO2022183802 A1 WO 2022183802A1 CN 2021136449 W CN2021136449 W CN 2021136449W WO 2022183802 A1 WO2022183802 A1 WO 2022183802A1
Authority
WO
WIPO (PCT)
Prior art keywords
target server
target
server
data structure
response time
Prior art date
Application number
PCT/CN2021/136449
Other languages
English (en)
French (fr)
Inventor
王波
Original Assignee
深圳前海微众银行股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2022183802A1 publication Critical patent/WO2022183802A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/505Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the load

Definitions

  • the embodiments of the present application relate to, but are not limited to, the information technology of financial technology (Fintech), and in particular, relate to a load balancing method and apparatus, device, storage medium, and computer program product.
  • Embodiments of the present application provide a load balancing method and apparatus, device, storage medium, and computer program product.
  • the embodiment of the present application provides a load balancing method, the method includes:
  • the data elements in the data structure at least include a response time prediction value and a server identification (Identity, ID);
  • the updated response time prediction value is updated into the first target element, and the execution result is sent to the client.
  • the embodiment of the present application provides a load balancing method, the method includes:
  • the proxy of the first target server receives the URL request sent by the analyzer of the load balancer
  • the response node data structure includes: the total number of requests of the first target server, the total response time of the first target server and the first target server. The number of accumulated requests to the target server;
  • An embodiment of the present application provides a load balancing device, and the device includes:
  • the first determining part is configured to determine a corresponding data structure based on the URL in the URL request sent by the client; the data elements in the data structure at least include a response time prediction value and a server ID;
  • a second determining part is configured to determine a data element with the smallest response time prediction value from the data structure as a first target element, and send the URL request to the first target element based on the server ID of the first target element the proxy of the target server;
  • the first receiving part is configured to receive the response result returned by the proxy of the first target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • the first update part is configured to update the updated response time prediction value into the first target element, and send the execution result to the client.
  • An embodiment of the present application provides a load balancing device, and the device includes:
  • the third receiving part is configured as the proxy of the first target server to receive the URL request sent by the analyzer of the load balancer;
  • the update part is configured to update the response time of the current URL request to the response node data structure of the first target server;
  • the response node data structure includes: the total number of requests of the first target server, the The total response time and the number of accumulated requests for the first target server;
  • a determining part configured to determine an updated response time prediction value according to the total number of requests of the first target server, the total response time of the first target server and the accumulated number of requests of the first target server;
  • an encapsulation part configured to encapsulate the updated response time prediction value and the execution result of the URL request into an extended protocol message
  • the sending part is configured to send the extended protocol packet as a response result to the analyzer of the load balancer.
  • An embodiment of the present application provides a load balancing device, including a memory and a processor, where the memory stores a computer program that can be run on the processor, and the processor implements the steps in the above method when the processor executes the program.
  • Embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, implements the steps in the above method.
  • Embodiments of the present application provide a computer program product configured to store computer-readable instructions, which, when executed, cause a computer to execute the steps in the above method.
  • the corresponding data structure is determined based on the URL in the URL request sent by the client; the data elements in the data structure at least include the response time prediction value and the server ID; The data element with the smallest time prediction value is determined as the first target element, and based on the server ID of the first target element, the URL request is sent to the proxy of the first target server; Response result, wherein the response result includes at least the execution result of the URL request and the updated response time prediction value; update the updated response time prediction value into the first target element, and update the execution result sent to the client.
  • the response result at least includes the execution result of the URL request and the updated response time prediction value, and the original execution result on the load balancing analyzer
  • the computation is distributed on the first target server, reducing the CPU consumption of the load balancer.
  • FIG. 1 is a schematic diagram of an implementation flowchart of a load balancing method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an implementation flow of a load balancing method provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of an implementation flowchart of a load balancing method provided by an embodiment of the present application
  • FIG. 4 is a schematic diagram of an implementation flowchart of a load balancing method provided by an embodiment of the present application
  • FIG. 5 is a schematic diagram of an implementation flowchart of a load balancing method provided by an embodiment of the present application
  • FIG. 6 is a schematic diagram of an implementation flow of a load balancing method provided by an embodiment of the present application.
  • FIG. 7A is a schematic diagram of a load balancing method in the related art
  • FIG. 7B is a schematic diagram of an implementation flow of a load balancing method in the related art.
  • 7C is a schematic structural diagram of request information in the related art.
  • FIG. 7D is a schematic diagram of a load balancing method provided by an embodiment of the present application.
  • FIG. 7E is a schematic structural diagram of an extended protocol message provided by an embodiment of the present application.
  • FIG. 8A is a schematic diagram of a data structure provided by an embodiment of the present application.
  • FIG. 8B is a schematic diagram of a data structure provided by an embodiment of the present application.
  • FIG. 8C is a schematic diagram of a data structure related to a server request provided by an embodiment of the present application.
  • 8D is a schematic structural diagram of an extended protocol packet provided by an embodiment of the present application.
  • FIG. 9A is a schematic diagram of the composition and structure of a load balancing apparatus provided by an embodiment of the present application.
  • FIG. 9B is a schematic diagram of the composition and structure of a load balancing apparatus provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a hardware entity of a load balancing device in an embodiment of the present application.
  • first ⁇ second ⁇ third is only used to distinguish similar objects, and does not represent a specific ordering of objects. It is understood that “first ⁇ second ⁇ third” is used in Where permitted, the specific order or sequence may be interchanged to enable the embodiments of the application described herein to be practiced in sequences other than those illustrated or described herein.
  • FIG. 1 is a schematic diagram of an implementation flow of the load balancing method provided by an embodiment of the present application. As shown in FIG. 1 , the method includes:
  • Step S101 determining the corresponding data structure based on the URL in the URL request sent by the client; the data elements in the data structure at least include a response time prediction value and a server ID;
  • the client may be a requester that sends a resource request.
  • the interaction process among the requester who issued the resource request, the load balancer and the background server (server, target server) is as follows: the requester who issued the resource request sends the URL request to the analyzer of the load balancer , the analyzer locates its own data structure according to the requested Uniform Resource Locator (URL), for example, a map (Map) + linked list (List) structure, and selects the minimum response time prediction value from the data structure
  • URL Uniform Resource Locator
  • the data element, the data element with the minimum predicted value of the response time is used as the target element, and the URL request is sent to the proxy of the target server (background server) corresponding to the target element;
  • the proxy (Proxy) of the background server receives After reaching the URL request, according to the response time of responding to the URL request, calculate the time prediction value of responding to the URL request when the URL request is received next time;
  • the execution result of the request is sent to the analyzer of the load balancer together; the analyzer of the load balancer returns the execution result to the requester
  • the data structure may be any structure for storing data, for example, an array, a stack, a queue, a linked list (List), a tree, a hash table, a heap, and a map (Map).
  • the data elements stored in the data structure may be data elements (Entry), and the Entry includes the following content: 1) key-value pair key, value, where key is used to store the server
  • the identifier (ID) each described server ID corresponds to an information resource, and each information resource corresponds to a unique URL; value is used to store the information requested by the server, including: server ID, response time prediction value (time) and weight value (weight).
  • the response time prediction value is the time prediction value for responding to the URL request when the URL request is received next time.
  • the weight value is used to represent the priority of each server. For example, the weight is set to 3 for the server with 2 CPUs, and the weight value is set for the server with 4 central processing units (Central Processing Unit, CPU). It is 6, the higher the weight, the better the performance of the server in responding to the request. 2) pre, pro, next, where pre means pointing to the previous element of the element in the ordered linked list; pro means pointing to the next element of the element in the ordered linked list; next means pointing to the current subscript in the Map corresponding to the linked list The element that follows this element.
  • Step S102 determining the data element with the smallest response time prediction value as the first target element from the data structure, and sending the URL request to the agent of the first target server based on the server ID of the first target element;
  • the data element with the smallest response time prediction value indicates that the corresponding backend server has a more efficient ability to respond to the URL request, and the time to respond to the URL request is shorter.
  • the data element with the smallest response time prediction value may be one data element, or may be multiple data elements with the same response time prediction value.
  • the analyzer of the load balancer when the minimum value of time corresponds to one data element (Entry), the analyzer of the load balancer requests the server corresponding to the Entry; when the minimum value of time corresponds to at least two Entry, if each If the weight value of an Entry is the same, the analyzer requests a target server according to the first random method; if the weight value of each Entry is different, the analyzer selects a target server to request according to the second random method.
  • the proxy of the target server receives the URL request, the first random method is an equal probability selection method, and the second random method is a non-equi probability method.
  • 3 servers when selecting according to the non-equi-probability method, 3 servers have weight values of 3, 2, and 1 respectively. At this time, the total weight is 6, and the probability of each server being selected is 0.5, 0.33, and 0.17 to select a target. server.
  • the weights of 3 servers are 1, 1, and 1, respectively. At this time, the total weight is 3, and the probability of each server being selected is the same.
  • Step S103 receiving the response result returned by the agent of the first target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • the proxy (Proxy) of the first target server is the entrance of the request, and the proxy shares a part of the computing responsibilities originally undertaken by the load balancer, which can reduce the pressure on the load balancer.
  • the execution result is obtained according to the Proxy's response to the request, and the updated response time prediction value is calculated according to the execution result, that is, a part of the calculation responsibility originally undertaken by the load balancer is shared.
  • the execution result of the URL request is the execution result of the content of the URL request by the background server.
  • Step S104 Update the updated response time prediction value into the first target element, and send the execution result to the client.
  • the analyzer updates the parsed response time prediction value to the time of the Entry (curEntry). Since the time value changes, the position of curEntry in the list may also change, so it is necessary to determine whether curEntry needs to be processed. Reordering operations, including:
  • Step S11 the analyzer compares the time value (curEntryTime) of curEntry with the time (preEntryTime) value of the previous Entry (preEntry);
  • Step S12 if it is less than preEntryTime, continue to compare until the first Entry (targetEntry) less than or equal to curEntryTime is encountered, or, reaching the head of the linked list, then remove the Entry from the original position, and insert after curEntryTime or the head of the linked list;
  • Step S13 if it is greater than preEntryTime, compare it with the time (proEntryTime) value of the next element (proEntry), and if it is greater than proEntryTime, continue to search backward until the first Entry (targetEntry) greater than or equal to curEntryTime is encountered, or the end of the linked list. , and then remove the Entry from its original position and insert it before the targetEntry or at the end of the linked list;
  • Step S14 if it is greater than preEntryTime and less than proEntryTime, or equal to any one of the two, the element position remains unchanged.
  • the corresponding data structure is determined based on the URL in the URL request sent by the client; the data elements in the data structure at least include the response time prediction value and the server ID; The data element with the smallest time prediction value is determined as the first target element, and based on the server ID of the first target element, the URL request is sent to the proxy of the first target server; Response result, wherein the response result includes at least the execution result of the URL request and the updated response time prediction value; update the updated response time prediction value into the first target element, and update the execution result sent to the client.
  • the response result at least includes the execution result of the URL request and the updated response time prediction value, and the original execution result on the load balancing analyzer
  • the computation is distributed on the first target server, reducing the CPU consumption of the load balancer.
  • FIG. 2 is a schematic diagram of an implementation flow of the load balancing method provided by an embodiment of the present application. As shown in FIG. 2 , the method includes:
  • Step S201 based on the URL in the URL request sent by the client, determine the corresponding data structure; the data elements in the data structure at least include the response time prediction value and the server ID;
  • Step S202 from the data structure, the data element with the minimum response time prediction value is determined as the first target element, and based on the server ID of the first target element, the URL request is sent to the agent of the first target server;
  • Step S203 in the case that the response result returned by the agent of the first target server is not received over time, from the data structures other than the first target element, determine the data element with the smallest response time prediction value as the first target element.
  • Two target elements, and based on the server ID of the second target element, the URL request is sent to the proxy of the second target server;
  • the analyzer re-selects a target server to request according to preset conditions when the request time-out does not return.
  • re-selecting a target service can ensure that the current request is processed normally.
  • the preset condition is: call the min(copyList) method, and copyList is a copy of the current List.
  • copyList is a copy of the current List.
  • Step S204 receiving the response result returned by the agent of the second target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • Step S205 updating the updated response time prediction value into the second target element, and sending the execution result to the client.
  • the data with the smallest response time prediction value is selected from the data structures other than the first target element.
  • the element is determined as the second target element, and based on the server ID of the second target element, the URL request is sent to the proxy of the second target server, so that the target server that cannot respond to the request can be removed from the server cluster, Dynamically adjusting the list of selectable servers increases the probability that the target server will respond to the request, thereby improving the effectiveness of the load balancer in sending requests.
  • FIG. 3 is a schematic diagram of an implementation flow of the load balancing method provided by the embodiment of the present application. As shown in FIG. 3 , the method includes:
  • Step S301 based on the URL in the URL request sent by the client, determine the corresponding data structure; the data elements in the data structure at least include the response time prediction value and the server ID;
  • Step S302 from the data structure, determine the data element with the smallest response time prediction value as the first target element, and send the URL request to the agent of the first target server based on the server ID of the first target element;
  • Step S303 in the case that the response result returned by the proxy of the first target server is not received over time, create a copy of the data structure
  • Step S304 removing the first target element from the copy of the data structure
  • the entry corresponding to the request timeout server is removed from the copy of the data structure (copyList) to ensure that other entries are selected.
  • Step S305 from the updated copy, determine the data element with the smallest response time prediction value as the second target element, and send the URL request to the second target server based on the server ID of the second target element. acting;
  • Step S306 receiving the response result returned by the agent of the second target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • Step S307 Update the updated response time prediction value into the second target element, and send the execution result to the client.
  • a copy of the data structure is established; the first target element is removed from the copy of the data structure , in this way, on the one hand, the data element corresponding to the request timeout server will be removed from the copy before the call to ensure that other background servers are selected; A copy of the structure ensures the consistency and validity of the original data element corresponding to the URL request.
  • FIG. 4 is a schematic diagram of an implementation flow of the load balancing method provided by the embodiment of the present application. As shown in FIG. 4 , the method includes:
  • Step S401 determining the corresponding data structure based on the URL in the URL request sent by the client; the data elements in the data structure at least include the response time prediction value and the server ID;
  • Step S402 from the data structure, determine the data element with the smallest response time prediction value as the first target element, and send the URL request to the agent of the first target server based on the server ID of the first target element;
  • Step S403 in the case of not receiving the response result returned by the agent of the first target server over time, from the data structures other than the first target element, determine the data element with the smallest response time prediction value as the first target element.
  • Two target elements, and based on the server ID of the second target element, the URL request is sent to the proxy of the second target server;
  • Step S404 receiving the response result returned by the agent of the second target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • Step S405 Update the updated response time prediction value into the second target element, and send the execution result to the client.
  • Step S406 in the case of not receiving the response result returned by the agent of the first target server over time, calling the insertion method of the sliding window to determine whether the first target server satisfies the abnormality determination rule;
  • the Entry is removed from the map and list, and the analyzer will not request the server again until it is determined that the server is recovered.
  • Step S407 in the case that the first target server satisfies the abnormality determination rule, remove the first target element corresponding to the first target server from the data structure, so that the first target element is not determined when the first target server is not determined. Before the server resumes the function of processing the request, it no longer sends the request to the first target server.
  • a sliding window is used to determine whether a specified server triggers an exception rule, and the time range for triggering an exception rule is limited by the sliding window, which can implement a frequency control mechanism, detect time-out servers, and improve the probability of the server responding to requests.
  • the embodiment of the present application provides a load balancing method, and the method includes:
  • Step S501 based on the URL in the URL request sent by the client, determine the corresponding data structure; the data elements in the data structure at least include the response time prediction value and the server ID;
  • Step S502 determining the data element with the smallest response time prediction value as the first target element from the data structure, and sending the URL request to the agent of the first target server based on the server ID of the first target element;
  • Step S503 in the case of not receiving the response result returned by the proxy of the first target server over time, from the data structures other than the first target element, determine the data element with the smallest response time prediction value as the first target element.
  • Two target elements, and based on the server ID of the second target element, the URL request is sent to the proxy of the second target server;
  • Step S504 receiving the response result returned by the agent of the second target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • Step S505 Update the updated response time prediction value into the second target element, and send the execution result to the client.
  • Step S506 in the case of not receiving the response result returned by the agent of the first target server over time, obtain the sliding window data structure of the first target server; the number of elements in the sliding window data structure represents the The number of times the first target server times out;
  • the linked list is used as the data structure of the sliding window (sliceWindow).
  • Each server with timeout corresponds to a linked list of the occurrence time of the timeout request.
  • Each node of the linked list only stores a timestamp, and each timestamp represents a timeout request. time of occurrence.
  • Step S507 based on the preset time window, determine the number of elements of the sliding window data structure within the preset time window; the number of elements represents that the first target server occurs within the preset window The target number of timeouts;
  • Step S508 judging whether the target number of times is greater than the preset number of times threshold, to determine whether the first target server satisfies the abnormality judgment rule; wherein, the abnormality judgment rule includes that the request timeout times in the preset time window is greater than The preset number of thresholds;
  • Tw time window
  • Step S509 in the case that the first target server satisfies the abnormality determination rule, remove the first target element corresponding to the first target server from the data structure, so that the first target element is not determined when the first target server is not determined. Before the server resumes the function of processing the request, it no longer sends the request to the first target server.
  • the method further includes: step S511, inserting an element into the sliding window data structure when the response result returned by the proxy of the first target server is not received after a timeout; is used to store the time for the timeout request of the first target server.
  • sliceWindow only provides an insertion method with a return value of boolean type. When inserting, first append the current timestamp to the end of the linked list, and then traverse the linked list elements from the beginning.
  • the method further includes: step S521, regularly scanning the end element in the sliding window data structure; step S522, the time at which the timeout request occurs at the end element is greater than a preset multiple of the time window , remove the sliding window data structure.
  • the analyzer will regularly scan the tail nodes of all linked lists. If the timestamp in the node is before the window period three times the current time, the linked list will be destroyed and the memory will be reclaimed.
  • Tw 60
  • the current time is At 20:30:15
  • the timestamp of the tail node is before 20:27:15, indicating that the server has not timed out for more than 3 minutes, and it is considered that the linked list has no meaning to continue to exist and can be destroyed.
  • the number of elements of the sliding window data structure within the preset time window is determined; the number of elements represents the first target The target number of times the server has timed out within a preset window; judging whether the target number of times is greater than the preset number of times threshold, to determine whether the first target server satisfies the abnormality judgment rule; wherein, the abnormality judgment rule includes in The preset time window request timeout times are greater than the preset times threshold; in this way, the abnormal server can be found in time through the judgment of the abnormal rule.
  • FIG. 5 is a schematic diagram of an implementation flow of the load balancing method provided by the embodiment of the present application. As shown in FIG. 5 , the method includes:
  • Step S510 in the case where the corresponding data structure cannot be determined based on the URL in the URL request, initialize a corresponding data structure for the URL;
  • the data structure is a Map
  • the map is empty, it means that the request for this URL is received for the first time.
  • Step S520 inserting an initialization data element into the data structure, and initializing the response time prediction value of the initialization element
  • server ID list and weight value are derived from the existing data of the load balancer, and the time parameter is initialized to 0.
  • inserting Entry data in the List includes: 1) Use the initial value of time (curTime) to compare one by one from the head node of the linked list until the first Entry (targetEntry) whose time parameter is greater than or equal to curTime is encountered, and then insert the Entry into targetEntry Previously, if a qualified Entry is not found at the end of the linked list, insert the Entry into the end of the linked list. Note that insertion is a pointer operation.
  • Step S530 sending the URL request to the agent of the first target server corresponding to any of the initialization data elements
  • the value corresponding to the time parameter in each entry is the smallest, and any one is selected to respond to the request.
  • Step S540 receiving the response result returned by the agent of the first target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • Step S550 Update the updated response time prediction value into the first target element, and send the execution result to the client.
  • the response result is an extended protocol packet
  • the step S540, receiving the response result returned by the proxy of the first target server includes: receiving the response from the proxy of the first target server through the extended protocol The extended protocol message, wherein the extended protocol message at least includes the execution result of the URL request and the updated response time prediction value.
  • FIG. 7E is a schematic diagram of an expanded protocol packet structure provided by an embodiment of the present application.
  • the expanded protocol packet structure is composed of a packet header (header) and a packet body (body). .
  • the attribute information of the message is stored in the header, for example, the length (length), the message information (info), and the extension part.
  • the response time prediction value is stored in the extension part.
  • the body stores the execution result of the communication according to the extended protocol message structure.
  • the analyzer of the load balancer can read the execution result of the URL request transmitted by the proxy of the background server and the updated response time prediction value by extending the protocol message.
  • an initialization data element is inserted into the data structure, and the response time prediction value of the initialization element is initialized; in this way, a data element can be initialized for a server corresponding to a URL that has not been requested before, In the next visit, the request can be sent to the server with abundant idle resources, which improves the processing efficiency of the request in the distributed structure.
  • FIG. 6 is a schematic diagram of an implementation flowchart of the load balancing method provided by the embodiment of the present application. As shown in FIG. 6 , the method includes the following steps S601 to S605:
  • Step S601 the proxy of the first target server receives the URL request sent by the analyzer of the load balancer
  • the method further includes:
  • Step S21 receiving the URL request sent by the analyzer of the load balancer
  • Step S22 record and process the starting time of the URL request
  • Step S23 sending the URL request to the first target server
  • Step S24 receiving the execution result of the URL request sent by the first target server, recording the end time of the URL request;
  • Step S25 determining the difference between the start time of the URL request and the end time of the URL request as the response time of the current request.
  • Step S602 updating the response time of the current URL request to the response node data structure of the first target server;
  • the response node data structure includes: the total number of requests of the first target server, the total response time of the first target server and the number of accumulated requests for the first target server;
  • the Proxy maintains a data structure (reqNode) related to server requests, as shown in Figure 8C, the reqNode includes: the total number of requests, the total response time, and the number of accumulated requests.
  • the Proxy After the Proxy receives the request from the load balancer, the Proxy records the request start time, and then calls the background service.
  • Step S603 according to the total number of requests of the first target server, the total response time of the first target server and the accumulated number of requests of the first target server, determine the updated response time prediction value;
  • the predicted response time is calculated by formula (1), which is:
  • Predicted value of response time (total response time - timeout response time) / (total number of requests - number of timeout requests) ⁇ number of accumulated requests; (1);
  • Step S604 encapsulating the updated response time prediction value and the execution result of the URL request into an extended protocol message
  • the Proxy assembles the extended protocol message, puts the background service execution result result and the response time prediction value Tn into the message, the structure of the message is shown in Figure 8D, and returns it to the load balancer.
  • Step S605 sending the extended protocol packet as a response result to the analyzer of the load balancer.
  • the updated response time prediction value is determined according to the total number of requests of the first target server, the total response time of the first target server, and the number of accumulated requests of the first target server. Part of the computing responsibilities that the load balancer is responsible for is pushed down to the target server, reducing the CPU consumption of the load balancer.
  • FIG. 7A is a schematic diagram of a load balancing method in the related art.
  • the analyzer 71 of the load balancer is responsible for request time prediction and routing decision, and receives the response result returned by the background server 72 .
  • FIG. 7B is a schematic diagram of an implementation flow of the load balancing method in the related art. As shown in FIG. 7B , the method includes:
  • Step S701 the load balancer receives the request (URL request) sent by the requester (client), and locates the corresponding data structure (List structure) according to the URL in the URL request;
  • the analyzer of the load balancer maintains a linked list (List) structure for each type of URL;
  • the request information corresponding to each background server is stored in the List structure.
  • the request information includes the server ID, the total number of requests, the total response time, the number of overtime requests, the overtime response time, and the number of accumulated requests. ,Weights.
  • Step S702 before sending the URL request to the background server 72, traverse the List structure corresponding to the URL request;
  • Step S703 calculating the predicted value of the response time
  • the predicted response time is the estimated waiting time after the next request is sent to the background server 72 .
  • the response time prediction value is calculated by formula (1).
  • Step S704 comparing the predicted value of the minimum response time
  • Step S705 determine the target server that receives the URL request
  • the step S705 determines the target server that receives the URL request, including:
  • Step S705A in the case that the predicted value of the minimum response time is one, send the URL request to the target server corresponding to the predicted value of the minimum response time;
  • the minimum response time prediction value is compared, and if there is only one corresponding server, the server is requested.
  • Step S705B when the predicted minimum response time is multiple and the weight value is the same, determine a target server based on a random algorithm, and send the URL request to the target server;
  • Step S705C when the predicted minimum response time is multiple and the weight values are different, determine a target server based on a weighted random algorithm, and send the URL request to the target server;
  • Step S706 receiving the execution result (response result) returned by the target server;
  • Step S707 modifying the request information of the target machine (target server) in the List structure according to the response result;
  • Step S708 after modifying the request information of the target machine in the List structure, send the execution result to the requester.
  • the load balancer needs to do a lot of calculation work each time, including: traversing all elements of the URL corresponding to the List, calculating the predicted response time, and comparing the predicted minimum response time. ; 2) After each request is completed, it is also necessary to modify the request information corresponding to the target server in the List element of the load balancer, including the total number of requests and total response time; 3) If the request times out, it is also necessary to modify the number of timeout requests and timeout. Response time; in a multi-threaded environment, the modifications here are generally implemented by Compare and Swap (CAS). Whether it is a high-frequency request or a scenario with a large number of servers, it will bring about a CPU load problem, and the higher the request frequency and the more servers, the more serious the load problem.
  • CAS Compare and Swap
  • the embodiment of the present application provides a load balancing method.
  • the calculation is performed by a proxy (Proxy) added by the server, and the calculation result and the execution result of the server are assembled to conform to the extended communication protocol.
  • the packets are sent back to the load balancer through the extended communication protocol.
  • the load balancer cooperates with the Proxy to complete the shortest time load balancing through a specific algorithm, such as a minimum value algorithm (min(copyList)), a random algorithm, and a weighted random algorithm.
  • FIG. 7D is a schematic diagram of a load balancing method according to an embodiment of the present application.
  • the analyzer 73 of the load balancer communicates with the Proxy 74 of each server through an extended protocol.
  • the Proxy can implement the server responsible for the proxy layer. It analyzes and calculates the requested data, activates the background service, and assembles the calculation result and the execution result of the server into a message that conforms to the extended communication protocol, and sends it back to the load balancer through the extended communication protocol.
  • the analyzer of the load balancer uses certain algorithms, such as the minimum value algorithm, the random algorithm, the weighted random algorithm, and the Proxy to complete the shortest time response load balancing.
  • FIG. 7E is a schematic diagram of the structure of an extended protocol message in an embodiment of the present application. As shown in FIG. 7E , the structure of the extended protocol message is composed of a header and a body.
  • the attribute information of the message is stored in the header, for example, the length (length), the message information (info), and the extension part.
  • Response time predictions are stored in the extension section.
  • the body stores the execution result of communication according to the extended protocol message structure.
  • FIG. 8A is a schematic diagram of a data structure provided by an embodiment of the present application. As shown in FIG. 8A , the dotted line represents the context of elements in the linked list corresponding to the subscript of the array in the Map; the solid line represents each element in the ordered linked list list.
  • a context of data (Entry) A context of data (Entry).
  • FIG. 8B is a schematic diagram of a data structure provided by an embodiment of the present application.
  • the Entry includes the following contents: 1) a key-value pair key, value, wherein the key is used to store the ID of the server, and each of the servers ID corresponds to an information resource, and each information resource corresponds to a unique URL; value is used to store the information requested to the server, including: server ID, response time prediction value (time) and weight value (weight).
  • the weight value is used to indicate the priority of each server. For example, set the weight to 3 for a server with 2 CPUs, and set a weight value of 6 for a server with 4 CPUs. The higher the weight, the more representative the server is. The better the performance of responding to requests.
  • pre means pointing to the previous element of the element in the ordered linked list; pro means pointing to the next element of the element in the ordered linked list; next means pointing to the current subscript in the Map corresponding to the linked list The element that follows this element.
  • the embodiment of the present application provides a load balancing method, and the method includes:
  • the steps for the analyzer in the load balancer to achieve load balancing are:
  • Step S801 the analyzer locates the corresponding Map and List according to the URL
  • Step S802 if the Map is empty, the analyzer initializes the Map and List structures for the URL, and inserts the Entry data corresponding to the URL into the Map and List;
  • the map is empty, it means that the request for this URL is received for the first time.
  • server ID list and weight value are derived from the existing data of the load balancer, and the time parameter is initialized to 0.
  • inserting Entry data in the List includes: 1) Use the initial value of time (curTime) to compare one by one from the head node of the linked list until the first Entry (targetEntry) whose time parameter is greater than or equal to curTime is encountered, and then insert the Entry into targetEntry Previously, if a qualified Entry is not found at the end of the linked list, insert the Entry into the end of the linked list. Note that insertion is a pointer operation.
  • Step S803 if the Map is not empty, the analyzer calls the min(copyList) method
  • copyList is a copy of the current List
  • the min method will take out one or more Entry with the smallest time (the first one) from the copyList.
  • the multiple Entry have the same time parameter value, and the corresponding time parameter value is the minimum value in the linked list.
  • Step S804 in the case that the minimum value of time corresponds to one Entry, the analyzer requests the server corresponding to the Entry; in the case that the minimum value of time corresponds to at least two Entry, if the weight value of each Entry is the same, the analyzer according to the first entry.
  • a random method requests a server Entry; if the weight value of each Entry is different, the analyzer selects a target server to request according to the second random method.
  • the first random method is an equal-probability selection method
  • the second random method is a non-equi-probability method
  • 3 servers when selecting according to the non-equi-probability method, 3 servers have weight values of 3, 2, and 1 respectively. At this time, the total weight is 6, and the probability of each server being selected is 0.5, 0.33, and 0.17 to select a server. .
  • the weights of 3 servers are 1, 1, and 1, respectively. At this time, the total weight is 3, and the probability of each server being selected is the same.
  • the load balancer routes the request to the backend server in the following two cases:
  • Step S41 when the request returns normally, the analyzer parses out the response time prediction value in the response given by the server;
  • step S42 the Entry in the Map is obtained according to the server ID, and the analyzer updates the parsed response time prediction value to the time of the Entry (curEntry). Since the time value changes, the position of curEntry in the list may also change, so To determine whether curEntry needs to be reordered, include:
  • Step S421 the analyzer compares the time value (curEntryTime) of curEntry with the time (preEntryTime) value of the previous Entry (preEntry);
  • Step S422 if less than preEntryTime, continue to compare, until encounter the first Entry (targetEntry) less than or equal to curEntryTime, or, reach the linked list header, then remove the Entry from the original position, insert after curEntryTime or the linked list header;
  • Step S423 if it is greater than preEntryTime, compare it with the time (proEntryTime) value of the next element (proEntry), and if it is greater than proEntryTime, continue to search backward until the first Entry (targetEntry) greater than or equal to curEntryTime is encountered, or the tail of the linked list , and then remove the Entry from its original position and insert it before the targetEntry or at the end of the linked list;
  • Step S424 if it is greater than preEntryTime and less than proEntryTime, or equal to any one of the two, the element position remains unchanged.
  • Step S51 the analyzer re-selects a server to make a request according to a preset condition under the condition that the request time-out does not return;
  • re-selecting a service can ensure that the current request is processed normally.
  • the preset condition is: calling the min(copyList) method, and copyList is a copy of the current List.
  • the Entry corresponding to the request timeout server will be removed from the copyList before the call to ensure that other Entry is selected. Since operations such as removal are required, this is also the reason why the min method uses the List copy as a parameter, which is to dynamically adjust the selectable server list;
  • Step S52 the analyzer invokes the insertion method of the sliding window to determine whether the server requesting timeout satisfies the abnormality rule;
  • the Entry is removed from the map and list, and the analyzer will not request the server again until it is determined that the server is recovered.
  • a sliding window (sliceWindow) is used to determine whether a specified server triggers an exception rule, and the time range for triggering an exception rule is limited by sliceWindow.
  • sliceWindow is suitable for use in the scenario of timeout frequency detection.
  • the linked list is used as the data structure of sliceWindow.
  • Each server with timeout corresponds to a linked list of the occurrence time of the timeout request.
  • Each node of the linked list only stores a timestamp, and each timestamp represents the occurrence time of a timeout request.
  • sliceWindow only provides an insertion method with a return value of Boolean type.
  • Tw seconds time window
  • the traversal determine whether the number of remaining elements is greater than the threshold Cm. If it is, it returns false to indicate that the server is abnormal, otherwise it returns true to indicate that the server can continue to be requested.
  • Abnormal recovery detection For abnormal machines, the analyzer will remove its corresponding Entry from the map and linked list to prevent high-frequency request timeouts. After removal, recovery mechanisms are also required to ensure that servers that have recovered from the anomaly can continue to be distributed to traffic.
  • the analyzer will periodically issue multiple probe requests to the abnormal machine, for example, probe requests greater than or equal to 3 times. If the probe requests all respond normally, the server is considered to be back to normal, and the Entry insertion logic during initialization is executed. The time is the initial value of 0. .
  • the server After receiving the request from the load balancer, the server performs the following steps:
  • the request entry of the server is a Proxy
  • the Proxy shares a part of the computing responsibilities originally undertaken by the load balancer, which can reduce the pressure on the load balancer.
  • the Proxy maintains a data structure (reqNode) related to server requests, as shown in Figure 8C, the reqNode includes: the total number of requests, the total response time, and the number of accumulated requests.
  • the Proxy After the Proxy receives the request from the load balancer, the Proxy records the request start time, and then calls the background service.
  • the request start time recorded by the Proxy is used to calculate the request response time.
  • Step S62 after the background service processes the request, it responds to the Proxy (set the response as result), the Proxy calculates the time-consuming of the call (set as Ti), and then modifies the attribute value in the reqNode (total number of requests + 1, total response time) +Ti), then calculate the average response time, combined with the number of accumulated requests to calculate the predicted response time for the next request (set as Tn). Finally, the Proxy assembles the extension protocol message, and puts the background service execution result result and the response time prediction value Tn into the message. The structure of the message is shown in Figure 8D, and returns to the load balancer.
  • CPU consumption CPU time occupied by the process
  • the CPU time can be measured by the number of CPU clock cycles.
  • the comparison table of CPU clock cycles consumed by common operations the corresponding relationship between the operations involved in the embodiments of the present application and the number of CPU clock cycles consumed is as follows:
  • the main calculation logic comparison table 1 before and after each normal request of the load balancer of the two schemes is as follows:
  • the consumption in related technologies is linearly related to the number of background servers and the degree of concurrency, that is, the more the number of background servers, the higher the consumption, and the higher the degree of concurrency, the higher the consumption
  • the CPU consumption related to the number of background servers is used in the calculation of the response time prediction value. In the embodiment of the present application, this part of the calculation still needs to be performed, but is allocated to each backend server, thus reducing the CPU consumption of the load balancer.
  • the embodiments of the present application provide a load balancing apparatus.
  • the load balancing apparatus may be an analyzer in the load balancer in FIG. 7A during the implementation process.
  • Each sub-part included in the section can be realized by the processor in the load balancing device; of course, it can also be realized by a specific logic circuit; in the process of implementation, the processor can be a central processing unit (CPU), a microprocessor (MPU), digital signal processor (DSP) or field programmable gate array (FPGA), etc.
  • CPU central processing unit
  • MPU microprocessor
  • DSP digital signal processor
  • FPGA field programmable gate array
  • FIG. 9A is a schematic structural diagram of a load balancing apparatus provided by an embodiment of the present application.
  • the apparatus 900A includes a first determining part 901 , a second determining part 902 , a first receiving part 903 and an updating part 904, of which:
  • the first determining part 901 is configured to determine a corresponding data structure based on the URL in the URL request sent by the client; the data elements in the data structure at least include a response time prediction value and a server ID;
  • the second determining part 902 is configured to determine the data element with the smallest response time prediction value from the data structure as the first target element, and send the URL request to the first target element based on the server ID of the first target element a proxy for the target server;
  • the first receiving part 903 is configured to receive the response result returned by the proxy of the first target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • the first update part 904 is configured to update the updated response time prediction value into the first target element, and send the execution result to the client.
  • the apparatus further includes a third determining part, a second receiving part and a second updating part, wherein: the third determining part is configured to not receive the returned message from the proxy of the first target server within a timeout period In the case of the response result, from the data structures other than the first target element, the data element with the smallest response time prediction value is determined as the second target element, and based on the server ID of the second target element
  • the URL request is sent to the proxy of the second target server;
  • the second receiving part is configured to receive the response result returned by the proxy of the second target server, wherein the response result at least includes the execution result of the URL request and the updated response time prediction value;
  • the second update part is configured to update the updated response time prediction value into the second target element, and send the execution result to the client.
  • the third determination part includes an establishment subsection, a removal subsection and a first determination subsection, wherein: the establishment subsection is configured to not receive the returned message from the proxy of the first target server within a timeout period. In the case of responding to the result, a copy of the data structure is created; the removal subsection is configured to remove the first target element from the copy of the data structure; the first determination subsection is configured to remove the first target element from the updated In the replica, the data element with the smallest response time prediction value is determined as the second target element.
  • the apparatus further includes a determination part and a removal part, wherein: the determination part is configured to call the sliding window in the case of not receiving the response result returned by the proxy of the first target server after a timeout. an inserting method, for determining whether the first target server satisfies an abnormality determination rule; a removing part, configured to remove the The first target element corresponding to the first target server is not to send a request to the first target server until it is determined that the first target server resumes the function of processing the request.
  • the abnormality determination rule includes that the number of times of request timeout in a preset time window is greater than a preset number of times threshold; the determination part includes an acquisition sub-part, a second determination sub-part and a determination sub-part, wherein:
  • the acquisition subsection is configured to acquire the sliding window data structure of the first target server; the number of elements in the sliding window data structure represents the number of times that the first target server times out;
  • the second determination subsection is is configured to determine the number of elements of the sliding window data structure within the preset time window based on the preset time window; the number of elements represents that the first target server times out within the preset window
  • the judging subsection is configured to judge whether the target times is greater than the preset times threshold, so as to judge whether the first target server satisfies the abnormality judgment rule.
  • the apparatus further includes a first inserting part, wherein: the first inserting part is configured to slide to the sliding part in the case of not receiving the response result returned by the proxy of the first target server after a timeout An element is inserted into the window data structure; the element is used to store the time when the first target server times out the request.
  • the apparatus further includes a timing portion and a removal portion, wherein: a timing portion is configured to periodically scan an end element in the sliding window data structure; a removal portion is configured to scan at the end of the sliding window data structure. In the case that the time for an element to generate a timeout request is greater than the preset multiple of the time window, the sliding window data structure is removed.
  • the apparatus further includes a fourth determining part, a second inserting part and a sending part, wherein: the fourth determining part is configured to not determine the corresponding data based on the URL in the URL request In the case of the structure, a corresponding data structure is initialized for the URL; the second insertion part is configured to insert an initialization data element into the data structure, and initialize the response time prediction value of the initialization element; send part is configured to send the URL request to a proxy of the first target server corresponding to any one of the initialization data elements.
  • the response result is an extended protocol packet
  • the response result returned by the agent for receiving the first target server the first receiving part 903 is further configured to receive the first target The extended protocol message returned by the proxy of the server through the extended protocol, wherein the extended protocol message at least includes the execution result of the URL request and the updated response time prediction value.
  • the embodiments of the present application provide a load balancing apparatus.
  • the load balancing apparatus may be a proxy of the background server in FIG. 7A during the implementation process.
  • Each sub-part of the server can be realized by a processor in the background server; of course, it can also be realized by a specific logic circuit; in the process of implementation, the processor can be CPU, MPU, DSP or FPGA, etc.
  • FIG. 9B is a schematic structural diagram of a load balancing apparatus provided by an embodiment of the present application.
  • the apparatus 900B includes a third receiving part 910 , an updating part 920 , a determining part 930 , an encapsulating part 940 and a sending part 950, of which:
  • the third receiving part 910 is configured to receive the URL request sent by the analyzer of the load balancer
  • the updating part 920 is configured to update the response time of the current URL request to the response node data structure of the first target server;
  • the response node data structure includes: the total number of requests of the first target server, the first target server The total response time and the number of accumulated requests for the first target server;
  • the determining part 930 is configured to determine the updated response time prediction value according to the total number of requests of the first target server, the total response time of the first target server and the accumulated number of requests of the first target server;
  • an encapsulation part 940 configured to encapsulate the updated response time prediction value and the execution result of the URL request into an extended protocol message
  • the sending part 950 is configured to send the extended protocol packet as a response result to the analyzer of the load balancer.
  • a "part" may be a part of a circuit, a part of a processor, a part of a program or software, etc., of course, a unit, a module or a non-modularity.
  • the above load balancing method is implemented in the form of a software function module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of the present application may be embodied in the form of software products in essence or the parts that contribute to related technologies.
  • the computer software products are stored in a storage medium and include several instructions to make A load balancing device (which may be a server, or a network device, etc.) executes all or part of the methods described in the various embodiments of this application.
  • the aforementioned storage medium includes: a U disk, a mobile hard disk, a read only memory (Read Only Memory, ROM), a magnetic disk or an optical disk and other media that can store program codes.
  • ROM Read Only Memory
  • the aforementioned storage medium includes: a U disk, a mobile hard disk, a read only memory (Read Only Memory, ROM), a magnetic disk or an optical disk and other media that can store program codes.
  • the embodiments of the present application are not limited to any specific combination of hardware and software.
  • an embodiment of the present application provides a load balancing device, including a memory and a processor.
  • the memory stores a computer program that can be run on the processor, and the processor implements the steps in the above method when the processor executes the program.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps in the above method.
  • Computer storage media may be volatile or non-volatile storage media.
  • Embodiments of the present application provide a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and when the computer program is read and executed by a computer, the some or all of the steps of the described method.
  • the embodiments of the present application provide a computer program, where the computer program includes computer-readable codes, and when the computer-readable codes are read and executed by a computer, a part or part of the method described in the embodiments of the present disclosure is implemented. all steps.
  • FIG. 10 is a schematic diagram of a hardware entity of the load balancing device in the embodiment of the application.
  • the hardware entity of the load balancing device 100 includes: a processor 1001 , a communication interface 1002 and a memory 1003 , in
  • the processor 1001 generally controls the overall operation of the load balancing device 100 .
  • the communication interface 1002 enables the load balancing device to communicate with other terminals or servers through a network.
  • the memory 1003 is configured to store the instructions and applications executable by the processor 1001, and can also cache the data to be processed or processed in each part of the processor 1001 and the load balancing device 100 (for example, image data, audio data, voice communication data) and video communication data), which can be implemented through flash memory (FLASH) or random access memory (Random Access Memory, RAM).
  • FLASH flash memory
  • RAM Random Access Memory
  • the load balancing device may be the load balancer in FIG. 7A ; in other embodiments, the load balancing device may be the background server in FIG. 7A .
  • the disclosed apparatus and method may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.
  • the unit described above as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit; it may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to implement the solution of this embodiment.
  • each functional unit in each embodiment of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integration
  • the unit can be implemented either in the form of hardware or in the form of hardware plus software functional units.
  • the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, the execution includes: The steps of the above method embodiments; and the aforementioned storage medium includes: a removable storage device, a read only memory (Read Only Memory, ROM), a magnetic disk or an optical disk and other media that can store program codes.
  • ROM Read Only Memory
  • the above-mentioned integrated units of the present application are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.
  • the technical solutions of the embodiments of the present application may be embodied in the form of software products in essence or the parts that contribute to related technologies.
  • the computer software products are stored in a storage medium and include several instructions to make A load balancing device (which may be a server, or a network device, etc.) executes all or part of the methods described in the various embodiments of this application.
  • a load balancing device which may be a server, or a network device, etc.
  • the aforementioned storage medium includes various media that can store program codes, such as a removable storage device, a ROM, a magnetic disk, or an optical disk.
  • Embodiments of the present disclosure provide a load balancing method, device, storage medium, and computer program product, wherein the method includes: determining a corresponding data structure based on a URL in a URL request sent by a client;
  • the data element includes at least a response time prediction value and a server ID; the data element with the smallest response time prediction value is determined from the data structure as the first target element, and the URL request is sent to the first target server based on the server ID of the first target element agent; receive the response result returned by the agent of the first target server, the response result at least includes the execution result of the URL request and the updated response time prediction value; update the updated response time prediction value to the first target element, and
  • the execution result is sent to the client.
  • the calculation originally performed on the load balancing analyzer can be allocated to the first target server, thereby reducing the CPU consumption of the load balancer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

一种负载均衡方法及装置、设备、存储介质、计算机程序产品,其中,该方法包括:基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。

Description

一种负载均衡方法及装置、设备、存储介质、计算机程序产品
相关申请的交叉引用
本申请基于申请号为202110245329.4、申请日为2021年03月05日、申请名称为“一种负载均衡方法及装置、设备、存储介质”的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请实施例涉及但不限于金融科技(Fintech)的信息技术,尤其涉及一种负载均衡方法及装置、设备、存储介质、计算机程序产品。
背景技术
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Fintech)转变,然而,由于金融行业的安全性、实时性要求,金融科技也对技术提出了更高的要求。金融科技领域下,相关技术中的负载均衡方法中,每次请求负载均衡器要做的计算工作很多。
发明内容
本申请实施例提供一种负载均衡方法及装置、设备、存储介质、计算机程序产品。
本申请实施例的技术方案是这样实现的:
本申请实施例提供一种负载均衡方法,所述方法包括:
基于客户端发送的统一资源定位器(Uniform Resource Locator,URL)请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器标识(Identity,ID);
从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
本申请实施例提供一种负载均衡方法,所述方法包括:
第一目标服务器的代理接收负载均衡器的分析器发送的URL请求;
将当前URL请求的响应时间更新到所述第一目标服务器的响应节点数据结构;所述响应节点数据结构中包括:第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数;
根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值;
将所述更新的响应时间预测值和所述URL请求的执行结果封装成扩展协议报文;
将所述扩展协议报文作为响应结果发送给负载均衡器的分析器。
本申请实施例提供一种负载均衡装置,所述装置包括:
第一确定部分,被配置为基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
第二确定部分,被配置为从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
第一接收部分,被配置为接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
第一更新部分,被配置为将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
本申请实施例提供一种负载均衡装置,所述装置包括:
第三接收部分,被配置为第一目标服务器的代理接收负载均衡器的分析器发送的URL请求;
更新部分,被配置为将当前URL请求的响应时间更新到所述第一目标服务器的响应节点数据 结构;所述响应节点数据结构中包括:第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数;
确定部分,被配置为根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值;
封装部分,被配置为将所述更新的响应时间预测值和所述URL请求的执行结果封装成扩展协议报文;
发送部分,被配置为将所述扩展协议报文作为响应结果发送给负载均衡器的分析器。
本申请实施例提供一种负载均衡设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述方法中的步骤。
本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述方法中的步骤。
本申请实施例提供一种计算机程序产品,配置为存储计算机可读指令,所述计算机可读指令被执行时使得计算机执行上述方法中的步骤。
在本申请实施例中,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。这样,通过接收所述第一目标服务器的代理返回的响应结果;所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值,将原有在负载均衡分析器上执行的计算分摊在第一目标服务器上,减少了负载均衡器的CPU消耗。
附图说明
图1为本申请实施例提供的一种负载均衡方法的实现流程示意图;
图2为本申请实施例提供的一种负载均衡方法的实现流程示意图;
图3为本申请实施例提供的一种负载均衡方法的实现流程示意图;
图4为本申请实施例提供的一种负载均衡方法的实现流程示意图;
图5为本申请实施例提供的一种负载均衡方法的实现流程示意图;
图6为本申请实施例提供的一种负载均衡方法的实现流程示意图;
图7A为相关技术中负载均衡方法的示意图;
图7B为相关技术中负载均衡方法的实现流程示意图;
图7C为相关技术中请求信息的结构示意图;
图7D为本申请实施例提供的一种负载均衡方法的示意图;
图7E为本申请实施例提供的一种扩展后的协议报文结构示意图;
图8A为本申请实施例提供的一种数据结构示意图;
图8B为本申请实施例提供的一种数据结构示意图;
图8C为本申请实施例提供的一种服务器请求相关数据结构示意图;
图8D为本申请实施例提供的一种扩展协议报文的结构示意图;
图9A为本申请实施例提供的一种负载均衡装置的组成结构示意图;
图9B为本申请实施例提供的一种负载均衡装置的组成结构示意图;
图10为本申请实施例中负载均衡设备的一种硬件实体示意图。
具体实施方式
为了使本申请的目的、技术方案和优点更加清楚,下面结合附图和实施例对本申请的技术方案进一步详细阐述,所描述的实施例不应视为对本申请的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解, “一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。
在以下的描述中,所涉及的术语“第一\第二\第三”仅仅是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
下面结合附图和实施例对本申请的技术方案进一步详细阐述。
本申请实施例提供一种负载均衡方法,图1为本申请实施例提供的一种负载均衡方法的实现流程示意图,如图1所示,该方法包括:
步骤S101,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
这里,所述客户端可以为发出资源请求的请求方。
在实施过程中,发出资源请求的请求方、负载均衡器以及后台服务器(服务器、目标服务器)三者之间的交互过程为:发出资源请求的请求方将URL请求发送给负载均衡器的分析器,分析器根据请求的统一资源定位器(Uniform Resource Locator,URL)定位到自身的数据结构中,例如,图(Map)+链表(List)结构,从所述数据结构中选择响应时间预测值最小的数据元素,将所述响应时间预测值最小的数据元素作为目标元素,并将URL请求发送给所述目标元素对应的目标服务器(后台服务器)的代理;所述后台服务器的代理(Proxy)接收到所述URL请求后,根据响应所述URL请求的响应时间,计算出下一次接收到URL请求的情况下,响应所述URL请求的时间预测值;将所述响应时间预测值以及所述URL请求的执行结果一并发送给负载均衡器的分析器;由负载均衡器的分析器将执行结果返回给发出资源请求的请求方。
这里,所述数据结构可以为存储数据的任一种结构,例如,可以数组、栈、队列、链表(List)、树、散列表、堆和图(Map)。其中,所述数据结构为链表的情况下,所述数据结构中存储的数据元素可以为数据元素(Entry),Entry包括以下内容:1)键值对key,value,其中,key用于存储服务器的标识(ID),每一所述服务器ID对应一信息资源,每一信息资源对应唯一的URL;value用于存储对服务器请求的信息,包括:服务器ID、响应时间预测值(time)和权重值(weight)。这里,响应时间预测值为下一次接收到URL请求的情况下,响应所述URL请求的时间预测值。这里,所述权重值用于表示每一台服务器的优先级,例如,对2个CPU的服务器设定权重为3,给4个中央处理器(Central Processing Unit,CPU)的服务器设定权重值为6,权重越高,代表服务器响应请求的性能越好。2)pre,pro,next,其中,pre表示指向有序链表中该元素的前一个元素;pro表示指向有序链表中该元素中的后一个元素;next表示指向Map中当前下标对应链表中该元素的后一个元素。
步骤S102,从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
这里,所述响应时间预测值最小的数据元素表征对应的后台服务器具有更高效的响应URL请求的能力,响应URL请求的时间更短。
这里,所述响应时间预测值(time)最小的数据元素可以为一个数据元素,也可以为多个相同响应时间预测值的数据元素。
在一些实施例中,在time最小值对应一个数据元素(Entry)的情况下,负载均衡器的分析器请求所述Entry对应的服务器;在time最小值对应至少两个Entry的情况下,若每一Entry的权重值相同,分析器按照第一随机方法请求一台目标服务器;若每一Entry的权重值不相同,分析器按第二随机方法选择一台目标服务器进行请求。其中,目标服务器的代理接收URL请求,所述第一随机方法为等概率选择的方法,所述第二随机方法为非等概率方法。
举例说明,按照非等概率方法选择时,3台服务器,权重值分别为3、2、1,此时总权重为6,每一台服务器被选择的概率为0.5、0.33、0.17选择一台目标服务器。按照等概率方法选择时,3台服务器,权重值分别为1、1、1,此时总权重为3,每一台服务器被选择的概率都相同。
步骤S103,接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
这里,第一目标服务器的代理(Proxy)为请求的入口,Proxy分担了一部分原来由负载均衡器承担的计算职责,可以减轻负载均衡器的压力。其中,根据Proxy响应请求得到执行结果,并根据所述执行结果计算更新的响应时间预测值,即为分担了一部分原来由负载均衡器承担的计算职责。
这里,所述URL请求的执行结果为后台服务器对于URL请求的内容的执行结果。
步骤S104,将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
在一些实施例中,分析器将解析出的响应时间预测值更新到Entry(curEntry)的time中,由于time值发生变化,curEntry在list中的位置也可能会变动,所以要判断curEntry是否需要进行重排序操作,包括:
步骤S11,分析器将curEntry的time值(curEntryTime)与前一个Entry(preEntry)的time(preEntryTime)值进行比较;
步骤S12,如果小于preEntryTime则继续往前比较,直到遇到第一个小于等于curEntryTime的Entry(targetEntry),或者,到达链表首部,然后将Entry从原有位置移除,插入curEntryTime后或者链表首部;
步骤S13,如果大于preEntryTime,则与后一个元素(proEntry)的time(proEntryTime)值比较,如果大于proEntryTime则继续往后查找,直到遇到第一个大于等于curEntryTime的Entry(targetEntry),或者链表尾部,然后将Entry从原有位置移除,插入targetEntry前或者链表尾部;
步骤S14,如果大于preEntryTime并且小于proEntryTime,或等于二者中的任何一个,则元素位置不变。
在本申请实施例中,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。这样,通过接收所述第一目标服务器的代理返回的响应结果;所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值,将原有在负载均衡分析器上执行的计算分摊在第一目标服务器上,减少了负载均衡器的CPU消耗。
本申请实施例提供一种负载均衡方法,图2为本申请实施例提供的一种负载均衡方法的实现流程示意图,如图2所示,该方法包括:
步骤S201,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
步骤S202,从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
步骤S203,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;
在实施过程中,分析器在请求超时未返回的情况下,根据预设的条件重新选择一台目标服务器进行请求。
这里,重新选择一台目标服务可以保证当前请求被正常处理,预设的条件为:调用min(copyList)方法,copyList为当前List的副本。这里,需要说明的是,调用前会从copyList中移除这台请求超时的目标服务器对应的Entry,保证选出的是其他Entry。
步骤S204,接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
步骤S205,将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给 所述客户端。
在本申请实施例中,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理,这样,能够将无法响应请求的目标服务器从服务器集群中移除,动态调整可选择的服务器列表,提高了目标服务器响应请求的概率,从而提高了负载均衡器发送请求的有效性。
本申请实施例提供一种负载均衡方法,图3为本申请实施例提供的一种负载均衡方法的实现流程示意图,如图3所示,该方法包括:
步骤S301,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
步骤S302,从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
步骤S303,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,建立所述数据结构的副本;
在实施过程中,由于需要从数据结构中将无法响应请求的元素删除,因此,需要建立数据结构的副本。
步骤S304,从所述数据结构的副本中去除所述第一目标元素;
在实施过程中,从数据结构的副本(copyList)中移除这台请求超时服务器对应的entry,保证选出的是其他entry。
步骤S305,从更新后的所述副本中将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;
步骤S306,接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
步骤S307,将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给所述客户端。
在本申请实施例中,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,建立所述数据结构的副本;从所述数据结构的副本中去除所述第一目标元素,这样,一方面,在调用前会从副本中移除这台请求超时服务器对应的数据元素,保证选出的是其他后台服务器;另一方面,由于需要进行移除等操作,通过建立所数据结构的副本,保证了URL请求对应的原数据元素的一致性和有效性。
本申请实施例提供一种负载均衡方法,图4为本申请实施例提供的一种负载均衡方法的实现流程示意图,如图4所示,该方法包括:
步骤S401,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
步骤S402,从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
步骤S403,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;
步骤S404,接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
步骤S405,将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给所述客户端。
步骤S406,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,调用滑动窗口的插入方法,判定所述第一目标服务器是否满足异常判定规则;
这里,在请求超时的服务器满足异常规则的情况下,从map及list中移除该Entry,在未判定该服务器恢复前,分析器不会再请求该服务器。
这里,异常判定规则:判定规则由负载均衡器的使用者配置,包含两个参数,winSize表示时间窗口大小(单位:秒)、timeoutTimes表示请求超时次数,例如,winSize=10,timeoutTimes=5表示10秒内超时5次则认定服务器异常。
步骤S407,在所述第一目标服务器满足所述异常判定规则的情况下,从所述数据结构中移除所述第一目标服务器对应的第一目标元素,以在未判定所述第一目标服务器恢复处理请求功能前,不再向所述第一目标服务器发送请求。
这里,执行步骤S403至步骤S405,与执行步骤S406和步骤S407没有先后之分。
在本申请实施例中,使用滑动窗口判定指定服务器是否触发异常规则,通过滑动窗口限定进行触发异常规则的时间范围,能够实现频率控制机制,对超时的服务器进行检测,提高服务器响应请求的概率。
本申请实施例提供一种负载均衡方法,该方法包括:
步骤S501,基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
步骤S502,从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
步骤S503,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;
步骤S504,接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
步骤S505,将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给所述客户端。
步骤S506,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,获取所述第一目标服务器的滑动窗口数据结构;所述滑动窗口数据结构中元素的个数表征所述第一目标服务器发生超时的次数;
在实施过程中,将链表作为滑动窗口(sliceWindow)的数据结构,每个超时的服务器对应一个超时请求发生时间的链表,链表的每个节点仅存储一个时间戳,每个时间戳代表一个超时请求的发生时间。
步骤S507,基于所述预设的时间窗口,确定滑动窗口数据结构在所述预设的时间窗口内元素的个数;所述元素的个数表征所述第一目标服务器在预设窗口内发生超时的目标次数;
步骤S508,判断所述目标次数是否大于所述预设的次数阈值,以判定所述第一目标服务器是否满足异常判定规则;其中,所述异常判定规则包括在预设的时间窗口请求超时次数大于预设的次数阈值;
举例说明,判断元素的时间戳是否已经超出时间窗口(Tw秒),是则移除元素,比如Tw=60,当前时间为20点30分15秒,时间戳在20点29分15秒之前的就在时间窗口之外,应该被移除。遍历完成后,判断剩余元素数量是否大于阈值Cm,是则返回false表示服务器异常,否则返回true表示可以继续请求服务器。
步骤S509,在所述第一目标服务器满足所述异常判定规则的情况下,从所述数据结构中移除所述第一目标服务器对应的第一目标元素,以在未判定所述第一目标服务器恢复处理请求功能前,不再向所述第一目标服务器发送请求。
在一些实施例中,所述方法还包括:步骤S511,在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,向所述滑动窗口数据结构中插入元素;所述元素用于存储所述第一目标服务器超时请求的时间。
举例说明,sliceWindow插入方法:sliceWindow只对外提供一个返回值为布尔类型的插入方法,插入时,首先将当前时间戳追加到链表尾部,然后从头遍历链表元素。
在一些实施例中,所述方法还包括:步骤S521,定时扫描所述滑动窗口数据结构中的末尾元素;步骤S522,在所述末尾元素发生超时请求的时间大于所述时间窗口的预设倍数的情况下,移 除所述滑动窗口数据结构。
举例说明,sliceWindow中的链表何时销毁:通常情况下,超时的概率会比较低,多数时间sliceWindow中的链表并不会发生插入操作,链表中就很可能维持着无用元素并且得不到释放。为了减小内存压力,分析器会定时扫描所有链表的尾节点,如果节点中的时间戳在当前时间3倍的窗口期之前,就会销毁该链表,回收内存,比如Tw=60,当前时间为20点30分15秒,尾节点时间戳在20点27分15秒之前,表示该服务器已经超过3分钟没有发生超时了,就认为链表没有继续存在的意义了,可以被销毁掉。
在本申请实施例中,一方面,基于所述预设的时间窗口,确定滑动窗口数据结构在所述预设的时间窗口内元素的个数;所述元素的个数表征所述第一目标服务器在预设窗口内发生超时的目标次数;判断所述目标次数是否大于所述预设的次数阈值,以判定所述第一目标服务器是否满足异常判定规则;其中,所述异常判定规则包括在预设的时间窗口请求超时次数大于预设的次数阈值;这样,通过异常规则的判定可以及时发现异常服务器。另一方面,定时扫描所述滑动窗口数据结构中的末尾元素;在所述末尾元素发生超时请求的时间大于所述时间窗口的预设倍数的情况下,移除所述滑动窗口数据结构;这样,能够在互动窗口的数据结构不更新的情况下,释放无用元素,避免了数据结构中维持着无用元素并且得不到释放,减小了内存压力。
本申请实施例提供一种负载均衡方法,图5为本申请实施例提供的一种负载均衡方法的实现流程示意图,如图5所示,该方法包括:
步骤S510,在基于所述URL请求中的URL,确定不到对应的数据结构的情况下,为所述URL初始化一对应的数据结构;
在实施过程中,在所述数据结构为Map的情况下,确定不到对应的数据结构表征如果Map为空。这里,如果map为空,说明是第一次收到对于该URL的请求。
步骤S520,向所述数据结构中插入初始化数据元素,并对所述初始化元素的响应时间预测值进行初始化;
这里,服务器ID列表以及权重值来源于负载均衡器已有数据,time参数初始化为0。
这里,在List插入Entry数据包括:1)用time初始值(curTime)从链表首节点开始逐个往后比较,直到遇到第一个time参数大于等于curTime的Entry(targetEntry),然后将Entry插入targetEntry前面,如果到链表尾部还没找到符合条件的Entry,则将Entry插入链表尾部,注意,插入都是指针操作。
举例说明,CurTime=4;链表中包括3个节点,从第一个节点开始每一节点中的time参数分别为,aTime=2,bTime=3,cTime=6;对比到cTime节点时,cTime=6大于CurTime=4,将Entry插入到cTime对应的节点前。
步骤S530,将所述URL请求发送给任一所述初始化数据元素对应的第一目标服务器的代理;
举例说明,初始化为0后,每一个entry中time参数对应的值都最小,任一选择一个响应请求。
步骤S540,接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
步骤S550,将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
在一些实施例中,所述响应结果为扩展协议报文,所述步骤S540,接收所述第一目标服务器的代理返回的响应结果,包括:接收所述第一目标服务器的代理通过扩展协议返回的扩展协议报文,其中,所述扩展协议报文至少包括所述URL请求的执行结果和所述更新的响应时间预测值。
这里,图7E为本申请实施例提供的一种扩展后的协议报文结构示意图,如图7E所示,扩展后的协议报文结构由报文头(header),报文主体(body)组成。
这里,header中存储了报文的属性信息,例如,长度(length),报文信息(info),扩展部分。这里,扩展部分内存储响应时间预测值。这里,body中存储根据扩展协议报文结构通信的执行结果。
在实施过程中,负载均衡器的分析器通过扩展协议报文能够读取后台服务器的代理传输的URL请求的执行结果和所述更新的响应时间预测值。
在本申请实施例中,向所述数据结构中插入初始化数据元素,并对所述初始化元素的响应时间预测值进行初始化;这样,可以为没有请求过的URL对应的服务器初始化一个数据元素,待下次访问时,能够将请求发送到闲置资源较丰富的服务器上,提高了分布式结构中请求的处理效率。
本申请实施例提供一种负载均衡方法,图6为本申请实施例提供的一种负载均衡方法的实现流程示意图,如图6所示,该方法包括如下步骤S601至步骤S605:
步骤S601,第一目标服务器的代理接收负载均衡器的分析器发送的URL请求;
在一些实施例中,在执行完成步骤S601之后,所述方法还包括:
步骤S21,接收负载均衡器的分析器发送的URL请求;
步骤S22,记录处理所述URL请求的起始时间;
步骤S23,将所述URL请求发送给第一目标服务器;
步骤S24,接收所述第一目标服务器发送的URL请求的执行结果,记录URL请求的结束时间;
步骤S25,将所述URL请求的起始时间和所述URL请求的结束时间差值确定为当前请求的响应时间。
步骤S602,将当前URL请求的响应时间更新到所述第一目标服务器的响应节点数据结构;所述响应节点数据结构中包括:第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数;
在实施过程中,Proxy维护一个服务器请求相关的数据结构(reqNode),如图8C所示,reqNode中包括:总请求数、总响应时间和堆积请求数。在Proxy收到负载均衡器发来的请求后,Proxy记录请求起始时间,然后调用后台服务。
步骤S603,根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值;
举例说明,响应时间预测值通过公式(1)进行计算,公式(1)为:
响应时间预测值=(总响应时间-超时响应时间)/(总请求数-超时请求数)×堆积请求数;(1);
步骤S604,将所述更新的响应时间预测值和所述URL请求的执行结果封装成扩展协议报文;
举例说明,Proxy组装扩展协议报文,将后台服务执行结果result和响应时间预测值Tn放入报文中,报文的结构如图8D,返回给负载均衡器。
步骤S605,将所述扩展协议报文作为响应结果发送给负载均衡器的分析器。
在本申请实施例中,根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值,这样,能够将原本由负载均衡器负责的部分计算职责下推到目标服务器,减少了负载均衡器的CPU消耗。
图7A为相关技术中负载均衡方法的示意图,如图7A所示,相关技术中,由负载均衡器的分析器71负责请求时间预测以及路由决策,以及接收后台服务器72返回的响应结果。
本申请实施例提供一种负载均衡方法,图7B为相关技术中负载均衡方法的实现流程示意图,如图7B所示,该方法包括:
步骤S701,负载均衡器接收请求方(客户端)发出的请求(URL请求),并根据URL请求中的URL,定位对应的数据结构(List结构);
这里,所述负载均衡器的分析器为每类URL维护一个链表(List)结构;
这里,所述List结构中存放每一后台服务器对应的请求信息,如图7C所示,所述请求信息包括服务器ID、总请求数、总响应时间、超时请求数、超时响应时间、堆积请求数、权重值。
步骤S702,在将URL请求发送给后台服务器72之前,遍历URL请求对应的List结构;
步骤S703,计算响应时间预测值;
这里,响应时间预测值为下次请求到后台服务器72后预计需要等待的时间。这里,响应时间预测值通过公式(1)进行计算。
步骤S704,比较最小响应时间预测值;
步骤S705,根据比较结果,确定接收所述URL请求的目标服务器;
在一些实施例中,所述步骤S705,根据比较结果,确定接收所述URL请求的目标服务器,包 括:
步骤S705A,在所述最小响应时间预测值为一个的情况下,将URL请求发送给所述最小响应时间预测值对应的目标服务器;
在实施过程中,遍历完成后,比较出最小的响应时间预测值,如果对应的服务器只有一台,就请求这台服务器。
步骤S705B,在所述最小响应时间预测值为多个且权重值相同的情况下,基于随机算法确定一个目标服务器,并将URL请求发送给所述目标服务器;
在实施过程中,如果有多台,并且权重相等,则随机选择一个。
步骤S705C,在所述最小响应时间预测值为多个且权重值不相同的情况下,基于加权随机算法确定一个目标服务器,并将URL请求发送给所述目标服务器;
在实施过程中,如果有多个并且权重不相等,通过加权随机算法选择一台。
步骤S706,接收所述目标服务器返回的执行结果(响应结果);
步骤S707,根据所述响应结果,修改List结构中目标机器(目标服务器)的请求信息;
请求完成收到后台服务器响应后,修改list中对应服务器的请求信息(比如总请求数+1,总响应时间加上本次调用耗时等),用于下次计算。
步骤S708,在修改List结构中目标机器的请求信息之后,将所述执行结果发送给请求方。
由此可见,相关技术中存在以下缺点:1)每次请求负载均衡器要做的计算工作很多,包括:遍历URL对应List的所有元素、计算出响应时间预测值、比较出最小响应时间预测值;2)每次请求完成后,还需要在负载均衡器的List元素中修改目标服务器对应的请求信息,包括总请求数、总响应时间;3)如果请求超时,还需要修改超时请求数以及超时响应时间;在多线程环境下,这里的修改一般通过比较并交换(Compare and Swap,CAS)实现。无论是高频请求、或,服务器数量众多的场景,都会带来CPU负载问题,并且请求频率越高、服务器数量越多,负载问题越严重。
本申请实施例提供一种负载均衡方法,通过将负载均衡器中部分计算下推到服务器,由服务器增设的代理(Proxy)执行计算,并将计算结果与服务器的执行结果组装成符合扩展通信协议的报文,通过扩展通信协议传回负载均衡器。这样,负载均衡器通过特定算法,例如,最小值算法(min(copyList))、随机算法、加权随机算法,与Proxy配合完成最短时间负载均衡。
本申请实施例通过为服务器增设代理层(Proxy),用于实现相关技术中由负载均衡器实现的部分计算。图7D为本申请实施例负载均衡方法的示意图,如图7D所示,负载均衡器的分析器73通过扩展后的协议与每一服务器的Proxy74进行通信,例如,Proxy可以实现负责代理层所在服务器的请求数据的分析和计算、调起后台服务、并将计算结果与服务器的执行结果组装成符合扩展通信协议的报文,通过扩展通信协议传回负载均衡器。负载均衡器的分析器通过一定的算法,例如,最小值算法、随机算法、加权随机算法,和Proxy配合完成最短时间响应负载均衡。
图7E为本申请实施例中扩展后的协议报文结构示意图,如图7E所示,扩展后的协议报文结构由报文头(header),报文主体(body)组成。
这里,header中存储了报文的属性信息,例如,长度(length),报文信息(info),扩展部分。扩展部分内存储响应时间预测值。body中存储根据扩展协议报文结构通信的执行结果。
本申请实施例提供的一种负载均衡方法,分析器为每一URL维护了一个图结构(Map)和有序链表(List)结构,存储对应的服务器的响应时间信息。图8A为本申请实施例提供的一种数据结构示意图,如图8A所示,虚线表示的是Map中数组下标对应的链表中元素的前后关系;实线表示的是有序链表list中每一数据(Entry)的前后关系。
图8B为本申请实施例提供的一种数据结构示意图,如图8B所示,Entry包括以下内容:1)键值对key,value,其中,key用于存储服务器的ID,每一所述服务器ID对应一信息资源,每一信息资源对应唯一的URL;value用于存储对服务器请求的信息,包括:服务器ID、响应时间预测值(time)和权重值(weight)。这里,所述权重值用于表示每一台服务器的优先级,例如,对2个CPU的服务器设定权重为3,给4个CPU的服务器设定权重值为6,权重越高,代表服务器响应请求的性能越好。
2)pre,pro,next,其中,pre表示指向有序链表中该元素的前一个元素;pro表示指向有序链 表中该元素中的后一个元素;next表示指向Map中当前下标对应链表中该元素的后一个元素。
本申请实施例提供一种负载均衡方法,该方法包括:
在请求到达负载均衡器的情况下,负载均衡器中的分析器实现负载均衡的步骤为:
步骤S801,分析器根据URL定位到对应的Map和List;
步骤S802,如果Map为空,分析器为URL初始化Map、List结构,并向Map和List中插入URL对应的Entry数据;
这里,如果map为空,说明是第一次收到对于该URL的请求。
这里,服务器ID列表以及权重值来源于负载均衡器已有数据,time参数初始化为0。
这里,在List插入Entry数据包括:1)用time初始值(curTime)从链表首节点开始逐个往后比较,直到遇到第一个time参数大于等于curTime的Entry(targetEntry),然后将Entry插入targetEntry前面,如果到链表尾部还没找到符合条件的Entry,则将Entry插入链表尾部,注意,插入都是指针操作。
举例说明,CurTime=4;链表中包括3个节点,从第一个节点开始每一节点中的time参数分别为,aTime=2,bTime=3,cTime=6;对比到cTime节点时,cTime=6大于CurTime=4,将Entry插入到cTime对应的节点前。
步骤S803,如果Map不为空,分析器调用min(copyList)方法;
这里,copyList为当前List的副本,min方法会从copyList中取出time最小的(排在最前面的)一个或多个Entry。这里,所述多个Entry具有相同的time参数值,且,对应的time参数值为链表中的最小值。
步骤S804,在time最小值对应一个Entry的情况下,分析器请求所述Entry对应的服务器;在time最小值对应至少两个Entry的情况下,若每一Entry的权重值相同,分析器按照第一随机方法请求一台服务器Entry;若每一Entry的权重值不相同,分析器按第二随机方法选择一台目标服务器进行请求。
这里,所述第一随机方法为等概率选择的方法,所述第二随机方法为非等概率方法。
举例说明,按照非等概率方法选择时,3台服务器,权重值分别为3、2、1,此时总权重为6,每一台服务器被选择的概率为0.5、0.33、0.17选择一台服务器。按照等概率方法选择时,3台服务器,权重值分别为1、1、1,此时总权重为3,每一台服务器被选择的概率都相同。
分析器确定请求路由的服务器后,负载均衡器将请求路由到后台服务器,具有以下两种情况:
1)在请求正常返回的情况下,执行步骤S41和步骤S42:
步骤S41,在请求正常返回的情况下,分析器解析出服务器给出响应中的响应时间预测值;
步骤S42,根据服务器ID获取Map中的Entry,分析器将解析出的响应时间预测值更新到Entry(curEntry)的time中,由于time值发生变化,curEntry在list中的位置也可能会变动,所以要判断curEntry是否需要进行重排序操作,包括:
步骤S421,分析器将curEntry的time值(curEntryTime)与前一个Entry(preEntry)的time(preEntryTime)值进行比较;
步骤S422,如果小于preEntryTime则继续往前比较,直到遇到第一个小于等于curEntryTime的Entry(targetEntry),或者,到达链表首部,然后将Entry从原有位置移除,插入curEntryTime后或者链表首部;
步骤S423,如果大于preEntryTime,则与后一个元素(proEntry)的time(proEntryTime)值比较,如果大于proEntryTime则继续往后查找,直到遇到第一个大于等于curEntryTime的Entry(targetEntry),或者链表尾部,然后将Entry从原有位置移除,插入targetEntry前或者链表尾部;
步骤S424,如果大于preEntryTime并且小于proEntryTime,或等于二者中的任何一个,则元素位置不变。
2)在请求超时未返回的情况下,执行步骤S51和步骤S52:
步骤S51,分析器在请求超时未返回的情况下,根据预设的条件重新选择一台服务器进行请求;
这里,重新选择一台服务可以保证当前请求被正常处理,预设的条件为:调用min(copyList)方法,copyList为当前List的副本。这里,需要说明的是调用前会从copyList中移除这台请求超时 服务器对应的Entry,保证选出的是其他Entry。由于需要进行移除等操作,因此这也是min方法使用List副本作为参数的原因,就是为了动态调整可选择的服务器列表;
步骤S52,分析器调用滑动窗口的插入方法,判定请求超时的服务器是否满足异常规则;
这里,在请求超时的服务器满足异常规则的情况下,从map及list中移除该Entry,在未判定该服务器恢复前,分析器不会再请求该服务器。
这里,服务器异常判定规则:判定规则由负载均衡器的使用者配置,包含两个参数,winSize表示时间窗口大小(单位:秒)、timeoutTimes表示请求超时次数,例如,winSize=10,timeoutTimes=5表示10秒内超时5次则认定服务器异常。
本申请实施例使用滑动窗口(sliceWindow)判定指定服务器是否触发异常规则,通过sliceWindow限定进行触发异常规则的时间范围,sliceWindow作为一种频率控制机制,适合用于超时频率检测的场景中。
本申请实施例将链表作为sliceWindow的数据结构,每个超时的服务器对应一个超时请求发生时间的链表,链表的每个节点仅存储一个时间戳,每个时间戳代表一个超时请求的发生时间。
sliceWindow插入方法:sliceWindow只对外提供一个返回值为布尔类型的插入方法,插入时,首先将当前时间戳追加到链表尾部,然后从头遍历链表元素,判断元素的时间戳是否已经超出时间窗口(Tw秒),是则移除元素,比如Tw=60,当前时间为20点30分15秒,时间戳在20点29分15秒之前的就在时间窗口之外,应该被移除。遍历完成后,判断剩余元素数量是否大于阈值Cm,是则返回false表示服务器异常,否则返回true表示可以继续请求服务器。
异常恢复检测:对于异常机器,分析器会将其对应的Entry从map和链表中移除,防止发生高频率的请求超时。在移除后,还需要有恢复机制,保证那些已经从异常中恢复的服务器可以继续被分配到流量。分析器会定时对异常机器发出多个探测请求,例如,大于等于3次的探测请求,如果探测请求都正常响应,则认为该服务器恢复正常,执行初始化时的Entry插入逻辑,time为初始值0。
sliceWindow中的链表何时销毁:通常情况下,超时的概率会比较低,多数时间sliceWindow中的链表并不会发生插入操作,链表中就很可能维持着无用元素并且得不到释放。为了减小内存压力,分析器会定时扫描所有链表的尾节点,如果节点中的时间戳在当前时间3倍的窗口期之前,就会销毁该链表,回收内存,比如Tw=60,当前时间为20点30分15秒,尾节点时间戳在20点27分15秒之前,表示该服务器已经超过3分钟没有发生超时了,就认为链表没有继续存在的意义了,可以被销毁掉。
服务器端在收到负载均衡器发来的请求后,执行以下步骤:
步骤S61,服务器的请求入口为Proxy,Proxy分担了一部分原来由负载均衡器承担的计算职责,可以减轻负载均衡器的压力。Proxy维护一个服务器请求相关的数据结构(reqNode),如图8C所示,reqNode中包括:总请求数、总响应时间和堆积请求数。在Proxy收到负载均衡器发来的请求后,Proxy记录请求起始时间,然后调用后台服务。
这里,Proxy记录的请求起始时间用于计算请求的响应时间。
步骤S62,后台服务处理完请求后,响应给(设响应为result)Proxy,Proxy计算本次调用耗时(设为Ti),然后修改reqNode中的属性值(总请求数+1,总响应时间+Ti),然后算出平均响应时间,结合堆积请求数算出下次请求的响应时间预测值(设为Tn)。最后,Proxy组装扩展协议报文,将后台服务执行结果result和响应时间预测值Tn放入报文中,报文的结构如图8D,返回给负载均衡器。
比较相关技术与本申请实施例的负载均衡器CPU消耗量,得到:
CPU消耗量=进程占用的CPU时间;
其中,CPU时间可以用CPU时钟周期数来衡量,根据常见操作消耗的CPU时钟周期对照表,本申请实施例中涉及到的操作与消耗的CPU时钟周期数对应关系如下:
CAS:15~30,均值为22.5;
整数除法:12~44,均值为28;
整数乘法:3~6,均值为4.5;
加减法:<1,近似值为1;
两值比较:<1,近似值为1。
其中,均值和近似值仅仅是为了方便后续的计算和比较,不影响结论的准确性。
两种方案负载均衡器每次正常请求前后的主要计算逻辑对照表1为:
表1负载均衡器计算逻辑
Figure PCTCN2021136449-appb-000001
设后台服务器数量为n,设CAS修改的平均并发度为m(负载均衡器上,针对一个要CAS修改的数值,同时会有m个CAS请求),消耗的时钟周期数计算结果用x1,x2..,y1,y2..表示。
相关技术中消耗的CPU时钟周期数计算:
1)两次CAS修改操作:由于CAS修改可能会失败(多线程并发CAS修改同一个对象时),程序会不断重试直到成功为止,所以CAS修改消耗的CPU时钟周期取决于并发度(m),x1消耗的CPU时钟周期数根据公式(2)计算,公式(2)为:
x1=2*m*22.5=m*45    (2);
2)遍历计算(响应时间预测值):遍历n次,每次执行:堆积请求数*(总请求数-超时请求数)/(总响应时间-超时响应时间),分别是两次减法,一次除法,一次乘法,x2消耗的CPU时钟周期数根据公式(3)计算,公式(3)为:
x2=n*(2*1+28+4.5)=n*34.5    (3);
比较最值:n个数比较最值,需比较n-1次,即,x3=n-1;
相关技术中消耗的CPU时钟周期数总和根据公式(4)计算,公式(3)为:
x=x1+x2+x3=n*34.5+n-1+m*45=n*35.5+m*45-1   (4);
本申请实施例消耗的CPU时钟周期数计算:
插入有序链表(n/2次比较),即,y1=1*n/2=n/2;取出链表头元素,y2=1
本申请实施例消耗的CPU时钟周期数总和:y=y1+y2=n/2+1,由此,对比两种方案消耗的CPU时钟周期数可得出如下结论:
1.相关技术中的消耗与后台服务器数量、并发度线性相关,即后台服务器数量越多则消耗越高,并发度越高则消耗越高
2.本申请实施例的CPU消耗与本申请实施例的CPU消耗的比值为:
x/y=(n*35.5+m*45-1)/(n/2+1)=(n*35.5)/(n/2+1)+(m*45-1)/(n/2+1)
其中n和m都是>=1的正整数,所以(m*45-1)/(n/2+1)一定>0、并且(n*35.5)/(n/2+1)在n=1时最小(23.666..),n越大该项值越接近35.5*2=71,因此,本申请实施例的CPU消耗远小于相关技术中的CPU消耗。
需要说明的是:本申请实施例中,与后台服务器数量相关的CPU消耗量都用在了响应时间预测值的计算上,在本申请实施例中,这部分计算依然要进行,只不过被分摊到每个后台服务器上,因此减少了负载均衡器的CPU消耗。
基于前述的实施例,本申请实施例提供一种负载均衡装置,负载均衡装置在实施的过程中可以为图7A中的负载均衡器中的分析器,该装置包括所包括的各部分、以及各部分所包括的各子部分,可以通过负载均衡设备中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为中央处理器(CPU)、微处理器(MPU)、数字信号处理器(DSP)或现场可编程门阵列(FPGA)等。
图9A为本申请实施例提供的一种负载均衡装置的组成结构示意图,如图9A所示,所述装置 900A包括第一确定部分901、第二确定部分902、第一接收部分903和更新部分904,其中:
第一确定部分901,被配置为基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
第二确定部分902,被配置为从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
第一接收部分903,被配置为接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
第一更新部分904,被配置为将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
在一些实施例中,所述装置还包括第三确定部分、第二接收部分和第二更新部分,其中:第三确定部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;第二接收部分,被配置为接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;第二更新部分,被配置为将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给所述客户端。
在一些实施例中,所述第三确定部分包括建立子部分、去除子部分和第一确定子部分,其中:建立子部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,建立所述数据结构的副本;去除子部分,被配置为从所述数据结构的副本中去除所述第一目标元素;第一确定子部分,被配置为从更新后的所述副本中将响应时间预测值最小的数据元素确定为第二目标元素。
在一些实施例中,所述装置还包括判定部分和移除部分,其中:判定部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,调用滑动窗口的插入方法,判定所述第一目标服务器是否满足异常判定规则;移除部分,被配置为在所述第一目标服务器满足所述异常判定规则的情况下,从所述数据结构中移除所述第一目标服务器对应的第一目标元素,以在未判定所述第一目标服务器恢复处理请求功能前,不再向所述第一目标服务器发送请求。
在一些实施例中,所述异常判定规则包括在预设的时间窗口请求超时次数大于预设的次数阈值;所述判定部分,包括获取子部分、第二确定子部分和判断子部分,其中:获取子部分,被配置为获取所述第一目标服务器的滑动窗口数据结构;所述滑动窗口数据结构中元素的个数表征所述第一目标服务器发生超时的次数;第二确定子部分,被配置为基于所述预设的时间窗口,确定滑动窗口数据结构在所述预设的时间窗口内元素的个数;所述元素的个数表征所述第一目标服务器在预设窗口内发生超时的目标次数;判断子部分,被配置为判断所述目标次数是否大于所述预设的次数阈值,以判定所述第一目标服务器是否满足异常判定规则。
在一些实施例中,所述装置还包括第一插入部分,其中:第一插入部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,向所述滑动窗口数据结构中插入元素;所述元素用于存储所述第一目标服务器超时请求的时间。
在一些实施例中,所述装置还包括定时部分和移除部分,其中:定时部分,被配置为定时扫描所述滑动窗口数据结构中的末尾元素;移除部分,被配置为在所述末尾元素发生超时请求的时间大于所述时间窗口的预设倍数的情况下,移除所述滑动窗口数据结构。
在一些实施例中,所述装置还包括第四确定部分、第二插入部分和发送部分,其中:第四确定部分,被配置为在基于所述URL请求中的URL,确定不到对应的数据结构的情况下,为所述URL初始化一对应的数据结构;第二插入部分,被配置为向所述数据结构中插入初始化数据元素,并对所述初始化元素的响应时间预测值进行初始化;发送部分,被配置为将所述URL请求发送给任一所述初始化数据元素对应的第一目标服务器的代理。
在一些实施例中,所述响应结果为扩展协议报文,所述接收所述第一目标服务器的代理返回的响应结果,所述第一接收部分903,还被配置为接收所述第一目标服务器的代理通过扩展协议返回的扩展协议报文,其中,所述扩展协议报文至少包括所述URL请求的执行结果和所述更新的响应 时间预测值。
基于前述的实施例,本申请实施例提供一种负载均衡装置,负载均衡装置在实施的过程中可以为图7A中的后台服务器的代理,该装置包括所包括的各部分、以及各部分所包括的各子部分,可以通过后台服务器中的处理器来实现;当然也可通过具体的逻辑电路实现;在实施的过程中,处理器可以为CPU、MPU、DSP或FPGA等。
图9B为本申请实施例提供的一种负载均衡装置的组成结构示意图,如图9B所示,所述装置900B包括第三接收部分910、更新部分920、确定部分930、封装部分940和发送部分950,其中:
第三接收部分910,被配置为接收负载均衡器的分析器发送的URL请求;
更新部分920,被配置为将当前URL请求的响应时间更新到所述第一目标服务器的响应节点数据结构;所述响应节点数据结构中包括:第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数;
确定部分930,被配置为根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值;
封装部分940,被配置为将所述更新的响应时间预测值和所述URL请求的执行结果封装成扩展协议报文;
发送部分950,被配置为将所述扩展协议报文作为响应结果发送给负载均衡器的分析器。
以上装置实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。
在本申请实施例以及其他的实施例中,“部分”可以是部分电路、部分处理器、部分程序或软件等等,当然也可以是单元,还可以是模块也可以是非模块化的。
需要说明的是,本申请实施例中,如果以软件功能模块的形式实现上述的负载均衡方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台负载均衡设备(可以是服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这样,本申请实施例不限制于任何特定的硬件和软件结合。
对应地,本申请实施例提供一种负载均衡设备,包括存储器和处理器所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现上述方法中的步骤。
对应地,本申请实施例提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述方法中的步骤。计算机存储介质可为易失性存储介质或非易失性存储介质。
本申请实施例提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序被计算机读取并执行时,实现本公开实施例中所描述的方法的部分或全部步骤。
本申请实施例提供一种计算机程序,所述计算机程序包括计算机可读代码,在所述计算机可读代码被计算机读取并执行的情况下,实现本公开实施例中所描述的方法的部分或全部步骤。
这里需要指出的是:以上存储介质、设备、计算机程序产品和计算机程序实施例的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本申请存储介质和设备实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。
需要说明的是,图10为本申请实施例中负载均衡设备的一种硬件实体示意图,如图10所示,该负载均衡设备100的硬件实体包括:处理器1001、通信接口1002和存储器1003,其中
处理器1001通常控制负载均衡设备100的总体操作。
通信接口1002可以使负载均衡设备通过网络与其他终端或服务器通信。
存储器1003配置为存储由处理器1001可执行的指令和应用,还可以缓存待处理器1001以及负载均衡设备100中各部分待处理或已经处理的数据(例如,图像数据、音频数据、语音通信数据和视频通信数据),可以通过闪存(FLASH)或随机访问存储器(Random Access Memory,RAM)实现。
在一些实施例中,负载均衡设备可以为图7A中的负载均衡器;在另一些实施例中,负载均衡设备可以为图7A中的后台服务器。
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定的特征、结构或特性可以任意适合的方式结合在一个或多个实施例中。应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元;既可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案。
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对相关技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台负载均衡设备(可以是服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本申请的实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。
工业实用性
本公开实施例提供了一种负载均衡方法及装置、设备、存储介质、计算机程序产品,其中,该方法包括:基于客户端发送的URL请求中的URL,确定对应的数据结构;数据结构中的数据元素至少包括响应时间预测值和服务器ID;从数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于第一目标元素的服务器ID将URL请求发送给第一目标服务器的代理;接收第一目标服务器的代理返回的响应结果,响应结果中至少包括URL请求的执行结果和更新的响应时间预测值;将更新的响应时间预测值更新到第一目标元素中,并将执行结果发送给客户端。通过本公开实施例,可以将原有在负载均衡分析器上执行的计算分摊在第一目标服务器上,减少了负载均衡器的CPU消耗。

Claims (23)

  1. 一种负载均衡方法,所述方法包括:
    基于客户端发送的统一资源定位器URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器标识ID;
    从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
    接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
    将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
  2. 根据权利要求1所述的方法,所述方法还包括:
    在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;
    接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
    将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给所述客户端。
  3. 根据权利要求2所述的方法,其中,所述在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,包括:
    在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,建立所述数据结构的副本;
    从所述数据结构的副本中去除所述第一目标元素;
    从更新后的所述副本中将响应时间预测值最小的数据元素确定为第二目标元素。
  4. 根据权利要求2所述的方法,所述方法还包括:
    在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,调用滑动窗口的插入方法,判定所述第一目标服务器是否满足异常判定规则;
    在所述第一目标服务器满足所述异常判定规则的情况下,从所述数据结构中移除所述第一目标服务器对应的第一目标元素,以在未判定所述第一目标服务器恢复处理请求功能前,不再向所述第一目标服务器发送请求。
  5. 根据权利要求4所述的方法,其中,所述异常判定规则包括在预设的时间窗口请求超时次数大于预设的次数阈值;
    所述调用滑动窗口的插入方法,判定所述第一目标服务器是否满足异常判定规则,包括:
    获取所述第一目标服务器的滑动窗口数据结构;所述滑动窗口数据结构中元素的个数表征所述第一目标服务器发生超时的次数;
    基于所述预设的时间窗口,确定滑动窗口数据结构在所述预设的时间窗口内元素的个数;所述元素的个数表征所述第一目标服务器在预设窗口内发生超时的目标次数;
    判断所述目标次数是否大于所述预设的次数阈值,以判定所述第一目标服务器是否满足异常判定规则。
  6. 根据权利要求5所述的方法,所述方法还包括:
    在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,向所述滑动 窗口数据结构中插入元素;所述元素用于存储所述第一目标服务器超时请求的时间。
  7. 根据权利要求5所述的方法,所述方法还包括:
    定时扫描所述滑动窗口数据结构中的末尾元素;
    在所述末尾元素发生超时请求的时间大于所述时间窗口的预设倍数的情况下,移除所述滑动窗口数据结构。
  8. 根据权利要求1至7任一项所述的方法,所述方法还包括:
    在基于所述URL请求中的URL,确定不到对应的数据结构的情况下,为所述URL初始化一对应的数据结构;
    向所述数据结构中插入初始化数据元素,并对所述初始化元素的响应时间预测值进行初始化;
    将所述URL请求发送给任一所述初始化数据元素对应的第一目标服务器的代理。
  9. 根据权利要求1至7任一项所述的方法,其中,所述响应结果为扩展协议报文,所述接收所述第一目标服务器的代理返回的响应结果,包括:
    接收所述第一目标服务器的代理通过扩展协议返回的扩展协议报文,其中,所述扩展协议报文至少包括所述URL请求的执行结果和所述更新的响应时间预测值。
  10. 一种负载均衡方法,所述方法包括:
    第一目标服务器的代理接收负载均衡器的分析器发送的URL请求;
    将当前URL请求的响应时间更新到所述第一目标服务器的响应节点数据结构;所述响应节点数据结构中包括:第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数;
    根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值;
    将所述更新的响应时间预测值和所述URL请求的执行结果封装成扩展协议报文;
    将所述扩展协议报文作为响应结果发送给负载均衡器的分析器。
  11. 一种负载均衡装置,所述装置包括:
    第一确定部分,被配置为基于客户端发送的URL请求中的URL,确定对应的数据结构;所述数据结构中的数据元素至少包括响应时间预测值和服务器ID;
    第二确定部分,被配置为从所述数据结构中将响应时间预测值最小的数据元素确定为第一目标元素,并基于所述第一目标元素的服务器ID将所述URL请求发送给第一目标服务器的代理;
    第一接收部分,被配置为接收所述第一目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;
    第一更新部分,被配置为将更新的响应时间预测值更新到所述第一目标元素中,并将所述执行结果发送给所述客户端。
  12. 根据权利要求11所述的装置,所述装置还包括第三确定部分、第二接收部分和第二更新部分,其中:第三确定部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,从除所述第一目标元素之外的数据结构中,将响应时间预测值最小的数据元素确定为第二目标元素,并基于所述第二目标元素的服务器ID将所述URL请求发送给第二目标服务器的代理;第二接收部分,被配置为接收所述第二目标服务器的代理返回的响应结果,其中,所述响应结果中至少包括所述URL请求的执行结果和更新的响应时间预测值;第二更新部分,被配置为将更新的响应时间预测值更新到所述第二目标元素中,并将所述执行结果发送给所述客户端。
  13. 根据权利要求12所述的装置,其中,所述第三确定部分包括建立子部分、去除子部分和第一确定子部分,其中:建立子部分,被配置为在超时未接收所述第一目标 服务器的代理返回的响应结果的情况下,建立所述数据结构的副本;去除子部分,被配置为从所述数据结构的副本中去除所述第一目标元素;第一确定子部分,被配置为从更新后的所述副本中将响应时间预测值最小的数据元素确定为第二目标元素。
  14. 根据权利要求12所述的装置,所述装置还包括判定部分和移除部分,其中:判定部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,调用滑动窗口的插入方法,判定所述第一目标服务器是否满足异常判定规则;移除部分,被配置为在所述第一目标服务器满足所述异常判定规则的情况下,从所述数据结构中移除所述第一目标服务器对应的第一目标元素,以在未判定所述第一目标服务器恢复处理请求功能前,不再向所述第一目标服务器发送请求。
  15. 根据权利要求14所述的装置,其中,所述异常判定规则包括在预设的时间窗口请求超时次数大于预设的次数阈值;所述判定部分,包括获取子部分、第二确定子部分和判断子部分,其中:获取子部分,被配置为获取所述第一目标服务器的滑动窗口数据结构;所述滑动窗口数据结构中元素的个数表征所述第一目标服务器发生超时的次数;第二确定子部分,被配置为基于所述预设的时间窗口,确定滑动窗口数据结构在所述预设的时间窗口内元素的个数;所述元素的个数表征所述第一目标服务器在预设窗口内发生超时的目标次数;判断子部分,被配置为判断所述目标次数是否大于所述预设的次数阈值,以判定所述第一目标服务器是否满足异常判定规则。
  16. 根据权利要求15所述的装置,所述装置还包括第一插入部分,其中:第一插入部分,被配置为在超时未接收所述第一目标服务器的代理返回的响应结果的情况下,向所述滑动窗口数据结构中插入元素;所述元素用于存储所述第一目标服务器超时请求的时间。
  17. 根据权利要求15所述的装置,所述装置还包括定时部分和移除部分,其中:定时部分,被配置为定时扫描所述滑动窗口数据结构中的末尾元素;移除部分,被配置为在所述末尾元素发生超时请求的时间大于所述时间窗口的预设倍数的情况下,移除所述滑动窗口数据结构。
  18. 根据权利要求11至17任一项所述的装置,所述装置还包括第四确定部分、第二插入部分和发送部分,其中:第四确定部分,被配置为在基于所述URL请求中的URL,确定不到对应的数据结构的情况下,为所述URL初始化一对应的数据结构;第二插入部分,被配置为向所述数据结构中插入初始化数据元素,并对所述初始化元素的响应时间预测值进行初始化;发送部分,被配置为将所述URL请求发送给任一所述初始化数据元素对应的第一目标服务器的代理。
  19. 根据权利要求11至17任一项所述的装置,其中,所述响应结果为扩展协议报文,所述接收所述第一目标服务器的代理返回的响应结果,所述第一接收部分,还被配置为接收所述第一目标服务器的代理通过扩展协议返回的扩展协议报文,其中,所述扩展协议报文至少包括所述URL请求的执行结果和所述更新的响应时间预测值。
  20. 一种负载均衡装置,所述装置包括:
    第三接收部分,被配置为第一目标服务器的代理接收负载均衡器的分析器发送的URL请求;
    更新部分,被配置为将当前URL请求的响应时间更新到所述第一目标服务器的响应节点数据结构;所述响应节点数据结构中包括:第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数;
    确定部分,被配置为根据所述第一目标服务器的总请求数、第一目标服务器的总响应时间和第一目标服务器的堆积请求数,确定更新的响应时间预测值;
    封装部分,被配置为将所述更新的响应时间预测值和所述URL请求的执行结果封 装成扩展协议报文;
    发送部分,被配置为将所述扩展协议报文作为响应结果发送给负载均衡器的分析器。
  21. 一种负载均衡设备,包括存储器和处理器,所述存储器存储有可在处理器上运行的计算机程序,所述处理器执行所述程序时实现权利要求1至9任一项所述方法中的步骤,或实现权利要求10所述方法中的步骤。
  22. 一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现权利要求1至9任一项所述方法中的步骤,或实现权利要求10所述方法中的步骤。
  23. 一种计算机程序产品,配置为存储计算机可读指令,所述计算机可读指令被执行时使得计算机执行权利要求1至9任一项所述方法中的步骤,或执行权利要求10所述方法中的步骤。
PCT/CN2021/136449 2021-03-05 2021-12-08 一种负载均衡方法及装置、设备、存储介质、计算机程序产品 WO2022183802A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110245329.4A CN113076192B (zh) 2021-03-05 2021-03-05 一种负载均衡方法及装置、设备、存储介质
CN202110245329.4 2021-03-05

Publications (1)

Publication Number Publication Date
WO2022183802A1 true WO2022183802A1 (zh) 2022-09-09

Family

ID=76612070

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/136449 WO2022183802A1 (zh) 2021-03-05 2021-12-08 一种负载均衡方法及装置、设备、存储介质、计算机程序产品

Country Status (2)

Country Link
CN (1) CN113076192B (zh)
WO (1) WO2022183802A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149099A (zh) * 2023-10-31 2023-12-01 江苏华鲲振宇智能科技有限责任公司 一种计算存储分体式服务器系统及控制方法
CN117319406A (zh) * 2023-11-23 2023-12-29 北京华耀科技有限公司 负载均衡方法、装置、设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113076192B (zh) * 2021-03-05 2023-09-01 深圳前海微众银行股份有限公司 一种负载均衡方法及装置、设备、存储介质
CN114553795A (zh) * 2022-02-24 2022-05-27 杭州迪普科技股份有限公司 基于虚拟交换矩阵的报文处理方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040103194A1 (en) * 2002-11-21 2004-05-27 Docomo Communicatios Laboratories Usa, Inc. Method and system for server load balancing
CN107026907A (zh) * 2017-03-30 2017-08-08 上海斐讯数据通信技术有限公司 一种负载均衡方法、负载均衡器及负载均衡系统
CN110311987A (zh) * 2019-07-24 2019-10-08 中南民族大学 微服务器的节点调度方法、装置、设备及存储介质
CN111176843A (zh) * 2019-12-23 2020-05-19 中国平安财产保险股份有限公司 基于多维度的负载均衡方法、装置及相关设备
CN113076192A (zh) * 2021-03-05 2021-07-06 深圳前海微众银行股份有限公司 一种负载均衡方法及装置、设备、存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100466551C (zh) * 2006-09-20 2009-03-04 杭州华三通信技术有限公司 一种实现负载均衡的方法和一种负载均衡设备
CN106790381A (zh) * 2016-11-21 2017-05-31 浙江理工大学 基于加权最小连接的动态反馈负载均衡方法
CN109040243B (zh) * 2018-08-02 2021-04-30 新华三信息安全技术有限公司 一种报文处理方法及装置
CN111404713B (zh) * 2019-01-02 2022-12-13 中国移动通信有限公司研究院 一种网络资源调整方法、装置和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040103194A1 (en) * 2002-11-21 2004-05-27 Docomo Communicatios Laboratories Usa, Inc. Method and system for server load balancing
CN107026907A (zh) * 2017-03-30 2017-08-08 上海斐讯数据通信技术有限公司 一种负载均衡方法、负载均衡器及负载均衡系统
CN110311987A (zh) * 2019-07-24 2019-10-08 中南民族大学 微服务器的节点调度方法、装置、设备及存储介质
CN111176843A (zh) * 2019-12-23 2020-05-19 中国平安财产保险股份有限公司 基于多维度的负载均衡方法、装置及相关设备
CN113076192A (zh) * 2021-03-05 2021-07-06 深圳前海微众银行股份有限公司 一种负载均衡方法及装置、设备、存储介质

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117149099A (zh) * 2023-10-31 2023-12-01 江苏华鲲振宇智能科技有限责任公司 一种计算存储分体式服务器系统及控制方法
CN117149099B (zh) * 2023-10-31 2024-03-12 江苏华鲲振宇智能科技有限责任公司 一种计算存储分体式服务器系统及控制方法
CN117319406A (zh) * 2023-11-23 2023-12-29 北京华耀科技有限公司 负载均衡方法、装置、设备及存储介质
CN117319406B (zh) * 2023-11-23 2024-03-12 北京华耀科技有限公司 负载均衡方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN113076192A (zh) 2021-07-06
CN113076192B (zh) 2023-09-01

Similar Documents

Publication Publication Date Title
WO2022183802A1 (zh) 一种负载均衡方法及装置、设备、存储介质、计算机程序产品
US9804981B2 (en) Method, controller, and system for service flow control in object-based storage system
CN109995881B (zh) 缓存服务器的负载均衡方法和装置
US20170193416A1 (en) Reducing costs related to use of networks based on pricing heterogeneity
CN109951546B (zh) 基于智能合约的事务请求处理方法、装置、设备和介质
CN106230997B (zh) 一种资源调度方法和装置
CN111786895A (zh) 动态全局限流的方法和装置
WO2019237594A1 (zh) 会话保持方法、装置、计算机设备及存储介质
CN108540510B (zh) 一种云主机创建方法、装置及云服务系统
JP6972714B2 (ja) データ取得プログラム、装置、及び方法
WO2022111313A1 (zh) 一种请求处理方法及微服务系统
CN110633168A (zh) 一种分布式存储系统的数据备份方法和系统
WO2019153880A1 (zh) 集群中镜像文件下载的方法、节点、查询服务器
TWI716822B (zh) 事務因果序的校正方法及裝置、電子設備
CN111597041B (zh) 一种分布式系统的调用方法、装置、终端设备及服务器
WO2018153236A1 (zh) 一种基于api请求的动态资源访问加速方法、装置、介质及设备
US7933962B1 (en) Reducing reliance on a central data store while maintaining idempotency in a multi-client, multi-server environment
CN109660589B (zh) 请求处理方法及装置、电子设备
CN107085681B (zh) 鲁棒的计算设备标识框架
EP3408989B1 (en) Detecting malware on spdy connections
CN114374657A (zh) 一种数据处理方法和装置
CN113592653A (zh) 代理延时交易方法、计算机设备和存储介质
CN113886082A (zh) 请求处理方法、装置、计算设备及介质
CN113760876A (zh) 一种数据过滤方法和装置
WO2021095114A1 (ja) 監視システム、監視方法、エージェントプログラムおよびマネージャプログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21928874

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 11.12.2023)