A method and device for responding to a service request
By using gateway devices and servers deployed remotely in the service response system, combined with the update mechanism of load parameters and domain name routing tables, the problem of disaster recovery and load balancing is solved, and the reliability of service response and system stability are improved.
Patent Information
- Application Number
- CN201811080493.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-09-17
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2038-09-17
AI Technical Summary
Existing service request response technology cannot achieve a good balance between disaster recovery performance and load balancing, resulting in reduced service response reliability.
Using gateway devices and servers deployed remotely, disaster recovery and load balancing are achieved by receiving service requests, collecting server load parameters, determining the target server, and updating the domain name routing table when an exception occurs to avoid allocating requests to abnormal servers.
It improves the disaster recovery performance and load balancing of the service response system, ensures data uniformity and system stability, and enhances the reliability of service response.
Smart Images

Figure CN109308223B
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of Internet technology, and in particular relates to a method and device for responding to a service request. Background Art
[0002] As one of the core devices that respond to user service requests, the stability and robustness of the server directly affect the quality of service response, and disaster recovery is one of the key indicators of server robustness. In order to improve the server's disaster recovery capability, the administrator will configure multiple servers in the same computer room. When a server circuit short circuits or hardware burns out, other servers can respond to user terminal service requests.
[0003] However, when a large-scale natural disaster such as an earthquake or flood occurs in the area where the computer room is located, all servers will be affected by the disaster because all servers are placed in the same computer room; and deploying servers in different locations will lead to inconsistent domain names of servers in different regions, which will lead to unbalanced server loads and reduce the stability of the response system. It can be seen that the existing service request response technology cannot achieve a good balance between disaster recovery performance and load balancing, thereby reducing the reliability of service response. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a service request response method and device to solve the problem that the existing service request response technology cannot achieve a good balance between disaster recovery performance and load balancing, thereby reducing the reliability of service response.
[0005] A first aspect of an embodiment of the present invention provides a method for responding to a service request, which is applied to a system for responding to a service request, wherein the system for responding to a service request comprises: a gateway device and at least two servers deployed remotely, and the method for responding to a service request comprises:
[0006] The gateway device receives a service request sent by a user terminal; the service request includes a domain name identifier;
[0007] The gateway device collects the first load parameter of each of the servers at the current moment, and determines the target server that responds to the service request according to the first load parameter and a preset domain name routing table, and sends the service request to the target server; the domain name routing table records the corresponding relationship between each of the servers and the domain name identifier;
[0008] The target server responds to the service request and synchronizes the response result of the service request to all the servers in the response system;
[0009] If an abnormality is detected in any of the servers, the gateway device changes the domain name routing table so that the domain name identifier of the server where the abnormality occurs points to any server in the response system where no abnormality occurs.
[0010] A second aspect of an embodiment of the present invention provides a service request response system, the service request response system comprising: a gateway device and at least two servers deployed remotely:
[0011] The gateway device is used to receive a service request sent by a user terminal; the service request includes a domain name identifier;
[0012] The gateway device is used to collect the first load parameter of each of the servers at the current moment, and determine the target server that responds to the service request according to the first load parameter and a preset domain name routing table, and send the service request to the target server; the domain name routing table records the corresponding relationship between each of the servers and the domain name identifier;
[0013] The target server is used to respond to the service request and synchronize the response result of the service request to all the servers in the response system;
[0014] The gateway device is used to change the domain name routing table if it is detected that any of the servers has an abnormality, so that the domain name identifier of the server with the abnormality points to any server in the response system that has not had an abnormality.
[0015] The method and system for responding to a service request provided by the embodiment of the present invention have the following beneficial effects:
[0016] In the embodiment of the present invention, all service requests initiated by the user terminal will be redirected through the gateway device. The gateway device will determine the target server that responds to the service request based on the load parameters of the servers deployed in different regions and the domain name identifier of the service request. After the target server responds to the service request, it will also synchronize the response result to all servers in the response system of the service request to ensure the data unification in the system, and when an abnormality occurs, the gateway device will modify the domain name routing table and no longer allocate service requests to the abnormal server. Compared with the existing service request response technology, since each server is deployed in a different place, the disaster recovery performance is higher, and the load balancing between each server is achieved through the gateway device, and the load balancing of all servers in the response system is achieved at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0018] Figure 1 is an interactive flow chart of a method for responding to a service request provided by the first embodiment of the present invention;
[0019] Figure 2 This is a specific interaction flow chart of a method S102 for responding to a service request provided in the second embodiment of the present invention;
[0020] Figure 3 This is a specific implementation flow chart of a method S104 for responding to a service request provided in the third embodiment of the present invention;
[0021] Figure 4 is a specific implementation flow chart of a method for responding to a service request provided by the fourth embodiment of the present invention;
[0022] Figure 5 is a specific implementation flow chart of a method for responding to a service request provided by a fifth embodiment of the present invention;
[0023] Figure 6 It is a structural block diagram of a service request response system provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0025] All service requests initiated by user terminals in the embodiment of the present invention will be redirected through the gateway device. The gateway device will determine the target server that responds to the service request based on the load parameters of the servers deployed in different regions and the domain name identifier of the service request. After the target server responds to the service request, the response result will also be synchronized to all servers in the response system of the service request to ensure the unification of data in the system. In addition, when an abnormality occurs, the gateway device will modify the domain name routing table and will no longer allocate service requests to the abnormal server. This solves the problem that the existing service request response technology cannot achieve a good balance between disaster recovery performance and load balancing, thereby reducing the reliability of service responses.
[0026] In an embodiment of the present invention, the execution subject of the process is a response system for service requests. The response device for the service request includes a gateway device and at least two servers deployed remotely. Specifically, the remote deployment means that the servers are located in different equipment rooms, thereby ensuring that when a natural disaster occurs, not all servers in the response system are affected. There is a communication link between the remotely deployed servers, and the synchronization operation of the response results is achieved through the communication link. On the other hand, each server is connected to the gateway device and receives the service request forwarded by the gateway device. Figure 1 The interactive flow chart of the service request response method provided by the first embodiment of the present invention is shown, and the details are as follows:
[0027] In S101, the gateway device receives a service request sent by a user terminal; the service request includes a domain name identifier.
[0028] In this embodiment, the gateway device receives a service request sent by each user terminal, and the service request carries a domain name identifier corresponding to the server initially designated by the user terminal. The gateway device will parse the service request to extract the domain name identifier in the service request, and determine the target server that responds to the service request based on the domain name identifier and the first load parameter of each server in the subsequent operation steps. Since it is impossible to determine whether the selected server is in an overloaded state when the user terminal initiates a service request, if the initially selected server is in a non-overloaded state, the service request will be forwarded to the server initially selected by the user terminal for response; and if the server initially designated by the user is in an overloaded state, the gateway device needs to re-designate the server to balance the load of each server in the response system of the service request.
[0029] In this embodiment, the domain name identifiers in the service request initiated by the user terminal may be different, but the gateway devices they point to may be the same, that is, after receiving the service request, the router in the metropolitan area network will resolve the domain name identifier, convert it into a network address, and query the routing table in the router to determine the target device pointed to by the network address. In order to achieve that the target devices pointed to by different domain name identifiers are all gateway devices, the network addresses of different domain name identifiers can be in the same network segment. In this case, the gateway device can configure the network segment by means of a mask, so that the target device of each network address points to the gateway device.
[0030] Optionally, if the remotely deployed servers are in different metropolitan area networks, that is, the service requests sent by user terminals in different metropolitan area networks will be converged on different gateway devices. In this case, the response device of the service request may include multiple gateway devices. Different gateway devices are used to receive service requests sent by user terminals in the metropolitan area network where they are located, and obtain the first load parameters of the servers in the local metropolitan area network and receive the first load parameters of the servers in other metropolitan area networks fed back by other gateway devices, thereby achieving the purpose of remote deployment of different metropolitan area networks and further improving the disaster recovery capability of the response system.
[0031] In S102, the gateway device collects the first load parameter of each of the servers at the current moment, and determines the target server that responds to the service request based on the first load parameter and a preset domain name routing table, and sends the service request to the target server; the domain name routing table records the correspondence between each of the servers and the domain name identifier.
[0032] In this embodiment, in order to achieve load balancing, the gateway device will not directly forward the service request to the server corresponding to the domain name identifier, but will obtain the first load parameter corresponding to each server at the current moment in the response system of the service request, and determine the number of service requests being processed by each server. The specific implementation process can be as follows: the gateway device will send a load parameter reporting broadcast in the response system of the service request. After receiving the broadcast information, each server will detect its own load parameter at the current moment, and generate reporting feedback information to return to the gateway device, so that the gateway device can obtain the first load parameter of each server at the current moment.
[0033] Optionally, in this embodiment, in order to detect whether each server is in a normal state, the gateway device sends a heartbeat data packet to the gateway device at a preset time interval so that the gateway device can determine that the server is in a normal operating state. Based on this, the server can encapsulate the first load parameter corresponding to each reporting moment in the heartbeat data packet and send it to the gateway device together, so that the gateway device can determine the load status of each server based on the heartbeat data packet fed back by the server at each moment, without having to send it again, thereby improving the efficiency of service response and reducing the transmission pressure of channel data.
[0034] In this embodiment, the gateway device stores a domain name routing table, which records the correspondence between each server and the domain name identifier. Therefore, the gateway device can determine the server initially requested by the service request based on the domain name identifier contained in the service request. Among them, the domain name identifiers corresponding to each server in the domain name routing table can be changed. When a server is abnormal, or recovers from an abnormal state to a normal state, the gateway device will adjust the domain name routing table so that the servers corresponding to each domain name identifier are all servers in a normal state. Therefore, when a server is abnormal, the domain name identifier corresponding to the server needs to point to other servers. In this case, the same server can correspond to multiple different domain name identifiers, but one domain name identifier has one and only one corresponding server.
[0035] In this embodiment, after obtaining the first load parameter of each server, the terminal device will determine the server corresponding to the domain name identifier according to the domain name routing table, and query the first load parameter of the server to determine whether the server is in an overloaded state, so that the gateway device identifies the target server corresponding to the response to the service request. Optionally, the gateway device is provided with a load threshold. If the first load parameter of the server initially pointed to by the service request is greater than the load threshold, the server is identified as being in an overloaded state, and any other server whose first load parameter is less than the load threshold is identified as the target server; if the first load parameter of the server initially pointed to by the service request is less than or equal to the load threshold, the server is identified as not being in an overloaded state, and the server is identified as the target server. Preferably, a primary server and a backup server may be provided in the response system. In this case, the load thresholds of different servers are different.
[0036] In S103, the target server responds to the service request, and synchronizes the response result of the service request to all the servers in the response system.
[0037] In this embodiment, the gateway device forwards the service request to the target server. It should be noted that the target server is one of the servers deployed remotely in the response device of the service request, specifically, the server that responds to the service request sent by the user terminal. The server performs the corresponding response operation according to the request content of the service request, generates a response result according to the response data generated after processing, and then returns the response result to the user terminal. At the same time, in order to achieve data synchronization of all servers in the response system, the target server will also synchronize the response result to other servers in the response system after completing the response operation, thereby reducing the amount of data that needs to be transferred in the event of a failure, and achieving real-time data synchronization of the server.
[0038] It should be noted that after generating the response result, the target server can directly feed back the response result to the user terminal according to the original address included in the service request, or send the response result to the gateway device for forwarding.
[0039] In S104, if it is detected that any of the servers has an abnormality, the gateway device changes the domain name routing table so that the domain name identifier of the server with the abnormality points to any server in the response system that has not had an abnormality.
[0040] In this embodiment, when an abnormality occurs in a server, the server can actively send an abnormality warning message to the gateway device. After receiving the abnormality warning message, the gateway device will identify that the server has an abnormality. Of course, if the server and the gateway device send heartbeat data packets at preset time intervals, in this case, if the gateway device does not receive the heartbeat data packet sent by the server after the preset time interval, it can identify that the server has an abnormality and perform the relevant operations of S104. Among them, the cause of the abnormality may be: a power outage or leakage in the computer room of a server occurs, which cannot be self-repaired, or the physical link leading to the server is damaged and data cannot be transmitted. Therefore, it is necessary to execute a disaster recovery response process to change the domain name identifier pointing to the server to avoid forwarding service requests to the abnormal server.
[0041] In this embodiment, the gateway device extracts the entry corresponding to the server in the domain name routing table, and changes the server corresponding to the domain name identifier of the abnormal server, so that the domain name identifier points to any server in the response system that has not had an abnormality. Optionally, if the server of the response system of the service request includes a master-slave relationship, the server pointed to by the domain name identifier is changed to the master server; if the servers in the response system do not have a master-slave relationship, the server with the highest operating parameters can be selected as the server pointed to by the domain name identifier.
[0042] From the above, it can be seen that in the service request response method provided by the embodiment of the present invention, all service requests initiated by the user terminal will be redirected through the gateway device. The gateway device will determine the target server that responds to the service request based on the load parameters of the servers deployed in different regions and the domain name identifier of the service request. After the target server responds to the service request, it will also synchronize the response result to all servers in the response system of the service request to ensure the data unity in the system, and when an abnormality occurs, the gateway device will modify the domain name routing table and no longer allocate service requests to the abnormal server. Compared with the existing service request response technology, since each server is deployed in a different place, the disaster recovery performance is higher, and the load balancing between each server is achieved through the gateway device, and the load balancing of all servers in the response system is achieved at the same time.
[0043] Figure 2 FIG. 1 shows a specific implementation flow chart of a method S102 for responding to a service request provided by the second embodiment of the present invention. Figure 2 As shown, relative to Figure 1 In the embodiment, a method for responding to a service request provided in this embodiment includes S1021 to S1024, which are described in detail as follows:
[0044] Further, determining a target server that responds to the service request according to the first load parameter and the domain name routing table includes:
[0045] In S1021, the server corresponding to the domain name identifier of the service request is queried according to the domain name routing table, and is identified as a candidate server.
[0046] In this embodiment, the execution subject of the process is a gateway device. After obtaining the first load parameter of each server, the gateway device can determine the target server that responds to the service request based on the domain name routing table and the first load parameter. Therefore, the gateway device will parse the service request, extract the domain name identifier contained in the service request, and query the server corresponding to the domain name identifier based on the domain name routing table, and identify the server as a candidate server, that is, the server initially specified by the user terminal.
[0047] In this embodiment, since the gateway device has obtained the first load parameter fed back by each server, the gateway device can also determine the first load parameter of the candidate server at the current moment according to the device identifier of the candidate server, that is, the following Main fct It should be noted that, in order to achieve load balancing, each server has a preset load ratio, that is, the ratio between the load amount responded by the server and the total load amount of the response system. After the gateway device determines the candidate server, it can also query the preset load ratio corresponding to the candidate server, that is, Expect pro After determining the above parameters, the gateway device will execute the operation of S1022 to calculate the response index of the candidate server.
[0048] In S1022, each of the first load parameters is introduced into a response index calculation model to determine the response index of the candidate server; the response index calculation model is specifically:
[0049]
[0050] Among them, ReqLevel is the response index; Expect pro is the preset load ratio of the candidate server; fctis the first load parameter of the candidate server; RequstNum is the number of request items contained in the service request; Reserve fct(i) is the first load parameter of the ith server; n is the total number of servers in the response system.
[0051] In this embodiment, since the user terminal can encapsulate multiple request items into the same service request, the server may need to process different request items through multiple parallel processes when responding to a service request, that is, it can be considered that there are multiple service requests. Of course, a service request can also include one service item. In this case, the value of RequstNum is 1. Therefore, based on the first load parameter corresponding to the candidate server at the current moment and the number of service items included in the service request, it can be determined that if the service request is forwarded to the candidate server for processing, the expected load parameter of the server, that is, Main fct +RequstNum.
[0052] In this embodiment, the terminal device calculates the load according to the estimated load parameter and the total load at the current moment, that is, Calculate the actual load ratio of the candidate server. The gateway device may calculate the difference between the preset load ratio and the actual load ratio as the response index of the candidate server. If the value of the response index is less than zero, perform the relevant operations of S1024; otherwise, if the value of the response index is greater than or equal to zero, perform the relevant operations of S1023.
[0053] In S1023, if the value of the response index is greater than or equal to zero, the candidate server is identified as the target server.
[0054] In this embodiment, if the value of the response index is greater than or equal to zero, it means that after the candidate server receives the service request, its actual load ratio does not exceed the preset load ratio, that is, it is in a non-overloaded state. In this case, the gateway device will identify the candidate server as the target server, that is, forward the service request sent by the user terminal to the initial server corresponding to the domain name identifier, and the candidate server will respond.
[0055] In S1024, if the value of the response index is less than zero, the server with the smallest first load parameter is selected as the target server.
[0056] In this embodiment, if the response index of the candidate server is less than zero, it means that after the candidate server receives the service request, its actual load ratio will exceed the preset load ratio, that is, the candidate server will be in an overloaded state. In this case, in order to reduce the number of service requests responded to by the candidate server, the gateway device will forward the service request to other servers, and the selection rule is specifically: select the server with the smallest number of service requests, that is, the server with the smallest first load parameter, so as to avoid the situation where the number of service requests processed by some servers in the response system is too many or too few, thereby achieving the purpose of load balancing.
[0057] In the embodiment of the present invention, by calculating the response index of the candidate server, it is determined whether the candidate server is in an overloaded state, thereby determining the target server that responds to the service request and achieving load balancing in the service request response system.
[0058] Figure 3 FIG. 4 is a flowchart showing a specific implementation of a method S104 for responding to a service request provided in the third embodiment of the present invention. Figure 3 As shown, relative to Figure 1 In the embodiment, a service request response method S104 provided in the embodiment includes S1041 to S1043, which are described in detail as follows:
[0059] Furthermore, the gateway device changes the domain name routing table, including:
[0060] In S1041, the operating parameters and the second load parameter of each server that has no abnormality are obtained.
[0061] In this embodiment, when the gateway device detects that an abnormal server has occurred, it is necessary to change the server pointed to by the domain name identifier of the abnormal server. Therefore, it is necessary to select a relatively stable server from the servers where the abnormal server has occurred in the response system of the service request, thereby avoiding repeated changes and improving the stability of the domain name routing table in the response system.
[0062] In this embodiment, the gateway device calculates the priority of the server according to the operating parameters and load conditions of the server. The higher the parameter value of the operating parameter, the faster the server's ability to process service requests, so that its stability is also more responsive, and the probability of equipment failure or load backlog is lower; similarly, if the load parameter is smaller, it means that the probability of load backlog of the server is lower, so the probability of overload is also lower, and the stability is higher. Based on this, after collecting the operating parameters and the second load parameter of each server that has not experienced an abnormality, the gateway device can calculate the priority of each server.
[0063] In this embodiment, the process of the gateway device obtaining the above two parameters can refer to the process of obtaining the first load parameter, for example, by broadcasting in the response system or extracting from the heartbeat data packet returned from the server. The specific implementation process can refer to the relevant description of S102 and will not be repeated here.
[0064] In S1042, the operating parameters and the second load parameters are imported into a preset priority selection model to calculate the priority of each of the servers that have not experienced an abnormality; the priority selection model is specifically:
[0065]
[0066] Wherein, PRI(j) is the priority of the jth server that has no abnormality; RunPrmeter j is the operating parameter of the jth server without any abnormality; j is the second load parameter of the jth server that has no abnormality; m is the number of the servers that have no abnormality; α is a preset coefficient.
[0067] In this embodiment, the preset coefficient α is specifically used to adjust the weight of the operating parameter and the second load parameter in the priority. For example, if the user sets the operating efficiency priority mode, the value of the preset coefficient α is larger, and if the user sets the load balancing priority mode, the value of the preset coefficient α is smaller. Therefore, the user can adjust the value of the preset coefficient α to achieve the adjustment of the parameter focus. It should be noted that the value of the preset coefficient α is greater than 0 and less than 1.
[0068] In this embodiment, the higher the value of the priority, the higher the stability of the server; conversely, if the priority is lower, the stability of the server is lower. Therefore, if the parameter value of the operating parameter of a server is larger and the value of the second load parameter is smaller, it means that the service response efficiency of the server is the highest and the current load is low, so it is identified as the server with the highest priority and the best stability.
[0069] In S1043, the server with the highest priority and no abnormality is identified as the server pointed to by the domain name identifier.
[0070] In this embodiment, the gateway device sorts the servers that have not experienced anomalies according to the order of priority, and selects the server that has not experienced anomalies with the highest priority as the server to which the domain name identifier of the server that has experienced anomalies points.
[0071] In an embodiment of the present invention, the priority of each server that has not experienced an abnormality is calculated through operating parameters and a second load parameter, and the server with the highest priority is selected as the server to which the domain name identifier that needs to be changed points, thereby reducing the possibility that the server pointed to by the domain name identifier will be overloaded after the domain name routing table is changed, which may cause a chain reaction of abnormalities and improve the stability of the response system.
[0072] Figure 4 FIG. 4 shows a specific implementation flow chart of a method for responding to a service request provided by the fourth embodiment of the present invention. Figure 4 As shown, relative to Figures 1 to 3 The embodiment, a method for responding to a service request provided in this embodiment, further includes: S401 to S402, which are described in detail as follows:
[0073] In S401, if it is detected that an abnormality occurs in any of the servers, the gateway device obtains a to-be-processed service request from the server where the abnormality occurs.
[0074] In this embodiment, when the gateway device detects that an abnormality has occurred in the server, in addition to changing the domain name routing table so that service requests subsequently initiated by the user terminal can be forwarded to the server where the abnormality has not occurred for processing, the service requests that the server where the abnormality has occurred is currently responding to also need to be further forwarded to other servers for subsequent response operations, thereby reducing the situation where the user terminal repeatedly initiates the same service request, improving the user experience, and responding to the self-deployment capabilities within the system.
[0075] In this embodiment, the gateway device will obtain the processed service request from the cache area of the server where the exception occurred. If the server has output a response result but has not fed back to the user terminal, the gateway device can also obtain the response result of the service request from the cache area and send it to the user terminal. The service request corresponding to the response result will be identified as a responded service request, and no subsequent request forwarding operations will be performed.
[0076] It should be noted that if the network management device cannot obtain the service request from the server where the exception occurs, since the service requests of each server are forwarded by the network management device, the network management device can extract the service request list sent to the server where the exception occurs from the local cache area, and identify the service request to be processed based on the response information of the user terminal.
[0077] In S402, based on the order of the first load parameters from small to large, the gateway device forwards the to-be-processed service requests to the servers in the response system that have not experienced any abnormality.
[0078] In this embodiment, the network management device will sort from small to large based on the value of the first load parameter to obtain a server sequence. Since the number of unprocessed service requests may be multiple, in order to achieve load balancing, the network management device will forward the service requests starting from the server with the smallest first load parameter. If each server has forwarded the unprocessed service requests but there are still unassigned service requests, they will continue to be assigned one by one in the above order until all unprocessed service requests are forwarded.
[0079] In an embodiment of the present invention, by obtaining unprocessed service requests from the server where the exception occurs and forwarding the service requests in sequence according to the value of the first load parameter, not only can the situation where the user terminal repeatedly initiates service requests be reduced, but load balancing can also be achieved, thereby improving the stability of the service request response system.
[0080] Figure 5 FIG. 5 shows a specific implementation flow chart of a method for responding to a service request provided by the fifth embodiment of the present invention. Figure 5 As shown, relative to Figure 1-Figure 3 The embodiment, a method for responding to a service request provided in this embodiment, further includes: S501 and S502, which are described in detail as follows:
[0081] Further, after the gateway device changes the domain name routing table if an abnormality is detected in any of the servers, the method further includes:
[0082] In S501, the gateway device receives abnormality repair information, where the abnormality repair information carries a device identifier corresponding to the server whose abnormality repair is completed.
[0083] In this embodiment, after the fault condition of the abnormal server has been eliminated, it can send an abnormal repair information to the gateway device, thereby informing the gateway device that the service request can be forwarded to the server. Optionally, after the server fault is repaired, the server will send a synchronization broadcast to the response system, so that each server in the response system will synchronize the data updated during the fault period to the server, thereby ensuring data synchronization of all servers in the response system.
[0084] In this embodiment, the abnormal repair information includes the device identification of the server. The gateway device can identify the original domain name identification of the server through the device identification and perform the relevant operations of S502.
[0085] In S502, the gateway device re-establishes the correspondence between the server whose abnormality has been repaired and the domain name identifier according to the device identifier, and updates the domain name routing table.
[0086] In this embodiment, the gateway device will query the domain name identifier originally corresponding to the server whose abnormality has been repaired, and re-establish the correspondence between the server and the domain name identifier, and update the domain name routing table after establishing the correspondence. In subsequent operations, the gateway device can forward the corresponding service request to the server.
[0087] In the embodiment of the present invention, after the server abnormality is repaired, it is added back into the response system, thereby improving the stability of the response system.
[0088] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0089] Figure 6 The structure diagram of a service request response system provided by an embodiment of the present invention is shown. The service request response device includes various devices for executing Figure 1 For details, please refer to the steps in the corresponding embodiment. Figure 1 and Figure 1 For the convenience of explanation, only the parts related to this embodiment are shown.
[0090] See also Figure 6 The service request response system includes: a gateway device 610 and at least two servers 620 deployed remotely:
[0091] The gateway device 610 is used to receive a service request sent by a user terminal; the service request includes a domain name identifier;
[0092] The gateway device 610 is used to collect the first load parameter of each server at the current moment, and determine the target server that responds to the service request according to the first load parameter and a preset domain name routing table, and send the service request to the target server 621; the domain name routing table records the corresponding relationship between each server and the domain name identifier;
[0093] The target server 621 is used to respond to the service request and synchronize the response result of the service request to all the servers 620 in the response system;
[0094] The gateway device 610 is used to change the domain name routing table if it is detected that any of the servers 622 has an abnormality, so that the domain name identifier of the server 622 with the abnormality points to any server 623 in the response system that has not had an abnormality.
[0095] Optionally, determining the target server 621 that responds to the service request according to the first load parameter and the domain name routing table includes:
[0096] According to the domain name routing table, query the server 620 corresponding to the domain name identifier of the service request and identify it as a candidate server;
[0097] Each of the first load parameters is introduced into a response index calculation model to determine the response index of the candidate server; the response index calculation model is specifically:
[0098]
[0099] Among them, ReqLevel is the response index; Expect pro is the preset load ratio of the candidate server; fct is the first load parameter of the candidate server; RequstNum is the number of request items contained in the service request; Reserve fct(i) is the first load parameter of the i-th server; n is the total number of servers in the response system;
[0100] If the value of the response index is greater than or equal to zero, identifying the candidate server as the target server 621;
[0101] If the value of the response index is less than zero, the server with the smallest first load parameter is selected as the target server 621.
[0102] Optionally, the gateway device 610 is used to change the domain name routing table, including:
[0103] The gateway device 610 is used to obtain the operating parameters and the second load parameter of each of the servers 623 that have not experienced any abnormality;
[0104] The gateway device 610 is used to import the operating parameters and the second load parameter into a preset priority selection model to calculate the priority of each of the servers 623 that have not experienced an abnormality; the priority selection model is specifically:
[0105]
[0106] Wherein, PRI(j) is the priority of the jth server 623 that has no abnormality; RunPrmeter j is the operating parameter of the jth server 623 that has no abnormality; j is the second load parameter of the jth server 623 that has no abnormality; m is the number of the servers 623 that have no abnormality; α is a preset coefficient;
[0107] The gateway device 610 is used to identify the server 623 with the highest priority and no abnormality as the server pointed to by the domain name identifier.
[0108] Optionally, the gateway device 610 is further configured to:
[0109] The gateway device 610 is used to obtain a to-be-processed service request from the server 622 where the abnormality occurs if an abnormality is detected in any of the servers 620;
[0110] The gateway device 610 is used to forward the to-be-processed service requests to the servers 623 in the response system where no abnormality has occurred, in sequence, based on the first load parameters in ascending order.
[0111] Optionally, the gateway device 610 is further configured to:
[0112] The gateway device 610 is used to receive abnormality repair information, where the abnormality repair information carries a device identifier corresponding to the server whose abnormality repair is completed;
[0113] The gateway device 610 is used to re-establish the correspondence between the server whose abnormality has been repaired and the domain name identifier according to the device identifier, and update the domain name routing table.
[0114] Therefore, in the service request response system provided by the embodiment of the present invention, all service requests initiated by the user terminal will be redirected through the gateway device. The gateway device will determine the target server that responds to the service request based on the load parameters of the servers deployed in different regions and the domain name identifier of the service request. After the target server responds to the service request, it will also synchronize the response result to all servers in the service request response system to ensure the data uniformity in the system, and when an abnormality occurs, the gateway device will modify the domain name routing table and no longer allocate service requests to the abnormal server. Compared with the existing service request response technology, since each server is deployed in a different location, the disaster recovery performance is higher, and the load balancing between each server is achieved through the gateway device, and the load balancing of all servers in the response system is achieved at the same time.
[0115] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0116] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for responding to a service request, applied to a system for responding to a service request, characterized in that: The service request response system includes: a gateway device and at least two servers deployed remotely, and the service request response method includes: The gateway device receives a service request sent by a user terminal; the service request includes a domain name identifier; The gateway device collects the first load parameter of each of the servers at the current moment, and determines the target server that responds to the service request according to the first load parameter and a preset domain name routing table, and sends the service request to the target server; the domain name routing table records the corresponding relationship between each of the servers and the domain name identifier; The target server responds to the service request and synchronizes the response result of the service request to all the servers in the response system; If an abnormality is detected in any of the servers, the gateway device changes the domain name routing table so that the domain name identifier of the server with the abnormality points to any server in the response system without the abnormality; The step of determining a target server that responds to the service request according to the first load parameter and the domain name routing table includes: According to the domain name routing table, query the server corresponding to the domain name identifier of the service request and identify it as a candidate server; Each of the first load parameters is introduced into a response index calculation model to determine the response index of the candidate server; the response index calculation model is specifically: Among them, ReqLevel is the response index; Expect pro is the preset load ratio of the candidate server; fct is the first load parameter of the candidate server; RequstNum is the number of request items contained in the service request; Reserve fct(i) is the first load parameter of the i-th server; n is the total number of servers in the response system; If the value of the response index is greater than or equal to zero, identifying the candidate server as the target server; If the value of the response index is less than zero, the server with the smallest first load parameter is selected as the target server.
2. The response method according to claim 1, characterized in that: The gateway device changes the domain name routing table, including: Obtaining the operating parameters and the second load parameter of each of the servers that have not experienced any abnormality; The operating parameters and the second load parameters are introduced into a preset priority selection model to calculate the priority of each server that has not experienced an abnormality; the priority selection model is specifically: Wherein, PRI(j) is the priority of the jth server that has no abnormality; RunPrmeter j is the operating parameter of the jth server without any abnormality; j is the second load parameter of the jth server that has no abnormality; m is the number of the servers that have no abnormality; α is a preset coefficient; The server with the highest priority and no abnormality is identified as the server pointed to by the domain name identifier.
3. The response method according to any one of claims 1 to 2, characterized in that: Also includes: If an abnormality is detected in any of the servers, the gateway device obtains a service request to be processed from the server where the abnormality occurs; Based on the order of the first load parameters from small to large, the gateway device forwards the to-be-processed service requests in sequence to the servers in the response system where no abnormality has occurred.
4. The response method according to any one of claims 1 to 2, characterized in that: After the gateway device changes the domain name routing table if an abnormality is detected in any of the servers, the method further includes: The gateway device receives abnormality repair information, where the abnormality repair information carries a device identifier corresponding to the server whose abnormality repair is completed; The gateway device re-establishes the correspondence between the server whose abnormality has been repaired and the domain name identifier according to the device identifier, and updates the domain name routing table.
5. A service request response system, characterized in that: The service request response system includes: a gateway device and at least two servers deployed remotely: The gateway device is used to receive a service request sent by a user terminal; the service request includes a domain name identifier; The gateway device is used to collect the first load parameter of each of the servers at the current moment, and determine the target server that responds to the service request according to the first load parameter and a preset domain name routing table, and send the service request to the target server; the domain name routing table records the corresponding relationship between each of the servers and the domain name identifier; The target server is used to respond to the service request and synchronize the response result of the service request to all the servers in the response system; The gateway device is used to change the domain name routing table if it is detected that any of the servers has an abnormality, so that the domain name identifier of the server with the abnormality points to any server in the response system that has not had an abnormality; The step of determining a target server that responds to the service request according to the first load parameter and the domain name routing table includes: According to the domain name routing table, query the server corresponding to the domain name identifier of the service request and identify it as a candidate server; Each of the first load parameters is introduced into a response index calculation model to determine the response index of the candidate server; the response index calculation model is specifically: Among them, ReqLevel is the response index; Expect pro is the preset load ratio of the candidate server; fct is the first load parameter of the candidate server; RequstNum is the number of request items contained in the service request; Reserve fct(i) is the first load parameter of the i-th server; n is the total number of servers in the response system; If the value of the response index is greater than or equal to zero, identifying the candidate server as the target server; If the value of the response index is less than zero, the server with the smallest first load parameter is selected as the target server.
6. The response system according to claim 5, characterized in that: The gateway device is used to change the domain name routing table, including: The gateway device is used to obtain the operating parameters and the second load parameter of each of the servers that have not experienced any abnormality; The gateway device is used to import the operating parameters and the second load parameters into a preset priority selection model to calculate the priority of each of the servers that has not experienced an abnormality; the priority selection model is specifically: Wherein, PRI(j) is the priority of the jth server that has no abnormality; RunPrmeter j is the operating parameter of the jth server without any abnormality; j is the second load parameter of the jth server that has no abnormality; m is the number of the servers that have no abnormality; α is a preset coefficient; The gateway device is used to identify the server with the highest priority and no abnormality as the server pointed to by the domain name identifier.
7. The response system according to any one of claims 5 to 6, characterized in that: The gateway device is further used for: The gateway device is used for obtaining a to-be-processed service request from the server where the abnormality occurs if an abnormality is detected in any of the servers; The gateway device is used to forward the to-be-processed service requests to the servers in the response system that have not experienced any abnormality in sequence based on the first load parameters in an ascending order.
8. The response system according to any one of claims 5 to 6, characterized in that: The gateway device is further used for: The gateway device is used to receive abnormality repair information, where the abnormality repair information carries a device identifier corresponding to the server whose abnormality repair is completed; The gateway device is used to re-establish the corresponding relationship between the server whose abnormality has been repaired and the domain name identifier according to the device identifier, and update the domain name routing table.
