Response Method, Apparatus, Device, and Medium of DNS Server

The DNS server method enhances response speed and fault tolerance by dynamically selecting devices based on identifiers and priorities, addressing slow response and low fault tolerance issues in existing DNS systems.

CN120034581BActive Publication Date: 2025-07-15SICHUAN TIANYI COMHEART TELECOM
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510515963.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-23
Publication Date
2025-07-15
Estimated Expiration
2045-04-23

AI Technical Summary

Technical Problem

The existing DNS response methods have problems such as slow response speed and low fault tolerance.

Method used

By receiving a user request, the corresponding identification of the request is determined, the target device and its target identification are determined based on the identification and multiple preset devices, and the target identification is determined whether the target device has obtained the request result within the preset time limit. If it is not obtained, the device to be requested and its device identification is determined, and the device to be obtained is determined based on the target identifier and the device identification, the target request result is obtained and sent to the terminal.

Benefits of technology

It improves the response speed and fault tolerance of DNS servers, realizes dual-stack compatibility and automatic switching of IPv4/IPv6, and optimizes the resource utilization of DNS proxy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120034581B_ABST
    Figure CN120034581B_ABST
Patent Text Reader

Abstract

The present application provides a response method, apparatus, device, and medium for a DNS server. The method includes: receiving a user request and determining an identifier corresponding to the user request; determining a corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtaining a request result of the user request according to the target device; determining whether the request result is obtained by the target device within a preset time limit; if the request result is obtained, determining the data type of the request result, and determining a device to be obtained in the preset devices based on the data type and the target identifier; if the request result is not obtained, determining a device to be requested and its device identifier in the preset devices, and determining the device to be obtained according to the target identifier and the device identifier; obtaining a target request result according to the device to be obtained, and sending the target request result to a terminal corresponding to the user request. In this way, the response speed of the DNS server is improved, and the user's network access experience is enhanced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of DNS proxy, and particularly to a response method, device, equipment and medium for a DNS server. Background Art

[0002] DNS proxy is a network proxy service that acts as an intermediary between the client and the DNS server, mainly for forwarding DNS query requests and responses.

[0003] If there is an abnormality in the DNS response, the existing methods generally adopt ways such as checking the device settings or clearing the DNS cache.

[0004] However, the existing processing methods have problems of slow response speed and low fault tolerance rate. Summary of the Invention

[0005] This application provides a response method, device, equipment and medium for a DNS server to solve the problems of slow response speed and low fault tolerance rate existing in the existing processing methods.

[0006] In a first aspect, this application provides a response method for a DNS server, and the method includes:

[0007] Receive a user request and determine the identifier corresponding to the user request;

[0008] According to the identifier and multiple preset devices, determine the corresponding target device and its target identifier, and obtain the request result of the user request according to the target device;

[0009] Judge whether the request result is obtained by the target device within the preset time limit;

[0010] If the request result is obtained, judge the data type of the request result, and determine the device to be obtained in the preset devices based on the data type and the target identifier;

[0011] If the request result is not obtained, determine the device to be requested and its device identifier in the preset devices, and determine the device to be obtained according to the target identifier and the device identifier;

[0012] Obtain the target request result according to the device to be obtained, and send the target request result to the terminal corresponding to the user request.

[0013] In some embodiments of this application, according to the identifier and multiple preset devices, determining the corresponding target device and its target identifier, and obtaining the request result of the user request according to the target device includes:

[0014] Determine the device identifier of the preset device, and determine the target device identifier that is the same as the identifier in the device identifier;

[0015] Determine the preset priority corresponding to the target device identifier, and compare the preset priorities to obtain a comparison result;

[0016] According to the comparison result, determine the target device identifier with the highest preset priority, and determine the preset device corresponding to the target device identifier as the target device;

[0017] Determine the device identifier of the target device as the target identifier, and obtain the request result of the user request according to the target device.

[0018] In some embodiments of the present application, if the request result is obtained, determine the data type of the request result, and based on the data type and the target identifier, determine the device to be obtained in the preset device, including:

[0019] If the request result is obtained, determine the data type of the request result;

[0020] If the data type does not include the target data type, determine the device identifier of the preset device, and determine the device identifier to be obtained that is different from the target identifier among the device identifiers;

[0021] Determine the preset priority corresponding to the device identifier to be obtained, and determine the device identifier to be obtained with the highest preset priority as the target device identifier to be obtained;

[0022] Determine the preset device corresponding to the target device identifier to be obtained as the device to be obtained;

[0023] If the data type includes the target data type, determine the request result as the target request result, and send the target request result to the terminal corresponding to the user request.

[0024] In some embodiments of the present application, if the request result is not obtained, determine the device to be requested and its device identifier in the preset device, and determine the device to be obtained according to the target identifier and the device identifier, including:

[0025] Determine the device in the preset device that has not sent the user request as the device to be requested;

[0026] Determine the device identifier of the device to be requested, and compare the device identifier and the target identifier to obtain a comparison result;

[0027] According to the comparison result, determine the device to be obtained.

[0028] In some embodiments of the present application, according to the comparison result, determine the device to be obtained, including:

[0029] Determine the comparison result;

[0030] If the comparison result is that there is an identifier in the device identifier that is the same as the target identifier, determine the device to be requested corresponding to the same identifier as the target device to be requested;

[0031] If the comparison result is that there is no identifier in the device identifier that is the same as the target identifier, then determine all the devices to be requested as the target devices to be requested;

[0032] Determine the preset priority corresponding to the target device to be requested, and determine the target device to be requested with the highest preset priority as the device to be obtained.

[0033] In some embodiments of the present application, the method further includes:

[0034] Determine the deadline corresponding to the user request, and the deadline is longer than the preset time limit;

[0035] If the target request result is not sent to the terminal corresponding to the user request within the deadline, then determine the devices in the preset devices that have sent the user request, and determine the target devices in the devices that have not obtained the request result of the user request;

[0036] Determine the target device as an unreachable device, and the unreachable device is a device that cannot receive the user request.

[0037] In some embodiments of the present application, after determining that the target device is an unreachable device, the method further includes:

[0038] Determine the preset detection time;

[0039] According to the detection time, send a detection request to the unreachable device, and determine the preset time limit and the deadline corresponding to the detection request;

[0040] According to the preset time limit and the deadline, determine the acquisition result of the unreachable device for the detection request;

[0041] If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is higher than that of other preset devices, and the reachable device is a device that can receive the user request;

[0042] If the acquisition result is that the unreachable device obtains the detection result within the time limit outside the preset time limit and within the deadline, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is lower than that of other preset devices;

[0043] If the acquisition result is that the unreachable device does not obtain the detection result within the deadline, then still determine it as an unreachable device.

[0044] In a second aspect, the present application provides a response device for a DNS server, and the device includes:

[0045] A receiving module, configured to receive a user request and determine the identifier corresponding to the user request;

[0046] An identification determination and result acquisition module, configured to determine a corresponding target device and its target identifier according to an identifier and a plurality of preset devices, and acquire a request result of a user request according to the target device;

[0047] An acquisition judgment module, configured to judge whether a request result is acquired by the target device within a preset time limit;

[0048] A data type judgment module, configured to, if a request result is acquired, judge the data type of the request result, and determine a device to be acquired in the preset devices based on the data type and the target identifier;

[0049] A device to be requested acquisition module, configured to, if a request result is not acquired, determine a device to be requested and its device identifier in the preset devices, and determine a device to be acquired according to the target identifier and the device identifier;

[0050] A sending module, configured to acquire a target request result according to the device to be acquired, and send the target request result to a terminal corresponding to the user request.

[0051] In a third aspect, the present application provides a computer device, including: a processor, and a memory communicatively connected to the processor;

[0052] The memory stores computer execution instructions;

[0053] The processor executes the computer execution instructions stored in the memory to implement the method of the present application.

[0054] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored, and when the program code is executed by a processor, it is used to implement the method of the present application.

[0055] The DNS server response method, device, device and medium provided by the present application receive a user request, and determine an identifier corresponding to the user request; determine a corresponding target device and its target identifier according to the identifier and a plurality of preset devices, and acquire a request result of the user request according to the target device; judge whether a request result is acquired by the target device within a preset time limit; if a request result is acquired, judge the data type of the request result, and determine a device to be acquired in the preset devices based on the data type and the target identifier; if a request result is not acquired, determine a device to be requested and its device identifier in the preset devices, and determine a device to be acquired according to the target identifier and the device identifier; acquire a target request result according to the device to be acquired, and send the target request result to a terminal corresponding to the user request.

[0056] In this way, by determining the preset time limit corresponding to the DNS server, the acquisition situation of the request result within the preset time limit can be determined, and according to the identifier of the DNS server, the corresponding new server can be determined for different acquisition situations, so as to obtain the request result corresponding to the user request again according to the new server, realizing the optimal selection of the DNS server and improving the response speed to the user request; at the same time, the dual-stack compatibility of IPv4 / IPv6 is realized, the IP type is automatically switched, and the fault tolerance rate of the DNS proxy is improved. Brief Description of the Drawings

[0057] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.

[0058] Figure 1 It is a schematic flowchart of a method for a DNS server to respond provided by an embodiment of the present application;

[0059] Figure 2 It is a schematic diagram of a method for a DNS server to respond provided by an embodiment of the present application;

[0060] Figure 3 It is a schematic flowchart of another method for a DNS server to respond provided by an embodiment of the present application;

[0061] Figure 4 It is a schematic structural diagram of a device for a DNS server to respond provided by an embodiment of the present application;

[0062] Figure 5 It is a structural block diagram of a device for executing the method for a DNS server to respond according to an embodiment of the present application.

[0063] Through the above-mentioned accompanying drawings, the clear embodiments of the present application have been shown, and there will be more detailed descriptions later; these accompanying drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to explain the concept of the present application to those skilled in the art by referring to specific embodiments. Detailed Description of the Embodiments

[0064] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0065] DNS proxy is a service or technology that forwards DNS requests to other DNS servers. The DNS proxy server acts as an intermediary between the client and the target DNS server. When the client sends a DNS request, instead of directly sending it to the locally configured DNS server, the request is sent to the DNS proxy server. After receiving the request, the proxy server queries the real DNS server on behalf of the client and returns the obtained result to the client.

[0066] The following uses specific embodiments to detail the technical solutions of this application and how the technical solutions of this application solve the above technical problems. These several specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0067] Figure 1 It is a schematic flowchart of a method for a DNS server to respond provided by an embodiment of this application. As Figure 1 shown, the method for the DNS server to respond may include the following steps:

[0068] S110. Receive a user request and determine the identifier corresponding to the user request.

[0069] Among them, the user request is a request sent by the user terminal. The user terminal sends the user request to the DNS server, so as to obtain the information corresponding to the user request through the DNS server. The user's DNS request can be added to the linked list, so that the corresponding request result can be obtained according to the requests in the linked list later.

[0070] The identifier can be understood as a specific number used for distinction and identification, and it can be the IP (Internet Protocol) of the user terminal corresponding to the user request, such as IPv4 or IPv6.

[0071] Based on this, by receiving the user request and determining the identifier of the user terminal corresponding to the user request, so that later, according to the identifier of the user request, the corresponding DNS server can be determined to forward the user request, so as to obtain the corresponding request result and send it to the user terminal, meeting the user's usage requirements.

[0072] S120. Determine the corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtain the request result of the user request according to the target device.

[0073] Among them, the preset device is a device set in advance for receiving and forwarding user requests, and it can be a DNS server.

[0074] The target device is the device corresponding to the identifier requested by the user among the preset devices, and is used to forward the user request. For example, if the identifier requested by the user is IPv4, the target device can be the DNS server for IPv4.

[0075] The request result is the corresponding response or feedback information obtained after sending the user request, and is the final presentation of the request operation, which may include the information required by the user request.

[0076] Based on this, by determining the identifier corresponding to the user request, so as to determine the server corresponding to the identifier in the preset DNS server, that is, the target device, and forwarding the user request according to the target device, the request result can be obtained. Then, according to the different acquisition situations of the request result, a new DNS server can be determined through the target identifier of the target device, so as to forward the user request again to improve the response speed.

[0077] S130. Determine whether the target device obtains the request result within the preset time limit.

[0078] Among them, the preset time limit is a preset time limit, which can be understood as the processing time of the DNS server for the user request stipulated in advance. For example, the preset time limit can be 5 seconds.

[0079] Based on this, by determining whether the DNS server obtains the request result within the preset time limit, it can be determined whether the DNS server completes the response to the user request within the specified time. Then, according to the response situation of the DNS server to the user request within the specified time, a corresponding new DNS server can be determined according to different response situations, so as to forward the user request again according to the new DNS server, thereby accelerating the processing of the user request, improving the resource utilization rate of the DNS server, enhancing the fluency of use, and better meeting the user's needs.

[0080] S140. If the request result is obtained, judge the data type of the request result, and determine the device to be obtained in the preset device based on the data type and the target identifier.

[0081] Among them, the data type is the type corresponding to the data included in the request result. For example, it may include the type type or the cname type.

[0082] The device to be obtained is the DNS server that can be used to forward the user request again.

[0083] Based on this, by determining whether the DNS server obtains the request result within a preset time limit, when the request result is obtained, the data type included in the request result is determined, so as to determine the DNS server that can forward the user request again according to the data type of the request result and the identifier of the DNS server. For example, the preset time limit can be 5 seconds. If the DNS server obtains the request result corresponding to the user request within 5 seconds, it is further determined whether the request result includes data of type type, so as to determine, according to the judgment result of the data type, through the target identifier corresponding to the DNS server, the server that can forward the user request again from the preset DNS servers.

[0084] S150. If the request result is not obtained, determine the device to be requested and its device identifier in the preset device, and determine the device to be obtained according to the target identifier and the device identifier.

[0085] Among them, the device to be requested is the server in the preset DNS server that has not forwarded this user request, and the device identifier is the IP identifier corresponding to this server.

[0086] Based on this, if the target DNS server does not obtain the corresponding request result within the preset time limit, by determining the server in the preset DNS server that has not forwarded this user request, the DNS server that can forward the user request again is determined according to the identifier of the target DNS server and the identifier of the server that has not forwarded the request, so as to forward the user request again according to this DNS server subsequently.

[0087] S160. According to the device to be obtained, obtain the target request result, and send the target request result to the terminal corresponding to the user request.

[0088] Among them, the target request result is the response result of the DNS server to the user request.

[0089] Based on this, the user request is forwarded again through the device to be obtained, so as to obtain the corresponding request result and send it to the user side, completing the current DNS response.

[0090] On the basis of the feasible implementation manner of the above S120, the present application further provides a process of determining the corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtaining the request result of the user request according to the target device:

[0091] Determine the device identifier of the preset device, and determine the target device identifier that is the same as the identifier in the device identifier;

[0092] Determine the preset priority corresponding to the target device identifier, and compare the preset priorities to obtain a comparison result;

[0093] According to the comparison result, determine the target device identifier with the highest preset priority, and determine the preset device corresponding to the target device identifier as the target device;

[0094] Determine the device identifier of the target device as the target identifier, and obtain the request result of the user request according to the target device.

[0095] Among them, the same identifier means the same IP of the DNS server. For example, the device identifier of the preset device may include IPv4 and IPv6. If the IP corresponding to the user request is IPv4, then determine that IPv4 in the preset device is the target device identifier.

[0096] The preset priority is the forwarding priority of the preset device. It can be understood that the DNS server with a higher priority obtains the request faster. Therefore, when determining the DNS server to forward the user request, the DNS server with a higher priority will be selected for forwarding according to the order of the preset priorities, so as to improve the speed of obtaining the request result. Further, the priorities of the servers can also be set to be the same in the initial state, and the main server can be preferentially selected when forwarding the user request.

[0097] Based on this, by determining the IP identifier corresponding to the user request, the server with the same IP as the user request is determined among the preset DNS servers, and the preset priorities of these servers are further determined, so as to determine the server with the highest priority as the target device and determine the corresponding target identifier, so as to obtain the request result according to the target device, which speeds up the speed of obtaining the request result.

[0098] On the basis of the feasible implementation manner of the above S140, the present application further provides a process of determining the device to be obtained in the preset device based on the request result, the data type of the request result, and the target identifier:

[0099] If the request result is obtained, judge the data type of the request result;

[0100] If the data type does not include the target data type, determine the device identifier of the preset device, and determine the device identifier to be obtained that is different from the target identifier in the device identifier;

[0101] Determine the preset priority corresponding to the device identifier to be obtained, and determine the device identifier to be obtained with the highest preset priority as the target device identifier to be obtained;

[0102] Determine the preset device corresponding to the target device identifier to be obtained as the device to be obtained;

[0103] If the data type includes the target data type, determine the request result as the target request result, and send the target request result to the terminal corresponding to the user request.

[0104] Among them, determining the data type of the request result can be understood as determining whether the request result includes the target data type. The target data type is used to determine whether the obtained request result meets the user's request and can be a response of the type type.

[0105] Based on this, if the DNS server obtains the request result within the preset time limit, it can further determine whether the request result contains a response of the type type. If it contains, it indicates that the request result meets the user's needs, and thus the request result can be sent to the corresponding terminal of the user request to implement the response of the DNS server to the user request. If it does not contain, it indicates that the request result does not meet the requirements. For example, there is no corresponding type type response in the response, only cname. This situation occurs more frequently when using an IPv6 server. Then, determine another IP type server (for example, if the previous server is the C server of IPv6, select the server with the higher priority from A and B), and forward the user request to the locally configured DNS server again through this server, and return the request result obtained from the locally configured DNS server to the user end, thereby improving the response speed of the user request.

[0106] Based on the feasible implementation manner of the above S150, the present application further provides a process for determining the device to be requested and its device identifier in the preset device and determining the device to be obtained according to the target identifier and the device identifier if the request result is not obtained:

[0107] Determine the device that has not sent the user request in the preset device as the device to be requested;

[0108] Determine the device identifier of the device to be requested, and compare the device identifier with the target identifier to obtain a comparison result;

[0109] Determine the device to be obtained according to the comparison result.

[0110] Based on this, if the DNS server does not obtain the request result within the preset time limit, it can determine the DNS server that has not forwarded the user request from the preset servers according to the device identifier, so as to obtain a comparison result by comparing the identifier of the target DNS server and the server that has not forwarded the user request, so as to subsequently determine the DNS server that can be used to forward the user request again from the DNS servers that have not forwarded the user request according to the comparison result.

[0111] Based on the feasible implementation manner of the above S150, the present application further provides a process for determining the device to be obtained according to the comparison result:

[0112] Determine the comparison result;

[0113] If the comparison result shows that there is an identifier in the device identifier that is the same as the target identifier, determine the device to be requested corresponding to the same identifier as the target device to be requested;

[0114] If the comparison result shows that there is no identifier in the device identifier that is the same as the target identifier, determine all devices to be requested as the target devices to be requested;

[0115] Determine the preset priority corresponding to the target device to be requested, and determine the target device to be requested with the highest preset priority as the device to be obtained.

[0116] Based on this, by determining the DNS server that has not forwarded the user request, further compare the IP identifier of the target DNS server and the IP identifier of the unforwarded DNS server, so as to determine whether the unforwarded DNS server includes a server with the same identifier as the target identifier. If there is, preferentially determine the server with the same identifier as the device to be requested, and further determine the server with the highest priority among the servers with the same identifier for re-forwarding the user request. If there is no server with the same identifier, it is also possible to forward through the server with the highest priority among them.

[0117] Please refer to Figure 2 , Figure 2 which is a schematic diagram of a method for a DNS server to respond provided by an embodiment of this application. As Figure 2 shown, the DNS request of the user is added to the linked list, and the received time is marked as the retrieval information when receiving the server response. Start a long timer, and the long timer can be marked with the transaction id. If the user accesses using IPv4, select the reachable and higher-priority server from servers A and B. Servers A and B are both IPv4 servers; if using IPv6, select from C and D. Servers C and D are both IPv6 servers. After selecting the server, forward the user's DNS request and record the selected server number in the linked list. After forwarding, start a short timer, and the short timer can be marked with a serial number.

[0118] If the server response is received, the short timer of this request has not timed out, and the response also contains the response of the required type, cancel the timing, and forward the response to the user according to the user information in the linked list, and set the server that received the response as the one that has received the response. If the server recorded in this linked list is only the server of this response, delete this record and delete the long timer. If there are other servers in this record that have not received information, keep this record.

[0119] If a server response is received, the short timer of the server has not timed out, but there is no corresponding type of response in the response. For example, there is only a CNAME type response. This situation is more common when using an IPv6 server. Select another server of a different IP type (for example, if the previous server was an IPv6 C server, select the server with the higher priority from A and B), forward the request again, record the server number in the linked list, and reset the timer.

[0120] If a server response is received, but the short timer has timed out, the recorded server information is set to received. If there is already a response information from another server in the request record, the response is not forwarded; otherwise, the response is forwarded.

[0121] If the short timer has timed out and no server response has been received, select another server from the servers of the same IP address type, forward the request again, and start a new short timer. The priority of the server with a response timeout is decreased by 1 level.

[0122] If DNS requests have been forwarded to all servers of the same type, such as IPv6 C and D servers have both been forwarded, select the server with the higher priority from the servers of another type, A and B, forward it, record the server number in the linked list, and reset the short timer. If all servers have been forwarded, and there is only a response that does not match the type of the request in the record, forward the response to the user.

[0123] If the long timer has timed out, check whether there is a forwarded request in the request record that has not received a response, and mark the corresponding server as unreachable.

[0124] In a separate thread, regularly detect unreachable servers. If a server can respond within the short timer period, change the server status to reachable and set the priority to the highest priority among the current servers of this type; if it can respond within the long timer period, change the server status to reachable and set the priority to the lowest priority among the current servers of this type.

[0125] In some embodiments of the present application, in order to implement the acquisition situation of user requests by the DNS server within a preset time limit, and thus perform corresponding DNS responses according to different acquisition situations, it is possible to determine the DNS server with the same IP identifier for forwarding through the IP identifier corresponding to the user request, and determine whether the DNS server obtains the request result within the preset time. If the result is obtained, it is further determined whether the request result contains data of the target type. If it does, it indicates that the request result meets the user's needs, and then the request result can be sent to the user terminal through the DNS server to achieve the response. If it does not, a server with a different IP identifier is determined from other DNS servers to forward the user request again; if the result is not obtained, other DNS servers with different IP identifiers are preferentially determined to forward the request again. If all servers with different IP identifiers have sent the request, it is also possible to send it through the server with the same IP identifier. At the same time, when determining the DNS server to send, by determining the priority corresponding to the server, a server with a higher priority is determined to send, so as to improve the response speed to user requests.

[0126] In this way, when an abnormality occurs in the acquisition of the request result by the DNS server within the preset time limit, it is possible to quickly determine a new DNS server to forward the user request again according to the IP identifier and priority, thereby accelerating the processing of the user request, improving the resource utilization rate of the DNS server, realizing the automatic switching of two types of IP servers, and improving the response speed by preferentially selecting the server.

[0127] Figure 3 It is a schematic flow chart of another DNS server response method provided by an embodiment of the present application. As Figure 3 shown, the DNS server response method may include the following steps:

[0128] S310. Receive a user request and determine the identifier corresponding to the user request.

[0129] S320. Determine the corresponding target device and its target identifier according to the identifier and multiple preset devices, and obtain the request result of the user request according to the target device.

[0130] S330. Determine whether the target device obtains the request result within the preset time limit.

[0131] S340. If the request result is obtained, determine the data type of the request result, and determine the device to be acquired in the preset device based on the data type and the target identifier.

[0132] S350. If the request result is not obtained, determine the device to be requested and its device identifier in the preset device, and determine the device to be acquired according to the target identifier and the device identifier.

[0133] S360. Obtain a target request result according to the device to be obtained, and send the target request result to the corresponding terminal of the user.

[0134] In some embodiments of the present application, the specific implementation manners of steps S310 to S360 may refer to the content in the foregoing embodiments, and will not be elaborated herein.

[0135] S370. Determine the deadline corresponding to the user request, and the deadline is longer than the preset time limit.

[0136] Among them, the deadline is used to determine whether the DNS server can continue to receive user requests. For example, the preset time limit of the DNS server is 5 seconds, and the deadline is 30 seconds. If the user terminal does not receive the target request result sent by the DNS server within 30 seconds, it can be determined that the server that has not obtained the request result among the DNS servers that have forwarded the user request has an abnormality.

[0137] Based on this, by determining the deadline corresponding to the user request, it is convenient to subsequently determine whether the DNS server has an abnormality according to the deadline, so as to perform further processing.

[0138] S380. If the target request result is not sent to the corresponding terminal of the user request within the deadline, determine the devices in the preset devices that have sent the user request, and determine the target device that has not obtained the request result of the user request in the devices.

[0139] Based on this, if the user terminal still does not receive the target request result after exceeding the deadline, the DNS server that has not obtained the request result all the time among the DNS servers that have forwarded the user request can be determined according to the linked list, so as to perform subsequent processing.

[0140] S390. Determine that the target device is an unreachable device, and the unreachable device is a device that cannot receive user requests.

[0141] Based on this, if the DNS server that has forwarded the user request has not obtained the request result all the time within the deadline, it indicates that the DNS server has an abnormality. Therefore, the server is determined as an unreachable server to prevent the server from receiving user requests, thereby improving the efficiency of other reachable devices in receiving and processing user requests.

[0142] On the basis of the feasible implementation manner of S390 above, the present application further provides a process included in the method after determining that the target device is an unreachable device:

[0143] Determine the preset detection time;

[0144] According to the detection time, send a detection request to the unreachable device, and determine the preset time limit and the deadline corresponding to the detection request;

[0145] Determine the acquisition result of the detection request for the unreachable device according to the preset time limit and the deadline.

[0146] If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is higher than that of other preset devices. The reachable device is a device that can receive user requests.

[0147] If the acquisition result is that the unreachable device obtains the detection result outside the preset time limit and within the deadline, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is lower than that of other preset devices.

[0148] If the acquisition result is that the unreachable device does not obtain the detection result within the deadline, then still determine it as an unreachable device.

[0149] Among them, the detection time is the time for regularly detecting the unreachable DNS server. For example, the unreachable server can be detected once every 2 minutes.

[0150] The detection request is a request for detecting whether the unreachable server has restored normal response.

[0151] Based on this, after determining the abnormal DNS server as an unreachable device, by regularly detecting the unreachable device, the server that has restored normal is adjusted to a server that can receive user requests, and the corresponding priority of the server is adjusted. Thus, by periodically detecting the server status, the timely adjustment of the DNS server is realized, and the user requests can be better responded to.

[0152] In some embodiments of the present application, by determining the deadline of the user request, the server that does not obtain the request result within the deadline is determined as an abnormal server, and the reception of the user request is stopped. Thus, the user requests can be better responded to by other normal servers, and the response speed is improved. At the same time, by regularly detecting the server status, the server that has restored normal is timely readjusted to a server that normally receives requests, thereby improving the utilization rate of server resources.

[0153] Figure 4 It is a schematic structural diagram of a response device 400 of a DNS server provided by an embodiment of the present application. As Figure 4 shown, the response device 400 of the DNS server includes: a receiving module 410, an identification determination and result acquisition module 420, an acquisition judgment module 430, a data type judgment module 440, a device to be requested acquisition module 450, and a sending module 460.

[0154] A receiving module 410, configured to receive a user request and determine an identifier corresponding to the user request;

[0155] An identifier determination and result acquisition module 420, configured to determine a corresponding target device and its target identifier according to the identifier and a plurality of preset devices, and acquire a request result of the user request according to the target device;

[0156] An acquisition judgment module 430, configured to judge whether a request result is acquired by the target device within a preset time limit;

[0157] A data type judgment module 440, configured to, if a request result is acquired, judge the data type of the request result, and determine a device to be acquired in the preset devices based on the data type and the target identifier;

[0158] A device to be requested acquisition module 450, configured to, if a request result is not acquired, determine a device to be requested and its device identifier in the preset devices, and determine a device to be acquired according to the target identifier and the device identifier;

[0159] A sending module 460, configured to acquire a target request result according to the device to be acquired, and send the target request result to a terminal corresponding to the user request.

[0160] In an embodiment of the present application, the identifier determination and result acquisition module 420 may further specifically be configured to:

[0161] Determine the device identifier of the preset device, and determine the target device identifier that is the same as the identifier in the device identifier;

[0162] Determine a preset priority corresponding to the target device identifier, and compare the preset priorities to obtain a comparison result;

[0163] According to the comparison result, determine the target device identifier with the highest preset priority, and determine the preset device corresponding to the target device identifier as the target device;

[0164] Determine the device identifier of the target device as the target identifier, and acquire a request result of the user request according to the target device.

[0165] In an embodiment of the present application, the data type judgment module 440 may further specifically be configured to:

[0166] If the request result is acquired, judge the data type of the request result;

[0167] If the data type does not include the target data type, determine the device identifier of the preset device, and determine the device identifier to be acquired that is different from the target identifier in the device identifier;

[0168] Determine the preset priority corresponding to the device identifier to be obtained, and determine the device identifier to be obtained with the highest preset priority as the target device identifier to be obtained;

[0169] Determine the preset device corresponding to the target device identifier to be obtained as the device to be obtained;

[0170] If the data type includes the target data type, determine the request result as the target request result, and send the target request result to the corresponding terminal of the user request.

[0171] In the embodiment of the present application, the device acquisition module 450 to be requested may further specifically be used for:

[0172] Determine the device that has not sent a user request among the preset devices as the device to be requested;

[0173] Determine the device identifier of the device to be requested, and compare the device identifier with the target identifier to obtain a comparison result;

[0174] Determine the device to be obtained according to the comparison result.

[0175] In the embodiment of the present application, the device acquisition module 450 to be requested may further specifically be used for:

[0176] Determine the comparison result;

[0177] If the comparison result is that there is an identifier in the device identifier that is the same as the target identifier, determine the device to be requested corresponding to the same identifier as the target device to be requested;

[0178] If the comparison result is that there is no identifier in the device identifier that is the same as the target identifier, determine all devices to be requested as the target devices to be requested;

[0179] Determine the preset priority corresponding to the target device to be requested, and determine the target device to be requested with the highest preset priority as the device to be obtained.

[0180] In the embodiment of the present application, the response device 400 of the DNS server may further specifically be used for:

[0181] Determine the deadline corresponding to the user request, and the deadline is longer than the preset time limit;

[0182] If the target request result is not sent to the corresponding terminal of the user request within the deadline, determine the devices that have sent user requests among the preset devices, and determine the target devices that have not obtained the request results of the user requests in the devices;

[0183] Determine the target device as an unreachable device, and the unreachable device is a device that cannot receive user requests.

[0184] In the embodiment of the present application, the response device 400 of the DNS server may further specifically be used for:

[0185] Determine a preset detection time;

[0186] According to the detection time, send a detection request to the unreachable device, and determine the preset time limit and the deadline corresponding to the detection request;

[0187] According to the preset time limit and the deadline, determine the acquisition result of the detection request by the unreachable device;

[0188] If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is higher than that of other preset devices, and the reachable device is a device that can receive user requests;

[0189] If the acquisition result is that the unreachable device obtains the detection result outside the preset time limit and within the deadline, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is lower than that of other preset devices;

[0190] If the acquisition result is that the unreachable device does not obtain the detection result within the deadline, then still determine it as an unreachable device.

[0191] Figure 5 It is a schematic structural diagram of the device provided by the embodiment of the present application. As Figure 5 shown, the device 500 includes:

[0192] The device 500 may include a processor 501 with one or more processing cores, a memory 502 with one or more computer-readable storage media, a communication component 503 and other components. Among them, the processor 501, the memory 502 and the communication component 503 are connected through a bus 504.

[0193] In a specific implementation process, at least one processor 501 executes the computer execution instructions stored in the memory 502, so that at least one processor 501 executes the response method of the DNS server as above.

[0194] For the specific implementation process of the processor 501, reference may be made to the above method embodiment, and its implementation principle and technical effect are similar, which will not be elaborated here in this embodiment.

[0195] Further, the processor may be a central processing unit (CPU for short), or other general-purpose processors, digital signal processors (DSP for short), application specific integrated circuits (ASIC for short), etc. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor.

[0196] The memory may include a high-speed random access memory (RAM), and may also include non-volatile memory (NVM), such as at least one disk memory.

[0197] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of representation, the bus in the drawings of this application is not limited to only one bus or one type of bus.

[0198] In some embodiments, a computer program product is also proposed, including a computer program or instruction, which, when executed by a processor, implements the steps in any of the above DNS server response methods.

[0199] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.

[0200] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware with instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0201] Therefore, an embodiment of this application provides a computer-readable storage medium, in which multiple program codes are stored, and the program codes can be loaded by a processor to execute the steps in any of the DNS server response methods provided by the embodiments of this application.

[0202] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM), magnetic disk, optical disc, etc.

[0203] According to one aspect of the present application, there is provided a computer program product or a computer program, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium.

[0204] Since the instructions stored in the storage medium can execute the steps in any of the DNS server response methods provided in the embodiments of the present application, the beneficial effects achievable by any of the DNS server response methods provided in the embodiments of the present application can be achieved. For details, see the previous embodiments and will not be repeated here.

[0205] Those skilled in the art will readily conceive of other implementations of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses, or adaptations of the present application, which follow the general principles of the present application and include known common knowledge or conventional technical means in the technical field not disclosed in the present application. The specification and the embodiments are only regarded as exemplary, and the true scope and spirit of the present application are pointed out by the claims above.

[0206] It should be understood that the present application is not limited to the exact structure already described and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present application is only limited by the appended claims.

Claims

1. A response method for a DNS server, characterized in that, The method includes: Receiving a user request and determining an identifier corresponding to the user request; According to the identifier, determining a target device and its target identifier corresponding to the identifier from multiple preset devices, and obtaining a request result of the user request according to the target device, where the preset devices include the DNS server; Judging whether the request result is obtained by the target device within a preset time limit; If the request result is obtained, judging whether the data type of the request result includes a target data type, and based on the judgment result that the data type does not include the target data type, determining a device to be obtained different from the target identifier from the preset devices; If the request result is not obtained, determining a device to be requested and its device identifier in the preset devices according to the user request, and determining the device to be obtained according to a comparison result between the target identifier and the device identifier of the device to be requested, where the device to be requested is a device in the preset devices that has not forwarded the user request; Obtaining a target request result according to the device to be obtained, and sending the target request result to a terminal corresponding to the user request.

2. The method according to claim 1, wherein The step of determining a target device and its target identifier corresponding to the identifier from multiple preset devices according to the identifier, and obtaining a request result of the user request according to the target device includes: Determining the device identifier of the preset device and determining a target device identifier identical to the identifier in the device identifier; Determining a preset priority corresponding to the target device identifier and comparing the preset priorities to obtain a comparison result; According to the comparison result, determining the target device identifier with the highest preset priority, and determining the preset device corresponding to the target device identifier as the target device; Determining the device identifier of the target device as the target identifier, and obtaining a request result of the user request according to the target device.

3. The method according to claim 1, characterized in that, The step of, if the request result is obtained, judging whether the data type of the request result includes a target data type, and based on the judgment result that the data type does not include the target data type, determining a device to be obtained different from the target identifier from the preset devices includes: If the request result is obtained, judging the data type of the request result; If the data type does not include the target data type, determining the device identifier of the preset device and determining a device identifier to be obtained different from the target identifier in the device identifier; Determining a preset priority corresponding to the device identifier to be obtained and determining the device identifier to be obtained with the highest preset priority as a target device identifier to be obtained; Determining the preset device corresponding to the target device identifier to be obtained as the device to be obtained; If the data type includes the target data type, determining the request result as the target request result, and sending the target request result to a terminal corresponding to the user request.

4. The method according to claim 1, characterized in that, If the request result is not obtained, then according to the user request, determine the device to be requested and its device identifier in the preset device, and determine the device to be acquired according to the comparison result between the target identifier and the device identifier of the device to be requested. The device to be requested is a device in the preset device that has not forwarded the user request, and includes: Determine the device in the preset device that has not sent the user request as the device to be requested; Determine the device identifier of the device to be requested, and compare the device identifier with the target identifier to obtain a comparison result; Determine the device to be acquired according to whether there is an identifier in the comparison result that is the same as the target identifier.

5. The method according to claim 4, characterized in that The determining the device to be acquired according to whether there is an identifier in the comparison result that is the same as the target identifier includes: Determine the comparison result; If the comparison result is that there is an identifier in the device identifier that is the same as the target identifier, then determine the device to be requested corresponding to the same identifier as the target device to be requested; If the comparison result is that there is no identifier in the device identifier that is the same as the target identifier, then determine all the devices to be requested as the target devices to be requested; Determine the preset priority corresponding to the target device to be requested, and determine the target device to be requested with the highest preset priority as the device to be acquired.

6. The method according to claim 1, characterized in that, The method further includes: Determine the deadline corresponding to the user request, and the deadline is longer than the preset time limit; If the target request result is not sent to the terminal corresponding to the user request within the deadline, then determine the devices in the preset device that have sent the user request, and determine the target devices in the devices that have not obtained the request result of the user request; Determine the target device as an unreachable device, and the unreachable device is a device that cannot receive user requests.

7. The method according to claim 6, characterized in that After determining that the target device is an unreachable device, the method further includes: Determine the preset detection time; According to the detection time, send a detection request to the unreachable device, and determine the preset time limit and the deadline corresponding to the detection request; According to the preset time limit and the deadline, determine the acquisition result of the unreachable device for the detection request; If the acquisition result is that the unreachable device obtains the detection result corresponding to the detection request within the preset time limit, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is higher than that of other preset devices. The reachable device is a device that can receive user requests; If the acquisition result is that the unreachable device obtains the detection result within the time limit outside the preset time limit and within the deadline, then adjust the unreachable device to a reachable device, and determine that the priority of the reachable device is lower than that of other preset devices; If the acquisition result is that the unreachable device does not obtain the detection result within the deadline, then still determine it as the unreachable device.

8. A response device for a DNS server, characterized in that, The device includes: A receiving module, configured to receive a user request and determine the identifier corresponding to the user request; An identification determination and result acquisition module, configured to determine a target device corresponding to the identification and its target identification from multiple preset devices according to the identification, and acquire a request result of the user request according to the target device, where the preset devices include the DNS server; An acquisition judgment module, configured to judge whether the target device acquires the request result within a preset time limit; A data type judgment module, configured to, if the request result is acquired, judge whether a target data type is included in the data type of the request result, and determine, based on a judgment result that the target data type is not included in the data type, a device to be acquired different from the target identification from the preset devices; A device to be requested acquisition module, configured to, if the request result is not acquired, determine a device to be requested and its device identification in the preset devices, and determine the device to be acquired according to the target identification and the device identification, where the device to be requested is a device in the preset devices that has not forwarded the user request; A sending module, configured to acquire a target request result according to the device to be acquired, and send the target request result to a terminal corresponding to the user request.

9. A device, characterized in that, Comprising: One or more processors; A memory; One or more programs, where one or more programs are stored in the memory and configured to be executed by one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, Program code is stored in a computer-readable storage medium, and the program code can be called by a processor to execute the method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • DNS server selection method and proxy server

    CN111262938A

  • Qos acceleration method and device

    CN118804117A