Network path detection method, device, electronic device and storage medium
By using thread pools to concurrently handle multiple path detection tasks in network path detection, the problem of inefficiency of traditional methods is solved, and more efficient and reliable network path detection is achieved.
Patent Information
- Application Number
- CN202410920711.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-07-10
AI Technical Summary
Traditional network path detection methods are inefficient, especially when dealing with multiple path detection tasks, they cannot meet user needs.
By obtaining multiple path detection tasks and initializing the thread pool, multiple target threads in the thread pool perform concurrent processing of multiple path detection tasks, and obtaining the path detection results of each path detection task.
It improves the network path detection efficiency of multiple network path detection tasks, reduces the number of packets sent and received, simplifies the complexity of packet resolution, and improves the reliability of path detection results.
Smart Images

Figure CN118677815B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to a network path detection method, device, electronic equipment and storage medium. Background Art
[0002] At present, network detection generally includes three types: icmp, tcp, and udp. The principle is to send out packets with a successively increasing time to live (TTL) value to obtain information about each hop in the network path, that is, each detection path node.
[0003] Traditional network probe programs usually use the raw socket method, that is, they perform multi-path detection tasks by sending and receiving messages through two threads respectively. However, when there are many path detection tasks, the efficiency of network path detection often cannot meet user needs. Summary of the invention
[0004] The present invention provides a network path detection method, device, electronic device and storage medium to solve the technical problem of low efficiency of network path detection.
[0005] According to one aspect of the present invention, a network path detection method is provided, wherein the method comprises:
[0006] Acquire multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to one target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads;
[0007] The plurality of path detection tasks are processed concurrently by the thread pool to obtain a path detection result of each path detection task, wherein each target thread is used to process one path detection task, and the path detection result includes a detection network path and / or a target detection delay corresponding to the target detection terminal, and the detection network path includes IP addresses of a plurality of target detection nodes;
[0008] For each of the path detection results, when the path detection result meets the target detection condition, a target detection result is determined based on the path detection result, and the target detection result is stored in a target database.
[0009] According to another aspect of the present invention, a network path detection device is provided, wherein the device comprises:
[0010] A task acquisition module, used to acquire multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to one target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads;
[0011] A concurrent processing module, used for concurrently processing the plurality of path detection tasks through the thread pool to obtain a path detection result of each path detection task, wherein each target thread is used to process one path detection task, the path detection result includes a detection network path and / or a target detection delay corresponding to the target detection terminal, and the detection network path includes IP addresses of a plurality of target detection nodes;
[0012] The target result determination module is used to determine the target detection result based on each of the path detection results when the path detection result meets the target detection condition, and store the target detection result in the target database.
[0013] According to another aspect of the present invention, there is provided an electronic device, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the network path detection method described in any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the network path detection method described in any embodiment of the present invention when executed.
[0018] The technical solution of the embodiment of the present invention is to obtain multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to a target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads; the thread pool concurrently processes multiple path detection tasks to obtain the path detection result of each path detection task, wherein each target thread is used to process one path detection task, the path detection result includes the detection network path and / or target detection delay corresponding to the target detection terminal, and the detection network path includes the IP addresses of multiple target detection nodes; for each path detection result, when the path detection result meets the target detection condition, the target detection result is determined based on the path detection result, and the target detection result is stored in the target database. The present invention uses a method in which multiple target threads in a thread pool perform one-to-one concurrent processing on multiple path detection tasks, which can improve the network path detection efficiency for multiple network path detection tasks.
[0019] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 is an architecture diagram of a network path detection system provided according to an embodiment of the present invention;
[0022] Figure 2 is an example diagram of a network path provided according to an embodiment of the present invention;
[0023] Figure 3 A flowchart of a network path detection method is provided for the first embodiment of the present invention;
[0024] Figure 4 is an overall flow chart of determining a path detection result provided according to an embodiment of the present invention;
[0025] Figure 5 A flowchart of a network path detection method provided in Embodiment 2 of the present invention;
[0026] Figure 6is a flow chart of path node supplementation provided according to an embodiment of the present invention;
[0027] Figure 7 is an overall flow chart of a network path detection method provided according to an embodiment of the present invention;
[0028] Figure 8 A schematic diagram of the structure of a network path detection device provided in Embodiment 3 of the present invention;
[0029] Fig. 9 It is a structural schematic diagram of an electronic device for implementing the network path detection method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Figure 1 is an architecture diagram of a network path detection system provided according to an embodiment of the present invention. Figure 1 As shown, the architecture of the network path detection system includes: a RedCap terminal and a perception platform, wherein the RedCap terminal includes a network probe program and a devinfo command. In the technical solution of the embodiment of the present invention, the network probe program set in the RedCap terminal can be used as the execution body.
[0033] Among them, 1. RedCap terminal can be understood as a simplified fifth generation mobile communication technology (5th Generation Mobile Communication Technology, 5G) terminal. RedCap terminal can reduce terminal complexity through RedCap technology, for example, reduce bandwidth and number of antennas, reduce modulation order, etc., which can reduce cost and power consumption and increase data transmission rate. RedCap terminal can be applied to various 5G private network application scenarios such as industrial wireless sensors, wearable devices and video surveillance, and has strong versatility.
[0034] 2. The perception platform can be understood as a management platform for network path detection tasks. Specifically, it can send network path detection tasks to the network probe program in the RedCap terminal, and can also manage the tasks in a unified manner.
[0035] 3. The network probe program can be deployed on the Linux platform of the RedCap terminal, and can receive network path detection tasks sent by the perception platform, execute tasks, and report task processing results.
[0036] 4. The devinfo command can be understood as a standard interface for data collection. The network probe program can obtain the data of the RedCap terminal through this interface, for example, including CPU or memory usage, service port rate, and 5G signal.
[0037] Figure 2 FIG. 1 is an example diagram of a network path provided according to an embodiment of the present invention. Figure 2 As shown, HostA can be represented Figure 1 In the RedCap terminal, HostB represents the target detection terminal, and R1, R2 and R3 represent the target detection nodes.
[0038] Embodiment 1
[0039] Figure 3 A flowchart of a network path detection method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of detecting the network path of a target detection terminal. The method can be executed by a network path detection device. The network path detection device can be implemented in the form of hardware and / or software. The network path detection device can be configured in a computer. Figure 3 As shown, the method includes:
[0040] S110, obtaining a plurality of path detection tasks and initializing a thread pool, wherein one path detection task corresponds to a target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes a plurality of target threads.
[0041] The path detection task can be understood as a task of detecting a network path issued by a sensing platform. Optionally, the path detection task can be a task of detecting a network path of a target detection terminal. In an embodiment of the present invention, specifically, a task request is sent to the sensing platform so that the sensing platform issues a task list including a plurality of the path detection tasks.
[0042] The thread pool can be understood as a form of multi-threaded processing. In an embodiment of the present invention, the thread pool may include multiple target threads, and the target threads may be used to process the path detection task. One target thread is used to process one path detection task. Exemplarily, thread A is used to process detection task A, thread B is used to process detection task B, etc.
[0043] The target detection terminal can be understood as the detection terminal of the target detection task. In an embodiment of the present invention, one target detection task corresponds to one target detection terminal, and different path detection tasks correspond to different target detection terminals. Exemplarily, detection task A corresponds to detection terminal A, detection task B corresponds to detection terminal B, etc. In an embodiment of the present invention, the target detection terminal may include a fifth generation mobile communication technology (5th Generation Mobile Communication Technology, 5G) lightweight terminal.
[0044] S120. Concurrently process the multiple path detection tasks through the thread pool to obtain the path detection result of each path detection task, wherein each target thread is used to process one path detection task, and the path detection result includes the detection network path and / or target detection delay corresponding to the target detection terminal, and the detection network path includes the IP addresses of multiple target detection nodes.
[0045] The concurrent processing can be understood as a parallel processing mode. In the embodiment of the present invention, multiple path detection tasks can be processed in parallel by multiple target threads at the same time, thereby improving the network path detection efficiency for multiple network path detection tasks.
[0046] The path detection result can be understood as the processing result of the path detection task. Optionally, the path detection result may include the detection network path and / or the target detection delay. Among them, the detection network path can be understood as the network path corresponding to the target detection terminal obtained by detection. The target detection delay can be understood as the delay of the detection path, that is, the time used to detect the path. The target detection node can be understood as the detection node corresponding to each survival time value. The Internet Protocol Address (IP) address can be understood as the address of the target detection node.
[0047] Exemplarily, the path detection result is:
[0048] [{ttl:1,ip:1.1.1.1,delay:5ms},{ttl:2,ip:2.2.2.2,delay:5ms},{ttl:3,ip:*,delay:null}]. The detection network path is ttl:1,ip:1.1.1.1-ttl:2,ip:2.2.2.2-ttl:3,ip:*, where delay:5ms indicates the target detection delay and delay:null indicates the detection delay loss. ttl:1, ttl:2 and ttl:3 indicate the target detection nodes.
[0049] Optionally, the concurrently processing the plurality of path detection tasks by the thread pool to obtain a path detection result corresponding to each path detection task includes:
[0050] For each of the path detection tasks, the preset survival time value sequence is traversed through the target thread, and for each traversed target survival time value, the detection message corresponding to the target survival time value is sent in sequence, a return message corresponding to the detection message is received, and the detection node information is determined based on a preset retry number threshold and the return message, wherein the detection node information includes the IP address and / or detection delay corresponding to the target detection node;
[0051] In the case where the detection node information includes the IP address corresponding to the target detection terminal, the traversal and execution operations are stopped, and the path detection result is determined based on the plurality of detection node information.
[0052] The survival time value sequence can be understood as a sequence of survival time values (time to live, TTL). Optionally, the survival time value sequence is (1, 2, 3...max). In the embodiment of the present invention, the max in the survival time value sequence can be preset according to the scenario requirements and is not specifically limited here. For example, max can be 15, 32 or 64, etc.
[0053] The target lifetime value may be understood as the currently traversed lifetime value.
[0054] The detection message can be understood as a message used to detect the target detection node. The return message can be understood as a message returned after the detection of the target detection node is completed.
[0055] The retry count threshold can be understood as the upper limit of the number of repeated detections of the target detection node corresponding to the same target lifetime value. In an embodiment of the present invention, the retry count threshold can be preset according to the scenario requirements and is not specifically limited here. Optionally, the retry count threshold can be 3, 4, or 5, etc.
[0056] The detection node information can be understood as the detection information of the target detection node corresponding to the target survival time value. Optionally, the detection node information may include an IP address, a detection delay, no IP address and detection delay, or both an IP address and a detection delay.
[0057] Optionally, determining the IP address based on the retry count threshold and the returned message includes:
[0058] If the return message is not returned within the preset time or the IP address does not exist in the return message, returning to execute the operation of sending the detection message corresponding to the target lifetime value, receiving the return message corresponding to the detection message, and determining the IP address based on the return message;
[0059] When the number of returned executions exceeds the retry number threshold, the node loss identifier is used as the IP address.
[0060] The preset time can be preset according to the scene requirements and is not specifically limited here. Optionally, the preset time can be 1ms, 2ms or 3ms.
[0061] The node loss flag can be understood as a flag indicating that the IP address of the target detection node is not detected. The node loss flag can be related to the actual system settings and is not specifically limited here. Exemplarily, the node loss flag can be a "*" flag.
[0062] Specifically, optionally, determining the IP address based on the retry count threshold and the returned message includes:
[0063] Determine whether the return message is returned within a preset time and whether there is an IP address in the return message, if not, return to execute the operation of sending a detection message corresponding to the target lifetime value and receiving a return message corresponding to the detection message;
[0064] In the case where the number of returned executions exceeds the retry number threshold, the node loss identifier is used as the IP address; otherwise, the IP address is determined based on the returned message.
[0065] Figure 4 FIG. 1 is an overall flow chart of determining a path detection result according to an embodiment of the present invention. Figure 4 As shown, optionally, the overall process of determining the path detection result can be:
[0066] 1. Initialize the queue of path detection tasks, initialize the thread pool, and process multiple path detection tasks concurrently through the thread pool;
[0067] 2. Traverse the sequence of preset time to live (TTL) values. For example, the preset TTL sequence is (1...max), where max can be preset according to the scenario requirements and is not specifically limited here. For example, max can be 32 or 64.
[0068] 3. Traverse the TTL sequence, and for each target lifetime value traversed, loop through the creation of a Socket with the attribute IP_RECVERR, send one or more detection messages with the same TTL according to the preset number of retries (for example, the number of retries is 3 times), receive the return message through the poll notification trigger mechanism, and repeat the operation of sending and returning the message when the return message times out (for example, 1 second) or the IP address is not returned, until the IP address is returned or the number of retries is exceeded, then jump out of the retry and continue to traverse the TTL sequence.
[0069] 4. Determine the path detection result. For example, the path detection result based on the detection network path and the target detection delay is:
[0070] [{ttl:1,ip:1.1.1.1,delay:5ms},{ttl:2,ip:2.2.2.2,delay:5ms},{ttl:3,ip:3.3.3.3,delay:5ms}..].
[0071] The technical solution for determining the path detection result in the present invention can improve the efficiency, accuracy and reliability of determining the path detection result. Traditional network probe programs usually use the raw mode of socket to send and receive messages. This method requires two threads to perform a path detection task, that is, one thread is used to send messages, and the other thread is used to receive and parse messages. Usually, the specific implementation method is to first send all the detection messages corresponding to the TTL sequence through one thread. For example, if the max corresponding to TTL is 32, then directly send 32 detection messages, and then receive the return message through another thread and parse the message to obtain the detection path. However, under normal circumstances, the network path can be detected without sending the max number of detection messages, and there is a problem of waste of detection messages; and completing the sending and receiving of messages through two threads increases the additional thread processing packet receiving logic, increases the calculation complexity, and affects the calculation efficiency. The socket with raw attributes also needs to additionally process the message header for message parsing, resulting in a technical problem of poor efficiency in determining the path detection result. The present invention adopts the Socket with IP_RECVERR attribute, which does not need to perform additional processing of the message header for message parsing, thereby improving the efficiency of message parsing; for each task, a thread is used to perform network path detection, that is, the target thread sends the detection message corresponding to the traversed TTL and receives the return message, and when the network path detection of the current TTL is completed, the network path detection corresponding to the next TTL is executed, and after the IP address of the target detection terminal is detected, the network path detection is ended, and the network path detection of the next TTL is no longer executed, and the TTL when the network path detection is ended can be less than max, that is, the number of packets sent is reduced, and the waste of detection messages is avoided; the present invention adds a retry mechanism to avoid the situation where the detection node is busy and does not respond, and the target detection node is mistakenly believed to be unable to be detected, thereby ensuring the reliability of the determined path detection result.
[0072] S130. For each of the path detection results, if the path detection result satisfies a target detection condition, determine a target detection result based on the path detection result, and store the target detection result in a target database.
[0073] The target detection condition can be used to determine whether the path detection result is standard. Optionally, the target detection condition can be that the detection network path exists in the path detection result, the IP address of the target detection terminal exists in the detection network path, the target detection delay exists and the target detection delay does not exceed a preset detection delay threshold.
[0074] The detection delay threshold may be understood as a threshold for determining whether the target detection delay has exceeded. In an embodiment of the present invention, the detection delay threshold may be preset according to scenario requirements and is not specifically limited herein. For example, the detection delay threshold may be 2ms, 3ms, or 5ms.
[0075] Optionally, after obtaining the path detection result corresponding to each of the path detection tasks, the method further includes:
[0076] In the case that the path detection result does not meet the target detection condition, detection abnormality information is generated based on the path detection result, wherein the detection abnormality information includes delay abnormality and / or detection terminal unreachable.
[0077] The detection abnormality information may be understood as prompt information indicating that the path detection result is abnormal.
[0078] The technical solution of the embodiment of the present invention is to obtain multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to a target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads; the multiple path detection tasks are processed concurrently by the thread pool to obtain the path detection result of each path detection task, wherein each target thread is used to process one path detection task, and the path detection result includes the detection network path and / or target detection delay corresponding to the target detection terminal, and the detection network path includes the IP addresses of multiple target detection nodes; for each path detection result, when the path detection result meets the target detection condition, the target detection result is determined based on the path detection result, and the target detection result is stored in the target database. The present application adopts a method in which multiple target threads in the thread pool perform one-to-one concurrent processing on multiple path detection tasks, which can improve the network path detection efficiency for multiple network path detection tasks.
[0079] Embodiment 2
[0080] Figure 5 This is a flow chart of a network path detection method provided in Embodiment 2 of the present invention. This embodiment refines the determination of target detection results based on the path detection results described in the above embodiments. Figure 5 As shown, the method includes:
[0081] S210 . In response to a task request, obtain multiple path detection tasks and initialize a thread pool.
[0082] S220: concurrently process the plurality of path detection tasks through the thread pool to obtain a path detection result of each path detection task.
[0083] S230. For each of the path detection results, when the path detection result meets the target detection condition.
[0084] S240: When there is a node loss identifier in the detection network path, obtain a historical detection path corresponding to the target detection terminal, wherein the node loss identifier indicates that the IP address of the target detection node is not detected.
[0085] The historical detection path may be understood as the historical detection path corresponding to the target detection terminal that is cached locally. The local cache may be performed through the RedCap terminal where the network probe program is located.
[0086] S250: Determine a target network path based on the historical detection path and the detection network path.
[0087] Optionally, determining the target network path based on the historical detection path and the detection network path includes:
[0088] The historical base station location is obtained through the target database, and the real-time base station location is determined. When the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost correspond to the historical detection path and the historical base station location is the same as the real-time base station location, the detection network path is supplemented with nodes based on the historical detection path to obtain the target network path.
[0089] The target database may be understood as a local database. The target database may be located at the RedCap terminal where the network probe program is located.
[0090] The historical base station location can be understood as the historical base station location cached locally. The real-time base station location can be understood as the real-time base station location. The base station location can be the geographical location corresponding to the target base station connected to the RedCap terminal where the network probe program is located.
[0091] Optionally, the network path detection method further includes:
[0092] In the case where the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost do not correspond to the historical detection path and the historical base station location is different from the real-time base station location, the detection network path is used as the target network path;
[0093] After determining the target network path based on the historical detection path and the detection network path, the method further includes:
[0094] The historical base station positions stored in the target database are updated based on the real-time base station positions.
[0095] Optionally, specifically, determining the target network path based on the historical detection path and the detection network path includes:
[0096] Determine whether the IP addresses corresponding to other detection nodes in the detection network path, except for the detection node whose IP address is lost, correspond to the historical detection path;
[0097] If they correspond, then obtain and determine whether the historical base station location and the real-time base station location are the same;
[0098] If they are the same, the nodes of the detected network path are supplemented based on the historical detected path to obtain the target network path.
[0099] Further, optionally, and specifically, the network path detection method further includes:
[0100] If they are not corresponding or the same, the detected network path is used as the target network path;
[0101] After determining the target network path based on the historical detection path and the detection network path, the method further includes:
[0102] The historical base station positions stored in the target database are updated based on the real-time base station positions.
[0103] Optionally, the network path detection method further includes:
[0104] In the case where there is a node loss identifier in the detection network path, the detection network path is used as the target network path.
[0105] Figure 6 This is a flow chart of path node supplementation provided according to an embodiment of the present invention.
[0106] It should be understood that for the detection network path in the determined path detection result, there may be a target detection node with a lost IP address in the detection network path due to the firewall policy blocking the icmp message or the node being busy and unresponsive. For example, the detection network path is: [{ttl:1,ip:1.1.1.1,delay:5ms},{ttl:2,ip:2.2.2.2,delay:5ms},{ttl:3,ip:*,delay:null}...], and it can be seen that the IP address of the target detection node with a TTL of 3 is lost. In an embodiment of the present invention, if the target base station corresponding to the RedCap terminal where the main network probe program is executed has not changed, the node of the detection network path can be obtained and supplemented based on the historical detection path corresponding to the target detection terminal to make up for the loss of path nodes caused by the firewall policy blocking the icmp message or the node being busy and unresponsive, so as to ensure that the results reported to the perception platform later are more reliable. Figure 6 As shown, optionally, the process of supplementing the path nodes may be:
[0107] 1. Obtain the real-time base station location corresponding to the RedCap terminal where the network probe program is located through the devinfo command. In the embodiment of the present invention, the base station location when the RedCap terminal enters the network, that is, the historical base station location, will be recorded.
[0108] 2. Obtain the historical detection path corresponding to the target detection terminal in the local cache, and determine whether the detection network path and the historical detection path correspond to each other, that is, whether they are similar paths. The characteristics of similar paths are as follows: the path results after the two paths complement each other are completely consistent. For example, path A is:
[0109] [{ttl:1,ip:1.1.1.1},{ttl:2,ip:*},{ttl:3,ip:*},{ttl:4,ip:4.4.4.4},{ttl:5:5.5.5.5}],
[0110] Path B is:
[0111] [{ttl:1,ip:*},{ttl:2,ip:2.2.2.2},{ttl:3,ip:*},{ttl:4,ip:4.4.4.4},{ttl:5:5.5.5.5}],
[0112] The result of path A supplementing ttl:2 and ttl:3 from path B is:
[0113] [{ttl:1,ip:1.1.1.1},{ttl:2,ip:2.2.2.2},{ttl:3,ip:*},{ttl:4,ip:4.4.4.4},{ttl:5:5.5.5.5}],
[0114] The result after path B supplements ttl:1 and ttl:3 from path A is:
[0115] [{ttl:1,ip:1.1.1.1},{ttl:2,ip:2.2.2.2},{ttl:3,ip:*},{ttl:4,ip:4.4.4.4},{ttl:5:5.5.5.5}], that is, the results of path A and path B are consistent after supplementation, and path A corresponds to path B, which is a similar path.
[0116] 3. If the detection network path and the historical detection path are similar paths and the base station position has not switched (the historical base station position is the same as the real-time base station position), the detection network path is supplemented with nodes based on the historical detection path to obtain the target network path; the target detection results corresponding to the target network path are reported to the sensing platform and the target detection results are cached locally.
[0117] 4. If the detected network path is not similar to the historical detected path, the path detection result is reported to the perception platform, and the path detection result is cached locally. If the base station location is switched, the path detection result and the real-time base station location are reported to the perception platform, and the path detection result and the real-time base station location are cached locally.
[0118] S260: Use the target network path and the target detection delay as the target detection result of the path detection task.
[0119] S270: Store the target detection result in a target database.
[0120] The technical solution of the embodiment of the present invention is to obtain the historical detection path corresponding to the target detection terminal when there is a node loss mark in the detection network path, wherein the node loss mark indicates that the IP address of the target detection node has not been detected; determine the target network path based on the historical detection path and the detection network path; and use the target network path and the target detection delay as the target detection result of the path detection task. In the case where there is a node loss mark in the detection network path, the application further optimizes the detection network path based on the historical detection path, thereby ensuring the reliability of the target detection result finally determined.
[0121] Figure 7 It is an overall flow chart of a network path detection method provided according to an embodiment of the present invention.
[0122] like Figure 7 As shown, the overall process of the network path detection method can be:
[0123] 1. The network probe program obtains the list of path detection tasks sent by the perception platform through the northbound interface;
[0124] 2. Perform the path detection task through the network path detection algorithm to obtain a list of path detection results. Exemplarily, the list of path detection results can be:
[0125] [{ttl:1,ip:1.1.1.1,delay:5ms},{ttl:2,ip:2.2.2.2,delay:5ms},{ttl:3,ip:*,delay:null}...], where ttl:1, ttl:2, and ttl:3 represent the target detection nodes; ip:1.1.1.1, ip:2.2.2.2, and p:* represent the IP addresses of the target detection nodes; delay:5ms and delay:null represent the target detection delay.
[0126] 3. Determine whether the target detection node is reachable and whether the delay is within a reasonable range based on the path detection results, so as to determine whether there is a fault in the detection network path.
[0127] 4. If there is a fault, you can report the fault; if there is no fault, you can check whether there is a "*" mark in the path detection result, where the "*" mark indicates that the target detection node of the IP address is not detected, and the path node of the detection network path is supplemented through the network path supplement algorithm.
[0128] 5. Send the final path detection results and / or fault information to the perception platform through the northbound interface.
[0129] The technical solution of the embodiment of the present invention improves the efficiency of network path detection, reduces the number of message sending and receiving, simplifies the complexity of message parsing, and improves the reliability of the determined path detection results through the thread pool concurrency mechanism, the one-to-one processing mechanism of threads and tasks, the IP_RECVERR attribute setting of the Socket, and the TTL retry mechanism; the detection network path is fitted and supplemented in combination with the base station location and the historical detection path of the local cache, thereby ensuring the integrity and accuracy of the determined target detection results and avoiding the perception platform's perception errors of the target detection results.
[0130] Embodiment 3
[0131] Figure 8 This is a schematic diagram of the structure of a network path detection device provided by Embodiment 3 of the present invention. Figure 8As shown, the device includes: a task acquisition module 310, a concurrent processing module 320 and a target result determination module 330.
[0132] Among them, a task acquisition module is used to acquire multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to a target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads; a concurrent processing module is used to concurrently process multiple path detection tasks through the thread pool to obtain a path detection result of each path detection task, wherein each target thread is used to process one path detection task, and the path detection result includes the detection network path and / or target detection delay corresponding to the target detection terminal, and the detection network path includes the IP addresses of multiple target detection nodes; a target result determination module is used to determine the target detection result based on the path detection result for each path detection result when the path detection result meets the target detection condition, and store the target detection result in a target database.
[0133] The technical solution of the embodiment of the present invention is to obtain multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to a target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads; the multiple path detection tasks are processed concurrently by the thread pool to obtain the path detection result of each path detection task, wherein each target thread is used to process one path detection task, and the path detection result includes the detection network path and / or target detection delay corresponding to the target detection terminal, and the detection network path includes the IP addresses of multiple target detection nodes; for each path detection result, when the path detection result meets the target detection condition, the target detection result is determined based on the path detection result, and the target detection result is stored in the target database. The present application adopts a method in which multiple target threads in the thread pool perform one-to-one concurrent processing on multiple path detection tasks, which can improve the network path detection efficiency for multiple network path detection tasks.
[0134] Optionally, the concurrent processing module includes: a traversal execution unit and a detection result determination unit;
[0135] The traversal execution unit is used to traverse the preset survival time value sequence through the target thread for each of the path detection tasks, and for each target survival time value traversed, sequentially execute the operations of sending the detection message corresponding to the target survival time value, receiving the return message corresponding to the detection message, and determining the detection node information based on the preset retry number threshold and the return message, wherein the detection node information includes the IP address and / or detection delay corresponding to the target detection node;
[0136] The path result determination unit is used to stop traversal and execution operations when the detection node information includes the IP address corresponding to the target detection terminal, and determine the path detection result based on the multiple detection node information.
[0137] Optionally, the traversal execution unit includes: a first IP address determination subunit and a second IP address determination subunit;
[0138] Wherein, the first IP address determination subunit is used to return to execute the operation of sending the detection message corresponding to the target survival time value, receiving the return message corresponding to the detection message, and determining the IP address based on the return message when the return message is not returned within the preset time or the IP address does not exist in the return message;
[0139] The second IP address determination subunit is used to use the node loss identifier as the IP address when the number of returned execution times exceeds the retry number threshold.
[0140] Optionally, the target result determination module 330 includes: a historical path acquisition unit, a target path determination unit and a target result determination unit;
[0141] The historical path acquisition unit is used to acquire the historical detection path corresponding to the target detection terminal when there is a node loss identifier in the detection network path, wherein the node loss identifier indicates that the IP address of the target detection node is not detected;
[0142] The target result determination unit is used to determine the target network path based on the historical detection path and the detection network path;
[0143] The target result determination unit is used to use the target network path and the target detection delay as the target detection result of the path detection task.
[0144] Optionally, the target result determination unit is specifically used to:
[0145] By obtaining the historical base station location from the target database and determining the real-time base station location, when the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost correspond to the historical detection path and the historical base station location is the same as the real-time base station location, the detection network path is supplemented with nodes based on the historical detection path to obtain the target network path.
[0146] Optionally, the target result determination unit is further specifically configured to:
[0147] In the case where the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost do not correspond to the historical detection path and the historical base station location is different from the real-time base station location, the detection network path is used as the target network path;
[0148] The target result determination module 330 further includes: a base station location updating unit, which is used to update the historical base station location stored in the target database based on the real-time base station location after the target network path is determined based on the historical detection path and the detection network path.
[0149] Optionally, the target detection terminal includes a 5G lightweight terminal, and the target detection conditions include the existence of the detection network path, the existence of the IP address of the target detection terminal in the detection network path, the existence of the target detection delay and the target detection delay does not exceed a preset detection delay threshold.
[0150] Optionally, the network path detection device also includes: a detection anomaly module, which is used to generate detection anomaly information based on the path detection result after obtaining the path detection result corresponding to each path detection task, when the path detection result does not meet the target detection condition, wherein the detection anomaly information includes delay anomaly and / or unreachable detection terminal.
[0151] The network path detection device provided in the embodiment of the present invention can execute the network path detection method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0152] Embodiment 4
[0153] Fig. 9A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0154] like Fig. 9 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0155] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0156] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as a network path detection method.
[0157] In some embodiments, the network path detection method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the network path detection method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the network path detection method in any other appropriate manner (e.g., by means of firmware).
[0158] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0159] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0160] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0161] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0162] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0163] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0164] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0165] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A network path detection method, characterized in that: include: Acquire multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to one target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads; The plurality of path detection tasks are processed concurrently by the thread pool to obtain a path detection result of each path detection task, wherein each target thread is used to process one path detection task, and the path detection result includes a detection network path and a target detection delay corresponding to the target detection terminal, and the detection network path includes IP addresses of a plurality of target detection nodes; For each of the path detection results, if the path detection result meets the target detection condition, determine the target detection result based on the path detection result, and store the target detection result in the target database; Wherein, determining the target detection result based on the path detection result includes: In the case where there is a node loss identifier in the detection network path, obtaining a historical detection path corresponding to the target detection terminal, wherein the node loss identifier indicates that the IP address of the target detection node is not detected; Determine a target network path based on the historical detection path and the detection network path; Using the target network path and the target detection delay as the target detection result of the path detection task; Wherein, determining the target network path based on the historical detection path and the detection network path includes: The historical base station location is obtained through the target database, and the real-time base station location is determined. When the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost correspond to the historical detection path and the historical base station location is the same as the real-time base station location, the detection network path is supplemented with nodes based on the historical detection path to obtain the target network path.
2. The method according to claim 1, characterized in that The concurrently processing the plurality of path detection tasks by the thread pool to obtain a path detection result corresponding to each path detection task includes: For each of the path detection tasks, the preset survival time value sequence is traversed through the target thread, and for each traversed target survival time value, the detection message corresponding to the target survival time value is sent in sequence, a return message corresponding to the detection message is received, and the detection node information is determined based on a preset retry number threshold and the return message, wherein the detection node information includes the IP address and / or detection delay corresponding to the target detection node; In the case where the detection node information includes the IP address corresponding to the target detection terminal, the traversal and execution operations are stopped, and the path detection result is determined based on the plurality of detection node information.
3. The method according to claim 2, characterized in that The determining the IP address based on the retry number threshold and the returned message includes: If the return message is not returned within the preset time or the IP address does not exist in the return message, returning to execute the operation of sending the detection message corresponding to the target lifetime value, receiving the return message corresponding to the detection message, and determining the IP address based on the return message; When the number of returned executions exceeds the retry number threshold, the node loss identifier is used as the IP address.
4. The method according to claim 1, characterized in that: Also includes: In the case where the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost do not correspond to the historical detection path and the historical base station location is different from the real-time base station location, the detection network path is used as the target network path; After determining the target network path based on the historical detection path and the detection network path, the method further includes: The historical base station positions stored in the target database are updated based on the real-time base station positions.
5. The method according to claim 1, characterized in that The target detection terminal includes a 5G lightweight terminal, and the target detection conditions include the existence of the detection network path, the IP address of the target detection terminal in the detection network path, and the existence of the target detection delay and the target detection delay does not exceed a preset detection delay threshold.
6. The method according to claim 1, characterized in that After obtaining the path detection result corresponding to each of the path detection tasks, the method further includes: In the case that the path detection result does not meet the target detection condition, detection abnormality information is generated based on the path detection result, wherein the detection abnormality information includes delay abnormality and / or detection terminal unreachable.
7. A network path detection device, characterized in that: include: A task acquisition module, used to acquire multiple path detection tasks and initialize a thread pool, wherein one path detection task corresponds to one target detection terminal, different path detection tasks correspond to different target detection terminals, and the thread pool includes multiple target threads; A concurrent processing module, used for concurrently processing the plurality of path detection tasks through the thread pool to obtain a path detection result of each path detection task, wherein each target thread is used to process one path detection task, the path detection result includes a detection network path and a target detection delay corresponding to the target detection terminal, and the detection network path includes IP addresses of a plurality of target detection nodes; A target result determination module, for each of the path detection results, if the path detection result satisfies the target detection condition, determines the target detection result based on the path detection result, and stores the target detection result in a target database; The target result determination module includes: a historical path acquisition unit, a target path determination unit and a target result determination unit; The historical path acquisition unit is used to acquire the historical detection path corresponding to the target detection terminal when there is a node loss identifier in the detection network path, wherein the node loss identifier indicates that the IP address of the target detection node is not detected; The target path determination unit is used to determine the target network path based on the historical detection path and the detection network path; The target result determination unit is used to use the target network path and the target detection delay as the target detection result of the path detection task; Wherein, the target path determination unit is specifically used to: The historical base station location is obtained through the target database, and the real-time base station location is determined. When the IP addresses corresponding to the other detection nodes in the detection network path except the detection node whose IP address is lost correspond to the historical detection path and the historical base station location is the same as the real-time base station location, the detection network path is supplemented with nodes based on the historical detection path to obtain the target network path.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the network path detection method according to any one of claims 1 to 6 when executed.
Citation Information
Patent Citations
Distributed routing-level network topology detection method based on embedded equipment
CN112583657A