Back-to-source detection method and device, computer device and storage medium
By dividing the CDN node probing tasks into fast and slow sets based on the response time of IP addresses and adopting probing methods with different cycles, the problem of low efficiency in multi-link probing of CDN nodes is solved, and faster probing speed and business traffic stability are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
- Filing Date
- 2024-12-02
- Publication Date
- 2026-06-02
AI Technical Summary
In multi-link asynchronous probing tasks from CDN nodes to origin servers, how can we improve the efficiency of large-scale origin server domain name back-to-origin probing, especially in cases where a large number of origin server IPs time out, to avoid blocking the probing queue and extend the probing update time?
By obtaining the response data probing duration of each IP address, the IP address set is divided into a fast set and a slow set, and source tracing is performed on each set with different probing periods. The fast set is probed with a short period, and the slow set is probed with a long period, and the probing results are output.
This accelerated the overall origin detection cycle, improved detection speed, avoided the impact of slow response data from slow-set IP addresses on overall detection efficiency, and ensured the stability of CDN node business traffic.
Smart Images

Figure CN122137827A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of source detection technology, and in particular to a source detection method, apparatus, computer equipment and storage medium. Background Technology
[0002] With the widespread adoption of Content Delivery Networks (CDNs), network status monitoring and link availability updates for CDN nodes have become crucial. This is especially true in live streaming services, where the high demands for real-time performance and data transmission stability make link availability monitoring and rapid updates between CDN nodes and origin servers a critical technical requirement. Current technologies typically design the probe task between CDN nodes and upper-layer origin servers as a one-to-many relationship, meaning one CDN node needs to probe multiple links to monitor their availability. The probe results are aggregated and updated to the local Domain Name System (DNS) service, providing the business layer with the latest link availability data and enabling dynamic domain name resolution. Therefore, the length of a complete probe cycle is affected by the number of timeout origin server IPs. Timeout origin servers can cause probe queue congestion; therefore, it is necessary to reasonably control the timeout time and queue length of probe tasks to avoid impacting the business traffic of CDN nodes.
[0003] However, in practice, if a large number of origin server IPs time out (e.g., more than several hundred), with a timeout of 5 seconds for each domain name, this will cause the timed-out IPs to block the queue, prolonging the entire probing cycle and affecting the probe update time, ultimately impacting the effective IP switching of the domain name. Therefore, for multi-link asynchronous probing tasks from CDN nodes to origin servers, how to improve the efficiency of large-scale origin server domain name back-to-origin probing has become an urgent problem to be solved. Summary of the Invention
[0004] In view of this, in order to solve the above-mentioned technical problems or some of the technical problems, the present invention provides a source detection method, device, computer equipment and storage medium.
[0005] In a first aspect, embodiments of the present invention provide a source detection method, comprising:
[0006] During the initial source tracing process targeting IP addresses in the IP address set, the tracing duration of the response data returned by each IP address is obtained.
[0007] Based on the detection duration, the IP addresses in the IP address set are divided into a fast set and a slow set;
[0008] The fast set is probed back to its source according to the first detection period corresponding to the fast set to obtain the first response data, and the slow set is probed back to its source according to the second detection period corresponding to the slow set to obtain the second response data, wherein the first detection period is shorter than the second detection period;
[0009] The detection results are output based on the first response data and the second response data.
[0010] In one possible implementation, the step of obtaining the probe duration for each IP address to return response data during the initial source lookup probe targeting IP addresses in the IP address set includes:
[0011] Obtain the set of IP addresses and the detection method from the configuration file of the origin detection;
[0012] According to the detection method, a source probe request is sent to each IP address in the IP address set;
[0013] When a response data is received from an IP address in response to the origin probe request, the response duration of the IP address is obtained as the probe duration.
[0014] In one possible implementation, dividing the IP addresses in the IP address set into a fast set and a slow set according to the detection duration includes:
[0015] When the detection duration is less than the time threshold, the IP address is assigned to the fast set, which is used to read the newly added IP address in the configuration file in the next detection cycle;
[0016] When the detection duration is greater than or equal to the time threshold, the IP address is assigned to the slow set.
[0017] In one possible implementation, the method further includes:
[0018] At the start of each new detection cycle, check for the presence of new IP addresses;
[0019] When a new IP address is added, and the new IP address does not belong to the IP address set, the new IP address is assigned to the fast set;
[0020] Add the newly added IP address to the end of the set of blocks.
[0021] In one possible implementation, the step of outputting the detection result based on the first response data and the second response data includes:
[0022] At the end of each second detection cycle, all second response data are added to the slow set detection result set;
[0023] At the end of each first detection cycle, determine whether there is second response data in the slow set detection result set;
[0024] If it exists, the first response result and all the second response data in the slow set detection result set are used as the detection result for output;
[0025] If it does not exist, the first response result will be used as the detection result for output.
[0026] In one possible implementation, the method further includes:
[0027] At the end of each second probe cycle, obtain the new probe duration for each IP address in the slow set during the second probe cycle;
[0028] IP addresses in the slow set whose new detection duration is less than the time threshold are assigned to the fast set.
[0029] In one possible implementation, the method further includes:
[0030] At the end of each first detection cycle, obtain the new detection duration of each IP address in the fast set within the first detection cycle;
[0031] IP addresses in the fast set whose new probe duration is greater than or equal to the time threshold are assigned to the candidate set;
[0032] After the second detection period ends, the candidate set is added to the slow set.
[0033] Secondly, embodiments of the present invention provide a source detection device, comprising:
[0034] The acquisition module is used to acquire the probe duration of the response data returned by each IP address during the initial source tracing process for IP addresses in the IP address set.
[0035] A partitioning module is used to divide the IP addresses in the IP address set into a fast set and a slow set according to the detection duration;
[0036] The source detection module is used to perform source detection on the fast set according to a first detection period corresponding to the fast set to obtain first response data, and to perform source detection on the slow set according to a second detection period corresponding to the slow set to obtain second response data, wherein the first detection period is shorter than the second detection period;
[0037] The output module is used to output the detection results based on the first response data and the second response data.
[0038] Thirdly, embodiments of the present invention provide a computer device, including: a processor and a memory, wherein the processor is configured to execute a back-to-source detection program stored in the memory to implement the back-to-source detection method described in any one of the first aspects above.
[0039] Fourthly, embodiments of the present invention provide a storage medium storing one or more programs, which can be executed by one or more processors to implement the source detection method described in any of the first aspects above.
[0040] The origin detection scheme provided in this invention obtains the detection duration of the response data returned by each IP address during the initial origin detection of IP addresses in a set of IP addresses; divides the IP addresses in the set into a fast set and a slow set based on the detection duration; performs origin detection on the fast set according to a first detection period corresponding to the fast set to obtain first response data, and performs origin detection on the slow set according to a second detection period corresponding to the slow set to obtain second response data, where the first detection period is shorter than the second detection period; and outputs the detection result based on the first response data and the second response data. Therefore, the IP address set can be divided into a fast set and a slow set according to the origin detection duration of IP addresses in each period, and origin detection can be performed on different sets. This avoids the slow response data returned by IP addresses in the slow set affecting the overall detection efficiency, thereby accelerating the overall origin detection cycle and improving the detection speed. Attached Figure Description
[0041] Figure 1 This is a flowchart illustrating a source detection method provided in an embodiment of the present invention;
[0042] Figure 2 A flowchart illustrating another source detection method provided in an embodiment of the present invention;
[0043] Figure 3 This is a schematic diagram of the structure of a source detection device provided in an embodiment of the present invention;
[0044] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present invention;
[0045] Figure 5 This is a flowchart illustrating another source detection method provided in an embodiment of the present invention. Detailed Implementation
[0046] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] To facilitate understanding of the embodiments of the present invention, further explanations and descriptions will be provided below with reference to the accompanying drawings and specific embodiments. These embodiments do not constitute a limitation on the embodiments of the present invention.
[0048] Figure 1 This is a flowchart illustrating a source detection method provided in an embodiment of the present invention, as shown below. Figure 1 As shown, the method specifically includes:
[0049] S11. During the initial source tracing process targeting IP addresses in the IP address set, obtain the tracing duration for each IP address to return response data.
[0050] The origin health check method provided in this invention is applied to computer equipment, which may include, but is not limited to, servers and desktop computers. The specific execution entity can be a CDN node within the computer equipment. A CDN node, as a CDN service provider, is commonly a group of servers operating in a data center, managed by software to provide caching functionality and serving as the resource provider for CDN scheduling. The CDN node ensures the availability of the origin server through origin health checks (or origin probes) to ensure successful retrieval of the latest content when cached content expires or is missing. The origin server refers to the IP address for which the CDN node needs to perform origin health checks. Specifically, the IP address set can be divided into a fast set and a slow set based on the origin health check duration within each period, and origin health checks can be performed on different sets. Origin health checks, also known as network liveness checks, can use network layer 4 or layer 7 protocols to access the other party's IP address, and the success rate or duration determines the link's availability.
[0051] In this embodiment, when performing origin probe for the first time, the CDN node can obtain a set of IP addresses from its corresponding configuration file. The set of IP addresses represents the IP addresses of all origin servers that need to be probed. The CDN node sends a probe request to the origin server corresponding to each IP address according to the currently selected probe method (e.g., HTTP request, TCP connection, ICMP ping, etc.).
[0052] Furthermore, the system receives response data from each IP address. If a valid response (e.g., HTTP 200 OK or a successful TCP connection) is returned, the duration of the received response (which could be the response duration included in the response data) can be obtained as the probe duration. The obtained probe duration can include: the normal probe duration within a preset time threshold, the timeout probe duration exceeding the preset time threshold, and if the origin server does not return response data or returns an error (e.g., HTTP 500 error), the current probe duration can be recorded as the timeout probe duration. Thus, the probe duration corresponding to each IP address is obtained.
[0053] S12. Divide the IP addresses in the IP address set into a fast set and a slow set according to the detection duration.
[0054] In this embodiment, after the first origin probe is completed, the IP address set is divided according to whether the obtained first probe duration has timed out. The normal probe duration is divided into the fast set, and the timed-out probe duration is divided into the slow set. Since the fast set and the slow set return response data at different speeds, different probe cycles are set in the subsequent origin probe process.
[0055] S13. Perform source detection on the fast set according to the first detection period corresponding to the fast set to obtain the first response data, and perform source detection on the slow set according to the second detection period corresponding to the slow set to obtain the second response data.
[0056] In this embodiment, since a source homing probe needs to be performed at fixed intervals, and the fast set and slow set correspond to different probe duration ranges, a first probe period (e.g., 1 minute) for the fast set is pre-set based on the longest probe duration in the fast set. The first probe period is longer than the longest probe duration in the fast set. Similarly, a second probe period (e.g., 2 minutes) for the slow set is set based on the longest probe duration in the slow set. The second probe period is longer than the longest probe duration in the slow set. Alternatively, if the probe duration in the slow set has extremely high latency (e.g., 10 minutes), or if no probe duration exists due to the absence of second response data, a pre-set duration can be added to the first probe period to obtain the second probe period. Since the probe durations in the fast set are all shorter than any probe duration in the slow set, the first probe period is shorter than the second probe period. The first probe period represents the interval between the fast set's next source homing probe, and the second probe period represents the interval between the slow set's next source homing probe.
[0057] After the initial origin probe ends, when the first probe cycle is reached, the IP addresses in the fast set are probed again to obtain the first response data. When the second probe cycle is reached, the IP addresses in the slow set are probed again to obtain the second response data.
[0058] S14. Output the detection results based on the first response data and the second response data.
[0059] In this embodiment, the response data may include, but is not limited to: status codes (e.g., HTTP status codes), response content (Body), connection status, origin server load information, error information, diagnostic data, etc. Since the fast set and slow set return response data based on their respective probing periods and the probing duration for each IP address, the times at which the first and second response data are received differ, resulting in different output probing results. When the first response data for the current probing period is received, but the second response data has not yet been received, the first response data can be directly used as the probing result. Alternatively, whenever the second response data is generated, it can be cached first. When the first response data is received, the second response data cached in the slow set and the first response data can be used as the probing result for output.
[0060] Furthermore, after obtaining the probe results, the domain name resolution can be updated to the named configuration file using `reloadnamed`. If the CDN node's current service is on-demand live streaming, the latest domain name resolution can be read through named. After the current period ends, the fast and slow sets can be re-partitioned based on the new probe duration for each IP address within the current fast and slow sets. After re-partitioning, the first and second probe periods corresponding to the next period can be determined. Here, `named` is the daemon of Berkeley Internet Name Domain (BIND), which implements authoritative and recursive DNS services for the Domain Name System (DNS). The named service typically runs in the background, handling client DNS query requests and providing DNS resolution services.
[0061] In one possible implementation, the CDN node may also perform the following operations after receiving the response data:
[0062] Check the format or specific fields of the response content to ensure they meet expectations and confirm the correctness of the content returned by the origin server. Based on HTTP header information such as Cache-Control, Content-Length, and Last-Modified, confirm the content caching strategy and update status. Update the origin server's status information based on the probe results and record it in the internal monitoring system. Dynamically adjust the weight of the origin server in the load balancing strategy based on the probe results to reduce traffic allocation to unavailable origin servers. Automatically switch to a backup origin server when an origin server is detected as unavailable to ensure high content availability. Notify the administrator in case of severe or persistent failures for further investigation and remediation. When the origin server probe is successful and the CDN node retrieves valid content from the origin server, it caches the content locally so that subsequent requests can be served directly from the cache, avoiding frequent origin server pulls. The updated cached data will be used for subsequent user requests to ensure the timeliness and stability of the content.
[0063] The origin detection method provided in this invention obtains the detection duration of the response data returned by each IP address during the initial origin detection of IP addresses in a set of IP addresses; divides the IP addresses in the set into a fast set and a slow set based on the detection duration; performs origin detection on the fast set according to a first detection period corresponding to the fast set to obtain first response data, and performs origin detection on the slow set according to a second detection period corresponding to the slow set to obtain second response data, where the first detection period is shorter than the second detection period; and outputs the detection result based on the first response data and the second response data. Therefore, the IP address set can be divided into a fast set and a slow set according to the origin detection duration of IP addresses in each period, and origin detection can be performed on different sets. This avoids the slow response data returned by IP addresses in the slow set affecting the overall detection efficiency, thereby accelerating the overall origin detection cycle and improving the detection speed.
[0064] Figure 2 This is a flowchart illustrating another source detection method provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the method specifically includes:
[0065] S21. Obtain the IP address set and probe method from the origin probe configuration file; send an origin probe request to each IP address in the IP address set according to the probe method; when the response data returned by the IP address in response to the origin probe request is received, obtain the response time of the IP address as the probe time.
[0066] In this embodiment, the configuration information required for origin-back probe is first obtained by reading the input configuration file (e.g., domain.conf, config.ini) of the probe program. The configuration file defines the probe method and the set of IP addresses. The first target parameter in the configuration file (e.g., the probe_method parameter) specifies the probe method. Supported probe methods may include, but are not limited to, http, ping, etc. http indicates that the probe is performed using an HTTP request, and ping indicates that the probe is performed using the ICMP protocol. The second target parameter in the configuration information (e.g., the ip_addresses parameter) may contain multiple IP addresses, separated by commas, forming a set of IP addresses. These IP addresses represent the target origin servers for which origin-back probes are to be performed.
[0067] Furthermore, based on the probing method obtained from the configuration file, the program performs corresponding probes on each IP address in the IP address set. HTTP Probing: If the probing method specified in the configuration file is HTTP, the program sends an HTTP request (usually using the GET method) to each IP address. The current time is recorded before each probe request begins, and the end time is recorded when the response data is received and the request is completed. The probe duration for that IP address is obtained by calculating the response time. The program outputs or logs the probe duration for each IP address for subsequent analysis.
[0068] The detection program in this embodiment can be deployed on the same device as the live streaming service. To avoid excessive CPU resource consumption and impact on the live streaming business, it is designed to be as lightweight as possible. Considering that the bottleneck of the detection cycle lies in network transmission, a single-threaded multi-coroutine operation is adopted, using an asynchronous IO coroutine queue to perform batch detection on the IP set. Asynchronous IO (Input / Output) is a programming pattern that allows a program to continue executing other tasks (non-blocking) while waiting for IO operations (such as reading / writing files, network communication, etc.) to complete. This pattern can improve program efficiency and performance, especially in IO-intensive or high-latency environments. Coroutines are commonly used in asynchronous programming, allowing programs to suspend execution while waiting for input / output operations (such as network requests, file read / write, etc.) to complete, thus enabling the program to perform other tasks, improving resource utilization and program efficiency. In a single-threaded environment, multi-coroutine tasks do not need to consider read / write lock synchronization issues.
[0069] As an example, a domain.conf configuration file is used to configure the input information for the probe. In this example, each line represents the probe configuration for a domain, including the domain name, set of IP addresses, probe method, and target URL. The file format is explained below:
[0070] #domain,ip,method,url
[0071] a.com,1.1.1.1,2.2.2.2,3.3.3.3,GET,http: / / origin-a.com / detect
[0072] domain: The domain name to be probed, such as a.com.
[0073] ip_addresses: A list of source IP addresses associated with this domain name, separated by commas, for example, 1.1.1.1, 2.2.2.2, 3.3.3.3.
[0074] method: The method used to probe the request, supporting HTTP request methods such as GET, POST, HEAD, etc.
[0075] url: The target URL used for probing, which is the actual target address of the origin probe request.
[0076] The first line of configuration indicates:
[0077] Domain name: a.com
[0078] IP address sets: 1.1.1.1, 2.2.2.2, and 3.3.3.3
[0079] Detection method: GET request
[0080] Target URL: http: / / origin-a.com / detect
[0081] When the probe performs a probe, it will use a GET request to access http: / / origin-a.com / detect for each IP address (1.1.1.1, 2.2.2.2, 3.3.3.3) and record the probe results based on the response.
[0082] S22. When the probe duration is less than the time threshold, the IP address is assigned to the fast set, which is used to read the newly added IP address in the configuration file in the next probe cycle; when the probe duration is greater than or equal to the time threshold, the IP address is assigned to the slow set.
[0083] In this embodiment, a time threshold (e.g., 1 minute) is preset. After each origin probe, the fast set and slow set need to be redefined based on the probe duration for each IP address. IP addresses with probe durations less than the time threshold are assigned to the fast set, and IP addresses with probe durations greater than or equal to the time threshold are assigned to the slow set. At the start of each new probe cycle, the fast set probe is the primary task, responsible for reading the upstream configuration file (e.g., domain.conf) and outputting the downstream configuration file (e.g., named).
[0084] In one possible implementation, at the start of each new probing cycle, it is detected whether a new IP address exists; if a new IP address exists and the new IP address does not belong to the IP address set, the new IP address is assigned to the fast set; and the new IP address is added to the end of the fast set.
[0085] Specifically, at the start of each new probing cycle, the quick collection can read the configuration file to determine if any new IP addresses have been added. If the result is yes and it is confirmed that the new IP address does not overlap with any IP addresses in the historical IP address set, it means that the probing duration for the new IP address is unknown. This new IP address is then assigned to the quick collection and added to the end of the quick collection. Since the timeout for each domain name is typically set to a few seconds, the completion time of the probing queue depends on the completion time of the last returned IP probe. Therefore, even if the probing of a small number of newly added IP addresses at the end times out by a few seconds, it will not significantly affect the probing task cycle of the quick collection.
[0086] S23. Perform source detection on the fast set according to the first detection period corresponding to the fast set to obtain the first response data, and perform source detection on the slow set according to the second detection period corresponding to the slow set to obtain the second response data.
[0087] In this embodiment, the procedure is similar to step S13, and can be referred to for details. Figure 1 For the sake of brevity, the relevant content will not be elaborated upon here.
[0088] S24. At the end of each second detection cycle, add all second response data to the slow set detection result set; at the end of each first detection cycle, determine whether there is second response data in the slow set detection result set; if there is, use the first response result and all second response data in the slow set detection result set as the detection result; if there is no second response data, use the first response result as the detection result.
[0089] In this embodiment, since the first detection period and the second detection period are different, the fast set and the slow set are detected according to their respective detection periods. Since the second detection period is longer, the second response data cannot be directly used as the detection result. Instead, the second response data of each time is first added to the preset slow set detection result set for caching.
[0090] At the end of each first detection cycle, the detection results can be generated. First, it is determined whether there is second response data in the current slow set detection result set. If there is, the first response result and all the second response data in the slow set detection result set are merged and used as the detection result. If there is no second response data, it means that the current second detection cycle has not ended, and only the first response result is used as the detection result.
[0091] In one possible implementation, at the end of each second probing cycle, the new probing duration for each IP address in the slow set during the second probing cycle is obtained; IP addresses in the slow set whose new probing duration is less than a time threshold are assigned to the fast set. At the end of each first probing cycle, the new probing duration for each IP address in the fast set during the first probing cycle is obtained; IP addresses in the fast set whose new probing duration is greater than or equal to the time threshold are assigned to the candidate set; when the second probing cycle ends, the candidate set is added to the slow set.
[0092] Specifically, after each probing cycle, the IP addresses need to be re-divided into fast and slow sets based on the probing duration of the current cycle. At the end of each second probing cycle, IP addresses in the slow set with new probing durations less than a time threshold are moved to the fast set. At the end of each first probing cycle, because the slow set has a longer probing cycle, to avoid affecting the fast set's ability to continue probing in the next cycle, IP addresses in the fast set with new probing durations greater than or equal to a time threshold are moved to a pre-defined candidate set. The candidate set is used to temporarily store IP addresses allocated from the fast set. After the second probing cycle ends, the candidate set is added to the slow set to update the slow set.
[0093] As an example, such as Figure 5The following is a schematic flowchart of another origin probing method provided by an embodiment of the present invention. The input configuration file of the probing program is domain.conf, which is used to provide IP addresses. First, initialization is performed, and two IP sets are set: a fast set and a slow set. At the first probe, the probe durations of all IP addresses are unknown, and they are all placed in the fast set. Here, the key of the set can be represented by the IP. In actual work, the set key is also related to the url, method, and local network card IP, and needs to be represented by a tuple. For example: (ip, url, method, bind_ip). Further, the start of the probing task: The fast set probe is used as the main task, which is responsible for reading the upstream domain.conf and outputting the downstream named configuration. The period is relatively short, such as 1 minute, and the slow set probing task has a longer period, such as more than 2 minutes. At the beginning of each period, a new slow set is read. During the probing process, single-threaded multi-coroutine operation is adopted, and an asynchronous IO coroutine queue is used to perform batch probing on the IP set. Since domain.conf will update some domain name-IP records irregularly, the domain names with unknown probing times are placed at the end of the fast set. After each probing period is completed, a certain waiting time can be set to reduce the CPU usage rate. And a suitable time threshold threshold is set as the standard for judging the speed of domain name probing, such as 5 seconds. A data container is used to maintain the slow set probing result cache: {domain: detect_time}, such as {'a.com': 5.123,...}, and timeouts can be represented by -1 or a large value (such as 1000). After the fast set probing task is completed, the latest probing results of the slow set are read and integrated into the output results. At the same time, the fast and slow sets are updated to prepare for the next period of probing for each. All domain names in the slow set with probing times < threhold are added to the fast set for the next period of probing. All domain names in the fast set with probing times >= threhold are added to the slow set candidate set {domain}. After the slow probing coroutine completes the probing, the slow set probing cache is updated, and then the incremental candidate set is merged into the slow set, thereby realizing separate probing of the fast and slow sets and updating the IP addresses in the fast and slow sets within each period.
[0094] The origin probing method provided by the embodiment of the present invention automatically distinguishes between the fast and slow sets after the first-period full-scale IP address probing. After the fast set probing, the most recent historical cache of the slow set is read, and then the configuration is output and named is reloaded, so that the point live broadcast service can more quickly perceive the change of the probing result. In this way, the update time of the IP records for normal probing can be guaranteed relatively quickly, and at the same time, the time for slow probing and invalid probing will not be significantly delayed. Without knowing the importance of the domain name, the fast and slow probing sets are automatically distinguished. The overall probing period is accelerated almost losslessly, and the probing speed is improved.
[0095] Figure 3This is a schematic diagram of a source detection device provided in an embodiment of the present invention, as shown below. Figure 3 As shown, the device specifically includes:
[0096] The acquisition module 31 is used to acquire the probe duration of the response data returned by each IP address during the initial source probe for the IP addresses in the IP address set.
[0097] The partitioning module 32 is used to divide the IP addresses in the IP address set into a fast set and a slow set according to the detection duration;
[0098] The source detection module 33 is used to perform source detection on the fast set according to the first detection period corresponding to the fast set to obtain first response data, and to perform source detection on the slow set according to the second detection period corresponding to the slow set to obtain second response data, wherein the first detection period is shorter than the second detection period;
[0099] Output module 34 is used to output the detection result based on the first response data and the second response data.
[0100] In one possible implementation, the acquisition module is specifically used to acquire the set of IP addresses and the detection method from the configuration file of the origin detection;
[0101] According to the detection method, a source probe request is sent to each IP address in the IP address set;
[0102] When a response data is received from an IP address in response to the origin probe request, the response duration of the IP address is obtained as the probe duration.
[0103] In one possible implementation, the partitioning module is specifically used to partition the IP address into the fast set when the detection duration is less than a time threshold, and the fast set is used to read the newly added IP address in the configuration file in the next detection cycle;
[0104] When the detection duration is greater than or equal to the time threshold, the IP address is assigned to the slow set.
[0105] In one possible implementation, the partitioning module is also used to detect whether a new IP address is added at the start of each new detection cycle;
[0106] When a new IP address is added, and the new IP address does not belong to the IP address set, the new IP address is assigned to the fast set;
[0107] Add the newly added IP address to the end of the set of blocks.
[0108] In one possible implementation, the output module is specifically used to add all the second response data to the slow set detection result set whenever the second detection cycle ends;
[0109] At the end of each first detection cycle, determine whether there is second response data in the slow set detection result set;
[0110] If it exists, the first response result and all the second response data in the slow set detection result set are used as the detection result for output;
[0111] If it does not exist, the first response result will be used as the detection result for output.
[0112] In one possible implementation, the partitioning module is further configured to obtain the new probe duration of each IP address in the slow set during the second probe cycle at the end of each second probe cycle;
[0113] IP addresses in the slow set whose new detection duration is less than the time threshold are assigned to the fast set.
[0114] In one possible implementation, the partitioning module is further configured to, at the end of each of the first detection cycles, obtain the new detection duration of each IP address in the fast set during the first detection cycle;
[0115] IP addresses in the fast set whose new probe duration is greater than or equal to the time threshold are assigned to the candidate set;
[0116] After the second detection period ends, the candidate set is added to the slow set.
[0117] The source detection device provided in this embodiment can be as follows: Figure 3 The apparatus shown can perform, for example Figure 1-2 All steps of the mid-source detection method are then implemented to achieve... Figure 1-2 For details on the technical effects of the source detection method shown, please refer to [link / reference]. Figure 1-2 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0118] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present invention. Figure 4The computer device 400 shown includes at least one processor 401, a memory 402, at least one network interface 404, and other user interfaces 403. The various components in the computer device 400 are coupled together via a bus system 405. It is understood that the bus system 405 is used to implement communication between these components. In addition to a data bus, the bus system 405 also includes a power bus, a control bus, and a status signal bus. However, for clarity, ... Figure 4 The general designated all buses as Bus System 405.
[0119] The user interface 403 may include a display, keyboard, or clicking device (e.g., mouse, trackball, touchpad, or touchscreen).
[0120] It is understood that the memory 402 in the embodiments of the present invention can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 402 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0121] In some implementations, memory 402 stores elements, executable units or data structures, or subsets thereof, or extended sets thereof: operating system 4021 and application program 4022.
[0122] The operating system 4021 includes various system programs, such as the framework layer, core library layer, and driver layer, used to implement various basic business functions and handle hardware-based tasks. The application program 4022 includes various applications, such as a media player and a browser, used to implement various application functions. The program implementing the method of this embodiment can be included in the application program 4022.
[0123] In this embodiment of the invention, by calling the program or instructions stored in the memory 402, specifically the program or instructions stored in the application program 4022, the processor 401 executes the method steps provided in each method embodiment, including, for example:
[0124] During the initial source tracing process targeting IP addresses in the IP address set, the tracing duration of the response data returned by each IP address is obtained.
[0125] Based on the detection duration, the IP addresses in the IP address set are divided into a fast set and a slow set;
[0126] The fast set is probed back to its source according to the first detection period corresponding to the fast set to obtain the first response data, and the slow set is probed back to its source according to the second detection period corresponding to the slow set to obtain the second response data, wherein the first detection period is shorter than the second detection period;
[0127] The detection results are output based on the first response data and the second response data.
[0128] In one possible implementation, the set of IP addresses and the detection method are obtained from the configuration file of the origin probe;
[0129] According to the detection method, a source probe request is sent to each IP address in the IP address set;
[0130] When a response data is received from an IP address in response to the origin probe request, the response duration of the IP address is obtained as the probe duration.
[0131] In one possible implementation, when the detection duration is less than a time threshold, the IP address is assigned to the fast set, which is used to read new IP addresses from the configuration file in the next detection cycle.
[0132] When the detection duration is greater than or equal to the time threshold, the IP address is assigned to the slow set.
[0133] In one possible implementation, at the start of each new probing cycle, it is checked whether a new IP address has been added;
[0134] When a new IP address is added, and the new IP address does not belong to the IP address set, the new IP address is assigned to the fast set;
[0135] Add the newly added IP address to the end of the set of blocks.
[0136] In one possible implementation, at the end of each second detection cycle, all second response data are added to the slow set detection result set;
[0137] At the end of each first detection cycle, determine whether there is second response data in the slow set detection result set;
[0138] If it exists, the first response result and all the second response data in the slow set detection result set are used as the detection result for output;
[0139] If it does not exist, the first response result will be used as the detection result for output.
[0140] In one possible implementation, at the end of each second probe cycle, the new probe duration for each IP address in the slow set during the second probe cycle is obtained;
[0141] IP addresses in the slow set whose new detection duration is less than the time threshold are assigned to the fast set.
[0142] In one possible implementation, when each of the first probe cycles ends, the new probe duration for each IP address in the fast set during the first probe cycle is obtained;
[0143] IP addresses in the fast set whose new probe duration is greater than or equal to the time threshold are assigned to the candidate set;
[0144] After the second detection period ends, the candidate set is added to the slow set.
[0145] The methods disclosed in the above embodiments of the present invention can be applied to processor 401, or implemented by processor 401. Processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 401 or by instructions in the form of software. The processor 401 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of the present invention can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software units in the decoding processor. The software units may be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 402. Processor 401 reads the information in memory 402 and, in conjunction with its hardware, completes the steps of the above method.
[0146] It is understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described herein, or combinations thereof.
[0147] For software implementation, the techniques described herein can be implemented by units that perform the functions described herein. The software code can be stored in memory and executed by a processor. The memory can be implemented in the processor or external to the processor.
[0148] The computer device provided in this embodiment may be as follows: Figure 4 The device shown can perform, for example Figure 1-2 All steps of the mid-source detection method are then implemented to achieve... Figure 1-2 For details on the technical effects of the source detection method shown, please refer to [link / reference]. Figure 1-2 The relevant descriptions are presented concisely and will not be elaborated upon here.
[0149] This invention also provides a storage medium (computer-readable storage medium). This storage medium stores one or more programs. The storage medium may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; the memory may also include combinations of the above types of memory.
[0150] When one or more programs in the storage medium can be executed by one or more processors to implement the above-described source detection method executed on the device side.
[0151] The processor is used to execute a source-tracking program stored in memory to implement the following steps of a source-tracking method executed on the device side:
[0152] During the initial source tracing process targeting IP addresses in the IP address set, the tracing duration of the response data returned by each IP address is obtained.
[0153] Based on the detection duration, the IP addresses in the IP address set are divided into a fast set and a slow set;
[0154] The fast set is probed back to its source according to the first detection period corresponding to the fast set to obtain the first response data, and the slow set is probed back to its source according to the second detection period corresponding to the slow set to obtain the second response data, wherein the first detection period is shorter than the second detection period;
[0155] The detection results are output based on the first response data and the second response data.
[0156] In one possible implementation, the set of IP addresses and the detection method are obtained from the configuration file of the origin probe;
[0157] According to the detection method, a source probe request is sent to each IP address in the IP address set;
[0158] When a response data is received from an IP address in response to the origin probe request, the response duration of the IP address is obtained as the probe duration.
[0159] In one possible implementation, when the detection duration is less than a time threshold, the IP address is assigned to the fast set, which is used to read new IP addresses from the configuration file in the next detection cycle.
[0160] When the detection duration is greater than or equal to the time threshold, the IP address is assigned to the slow set.
[0161] In one possible implementation, at the start of each new probing cycle, it is checked whether a new IP address has been added;
[0162] When a new IP address is added, and the new IP address does not belong to the IP address set, the new IP address is assigned to the fast set;
[0163] Add the newly added IP address to the end of the set of blocks.
[0164] In one possible implementation, at the end of each second detection cycle, all second response data are added to the slow set detection result set;
[0165] At the end of each first detection cycle, determine whether there is second response data in the slow set detection result set;
[0166] If it exists, the first response result and all the second response data in the slow set detection result set are used as the detection result for output;
[0167] If it does not exist, the first response result will be used as the detection result for output.
[0168] In one possible implementation, at the end of each second probe cycle, the new probe duration for each IP address in the slow set during the second probe cycle is obtained;
[0169] IP addresses in the slow set whose new detection duration is less than the time threshold are assigned to the fast set.
[0170] In one possible implementation, when each of the first probe cycles ends, the new probe duration for each IP address in the fast set during the first probe cycle is obtained;
[0171] IP addresses in the fast set whose new probe duration is greater than or equal to the time threshold are assigned to the candidate set;
[0172] After the second detection period ends, the candidate set is added to the slow set.
[0173] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0174] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented in hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0175] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for source detection, characterized in that, include: During the initial source tracing process targeting IP addresses in the IP address set, the tracing duration of the response data returned by each IP address is obtained. Based on the detection duration, the IP addresses in the IP address set are divided into a fast set and a slow set; The fast set is probed back to its source according to the first detection period corresponding to the fast set to obtain the first response data, and the slow set is probed back to its source according to the second detection period corresponding to the slow set to obtain the second response data, wherein the first detection period is shorter than the second detection period; The detection results are output based on the first response data and the second response data.
2. The method according to claim 1, characterized in that, The process of initially probing back to the source address in the IP address set, including obtaining the probing duration for each IP address to return response data, includes: Obtain the set of IP addresses and the detection method from the configuration file of the origin detection; According to the detection method, a source probe request is sent to each IP address in the IP address set; When a response data is received from an IP address in response to the origin probe request, the response duration of the IP address is obtained as the probe duration.
3. The method according to claim 2, characterized in that, The step of dividing the IP addresses in the IP address set into a fast set and a slow set according to the detection duration includes: When the detection duration is less than the time threshold, the IP address is assigned to the fast set, which is used to read the newly added IP address in the configuration file in the next detection cycle; When the detection duration is greater than or equal to the time threshold, the IP address is assigned to the slow set.
4. The method according to claim 3, characterized in that, The method further includes: At the start of each new detection cycle, check for the presence of new IP addresses; When a new IP address is added, and the new IP address does not belong to the IP address set, the new IP address is assigned to the fast set; Add the newly added IP address to the end of the set of blocks.
5. The method according to claim 2, characterized in that, The step of outputting the detection result based on the first response data and the second response data includes: At the end of each second detection cycle, all second response data are added to the slow set detection result set; At the end of each first detection cycle, determine whether there is second response data in the slow set detection result set; If it exists, the first response result and all the second response data in the slow set detection result set are used as the detection result for output; If it does not exist, the first response result will be used as the detection result for output.
6. The method according to claim 1, characterized in that, The method further includes: At the end of each second probe cycle, obtain the new probe duration for each IP address in the slow set during the second probe cycle; IP addresses in the slow set whose new detection duration is less than the time threshold are assigned to the fast set.
7. The method according to claim 1, characterized in that, The method further includes: At the end of each first detection cycle, obtain the new detection duration of each IP address in the fast set within the first detection cycle; IP addresses in the fast set whose new probe duration is greater than or equal to the time threshold are assigned to the candidate set; After the second detection period ends, the candidate set is added to the slow set.
8. A source traversal detection device, characterized in that, include: The acquisition module is used to acquire the probe duration of the response data returned by each IP address during the initial source tracing process for IP addresses in the IP address set. A partitioning module is used to divide the IP addresses in the IP address set into a fast set and a slow set according to the detection duration; The source detection module is used to perform source detection on the fast set according to a first detection period corresponding to the fast set to obtain first response data, and to perform source detection on the slow set according to a second detection period corresponding to the slow set to obtain second response data, wherein the first detection period is shorter than the second detection period; The output module is used to output the detection results based on the first response data and the second response data.
9. A computer device, characterized in that, include: A processor and a memory, the processor being configured to execute a source detection program stored in the memory to implement the source detection method according to any one of claims 1 to 7.
10. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the source detection method according to any one of claims 1 to 7.