Data back-to-source method and device based on multi-IP detection and electronic equipment
By dynamically monitoring and evaluating network interface performance in a multi-network card multi-IP environment, adjusting the source return strategy in real time, and selecting the target IP address using a multi-IP detection mechanism, the problems of data return stability and performance in a multi-network card multi-IP environment are solved, and efficient and reliable data return is achieved.
Patent Information
- Application Number
- CN202510081719.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-20
- Publication Date
- 2025-02-25
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In a multi-network card and multi-IP environment, the network quality of edge servers is uneven, resulting in failure or performance of data return requests, affecting the user's access experience.
By dynamically monitoring and evaluating the performance of network interfaces, adjusting the source return strategy in real time, adopting a multi-IP detection mechanism, regularly detecting the network quality of each local IP address, selecting the target IP address based on the scoring results, and building an address pair list to ensure that the best network path is used when data returns to the source.
It improves the efficiency and success rate of data return, enhances network adaptability, ensures high reliability and high availability of data transmission, and avoids the risk of single point of failure.
Smart Images

Figure CN119520379A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing, and in particular to a data return-to-source method, device and electronic device based on multi-IP detection. Background Art
[0002] With the rapid development of Internet technology and the deepening of digital applications, the scale and complexity of network data services continue to grow. CDN (Content Distribution Network), as a technology that effectively improves network performance and improves user access quality, plays an increasingly important role in Internet infrastructure. CDN vendors deploy a large number of server nodes at the edge of the network to cache content close to users to achieve local access and fast response. However, most current CDN vendors use an edge server architecture with a single network card and a single IP. This architecture faces challenges in network stability and service quality when processing back-to-source requests.
[0003] At present, with the increasing complexity of the network environment and the continuous improvement of business needs, it is difficult to meet the reliability and performance requirements of data backhaul by relying solely on a single network link. Especially in some special scenarios, edge servers may adopt a multi-NIC multi-IP configuration to provide greater network bandwidth and redundancy. However, the network quality of such servers is often uneven, the bandwidth of different NICs varies significantly, and connectivity and stability cannot be guaranteed, which brings new challenges to data backhaul services. The network characteristics of multi-NIC multi-IP servers, such as bandwidth fluctuations and link jitters, may cause the failure of backhaul requests or performance degradation, affecting the user's access experience. Therefore, for this type of server configuration, there is a lack of an effective and stable data backhaul solution.
[0004] Therefore, there is an urgent need for a data return-to-source method, device and electronic device based on multi-IP detection. Summary of the invention
[0005] The present application provides a data return-to-source method, device and electronic device based on multi-IP detection, which dynamically monitors and evaluates the performance of network interfaces, adjusts the return-to-source strategy in real time, and ensures the stability of data transmission in a multi-network card and multi-IP environment.
[0006] In a first aspect of the present application, a data return-to-source method based on multi-IP detection is provided, the method comprising: obtaining local IP addresses of multiple network interfaces, and storing the local IP addresses in a local IP list; determining whether the detection cycle of a preset timer has been reached; if it is determined that the detection cycle of the preset timer has been reached, traversing the local IP list, and sending a detection packet to a preset public service through each of the local IP addresses; receiving response information for the detection packet sent by the preset public service; scoring each of the local IP addresses according to the response information to obtain a scoring result corresponding to each of the local IP addresses; determining a target IP address from the multiple local IP addresses according to the scoring result, and constructing an address pair list, the address pair list comprising multiple IP address pairs, the IP address pairs being the corresponding relationship between the target IP address and the source IP address; according to the address pair list, initiating a network request from the target IP address to the source IP address to complete data return-to-source.
[0007] By adopting the above technical solution, multiple local IP addresses are obtained and stored in the local IP list, which provides a basis for subsequent detection and data return. A preset timer is introduced to trigger the detection of local IP addresses according to the detection cycle. By sending a detection packet to the preset public service and receiving a response, the network quality of each local IP address is evaluated and the corresponding scoring result is obtained. According to the scoring result, the target IP address is selected from the local IP list, and an address pair list of the target IP address and the source IP address is constructed to establish a network channel for back-to-source data transmission. Finally, according to the address pair list, a network request is initiated from the target IP to the source IP to complete the data return process. The method adopts a multi-IP detection mechanism, and through timed detection and scoring, it realizes real-time evaluation and dynamic selection of the network quality of the local IP address, ensures that the best quality network path is always used when the data is returned to the source, and improves the efficiency and success rate of the return. At the same time, the mapping relationship between the source IP address and the destination IP address is constructed using the address pair list, which provides flexible back-to-source path selection and enhances network adaptability.
[0008] Optionally, scoring each of the local IP addresses based on the response information to obtain a scoring result corresponding to each of the local IP addresses specifically includes: parsing the response information to obtain the number of detection packets received from the preset public service; determining the scoring result corresponding to the number of detection packets in a preset scoring database, wherein the preset scoring database includes a corresponding relationship between the number of detection packets and the scoring result.
[0009] By adopting the above technical solution, a preset scoring database is introduced. By parsing the response information of the preset public service, the number of received detection packets is obtained, and the scoring results corresponding to the number of detection packets are searched in the preset scoring database, and the quantitative evaluation of the IP address network quality is completed. This technical solution automates the IP address scoring process, and converts the detection results into standard scoring results through the preset scoring database. The scoring process is objective, efficient, and standardized. At the same time, the design of introducing a preset scoring database improves the configurability and scalability of the scoring mechanism, and can adapt to different scoring strategies and standards by adjusting the mapping relationship of the preset scoring database. The scoring scheme of the preset scoring database not only improves the automation level of IP address quality evaluation, but also enhances the accuracy and consistency of the scoring results, providing a reliable basis for subsequent IP address optimization.
[0010] Optionally, determining a target IP address from the multiple local IP addresses based on the scoring result and constructing an address pair list specifically includes: determining the number of available IP addresses among the multiple local IP addresses, the number of available IP addresses being local IP addresses among the multiple local IP addresses that have received detection packets sent by the preset public service; calculating a ratio of the number of available IP addresses to the number of local IP addresses; determining a target scoring result in a preset scoring result library based on the number ratio, the preset scoring result library including a correspondence between the number ratio and the target scoring result; determining a target IP address based on the target scoring result, the target IP address being a local IP address among the multiple local IP addresses whose scoring result is greater than or equal to the target scoring result.
[0011] By adopting the above technical solution, the target IP address selection process is optimized, the IP address detection success rate and the preset scoring result library are comprehensively considered, and a multi-stage dynamic selection scheme is proposed. This method counts the number of available IP addresses that are successfully detected and the total number of local IP addresses, and obtains a quantitative indicator to judge the availability of the local IP list. Secondly, the association between the number ratio and the target scoring result is introduced in the preset scoring result library, which can adaptively adjust the selection criteria of the target IP address according to the actual detection results.
[0012] Optionally, initiating a network request to complete the return to source data based on the address pair list specifically includes: determining a first IP address pair from the address pair list, and establishing a first network connection based on the first IP address pair, the first IP address pair being any one of the multiple IP address pairs; initiating the network request through the first network connection; if the network request fails, determining a second IP address pair from the address pair list to establish a second network connection, and initiating the network request based on the second network connection until the network request is successful, the second IP address pair being any one of the multiple IP address pairs except the first IP address pair.
[0013] By adopting the above technical solution, any one of the first IP address pairs is selected to establish a network connection, and a network request is initiated through the network connection. If the network request fails, the other IP address pairs in the address pair list are traversed, and new network connections are tried in turn and the network request is re-initiated until the network request succeeds. This request retry mechanism makes full use of the IP resources provided by the address pair list. When a request to a certain target IP address fails, it can automatically switch to other target IP addresses to continue trying until an available target IP address is found to complete the request. The introduction of this mechanism improves the fault tolerance and reliability of data return to the source. When the network path corresponding to the target IP address fails, other paths can be automatically selected for compensation without causing the failure of the entire return request, thereby effectively avoiding the risk of single point failure. This technical solution improves the stability, continuity and fault tolerance of the data return service, ensuring high reliability and high availability of data transmission.
[0014] Optionally, the method further includes: recording the total number of network requests initiated by each of the local IP addresses within a unit time to obtain a total number of requests, and recording the number of failed network requests initiated within a unit time to obtain a number of request failures; calculating a request failure rate based on the number of request failures and the total number of requests; and updating a scoring result for each of the local IP addresses based on the request failure rate.
[0015] By adopting the above technical solution, by recording the total number of network requests and the number of failed requests initiated by each local IP address in unit time, two key indicators for evaluating the quality of back-to-source are obtained. On this basis, the request failure rate, an intuitive quantitative indicator, is calculated. Based on the request failure rate, this method dynamically updates and adjusts the scoring results of the original local IP address. This feedback adjustment mechanism enables the scoring results to reflect the real-time performance of the local IP address in a timely manner, combining the back-to-source effect with the scoring results to form a closed-loop evaluation and optimization system. By introducing the request failure rate, the scoring mechanism no longer relies solely on the test results of the detection phase, but takes into account the actual performance in actual applications, making the scoring more comprehensive and objective, and the selection more accurate and reliable.
[0016] Optionally, updating the scoring result of each of the local IP addresses based on the request failure rate specifically includes: subtracting a preset score from the numerator of the request failure rate of each of the local IP addresses to obtain an updated scoring result.
[0017] By adopting the above technical solution, the calculation method of updating the local IP address score is specifically explained, and the comparison calculation of the preset score and the request failure rate is introduced to obtain a new score result. By comparing the numerator of the request failure rate with the preset score, the network quality status of the local IP address can be intuitively reflected. Through this scoring update mechanism that compares the preset score with the failure rate, the performance of the local IP address in the actual back-to-source application can be objectively evaluated. The updated scoring result can accurately reflect the current network quality status and provide a reliable basis for the subsequent IP address selection.
[0018] Optionally, sending a detection packet to a preset public service via each of the local IP addresses specifically includes: binding each of the local IP addresses with an address of the preset public service, and sending a preset number of detection packets to the preset public service at a preset frequency.
[0019] By adopting the above technical solution, a stable detection channel is established by binding the local IP address with the address of the preset public service. During the detection process, the method sends a preset number of detection packets to the public service at a preset frequency. By setting the preset frequency and preset number, the time granularity and detection intensity of the detection can be flexibly controlled.
[0020] In a second aspect of the present application, a data return source device based on multi-IP detection is provided, the device includes an acquisition module and a processing module, wherein: the acquisition module is used to acquire local IP addresses of multiple network interfaces and store the local IP addresses in a local IP list; the processing module is used to determine whether the detection cycle of a preset timer has been reached; the processing module is also used to traverse the local IP list if it is determined that the detection cycle of the preset timer has been reached, and send a detection packet to a preset public service through each local IP address; the processing module is also used to receive response information for the detection packet sent by the preset public service; the processing module is also used to score each local IP address according to the response information to obtain a scoring result corresponding to each local IP address; the processing module is also used to determine a target IP address from a plurality of local IP addresses according to the scoring result, and construct an address pair list, the address pair list including a plurality of IP address pairs, the IP address pairs being the corresponding relationship between the target IP address and the source IP address; the processing module is also used to initiate a network request from the target IP address to the source IP address according to the address pair list to complete the data return source.
[0021] In the third aspect of the present application, an electronic device is provided, including a processor, a memory, a user interface and a network interface, the memory is used to store instructions, the user interface and the network interface are both used to communicate with other devices, and the processor is used to execute the instructions stored in the memory so that the electronic device executes any one of the methods described above.
[0022] In a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed, any of the methods described above is executed.
[0023] In summary, one or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. By obtaining multiple local IP addresses and storing them in the local IP list, a basis is provided for subsequent detection and data return. A preset timer is introduced to trigger the detection of local IP addresses according to the detection cycle. By sending detection packets to the preset public service and receiving responses, the network quality of each local IP address is evaluated and the corresponding scoring results are obtained. According to the scoring results, the target IP address is selected from the local IP list, and an address pair list of the target IP address and the source IP address is constructed to establish a network channel for data transmission back to the source. Finally, according to the address pair list, a network request is initiated from the target IP to the source IP to complete the data return process. This method adopts a multi-IP detection mechanism, and through timed detection and scoring, it realizes real-time evaluation and dynamic selection of the network quality of the local IP address, ensures that the best network path is always used when data is returned to the source, and improves the efficiency and success rate of the return to the source. At the same time, the mapping relationship between the source IP address and the destination IP address is constructed using the address pair list, which provides flexible return path selection and enhances network adaptability.
[0024] 2. A preset scoring database is introduced. By parsing the response information of the preset public service, the number of received detection packets is obtained, and the scoring results corresponding to the number of detection packets are searched in the preset scoring database to complete the quantitative evaluation of the IP address network quality. This technical solution automates the IP address scoring process. Through the preset scoring database, the detection results are converted into standard scoring results. The scoring process is objective, efficient, and standardized. At the same time, the design of introducing a preset scoring database improves the configurability and scalability of the scoring mechanism. It can adapt to different scoring strategies and standards by adjusting the mapping relationship of the preset scoring database. The scoring scheme of the preset scoring database not only improves the automation level of IP address quality assessment, but also enhances the accuracy and consistency of the scoring results, providing a reliable basis for subsequent IP address optimization.
[0025] 3. The target IP address selection process is optimized, the IP address detection success rate and the preset scoring result library are comprehensively considered, and a multi-stage dynamic selection scheme is proposed. This method counts the ratio of the number of available IP addresses that are successfully detected to the total number of local IP addresses, and obtains a quantitative indicator to judge the availability of the local IP list. Secondly, the association between the number ratio and the target scoring result is introduced in the preset scoring result library, which can adaptively adjust the selection criteria of the target IP address according to the actual detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 It is a flowchart of a data return method based on multi-IP detection disclosed in an embodiment of the present application; Figure 2This is a module diagram of a data return-to-source device based on multi-IP detection disclosed in an embodiment of the present application; Figure 3 It is a structural schematic diagram of an electronic device disclosed in an embodiment of the present application.
[0027] Explanation of the reference numerals: 201, acquisition module; 202, processing module; 300, electronic device; 301, processor; 302, communication bus; 303, user interface; 304, network interface; 305, memory. DETAILED DESCRIPTION
[0028] In order to enable technicians in this field to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments.
[0029] In the description of the embodiments of the present application, words such as "for example" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "for example" or "for example" is intended to present related concepts in a specific way.
[0030] In the description of the embodiments of the present application, the meaning of the term "multiple" refers to two or more. For example, multiple systems refer to two or more systems, and multiple screen terminals refer to two or more screen terminals. In addition, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprise", "have" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0031] This application provides a data return method based on multi-IP detection. Figure 1 , Figure 1 This is a flow chart of a data return method based on multi-IP detection provided by an embodiment of the present application. The method is applied to a server, and the server is used to execute the data return program of multi-IP detection. The server can be a single server, or a server cluster composed of multiple servers, or a cloud computing service center. The method includes steps S101 to S107, and the above steps are as follows: Step S101: Acquire local IP addresses of multiple network interfaces, and store the local IP addresses in a local IP list.
[0032] In step S101, the server identifies all its network interfaces. The server is usually equipped with multiple network interfaces, which can be physical network cards or virtual network adapters. The server obtains information about all network interfaces in the current system by calling the network interface management interface provided by the operating system.
[0033] After obtaining the network interface information, the server further extracts the local IP address of each network interface. The server extracts all local IP addresses configured on each network interface by parsing the network interface information. After extracting all local IP addresses that can be used for communication, the server stores them in the local IP list. The local IP list is a data structure defined in the program, such as an array, linked list, or hash table. Each local IP address is stored as an independent element in the local IP list for subsequent traversal and access.
[0034] Step S102: Determine whether the detection period of the preset timer has been reached.
[0035] In step S102, the server first determines whether the current time has reached the detection period set by the preset timer. The preset timer is a timed task running on the server, which is used to periodically trigger the IP detection process. The detection period can be configured according to actual needs, such as every 5 minutes, every 10 minutes, etc. The server determines whether the detection period has been reached by comparing the current system time with the next trigger time of the preset timer. If the current time has reached or exceeded the next trigger time, it is considered that the detection period has been reached and IP detection needs to be performed; otherwise, the server will continue to wait until the next detection period is reached.
[0036] Step S103: If it is determined that the detection period of the preset timer has arrived, the local IP list is traversed, and a detection packet is sent to the preset public service through each local IP address.
[0037] In step S103, when it is determined that the detection cycle of the preset timer has been reached, the server starts to traverse the local IP list and sends a detection packet to the preset public service through each local IP address. The local IP list is obtained in step S101 and contains all public network IP addresses that can be used for communication on the server. The server will take out the local IP addresses in the local IP list one by one, and use each local IP address as the source address to send a detection packet to the preset public service. The preset public service can be some stable, reliable, and fast-responding public websites or services, such as well-known portals, search engines, etc. The server can reflect the availability and network performance of each local IP address through the quality of communication between the server and the preset public service. The detection packet can be a data packet based on the TCP, UDP or ICMP protocol. The server will construct a corresponding detection packet according to the preset detection method and send it to the preset public service.
[0038] In a possible implementation, sending a detection packet to a preset public service via each local IP address specifically includes: binding each local IP address with an address of the preset public service, and sending a preset number of detection packets to the preset public service at a preset frequency.
[0039] Specifically, the server first obtains each local IP address from the local IP list and binds it to the address of the preset public service. After the binding is completed, the server sends a preset number of detection packets to the preset public service at a preset frequency. The preset frequency represents the time interval between detections, usually in seconds or minutes, such as sending a detection packet every 30 seconds. The preset number represents the number of detection packets sent for each detection, usually a number, such as 3, 5, etc.
[0040] Step S104: receiving response information to the detection packet sent by the preset public service.
[0041] In step S104, the server will receive response information from the preset public service. After receiving the detection packet sent by the server, the preset public service will return response data to the server to confirm that the detection packet has arrived successfully.
[0042] Step S105: score each local IP address according to the response information to obtain a score result corresponding to each local IP address.
[0043] In step S105, the response information is parsed to obtain the number of detection packets of the received detection packets sent by the preset public service; in the preset scoring database, the scoring result corresponding to the number of detection packets is determined, and the preset scoring database includes the corresponding relationship between the number of detection packets and the scoring result.
[0044] Specifically, the server scores the availability and performance of each local IP address based on the response information received from the preset public service. The scoring process is divided into two main steps: first, the server parses the response information to obtain the number of probe packets actually received by each local IP address; then, the server searches the preset scoring database for the scoring result corresponding to the number of probe packets and uses it as the final score of the local IP address.
[0045] Specifically, when parsing the response information, the server extracts information related to each local IP address from the data returned by the preset public service, mainly the number of probe packets actually received. The number of probe packets reflects the quality and stability of the network communication between the local IP address and the preset public service. If the server sends 5 probe packets but only receives 3 responses, it indicates that the availability and stability of the local IP address are poor, and there are problems such as packet loss and delay. The server parses the format and content of the response data, and extracts the number of probe packets corresponding to each local IP address as an important basis for scoring.
[0046] After obtaining the number of detection packets for each local IP address, the server matches the corresponding scoring result according to the preset scoring database. The preset scoring database maps the number of detection packets to a numerical score based on the number of detection packets. The preset scoring database defines the correspondence between the number of detection packets and the scoring result, such as the score of a local IP address that receives 100% of the detection packets is 100; the score of a local IP address that receives more than 90% of the detection packets is 90, the score of a local IP address that receives 70% to 90% of the detection packets is 80, the score of a local IP address that receives 50% to 70% of the detection packets is 60, and the score of an IP address that receives less than 50% of the detection packets is 50. The server compares the number of detection packets for each local IP address with the preset scoring database to obtain the corresponding scoring result.
[0047] Step S106: According to the scoring result, determine the target IP address from the multiple local IP addresses, and construct an address pair list, the address pair list includes multiple IP address pairs, and the IP address pair is the correspondence between the target IP address and the source IP address.
[0048] In step S106, the number of available IP addresses among the multiple local IP addresses is determined, where the number of available IP addresses is the local IP addresses among the multiple local IP addresses that have received the detection packet sent by the preset public service; the ratio of the number of available IP addresses to the number of local IP addresses is calculated; in a preset scoring result library, based on the number ratio, a target scoring result is determined, and the preset scoring result library includes a corresponding relationship between the number ratio and the target scoring result; based on the target scoring result, a target IP address is determined, where the target IP address is the local IP address among the multiple local IP addresses whose scoring result is greater than or equal to the target scoring result.
[0049] Specifically, based on the scoring results, the server selects a better IP address from the local IP address list as the target IP address, and pairs it with the source IP address to build an address pair list for subsequent data back-to-source tasks. Specifically, the server first counts the number of available IP addresses in the local IP address list. Available IP addresses refer to local IP addresses that successfully receive preset public service response packets during the detection phase, indicating that they can communicate normally with the outside world. The server analyzes the detection results, finds all local IP addresses that have received responses, and calculates the number of available IP addresses. The number of available IP addresses reflects the overall quality of the server's current network connection and is an important reference for selecting target IP addresses.
[0050] Next, the server calculates the ratio of the number of available IP addresses to the total number of local IP addresses. The ratio is a percentage value that indicates the proportion of available IP addresses to all local IP addresses. The higher the ratio, the better the server's network connection is and the more local IP address resources are available; the lower the ratio, the more problems there are with the server's network connection and the limited local IP address resources are available. The server calculates the ratio by dividing the number of available IP addresses by the total number of local IP addresses.
[0051] After calculating the quantity ratio, the server determines the scoring threshold for selecting the target IP address based on the quantity ratio. Only local IP addresses with a scoring result greater than or equal to the scoring threshold will be selected as the target IP address. The setting of the scoring threshold needs to balance the quality and quantity of IP addresses, ensuring that the quality of the selected IP addresses is high enough and that there are enough IP addresses available to build address pairs. The server queries the preset scoring result library to find the target scoring result corresponding to the current quantity ratio as the scoring threshold. The preset scoring result library is a pre-configured mapping table that defines the correspondence between different quantity ratios and target scoring results. For example, when the ratio is above 90%, the target scoring result is 90 points; when the ratio is 70%, the target scoring result is 70 points; when the ratio is 50%, the target scoring result is 50.
[0052] Finally, the server traverses the local IP address list and finds the IP address whose score result is greater than or equal to the target score result, and uses it as the target IP address. The server pairs the target IP address with the source IP address to build an address pair list. Each address pair contains a target IP address and a source IP address, indicating that the data starts from the source IP address and is transmitted back to the server through the target IP address. The address pair list provides an optimal communication path for subsequent data return tasks, which helps to improve the efficiency and success rate of return.
[0053] Step S107: According to the address pair list, a network request is initiated from the target IP address to the source IP address to complete data return to the source.
[0054] In step S107, a first IP address pair is determined from the address pair list, and a first network connection is established based on the first IP address pair, where the first IP address pair is any one of the multiple IP address pairs; a network request is initiated through the first network connection; if the network request fails, a second IP address pair is determined from the address pair list to establish a second network connection, and a network request is initiated based on the second network connection until the network request succeeds, where the second IP address pair is any one of the multiple IP address pairs except the first IP address pair.
[0055] Specifically, the server uses the target IP address to initiate a network request to the source IP address based on the constructed address pair list to complete the data return task. Specifically, the server first selects any IP address pair from the address pair list as the first IP address pair. The first IP address pair can be any address pair in the list, and the server can select it randomly. After selecting the first IP address pair, the server uses the target IP address and source IP address in the address pair to establish a first network connection as a communication channel for data return. The first network connection can be a connection based on TCP, UDP or other network protocols, depending on the requirements of data return and the configuration of the server.
[0056] After the first network connection is established, the server initiates a network request to the source IP address through the first network connection to start data back to the source. The network request contains various parameters and instructions required for data back to the source, such as the requested data range and data format. After the source IP address receives the request, it will prepare the corresponding data as required and transmit the data to the server through the first network connection. After receiving the data, the server processes and stores it, completing a data back to the source process.
[0057] However, due to the complexity and instability of the network environment, data return to the source is not always successful at the first try. Various problems such as connection timeout, data packet loss, and server failure may occur, resulting in network request failure. To cope with this situation, the server adopts a multi-IP address pair mechanism to retry network requests by switching IP address pairs.
[0058] When the server finds that the network request of the first IP address pair fails, the server automatically selects another IP address pair from the address pair list as the second IP address pair. The second IP address pair can be any address pair in the list except the first IP address pair. After selecting the second IP address pair, the server uses the address pair to establish a second network connection and re-initiate the network request.
[0059] If the network request for the second IP address pair still fails, the server will continue to select the next IP address pair from the address pair list and repeat the above process until the network request succeeds or all IP address pairs have been tried. By constantly switching IP address pairs, the server can effectively avoid problems with a single IP address or connection and improve the success rate of data return to the source.
[0060] In a possible implementation, the method further includes: recording the total number of network requests initiated by each local IP address within a unit time to obtain a total number of requests, and recording the number of failed network requests initiated within a unit time to obtain a number of failed requests; calculating a request failure rate based on the number of failed requests and the total number of requests; and updating a scoring result for each local IP address based on the request failure rate.
[0061] Wherein, based on the request failure rate, the scoring result of each local IP address is updated, specifically including: subtracting the numerator of the request failure rate of each local IP address from the preset score to obtain an updated scoring result.
[0062] Specifically, based on the above embodiment, the server adopts a dynamic scoring update mechanism based on the request failure rate and preset score. It records the total number of network requests and the number of failures for each local IP address in a unit of time, calculates the request failure rate, and subtracts the request failure rate from the preset score to obtain an updated scoring result to reflect changes in network quality.
[0063] Specifically, the server maintains a request counter and a failure counter for each local IP address, which are used to record the total number of network requests and failures initiated by the local IP address within a unit of time (such as 1 minute). The total number of requests includes all data back-to-source requests initiated through the IP address, reflecting the usage frequency and load of the local IP address. The number of request failures includes request failures caused by various reasons (such as connection timeout, data packet loss, etc.), reflecting the network quality and stability issues of the local IP address.
[0064] At the end of each unit time, the server reads the values of the request counter and failure counter of each local IP address to obtain the total number of requests and the number of request failures of the local IP address in that unit time. Then, based on these two values, the server calculates the request failure rate of the IP address in that unit time. The calculation formula is: request failure rate = number of request failures / total number of requests × 100%.
[0065] The request failure rate is a percentage value, indicating the percentage of requests initiated by the local IP address that failed within a unit of time. The higher the request failure rate, the worse the network quality of the local IP address, and the greater the possibility of problems; conversely, the lower the request failure rate, the better the network quality of the local IP address, and the higher the success rate of data back to the source.
[0066] The server subtracts the numerator of the request failure rate of each IP address from the preset score to obtain an updated score result. Preferably, in the embodiment of the present application, the preset score is 100 points; for example, if the request failure rate of a local IP address is 5%, the updated score result is 100-5=95.
[0067] Reference Figure 2, the present application also provides a data return source device based on multi-IP detection, the device is a server, the server includes an acquisition module 201 and a processing module 202; the acquisition module 201 is used to obtain the local IP addresses of multiple network interfaces and store the local IP addresses in the local IP list; the processing module 202 is used to determine whether the detection cycle of the preset timer has been reached; the processing module 202 is also used to traverse the local IP list if it is determined that the detection cycle of the preset timer has been reached, and send a detection packet to the preset public service through each local IP address; the processing module 202 is also used to receive the response information for the detection packet sent by the preset public service; the processing module 202 is also used to score each local IP address according to the response information to obtain the scoring result corresponding to each local IP address; the processing module 202 is also used to determine the target IP address from the multiple local IP addresses according to the scoring result, and construct an address pair list, the address pair list includes multiple IP address pairs, and the IP address pair is the corresponding relationship between the target IP address and the source IP address; the processing module 202 is also used to initiate a network request from the target IP address to the source IP address according to the address pair list to complete the data return source.
[0068] In a possible implementation, the processing module 202 scores each local IP address according to the response information to obtain a scoring result corresponding to each local IP address, specifically including: the processing module 202 parses the response information to obtain the number of detection packets received from the preset public service; the processing module 202 determines the scoring result corresponding to the number of detection packets in a preset scoring database, and the preset scoring database includes a corresponding relationship between the number of detection packets and the scoring result.
[0069] In a possible implementation, the processing module 202 determines a target IP address from a plurality of local IP addresses according to the scoring result, and constructs an address pair list, specifically including: the processing module 202 determines the number of available IP addresses among the plurality of local IP addresses, where the number of available IP addresses is the local IP address among the plurality of local IP addresses that has received the detection packet sent by the preset public service; the processing module 202 calculates the ratio of the number of available IP addresses to the number of local IP addresses; the processing module 202 determines the target scoring result according to the number ratio in a preset scoring result library, where the preset scoring result library includes a corresponding relationship between the number ratio and the target scoring result; the processing module 202 determines the target IP address according to the target scoring result, where the target IP address is the local IP address among the plurality of local IP addresses whose scoring result is greater than or equal to the target scoring result.
[0070] In a possible implementation, the processing module 202 initiates a network request to complete the return to source data based on the address pair list, specifically including: the processing module 202 determines a first IP address pair from the address pair list, and establishes a first network connection based on the first IP address pair, the first IP address pair being any one of multiple IP address pairs; the processing module 202 initiates a network request through the first network connection; if the network request fails, the processing module 202 determines a second IP address pair from the address pair list to establish a second network connection, and initiates a network request based on the second network connection until the network request is successful, the second IP address pair being any one of the multiple IP address pairs except the first IP address pair.
[0071] In a possible implementation, the method further includes: the processing module 202 records the total number of network requests initiated by each local IP address within a unit time to obtain the total number of requests, and records the number of failed network requests initiated within a unit time to obtain the number of request failures; the processing module 202 calculates the request failure rate based on the number of request failures and the total number of requests; the processing module 202 updates the scoring results of each local IP address based on the request failure rate.
[0072] In a possible implementation, the processing module 202 updates the scoring result of each local IP address based on the request failure rate, specifically including: the processing module 202 subtracts the preset score from the numerator of the request failure rate of each local IP address to obtain an updated scoring result.
[0073] In a possible implementation, the processing module 202 sends a detection packet to a preset public service through each local IP address, specifically including: the processing module 202 binds each local IP address with the address of the preset public service, and sends a preset number of detection packets to the preset public service at a preset frequency.
[0074] It should be noted that: when the device provided in the above embodiment realizes its function, only the division of the above functional modules is used as an example. In actual application, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
[0075] The present application also provides an electronic device. Figure 3 , Figure 3The electronic device 300 may include: at least one processor 301 , at least one network interface 304 , a user interface 303 , a memory 305 , and at least one communication bus 302 .
[0076] The communication bus 302 is used to realize the connection and communication between these components.
[0077] The user interface 303 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 303 may also include a standard wired interface and a wireless interface.
[0078] The network interface 304 may optionally include a standard wired interface or a wireless interface (such as a WI-FI interface).
[0079] Among them, the processor 301 may include one or more processing cores. The processor 301 uses various interfaces and lines to connect various parts in the entire server, and executes various functions of the server and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory 305, and calling data stored in the memory 305. Optionally, the processor 301 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 301 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 301, and it can be implemented separately through a chip.
[0080] Among them, the memory 305 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory). Optionally, the memory 305 includes a non-transitory computer-readable storage medium. The memory 305 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 305 may optionally also be at least one storage device located away from the aforementioned processor 301. Refer to Figure 3 , the memory 305 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program of a data return source method based on multi-IP detection.
[0081] exist Figure 3 In the electronic device 300 shown, the user interface 303 is mainly used to provide an input interface for the user and obtain the data input by the user; and the processor 301 can be used to call the application program stored in the memory 305 for a data return method based on multi-IP detection, and when executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments. It should be noted that for the aforementioned method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required for the present application.
[0082] The present application also provides a computer-readable storage medium, which stores instructions. When executed by one or more processors 301, the electronic device 300 executes one or more of the methods described in the above embodiments.
[0083] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0084] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0085] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0086] In addition, each functional unit in each embodiment of the present application 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.
[0087] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: various media that can store program codes, such as USB flash drives, mobile hard drives, magnetic disks or optical disks.
[0088] The above is only an exemplary embodiment of the present disclosure and cannot be used to limit the scope of the present disclosure. That is, any equivalent changes and modifications made according to the teachings of the present disclosure are still within the scope of the present disclosure. After considering the disclosure of the specification and the truth of practice, those skilled in the art will easily think of other embodiments of the present disclosure.
[0089] This application is intended to cover any variation, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary technical means in the art not described in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A data tracing method based on multi-IP detection, characterized in that: The method comprises: Obtain local IP addresses of multiple network interfaces, and store the local IP addresses in a local IP list; Determine whether the detection period of the preset timer has been reached; If it is determined that the detection period of the preset timer has been reached, traverse the local IP list and send a detection packet to the preset public service through each of the local IP addresses; Receiving response information sent by the preset public service to the detection packet; Scoring each of the local IP addresses according to the response information to obtain a scoring result corresponding to each of the local IP addresses; According to the scoring result, determine the target IP address from the multiple local IP addresses, and construct an address pair list, wherein the address pair list includes multiple IP address pairs, and the IP address pairs are corresponding relationships between the target IP address and the source IP address; According to the address pair list, a network request is initiated from the target IP address to the source IP address to complete data return to the source.
2. The method according to claim 1, characterized in that Scoring each of the local IP addresses according to the response information to obtain a scoring result corresponding to each of the local IP addresses specifically includes: Parsing the response information to obtain the number of detection packets received from the preset public service; In a preset scoring database, a scoring result corresponding to the number of detection packets is determined, wherein the preset scoring database includes a corresponding relationship between the number of detection packets and the scoring result.
3. The method according to claim 1, characterized in that: Determining the target IP address from the plurality of local IP addresses according to the scoring result and constructing an address pair list specifically includes: Determine the number of available IP addresses among the multiple local IP addresses, where the number of available IP addresses is the local IP addresses among the multiple local IP addresses that have received the detection packet sent by the preset public service; Calculate the ratio of the number of available IP addresses to the number of local IP addresses; In a preset scoring result library, a target scoring result is determined according to the quantity proportion, and the preset scoring result library includes a corresponding relationship between the quantity proportion and the target scoring result; A target IP address is determined according to the target scoring result, where the target IP address is a local IP address among the multiple local IP addresses whose scoring result is greater than or equal to the target scoring result.
4. The method according to claim 1, characterized in that Initiating a network request to complete the return of source data according to the address pair list specifically includes: Determine a first IP address pair from the address pair list, and establish a first network connection based on the first IP address pair, wherein the first IP address pair is any one of the multiple IP address pairs; Initiating the network request through the first network connection; If the network request fails, a second IP address pair is determined from the address pair list to establish a second network connection, and the network request is initiated based on the second network connection until the network request succeeds. The second IP address pair is any one of the multiple IP address pairs except the first IP address pair.
5. The method according to claim 1, characterized in that: The method further comprises: Record the total number of network requests initiated by each of the local IP addresses within a unit time to obtain a total number of requests, and record the number of failed network requests initiated within a unit time to obtain a number of failed requests; Calculate the request failure rate based on the number of request failures and the total number of requests; Based on the request failure rate, the scoring result of each of the local IP addresses is updated.
6. The method according to claim 5, characterized in that The updating of the scoring results of each of the local IP addresses based on the request failure rate specifically includes: The preset score is subtracted from the numerator of the request failure rate of each local IP address to obtain an updated scoring result.
7. The method according to claim 1, characterized in that The sending of the detection packet to the preset public service through each of the local IP addresses specifically includes: Each of the local IP addresses is bound to the address of the preset public service, and a preset number of detection packets are sent to the preset public service at a preset frequency.
8. A data return source device based on multi-IP detection, characterized in that: The device comprises an acquisition module (201) and a processing module (202), wherein: The acquisition module (201) is used to acquire local IP addresses of multiple network interfaces and store the local IP addresses in a local IP list; The processing module (202) is used to determine whether a detection period of a preset timer has been reached; The processing module (202) is further configured to traverse the local IP list and send a detection packet to the preset public service through each local IP address if it is determined that the detection period of the preset timer has arrived; The processing module (202) is further configured to receive response information sent by the preset public service to the detection packet; The processing module (202) is further used to score each of the local IP addresses according to the response information to obtain a scoring result corresponding to each of the local IP addresses; The processing module (202) is further used to determine the target IP address from the multiple local IP addresses according to the scoring result, and to construct an address pair list, wherein the address pair list includes multiple IP address pairs, and the IP address pairs are corresponding relationships between the target IP address and the source IP address; The processing module (202) is further configured to initiate a network request from the target IP address to the source IP address according to the address pair list to complete data return to the source.
9. An electronic device, characterized in that: The electronic device (300) comprises a processor (301), a memory (305), a user interface (303) and a network interface (304), wherein the memory (305) is used to store instructions, the user interface (303) and the network interface (304) are used to communicate with other devices, and the processor (301) is used to execute the instructions stored in the memory (305) so that the electronic device (300) executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed, the method according to any one of claims 1 to 7 is performed.
Citation Information
Patent Citations
IP address detection method, system and device, and electronic equipment
CN107592291A
CDN edge node resource back method and system
CN109194772A
A DNS analysis method and device
CN109842566A
Data transmission method and device, electronic equipment and computer readable storage medium
CN112866413A
Scheduling method and apparatus for content delivery network, and storage medium and electronic device
WO2023179505A1