Request processing method, device, equipment, computer readable medium and program product

By selecting the request processing server according to the server status and updating the status, the problem of being unable to accurately evaluate the server status in the existing technology is solved, the load balancing effect is improved, and the occurrence of request timeout or errors is reduced.

CN118784648APending Publication Date: 2024-10-15BEIJING JINGDONG QIANSHITECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310363087.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-06
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing performance-based load balancing methods and slow start methods cannot accurately evaluate the server status after the server is restarted or recovered from a fault, resulting in poor load balancing effects and increasing the possibility of request timeouts or errors.

Method used

By selecting a request processing server based on the status information of the server collection and updating the server status based on the response results, speculation on initial performance indicators and assumptions about server steady state are avoided.

Benefits of technology

It improves the load balancing effect, reduces the occurrence of request timeouts or errors, and ensures that the request processing strategy can be adjusted in time when the server status changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118784648A_ABST
    Figure CN118784648A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a request processing method, device and equipment, a computer readable medium and a program product. A specific embodiment of the method comprises the following steps: selecting a server from a server set as a request processing server of a target request according to state information of each server in the server set; forwarding the target request to the request processing server; updating the state information of the request processing server according to a response result corresponding to the target request sent by the request processing server; and sending the response result to request equipment corresponding to the target request. The implementation mode is related to request processing, the load balancing effect is improved, and request timeout or errors are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to a request processing method, apparatus, device, computer-readable medium, and program product. Background Art

[0002] With the development of computer network technology, the number of requests that servers need to process is increasing. In order to avoid a large number of requests before the server reaches a steady state, which may cause request timeouts or errors, the commonly used load balancing methods are: performance-based load balancing method or slow start method.

[0003] However, the inventors found that when the above method is used for load balancing, the following technical problems often exist: the performance-based load balancing method requires at least one request sample to obtain the initial performance index, but there is no initial performance index after the server restarts or fails to recover, so it can only be initialized by speculating fixed values, and the accuracy of the fixed values ​​cannot be considered, resulting in poor load balancing effect, resulting in more request timeouts or errors. The slow start method assumes that the server can just reach a steady state within the time window by pre-estimating, but whether the server has reached a steady state cannot be effectively evaluated, resulting in poor load balancing effect, resulting in more request timeouts or errors.

[0004] The above information disclosed in this Background section is only for enhancement of understanding of the background of the inventive concept and therefore it may contain information that does not form the prior art that is already known in this country to a person of ordinary skill in the art. Summary of the invention

[0005] The content of this disclosure is used to introduce concepts in a brief form, which will be described in detail in the detailed implementation section below. The content of this disclosure is not intended to identify the key features or essential features of the technical solution claimed for protection, nor is it intended to limit the scope of the technical solution claimed for protection.

[0006] Some embodiments of the present disclosure propose request processing methods, devices, electronic devices, computer-readable media, and computer program products to solve one or more of the technical problems mentioned in the above background technology section.

[0007] In a first aspect, some embodiments of the present disclosure provide a request processing method, the method comprising: selecting a server from the server set as a request processing server for a target request based on status information of each server in the server set; forwarding the target request to the request processing server; updating the status information of the request processing server based on a response result corresponding to the target request sent by the request processing server; and sending the response result to a request device corresponding to the target request.

[0008] Optionally, the above-mentioned selecting a server from the server set as a request processing server for the target request based on the status information of each server in the server set includes: for a server in the server set, taking the server as the current server, performing the following steps: determining whether the current server is in an initial state based on the status information of the current server; in response to determining that the current server is in the initial state, determining the current server as the request processing server for the above-mentioned target request.

[0009] Optionally, after determining the current server as the request processing server of the target request, the method further includes: determining the state information of the request processing server as a determining state.

[0010] Optionally, after determining whether the current server is in the initial state based on the status information of the current server, the method further includes: in response to determining that the current server is not in the initial state, determining whether the current server is in a determination state based on the status information of the current server; in response to determining that the current server is in a determination state, deleting the current server from the server set, and performing the above steps again using the server set after deleting the current server.

[0011] Optionally, after determining whether the current server is in a determination state based on the status information of the current server, the method further includes: in response to determining that the current server is not in a determination state, determining whether the current server is in a healthy state based on the status information of the current server; in response to determining that the current server is in a healthy state, determining the performance information of the current server; based on the above performance information and the performance information of the target server, selecting one from the current server and the target server as the request processing server for the above target request, wherein when the above steps are executed for the first time, the above target server is empty; deleting the current server from the server set, and executing the above steps again using the server set after deleting the current server.

[0012] Optionally, after determining whether the current server is in a healthy state based on the status information of the current server, the method also includes: in response to determining that the server is not in a healthy state, deleting the current server from the server set, and using the server set after deleting the current server, executing the above steps again.

[0013] Optionally, the above-mentioned selecting a server from the server set as the request processing server for the target request based on the status information of each server in the server set includes: in response to determining that the selected request processing server is empty, performing the following random selection step: randomly selecting a server from the server set as the request processing server for the target request.

[0014] Optionally, after randomly selecting a server from the above-mentioned server set as the request processing server for the above-mentioned target request, the method also includes: determining whether the number of times a server is randomly selected from the above-mentioned server set meets a preset upper limit condition; in response to determining that the above-mentioned number does not meet the above-mentioned preset upper limit condition, determining whether the randomly selected server is in a fault state; in response to determining that the randomly selected server is not in a fault state, determining the randomly selected server as the request processing server for the above-mentioned target request; in response to determining that the randomly selected server is in a fault state, executing the above-mentioned random selection step again.

[0015] Optionally, the status information of the request processing server is updated based on the response result corresponding to the target request sent by the request processing server, including: in response to determining that the response result indicates a successful response, executing the following response success processing steps: updating the performance information and the number of successful requests of the request processing server; and determining the status information of the request processing server as a healthy state.

[0016] Optionally, the status information of the request processing server is updated based on the response result corresponding to the target request sent by the request processing server, including: in response to determining that the response result indicates a response failure, determining whether the request processing server is in a determination state; in response to determining that the request processing server is not in a determination state, performing the following steps: determining response failure information of the request processing server within a target healthy time period; in response to determining that the response failure information meets a preset failure threshold condition, determining the status information of the request processing server as a fault state.

[0017] Optionally, after determining the response failure information of the request processing server within the target healthy time period, the method further includes: in response to determining that the response failure information does not meet the preset failure threshold condition, executing the response success processing step.

[0018] Optionally, the method further includes: for each server in the above server set, performing the following steps: receiving a status check result of the above server at a periodic time; in response to determining that the above status check result indicates a successful status check, clearing a status check failure record of the above server.

[0019] Optionally, after receiving the status check result of the above-mentioned server at the periodic time, the method also includes: in response to determining that the above-mentioned status check result indicates that the status check is successful and the above-mentioned server was previously in a faulty state, determining the status information of the above-mentioned server as an initial state; in response to determining that the above-mentioned status check result indicates that the status check has failed and the above-mentioned server was previously in a healthy state, determining the status information of the above-mentioned server as a faulty state.

[0020] In a second aspect, some embodiments of the present disclosure provide a request processing device, comprising: a selection unit, configured to select a server from the server set as a request processing server for a target request based on status information of each server in the server set; a forwarding unit, configured to forward the target request to the request processing server; an updating unit, configured to update the status information of the request processing server according to a response result corresponding to the target request sent by the request processing server; and a sending unit, configured to send the response result to a request device corresponding to the target request.

[0021] Optionally, the selection unit is further configured to: for a server in the server set, take the server as the current server and perform the following steps: determine whether the current server is in an initial state based on the status information of the current server; in response to determining that the current server is in the initial state, determine the current server as the request processing server for the above-mentioned target request.

[0022] Optionally, the selection unit further includes: a first determination unit configured to determine the state information of the request processing server as being in a determination state.

[0023] Optionally, the selection unit further includes: a second determination unit and a first deletion unit. The second determination unit is configured to, in response to determining that the current server is not in the initial state, determine whether the current server is in a determination state according to the state information of the current server. The first deletion unit is configured to, in response to determining that the current server is in a determination state, delete the current server from the server set, and perform the above steps again using the server set after deleting the current server.

[0024] Optionally, the selection unit further includes: a third determination unit, a fourth determination unit, a server selection unit, and a second deletion unit. The third determination unit is configured to determine whether the current server is in a healthy state based on the state information of the current server in response to determining that the current server is not in a determination state. The fourth determination unit is configured to determine the performance information of the current server in response to determining that the current server is in a healthy state. The server selection unit is configured to select one item from the current server and the target server as the request processing server for the above-mentioned target request based on the above-mentioned performance information and the performance information of the target server, wherein when the above-mentioned steps are performed for the first time, the above-mentioned target server is empty. The second deletion unit is configured to delete the current server from the server set, and to perform the above-mentioned steps again using the server set after deleting the current server.

[0025] Optionally, the selection unit further includes: a third deleting unit configured to delete the current server from the server set in response to determining that the server is not in a healthy state, and to perform the above steps again using the server set after deleting the current server.

[0026] Optionally, the selection unit further includes: a random selection step execution unit configured to execute the following random selection step in response to determining that the selected request processing server is empty: randomly selecting a server from the above server set as the request processing server for the above target request.

[0027] Optionally, the random selection step execution unit also includes: a number determination unit, a fault state determination unit, a server determination unit and a step execution unit. The number determination unit is configured to determine whether the number of times a server is randomly selected from the above-mentioned server set meets a preset upper limit condition. The fault state determination unit is configured to determine whether the randomly selected server is in a fault state in response to determining that the above-mentioned number does not meet the above-mentioned preset upper limit condition. The server determination unit is configured to determine the randomly selected server as the request processing server for the above-mentioned target request in response to determining that the randomly selected server is not in a fault state. The step execution unit is configured to execute the above-mentioned random selection step again in response to determining that the randomly selected server is in a fault state.

[0028] Optionally, the update unit is further configured to: in response to determining that the above response result indicates a successful response, execute the following response success processing steps: update the performance information and number of successful requests of the above request processing server; determine the status information of the above request processing server as a healthy state.

[0029] Optionally, the update unit is further configured to: in response to determining that the above-mentioned response result represents a response failure, determine whether the above-mentioned request processing server is in a determination state; in response to determining that the above-mentioned request processing server is not in a determination state, perform the following steps: determine the response failure information of the above-mentioned request processing server within a target healthy time period; in response to determining that the above-mentioned response failure information meets a preset failure threshold condition, determine the status information of the above-mentioned request processing server as a fault state.

[0030] Optionally, the updating unit further includes: a response success processing step execution unit, configured to execute the response success processing step in response to determining that the response failure information does not satisfy the preset failure threshold condition.

[0031] Optionally, the request processing device also includes: an execution unit, configured to perform the following steps for each server in the above-mentioned server set: receiving the status check result of the above-mentioned server at a periodic time; in response to determining that the above-mentioned status check result indicates that the status check is successful, clearing the status check failure record of the above-mentioned server.

[0032] Optionally, the execution unit further includes: an initial state determination unit and a fault state determination unit. The initial state determination unit is configured to determine the state information of the server as an initial state in response to determining that the state check result indicates that the state check is successful and the server was previously in a fault state. The fault state determination unit is configured to determine the state information of the server as a fault state in response to determining that the state check result indicates that the state check fails and the server was previously in a healthy state.

[0033] In a third aspect, some embodiments of the present disclosure provide an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any implementation manner of the above-mentioned first aspect.

[0034] In a fourth aspect, some embodiments of the present disclosure provide a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the above-mentioned first aspect is implemented.

[0035] In a fifth aspect, some embodiments of the present disclosure provide a computer program product, including a computer program, which implements the method described in any implementation manner of the above-mentioned first aspect when executed by a processor.

[0036] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the request processing method of some embodiments of the present disclosure, the server for processing the request can be selected according to the status of each server, without inferring the initial performance index, and without assuming that the server reaches a steady state within the time window, thereby improving the effect of load balancing and reducing request timeouts or errors. Specifically, the reason for the poor effect of load balancing, request timeouts or more errors is that the performance-based load balancing method requires at least one request sample to obtain the initial performance index, but there is no initial performance index after the server is restarted or the fault is recovered, so it can only be initialized by inferring a fixed value, and the accuracy of the fixed value cannot be considered, resulting in poor load balancing effect, resulting in more request timeouts or errors. The slow start method assumes that the server can just reach a steady state within the time window by pre-estimation, but whether the server reaches a steady state cannot be effectively evaluated, resulting in poor load balancing effect, resulting in more request timeouts or errors. Based on this, the request processing method of some embodiments of the present disclosure, first, according to the status information of each server in the server set, selects a server from the above server set as the request processing server of the target request. Thus, the server for processing the request can be directly selected according to the status of each server. Then, the target request is forwarded to the request processing server. Thus, the selected server can be used as the server for processing the target request. Afterwards, the status information of the request processing server is updated according to the response result corresponding to the target request sent by the request processing server. Thus, the status of the request processing server can be automatically updated through the response result. Finally, the response result is sent to the request device corresponding to the target request. Thus, the request processing result can be fed back to the device sending the request. Also, because a performance-based load balancing method or a slow start method is not adopted, there is no need to speculate the initial performance indicators, nor is it necessary to assume that the server reaches a steady state within the time window, thereby improving the load balancing effect and reducing request timeouts or errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that components and elements are not necessarily drawn to scale.

[0038] Figure 1 is a schematic diagram of an application scenario of a request processing method according to some embodiments of the present disclosure;

[0039] Figure 2 is a flow chart of some embodiments of the request processing method according to the present disclosure;

[0040] Figure 3 are flowcharts of other embodiments of the request processing method according to the present disclosure;

[0041] Figure 4 is a schematic diagram of the structure of some embodiments of the request processing device according to the present disclosure;

[0042] Figure 5 It is a schematic diagram of the structure of an electronic device suitable for implementing some embodiments of the present disclosure. DETAILED DESCRIPTION

[0043] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0044] It should also be noted that, for ease of description, only the parts related to the invention are shown in the drawings. In the absence of conflict, the embodiments and features in the embodiments of the present disclosure can be combined with each other.

[0045] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0046] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0047] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0048] The present disclosure will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0049] Figure 1 It is a schematic diagram of an application scenario of the request processing method according to some embodiments of the present disclosure.

[0050] exist Figure 1In the application scenario, first, the computing device 101 can select a server from the server set 102 as the request processing server 104 of the target request 103 according to the status information of each server in the server set 102. Then, the computing device 101 can forward the target request 103 to the request processing server 104. After that, the computing device 101 can update the status information of the request processing server 104 according to the response result 105 corresponding to the target request 103 sent by the request processing server 104. Finally, the computing device 101 can send the response result 105 to the request device 106 corresponding to the target request 103.

[0051] It should be noted that the computing device 101 can be hardware or software. When the computing device is hardware, it can be implemented as a distributed cluster consisting of multiple servers or terminal devices, or as a single server or a single terminal device. When the computing device is embodied as software, it can be installed in the hardware devices listed above. It can be implemented as multiple software or software modules for providing distributed services, or as a single software or software module. No specific limitation is made here.

[0052] It should be understood that Figure 1 The number of computing devices in the embodiment is only illustrative. Any number of computing devices may be provided according to implementation requirements.

[0053] Continue to refer Figure 2 , shows a process 200 of some embodiments of the request processing method according to the present disclosure. The request processing method comprises the following steps:

[0054] Step 201 : Select a server from the server set as a request processing server for a target request according to status information of each server in the server set.

[0055] In some embodiments, the execution body of the request processing method (eg Figure 1 The computing device 101 shown in the figure can select a server from the server set as a request processing server for the target request based on the status information of each server in the server set. The server set can be a cluster of servers for processing requests. The status information can be the status of the server during the request processing process. For example, the status information can be but not limited to one of the following: healthy status, fault status. The target request can be the request that needs to be processed currently. Here, the request can be but not limited to one of the following: application request, web page request. In practice, the execution subject can select a server whose corresponding status information is a healthy status from the server set as the request processing server for the target request.

[0056] It should be noted that the execution subject may be a computing device for forwarding requests. For example, the execution subject may be a gateway.

[0057] Step 202: forward the target request to a request processing server.

[0058] In some embodiments, the execution entity may forward the target request to the request processing server. In practice, the execution entity may send the target request to the request processing server via a wired connection or a wireless connection, so that the request processing server processes the target request. It should be noted that the wireless connection method may include but is not limited to 3G / 4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or to be developed in the future.

[0059] Step 203: Update the status information of the request processing server according to the response result of the corresponding target request sent by the request processing server.

[0060] In some embodiments, the execution subject may update the status information of the request processing server according to the response result corresponding to the target request sent by the request processing server. The response result may be the processing result after the request processing server processes the target request. When the request processing server successfully processes the target request, the response result may include request processing data and a response status representing successful processing. When the request processing server fails to process the target request, the response result may include a response status representing a failed processing. In practice, the execution subject may update the status information of the request processing server to a faulty state in response to determining that the response result includes a response status representing a failed processing.

[0061] In some optional implementations of some embodiments, the execution subject may, in response to determining that the response result indicates a successful response, execute the following response success processing steps:

[0062] The first step is to update the performance information and request success number of the request processing server. In practice, the execution entity may determine the current response time, response success rate and number of connections of the request processing server as the updated performance information. The execution entity may determine the sum of the historical request success number and 1 as the updated request success number.

[0063] The second step is to determine the status information of the request processing server as a healthy state. Thus, when the request processing server successfully processes the target request, the status of the request processing server is determined to be a healthy state.

[0064] In some optional implementations of some embodiments, first, the execution subject may determine whether the request processing server is in a determination state in response to determining that the response result indicates a response failure. Thus, when the request processing server fails to process the target request, it may be determined whether the request processing server is in a determination state.

[0065] Then, in response to determining that the request processing server is not in a determination state, the following steps may be performed:

[0066] The first step is to determine the response failure information of the request processing server within the target healthy time period. The target healthy time period may be the time period from when the request processing server enters the healthy state to the current time. The response failure information may include the number of response failures and the response failure rate.

[0067] In the second step, in response to determining that the above-mentioned response failure information meets the preset failure threshold condition, the state information of the above-mentioned request processing server is determined to be a failure state. The above-mentioned preset failure threshold condition may be that the number of response failures is greater than the preset number of failures or the response failure rate is greater than the preset ratio. Here, the specific setting of the preset number of failures and the preset ratio is not limited. Thus, when the request processing server is not in the determination state and the response failure information meets the preset failure threshold condition, the state of the request processing server can be determined to be a failure state.

[0068] In the third step, in response to determining that the response failure information does not meet the preset failure threshold condition, the response success processing step is performed. Thus, when the request processing server is not in the determination state and the response failure information does not meet the preset failure threshold condition, the state of the request processing server can still be determined as a healthy state.

[0069] Optionally, the execution subject may determine the state information of the request processing server as a failure state in response to determining that the response result indicates a response failure and the request processing server is not in a determination state. Thus, when the request processing server fails to process the target request and is not in a determination state, the state of the request processing server may be directly determined as a failure state.

[0070] Step 204: Send the response result to the requesting device corresponding to the target request.

[0071] In some embodiments, the execution subject may send the response result to a requesting device corresponding to the target request, wherein the requesting device may be a device that initiates the target request, which may be understood as a client.

[0072] Optionally, for each server in the server set, the execution subject may further perform the following steps:

[0073] The first step is to receive the status check results of the above-mentioned server at a periodic time. The periodic time may be a time determined by a preset duration as a period. The time interval between each periodic time is the above-mentioned preset duration. In practice, the above-mentioned server can determine whether it is in a healthy state, and actively perform a status check process to obtain a status check result indicating whether the status check is successful. When the status check result indicates that the status check is successful, the above-mentioned server is in a healthy state. When the status check result indicates that the status check fails, the above-mentioned server is in a faulty state. Thus, the status check result of the server periodically performing an active status check can be received.

[0074] In the second step, in response to determining that the above status check result indicates that the status check is successful, the status check failure record of the above server is cleared. The status check failure record may be various information indicating that the status check of the above server has failed. The status check failure record may include but is not limited to at least one of the following: the number of response failures and the response failure rate. Thus, when the active status check succeeds, the status check failure record of the corresponding server can be automatically cleared.

[0075] In the third step, in response to determining that the status check result indicates that the status check is successful and the server is previously in a faulty state, the status information of the server is determined to be an initial state. Thus, when the active status check of the server in the faulty state succeeds, its state can be automatically updated to the initial state.

[0076] In step 4, in response to determining that the status check result indicates a status check failure and the server was previously in a healthy state, the status information of the server is determined to be a fault state. Thus, when a server in a healthy state fails an active status check, its state can be automatically updated to a fault state.

[0077] The above-mentioned embodiments of the present disclosure have the following beneficial effects: through the request processing method of some embodiments of the present disclosure, the server for processing the request can be selected according to the status of each server, without inferring the initial performance index, and without assuming that the server reaches a steady state within the time window, thereby improving the effect of load balancing and reducing request timeouts or errors. Specifically, the reason for the poor effect of load balancing, request timeouts or more errors is that the performance-based load balancing method requires at least one request sample to obtain the initial performance index, but there is no initial performance index after the server is restarted or the fault is recovered, so it can only be initialized by inferring a fixed value, and the accuracy of the fixed value cannot be considered, resulting in poor load balancing effect, resulting in more request timeouts or errors. The slow start method assumes that the server can just reach a steady state within the time window by pre-estimation, but whether the server reaches a steady state cannot be effectively evaluated, resulting in poor load balancing effect, resulting in more request timeouts or errors. Based on this, the request processing method of some embodiments of the present disclosure, first, according to the status information of each server in the server set, selects a server from the above server set as the request processing server of the target request. Thus, the server for processing the request can be directly selected according to the status of each server. Then, the target request is forwarded to the request processing server. Thus, the selected server can be used as the server for processing the target request. Afterwards, the status information of the request processing server is updated according to the response result corresponding to the target request sent by the request processing server. Thus, the status of the request processing server can be automatically updated through the response result. Finally, the response result is sent to the request device corresponding to the target request. Thus, the request processing result can be fed back to the device sending the request. Also, because a performance-based load balancing method or a slow start method is not adopted, there is no need to speculate the initial performance indicators, nor is it necessary to assume that the server reaches a steady state within the time window, thereby improving the load balancing effect and reducing request timeouts or errors.

[0078] Further references Figure 3 , which shows a process 300 of another embodiment of a request processing method. The process 300 of the request processing method includes the following steps:

[0079] Step 301, for a server in the server set, take the server as the current server and perform the following steps:

[0080] Step 3011, determining whether the current server is in an initial state based on the status information of the current server.

[0081] In some embodiments, the execution body of the request processing method (eg Figure 1The computing device 101 in the example may determine whether the current server is in an initial state according to the state information of the current server. In practice, the execution subject may determine that the current server processes the initial state in response to determining that the state information is in the initial state. The initial state may represent the state at the beginning of the current server processing or the state in which the current server has successfully taken the initiative to perform a health check when in a fault state.

[0082] Step 3012, in response to determining that the current server is in an initial state, determining the current server as a request processing server for the target request, and determining the state information of the request processing server as a determining state.

[0083] In some embodiments, the execution subject may determine the current server as the request processing server for the target request in response to determining that the current server is in the initial state, and determine the state information of the request processing server as a determination state. In practice, the execution subject may first determine the current server as the request processing server for the target request. Then, the state information of the request processing server may be determined as a determination state. The determination state may represent an attempt to forward the request to the server, but the final state of the server can only be determined when the request ends.

[0084] Step 3013, in response to determining that the current server is not in the initial state, determine whether the current server is in a determining state according to the state information of the current server.

[0085] In some embodiments, the execution subject may determine whether the current server is in a determination state according to the state information of the current server in response to determining that the current server is not in an initial state. In practice, the execution subject may determine that the current server is in a determination state in response to determining that the state information is in a determination state.

[0086] Step 3014, in response to determining that the current server is in the determination state, the current server is deleted from the server set, and the steps are executed again using the server set after the current server is deleted.

[0087] In some embodiments, the execution subject may delete the current server from the server set in response to determining that the current server is in the determination state, and perform the above steps again using the server set after deleting the current server. Deleting the current server from the server set can make the current server determined when the above steps are performed again a server that has not been cycled before, thereby avoiding selecting a server in the determination state as much as possible.

[0088] Step 3015, in response to determining that the current server is not in a determination state, determine whether the current server is in a healthy state based on the state information of the current server.

[0089] In some embodiments, the execution subject may determine whether the current server is in a healthy state according to the state information of the current server in response to determining that the current server is not in a determination state. In practice, the execution subject may determine that the current server is in a healthy state in response to determining that the state information is in a healthy state.

[0090] Step 3016, in response to determining that the current server is in a healthy state, determine performance information of the current server.

[0091] In some embodiments, the execution subject may determine the performance information of the current server in response to determining that the current server is in a healthy state. The performance information may be related information of performance indicators of the server processing requests. For example, the performance information may include but is not limited to at least one of the following: response time, response success rate, and number of connections.

[0092] Step 3017: Select one of the current server and the target server as a request processing server for the target request based on the performance information and the performance information of the target server.

[0093] In some embodiments, the execution subject may select one item from the current server and the target server as the request processing server for the target request based on the performance information and the performance information of the target server. Wherein, when the above steps are performed for the first time, the target server is empty. When the above steps are not performed for the first time, the target server may be the request processing server determined when the above steps were performed last time. In practice, the execution subject may select one item that meets the preset performance conditions from the current server and the target server as the request processing server for the target request. The preset performance condition may be a condition for determining a server with better performance. For example, the preset performance condition may be that the ratio of the response time to the response success rate included in the performance information is the minimum.

[0094] Step 3018, delete the current server from the server set, and use the server set after deleting the current server to execute the steps again.

[0095] In some embodiments, the execution subject may delete the current server from the server set, and use the server set after deleting the current server to execute the above steps again. Thus, the server that has not been cycled can be used to continue executing the above steps to select a server with better performance.

[0096] Step 3019, in response to determining that the server is not in a healthy state, the current server is deleted from the server set, and the steps are executed again using the server set after deleting the current server.

[0097] In some embodiments, the execution subject may delete the current server from the server set in response to determining that the server is not in a healthy state, and perform the above steps again using the server set after deleting the current server. Thus, selecting a server in an unhealthy state can be avoided as much as possible.

[0098] Optionally, the execution subject may also perform the following random selection step in response to determining that the selected request processing server is empty:

[0099] In the first step, a server is randomly selected from the server set as the request processing server for the target request. Here, the server set may be a server set that has not been deleted. Thus, a server can be randomly selected as the request processing server for the target request only when all servers are in a determination state or a failure state.

[0100] The second step is to determine whether the number of times a server is randomly selected from the server set satisfies a preset upper limit condition. The preset upper limit condition may be that the number of times a server is randomly selected from the server set is greater than a preset number. Here, there is no limitation on the specific setting of the preset number. It is understandable that the preset number is less than the number of servers included in the server set.

[0101] In a third step, in response to determining that the number of times does not satisfy the preset upper limit condition, determining whether the randomly selected server is in a fault state.

[0102] In a fourth step, in response to determining that the randomly selected server is not in a faulty state, the randomly selected server is determined as a request processing server for the target request.

[0103] In step 5, in response to determining that the randomly selected server is in a faulty state, the above random selection step is performed again. Thus, servers that are not in a faulty state can be screened out within a limited number of times.

[0104] Step 302: forward the target request to a request processing server.

[0105] Step 303: Update the status information of the request processing server according to the response result of the corresponding target request sent by the request processing server.

[0106] Step 304: Send the response result to the requesting device corresponding to the target request.

[0107] In some embodiments, the specific implementation of steps 302-304 and the technical effects brought about can be referred to Figure 2 The corresponding steps 202-204 in the embodiments are not described in detail here.

[0108] from Figure 3 It can be seen that Figure 2 Compared with the description of some corresponding embodiments, Figure 3 The process 300 of the request processing method in some corresponding embodiments reflects the steps expanded for various states of the server. Therefore, the schemes described in these embodiments can select the server that processes the target request by various states of the server, namely, the initial state, the determination state, and the health state, so that it can be judged from the initial state to the determination state whether the server has recovered from the fault, without the need to speculate the initial performance indicators, and without assuming that the server reaches a steady state within the time window. This improves the effect of load balancing and reduces request timeouts or errors.

[0109] Further references Figure 4 As an implementation of the methods shown in the above figures, the present disclosure provides some embodiments of a request processing device, and these device embodiments are Figure 2 Corresponding to the method embodiments shown, the device can be specifically applied to various electronic devices.

[0110] like Figure 4 As shown, the request processing device 400 of some embodiments includes: a selection unit 401, a forwarding unit 402, an updating unit 403 and a sending unit 404. The selection unit 401 is configured to select a server from the server set as a request processing server for a target request according to the status information of each server in the server set; the forwarding unit 402 is configured to forward the target request to the request processing server; the updating unit 403 is configured to update the status information of the request processing server according to the response result corresponding to the target request sent by the request processing server; and the sending unit 404 is configured to send the response result to the request device corresponding to the target request.

[0111] Optionally, the selection unit 401 can be further configured to: for a server in the server set, take the server as the current server and perform the following steps: determine whether the current server is in an initial state based on the status information of the current server; in response to determining that the current server is in the initial state, determine the current server as the request processing server for the above-mentioned target request.

[0112] Optionally, the selection unit 401 may further include: a first determination unit (not shown in the figure), configured to determine the state information of the request processing server as being in a determination state.

[0113] Optionally, the selection unit 401 may further include: a second determination unit and a first deletion unit (not shown in the figure). The second determination unit is configured to, in response to determining that the current server is not in the initial state, determine whether the current server is in a determination state according to the state information of the current server. The first deletion unit is configured to, in response to determining that the current server is in a determination state, delete the current server from the server set, and perform the above steps again using the server set after deleting the current server.

[0114] Optionally, the selection unit 401 may also include: a third determination unit, a fourth determination unit, a server selection unit, and a second deletion unit (not shown in the figure). The third determination unit is configured to determine whether the current server is in a healthy state based on the state information of the current server in response to determining that the current server is not in a determination state. The fourth determination unit is configured to determine the performance information of the current server in response to determining that the current server is in a healthy state. The server selection unit is configured to select one item from the current server and the target server as the request processing server for the above-mentioned target request based on the above-mentioned performance information and the performance information of the target server, wherein when the above-mentioned steps are performed for the first time, the above-mentioned target server is empty. The second deletion unit is configured to delete the current server from the server set, and to perform the above-mentioned steps again using the server set after deleting the current server.

[0115] Optionally, the selection unit 401 may also include: a third deletion unit (not shown in the figure), which is configured to delete the current server from the server set in response to determining that the server is not in a healthy state, and use the server set after deleting the current server to perform the above steps again.

[0116] Optionally, the selection unit 401 may also include: a random selection step execution unit (not shown in the figure), configured to execute the following random selection step in response to determining that the selected request processing server is empty: randomly select a server from the above-mentioned server set as the request processing server for the above-mentioned target request.

[0117] Optionally, the random selection step execution unit may further include: a number determination unit, a fault state determination unit, a server determination unit and a step execution unit (not shown in the figure). The number determination unit is configured to determine whether the number of times a server is randomly selected from the above-mentioned server set meets a preset upper limit condition. The fault state determination unit is configured to determine whether the randomly selected server is in a fault state in response to determining that the above-mentioned number does not meet the above-mentioned preset upper limit condition. The server determination unit is configured to determine the randomly selected server as the request processing server for the above-mentioned target request in response to determining that the randomly selected server is not in a fault state. The step execution unit is configured to execute the above-mentioned random selection step again in response to determining that the randomly selected server is in a fault state.

[0118] Optionally, the update unit 403 can be further configured to: in response to determining that the above response result indicates a successful response, perform the following response success processing steps: update the performance information and number of successful requests of the above request processing server; determine the status information of the above request processing server as a healthy state.

[0119] Optionally, the update unit 403 can be further configured to: in response to determining that the above-mentioned response result represents a response failure, determine whether the above-mentioned request processing server is in a determination state; in response to determining that the above-mentioned request processing server is not in a determination state, perform the following steps: determine the response failure information of the above-mentioned request processing server within a target healthy time period; in response to determining that the above-mentioned response failure information meets a preset failure threshold condition, determine the status information of the above-mentioned request processing server as a fault state.

[0120] Optionally, the updating unit 403 may further include: a response success processing step execution unit (not shown in the figure), configured to execute the above-mentioned response success processing step in response to determining that the above-mentioned response failure information does not meet the above-mentioned preset failure threshold condition.

[0121] Optionally, the request processing device 400 may also include: an execution unit (not shown in the figure), configured to perform the following steps for each server in the above-mentioned server set: receiving the status check result of the above-mentioned server at a periodic time; in response to determining that the above-mentioned status check result indicates that the status check is successful, clearing the status check failure record of the above-mentioned server.

[0122] Optionally, the execution unit may further include: an initial state determination unit and a fault state determination unit (not shown in the figure). The initial state determination unit is configured to determine the state information of the server as an initial state in response to determining that the state check result indicates that the state check is successful and the server is previously in a faulty state. The fault state determination unit is configured to determine the state information of the server as a faulty state in response to determining that the state check result indicates that the state check fails and the server is previously in a healthy state.

[0123] It is understood that the units described in the device 400 are similar to those described in the reference Figure 2 Therefore, the operations, features and beneficial effects described above for the method are also applicable to the device 400 and the units included therein, and will not be described in detail here.

[0124] Reference below Figure 5 , which shows an electronic device 500 (eg, Figure 1 A schematic diagram of the structure of the computing device in FIG. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0125] like Figure 5 As shown, the electronic device 500 may include a processing device 501 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0126] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead. Figure 5Each block shown in the figure may represent one device, or may represent multiple devices as required.

[0127] In particular, according to some embodiments of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, some embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In some such embodiments, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of some embodiments of the present disclosure are executed.

[0128] It should be noted that the computer-readable medium recorded in some embodiments of the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In some embodiments of the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In some embodiments of the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0129] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.

[0130] The computer-readable medium may be included in the electronic device; or it may exist independently without being installed in the electronic device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: selects a server from the server set as a request processing server for the target request based on the status information of each server in the server set; forwards the target request to the request processing server; updates the status information of the request processing server based on the response result corresponding to the target request sent by the request processing server; and sends the response result to the request device corresponding to the target request.

[0131] Computer program code for performing the operations of some embodiments of the present disclosure may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0132] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0133] The units described in some embodiments of the present disclosure may be implemented by software or hardware. The units described may also be set in a processor, for example, may be described as: a processor includes: a selection unit, a forwarding unit, an update unit, and a sending unit. The names of these units do not constitute limitations on the units themselves in certain circumstances. For example, the selection unit may also be described as "a unit that selects a server from the above server set as a request processing server for a target request based on the status information of each server in the server set."

[0134] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.

[0135] Some embodiments of the present disclosure further provide a computer program product, including a computer program, which implements any of the above-mentioned request processing methods when executed by a processor.

[0136] The above descriptions are only some preferred embodiments of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) and the technical solutions formed.

Claims

1. A request processing method, comprising: Selecting a server from the server set as a request processing server for the target request according to status information of each server in the server set; forwarding the target request to the request processing server; updating the status information of the request processing server according to the response result corresponding to the target request sent by the request processing server; The response result is sent to the requesting device corresponding to the target request.

2. The method according to claim 1, wherein: The selecting a server from the server set as a request processing server for the target request according to the status information of each server in the server set comprises: For a server in a server collection, make the server the current server and perform the following steps: According to the status information of the current server, determine whether the current server is in the initial state; In response to determining that the current server is in an initial state, the current server is determined as a request processing server for the target request.

3. The method according to claim 2, wherein: After determining the current server as the request processing server of the target request, the method further includes: The state information of the request processing server is determined to be in a determining state.

4. The method according to claim 3, wherein: After determining whether the current server is in an initial state according to the state information of the current server, the method further includes: In response to determining that the current server is not in the initial state, determining whether the current server is in a determining state according to the state information of the current server; In response to determining that the current server is in the determining state, the current server is deleted from the server set, and the steps are performed again using the server set after the current server is deleted.

5. The method according to claim 4, wherein: After determining whether the current server is in a determination state according to the state information of the current server, the method further includes: In response to determining that the current server is not in a determining state, determining whether the current server is in a healthy state according to the state information of the current server; In response to determining that the current server is in a healthy state, determining performance information of the current server; According to the performance information and the performance information of the target server, selecting one from the current server and the target server as the request processing server of the target request, wherein when the step is performed for the first time, the target server is empty; The current server is deleted from the server set, and the steps are performed again using the server set after the current server is deleted.

6. The method according to claim 5, wherein: After determining whether the current server is in a healthy state according to the status information of the current server, the method further includes: In response to determining that the server is not in a healthy state, the current server is deleted from the server set, and the steps are performed again using the server set after the current server is deleted.

7. The method according to claim 6, wherein: The selecting a server from the server set as a request processing server for the target request according to the status information of each server in the server set comprises: In response to determining that the selected request processing server is empty, performing the following random selection steps: A server is randomly selected from the server set as a request processing server for the target request.

8. The method according to claim 7, wherein: After randomly selecting a server from the server set as a request processing server for the target request, the method further includes: Determining whether the number of times a server is randomly selected from the server set meets a preset upper limit condition; In response to determining that the number of times does not satisfy the preset upper limit condition, determining whether the randomly selected server is in a fault state; In response to determining that the randomly selected server is not in a failed state, determining the randomly selected server as a request processing server for the target request; In response to determining that the randomly selected server is in a failed state, the random selection step is performed again.

9. The method according to any one of claims 1 to 8, wherein: The updating of the status information of the request processing server according to the response result corresponding to the target request sent by the request processing server includes: In response to determining that the response result indicates a successful response, the following response success processing steps are performed: Updating the performance information and the number of successful requests of the request processing server; The status information of the request processing server is determined to be a healthy status.

10. The method according to claim 9, wherein: The updating of the status information of the request processing server according to the response result corresponding to the target request sent by the request processing server includes: In response to determining that the response result indicates a response failure, determining whether the request processing server is in a determining state; In response to determining that the request processing server is not in a determination state, performing the following steps: Determining response failure information of the request processing server within a target healthy time period; In response to determining that the response failure information meets a preset failure threshold condition, the state information of the request processing server is determined to be a failure state.

11. The method according to claim 10, wherein: After determining the response failure information of the request processing server within the target healthy time period, the method further includes: In response to determining that the response failure information does not meet the preset failure threshold condition, the response success processing step is performed.

12. The method according to claim 1, wherein: The method further comprises: For each server in the server set, perform the following steps: Receiving a status check result of the server at a periodic time; In response to determining that the status check result indicates that the status check is successful, clearing the status check failure record of the server.

13. The method according to claim 12, wherein: After receiving the status check result of the server at the periodic time, the method further includes: In response to determining that the status check result indicates that the status check is successful and the server was previously in a faulty state, determining the status information of the server as an initial state; In response to determining that the status check result indicates a status check failure and the server was previously in a healthy state, the status information of the server is determined to be in a fault state.

14. A request processing device, comprising: A selection unit configured to select a server from the server set as a request processing server for the target request based on status information of each server in the server set; a forwarding unit, configured to forward the target request to the request processing server; an updating unit, configured to update the state information of the request processing server according to the response result corresponding to the target request sent by the request processing server; The sending unit is configured to send the response result to the requesting device corresponding to the target request.

15. An electronic device, comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 13.

16. A computer readable medium having a computer program stored thereon, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 13 is implemented.

17. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 13.