Path calculation method and apparatus based on content distribution network
Through the deep-first traversal algorithm and the path calculation method of the small-top heap data structure optimization content distribution network, the inefficiency problem when calculating multiple optimal paths is solved, and efficient path calculation in high node density and large data volume scenarios is realized and sort.
Patent Information
- Application Number
- PCT/CN2023/139648
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-31
- Filing Date
- 2023-12-18
- Publication Date
- 2024-12-05
AI Technical Summary
The prior art has too much calculation amount when calculating multiple optimal paths, especially when the number of edge host groups and the amount of detection data in the content distribution network increases, resulting in low path computing efficiency.
The path calculation method based on the depth-first traversal algorithm and the small-top heap data structure is adopted. By constructing a directed graph and judging the path threshold and the number of hops threshold, the path solution process is optimized and improved. Computational efficiency.
Effectively converge the calculation amount in high node density and large data volume scenarios, quickly obtain multiple superior paths, improve overall efficiency and efficient sorting.
Smart Images

Figure CN2023139648_05122024_PF_FP_ABST
Abstract
Description
A path calculation method and device based on content distribution network Technical Field
[0001] The present application belongs to the technical field of network data transmission, and in particular relates to a path calculation method and device based on a content distribution network. Background Art
[0002] A content distribution network (CDN) generally refers to an intelligent virtual network built on top of an existing network. Relying on edge servers deployed across various locations, and leveraging a central platform's load balancing, content distribution, and scheduling functions, it enables users to access required content locally, reduces network congestion, and improves user access response speed and hit rates. Within a CDN, dynamic acceleration is a CDN acceleration service targeted at content requiring dynamic interaction at the customer's origin site. In addition to leveraging proprietary technologies such as compressed transmission, protocol optimization, link reuse, and kernel optimization, intelligent routing to calculate a high-quality return path in real time is also a critical step.
[0003] Some existing technologies for calculating high-quality back-to-source paths can only obtain one optimal path at a time, and the calculation speed is relatively fast. However, this is not applicable when other suboptimal paths to the same target node need to be obtained. Moreover, with the development of content distribution network services, the number of edge host groups has increased dramatically, and the amount of detection data has increased dramatically. In particular, the number of nodes that detect each other within the content distribution network has increased. This leads to excessive computational complexity when calculating multiple optimal paths, and has a significant impact on the efficiency of sorting multiple optimal paths.
[0004] Summary of the Invention
[0005] This application aims to address the aforementioned technical drawbacks of not being applicable when obtaining other suboptimal paths to the same target node; and with the development of content distribution network services, the number of edge host groups and the dramatic increase in detection data, especially the increase in nodes that detect each other within the content distribution network, which leads to excessive computational complexity when calculating multiple optimal paths and greatly affects the efficiency of sorting multiple optimal paths. A path calculation method and device based on a content distribution network are proposed. The technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a path calculation method based on a content distribution network, comprising:
[0007] Determine the starting node and the source station address according to the received client request, and obtain at least two source station nodes based on the resolution result of the source station address;
[0008] Based on the preset database, all parent nodes between the starting node and each source station node are found, and network detection data between any two adjacent nodes in the starting node, each source station node and all parent nodes are obtained. The path value between any two adjacent nodes is calculated based on the preset weight value and the network detection data;
[0009] Construct a directed graph based on the starting node, source station address, all parent nodes, and the path values between any two adjacent nodes, and determine whether the path calculation function is enabled between the starting node and each source station node;
[0010] When it is detected that the path calculation function is enabled between the starting node and each source station node, a path is solved for the directed graph based on a depth-first traversal algorithm, and when it is detected that the total path value of the m-th solution path does not exceed a preset path threshold, it is determined whether the m-th solution path is written into a mini-heap data structure; wherein the m-th solution path includes the starting node and at least one parent node, m is a positive integer, and the mini-heap data structure sets n solution path storage locations, where n is a preset number threshold;
[0011] When it is detected within a preset time interval that no solution path is written into the small top heap data structure, all solution paths in the small top heap data structure are used as target solution paths.
[0012] In an optional solution of the first aspect, after determining whether a path calculation function is enabled between the start node and each source station node, the method further includes:
[0013] When it is detected that the path calculation function is not enabled between the starting node and each source station node, the first parent node with the smallest path value is determined among all parent nodes adjacent to the starting node;
[0014] Determine the second parent node with the smallest path value among all parent nodes adjacent to the first parent node, and until it is determined that all nodes adjacent to the j-th parent node contain the source station address, take the path corresponding to the starting node, j parent nodes and the source station address as the target solution path; where j is a positive integer greater than 2.
[0015] In another optional solution of the first aspect, after performing path solving on the directed graph based on the depth-first traversal algorithm and before detecting that the total path value of the m-th solved path does not exceed a preset path threshold, the method further includes:
[0016] Get the number of parent nodes in the current solution path, and determine the number of path hops based on the number of parent nodes;
[0017] When it is detected that the path hop count does not exceed the preset hop count threshold, the current solution path is used as the mth solution path, and the total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path;
[0018] When it is detected that the path hop count exceeds the preset hop count threshold, it is determined whether all nodes adjacent to the penultimate parent node in the current solution path contain the source station address;
[0019] When it is detected that all nodes adjacent to the second-to-last parent node contain the source station address, the first-to-last parent node in the current solution path is replaced with the source station address, and the replaced current solution path is used as the mth solution path. The total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path.
[0020] In another optional solution of the first aspect, determining whether the mth solution path is written into the mini-top heap data structure includes:
[0021] When it is detected that the source station address is included in the mth solution path, if m is less than or equal to n, the mth solution path is written into the mini-heap data structure, and all solution paths in the mini-heap data structure are sorted in descending order of total path value; among which, the tail of the mini-heap data structure is the solution path with the largest total path value.
[0022] In another optional solution of the first aspect, determining whether the mth solution path is written into the mini-top heap data structure further includes:
[0023] When it is detected that the source station address is included in the mth solution path, if m is greater than n, determine whether the total path value of the mth solution path exceeds the total path value corresponding to the tail of the heap in the mini-heap data structure;
[0024] When it is detected that the total path value of the mth solution path exceeds the total path value corresponding to the end of the heap, the mth solution path is not written into the small top heap data structure;
[0025] When it is detected that the total path value of the mth solution path does not exceed the total path value corresponding to the tail of the heap, the solution path corresponding to the tail of the heap in the mini-heap data structure is deleted, and the mth solution path is written into the mini-heap data structure.
[0026] In another optional solution of the first aspect, after writing the mth solution path into the small top heap data structure, the method further includes:
[0027] All solution paths in the mini-heap data structure are re-sorted in descending order of total path value, and the solution path with the largest total path value is re-used as the tail of the mini-heap data structure.
[0028] In another optional solution of the first aspect, the network detection data includes at least two types: packet loss rate, first packet time, and download rate.
[0029] In a second aspect, an embodiment of the present application provides a path calculation device based on a content distribution network, including:
[0030] A request processing module, configured to determine a starting node and a source station address according to a received client request, and obtain at least two source station nodes based on a parsing result of the source station address;
[0031] The path calculation module is used to find all parent nodes between the starting node and each source station node based on a preset database, obtain network detection data between any two adjacent nodes in the starting node, each source station node and all parent nodes, and calculate the path value between any two adjacent nodes based on the preset weight value and the network detection data;
[0032] The graph construction module is used to construct a directed graph based on the starting node, the source station address, all parent nodes, and the path values between any two adjacent nodes, and to determine whether the path calculation function is enabled between the starting node and each source station node;
[0033] A data update module is configured to, when detecting that the path calculation function is enabled between the starting node and each source station node, perform path solving on the directed graph based on a depth-first traversal algorithm, and when detecting that the total path value of the mth solution path does not exceed a preset path threshold, determine whether the mth solution path is written into a mini-heap data structure; wherein the mth solution path includes the starting node and at least one parent node, m is a positive integer, and the mini-heap data structure sets n solution path storage locations, where n is a preset number threshold;
[0034] The target determination module is used to use all solution paths in the small top heap data structure as target solution paths when it is detected that no solution path is written into the small top heap data structure within a preset time interval.
[0035] In a third aspect, an embodiment of the present application provides a path calculation device based on a content distribution network, comprising a processor and a memory;
[0036] The processor is connected to the memory;
[0037] a memory for storing executable program code;
[0038] The processor runs the program corresponding to the executable program code by reading the executable program code stored in the memory, so as to implement the path calculation method based on the content distribution network provided by the first aspect of the embodiment of the present application or any implementation method of the first aspect.
[0039] In a fourth aspect, an embodiment of the present application provides a computer storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the path calculation method based on the content distribution network provided by the first aspect of the embodiment of the present application or any implementation method of the first aspect can be implemented.
[0040] In an embodiment of the present application, when calculating multiple optimal paths based on a content distribution network, a starting node and a source station address can be determined based on a received client request, and at least two source station nodes can be obtained based on the parsing results of the source station address; all parent-layer nodes between the starting node and each source station node can be found based on a preset database, and network detection data between any two adjacent nodes in the starting node, each source station node, and all parent-layer nodes can be obtained, and the path value between any two adjacent nodes can be calculated based on a preset weight value and the network detection data; a directed graph can be constructed based on the starting node, the source station address, all parent-layer nodes, and the path value between any two adjacent nodes, and it can be determined whether a path calculation function is enabled between the starting node and each source station node; when it is detected that the path calculation function is enabled between the starting node and each source station node, a path solution is performed on the directed graph based on a depth-first traversal algorithm, and when it is detected that the total path value of the mth solution path does not exceed a preset path threshold, it is determined whether the mth solution path is written into a mini-heap data structure; when it is detected that no solution path is written into the mini-heap data structure within a preset time interval, all solution paths in the mini-heap data structure are used as target solution paths. A directed graph is constructed by using all parent nodes between the starting node and the source station address, as well as the path values between any two adjacent nodes. The depth-first traversal algorithm, path threshold, and hop threshold are combined to control the backtracking points in the entire path solving process. This is not only conducive to converging the computational complexity, but also enables it to well support the calculation of multiple optimal paths in scenarios where a large number of nodes detect each other. Secondly, a small top heap data structure is introduced, which is fast and uses less space, and can efficiently solve the sorting problem of calculating multiple optimal paths, thereby improving overall efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0042] FIG1 is an overall flow chart of a path calculation method based on a content distribution network provided in an embodiment of the present application;
[0043] FIG2 is a schematic diagram of the architecture of a path calculation system based on a content distribution network provided in an embodiment of the present application;
[0044] FIG3 is a schematic diagram of the structure of a directed graph provided in an embodiment of the present application;
[0045] FIG4 is a schematic diagram of a calculation effect of a target solution path provided in an embodiment of the present application;
[0046] FIG5 is a schematic structural diagram of a path calculation device based on a content distribution network according to an embodiment of the present application;
[0047] FIG6 is a schematic structural diagram of another path calculation device based on a content distribution network provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application.
[0049] In the following introduction, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance. The following introduction provides multiple embodiments of the present application. Different embodiments can be replaced or combined, so the present application can also be considered to include all possible combinations of the same and / or different embodiments described. Therefore, if one embodiment includes features A, B, and C, and another embodiment includes features B and D, then the present application should also be considered to include embodiments containing one or more of all other possible combinations of A, B, C, and D, even though the embodiment may not be clearly described in the following text.
[0050] The following description provides examples and does not limit the scope, applicability, or examples set forth in the claims. Changes may be made to the function and arrangement of the elements described without departing from the scope of the present application. Various examples may appropriately omit, replace, or add various processes or components. For example, the described method may be performed in an order different from the order described, and various steps may be added, omitted, or combined. In addition, features described in some examples may be combined in other examples.
[0051] When calculating multiple optimal paths, existing technologies generally directly use a depth-first traversal algorithm to obtain all possible paths through exhaustive search. The principle can be understood as going deeper into each branch until it cannot go any deeper, and each node can only be visited once; when it is found that there is no way to go, backtrack to the previous node, and continue to go deeper into the next reachable adjacent node at the backtracking node; when all the reachable adjacent nodes of the backtracking node have been walked, continue backtracking until the backtracking node is the starting node and all its reachable adjacent nodes have been walked, the entire depth traversal is completed, and the complete set of all paths from the starting node to the target node can be obtained. For the solution of multiple optimal path sets, it can be assumed here, but not limited to, that there are 13 parent nodes that detect each other in pairs, and the starting node passes through these 13 parent nodes to reach the target node. The approximate complete set of paths is as follows:
[0052] It can be seen that if the starting node and the target node are fixed at both ends and the intermediate nodes are randomly combined and arranged, there are about 17 billion paths. Such a complete set of solution paths obviously requires a huge amount of calculation and has no advantage in time and space.
[0053] Based on this, please refer to FIG1 , which shows an overall flow chart of a path calculation method based on a content distribution network provided by an embodiment of the present application.
[0054] As shown in FIG1 , the content distribution network-based path calculation method may include at least the following steps:
[0055] Step 102: Determine the starting node and the source station address according to the received client request, and obtain at least two source station nodes based on the resolution result of the source station address.
[0056] In an embodiment of the present application, a path calculation method based on a content distribution network can be, but is not limited to, applied to a control terminal of an edge node in a content distribution network, or directly applied to a control terminal corresponding to the content distribution network, so as to receive a client request through an edge node in the content distribution network or an edge node with an established connection, determine the corresponding starting node and source station address according to the client request, construct a directed graph through all parent nodes between the starting node and the source station address and the path values between any two adjacent nodes, and combine the depth-first traversal algorithm, the path threshold and the hop count threshold to control the backtracking points in the entire path solving process, which is not only conducive to converging the computational amount, but also enables it to well support the calculation of multiple optimal paths in a scenario where a large number of nodes detect each other in pairs; secondly, when storing multiple optimal paths, a small top heap data structure is also introduced, which is fast and uses less space, and efficiently solves the sorting problem of calculating multiple optimal paths, thereby improving overall efficiency.
[0057] Please refer to Figure 2 for an architectural diagram of a path calculation system based on a content distribution network provided in an embodiment of the present application. As shown in Figure 2, after a certain edge node receives a user request, the path calculation system based on the content distribution network can determine the corresponding source station address according to the user request, and obtain two source station nodes based on the resolution processing results of the source station address (the two server graphics on the leftmost side of Figure 2). Here, there are two layers of parent nodes between the edge node (which can also be understood as the starting node) corresponding to the user request and the two source station nodes. There are three types of transmission paths from the edge node to the source station node, namely, the first-layer first-parent node (the first of the three server graphs close to the user side in Figure 2) and the second-layer first-parent node (the first of the two server graphs close to the source station node in Figure 2), the first-layer second-parent node (the second of the three server graphs close to the user side in Figure 2) and the second-layer first-parent node (the first of the two server graphs close to the source station node in Figure 2), and the first-layer third-parent node (the third of the three server graphs close to the user side in Figure 2) and the second-layer second-parent node (the second of the two server graphs close to the source station node in Figure 2).
[0058] Specifically, when calculating multiple optimal paths based on a content distribution network, it is possible, but not limited to, to use a client request received by an edge node in the content distribution network as the starting node, and to extract the corresponding source station address from the received client request, so as to obtain at least two source station nodes through the resolution processing result of the source station address (here, it is possible, but not limited to, the source station address being resolved by the edge agent of the content distribution network). The starting node and each source station node can be represented by an IP address, that is, each node corresponds to an IP address. It is understandable that the client request can be regarded as an access request for a domain name. For example, when the client request is to search for a content, it can be regarded as an access request for www.xxx.com, such as, but not limited to, satisfying the client's search request through the Baidu search interface. The resolution processing of the domain name here is a common method in the art. After each domain name is resolved, it is possible, but not limited to, obtaining at least two source station nodes (i.e., IP addresses. For example, resolving the domain name corresponding to the Baidu search interface can obtain five IP addresses).
[0059] Step 104: Based on the preset database, find all parent nodes between the starting node and each source station node, and obtain network detection data between any two adjacent nodes in the starting node, each source station node and all parent nodes, and calculate the path value between any two adjacent nodes based on the preset weight value and the network detection data.
[0060] Specifically, after obtaining at least two source station nodes, all parent layer nodes between the starting node and each source station node can be found through a preset database, but is not limited to it. The preset database may include all parent layer nodes (i.e., intermediate nodes) contained between any two nodes among all nodes set up by the content distribution network. Here, all parent layer nodes contained between any two nodes can be understood as all intermediate nodes covered in the distance area between the two nodes. For example, but not limited to, the corresponding distance area coordinate range can be calculated based on the coordinates of the two nodes, and the nodes corresponding to all coordinates within the distance area coordinate range are all used as parent layer nodes.
[0061] Furthermore, after determining all parent nodes between the starting node and each source station node, network detection data between any two adjacent nodes can be obtained in the starting node, each source station node and all parent nodes. The network detection data may be, but is not limited to, any at least two of the comprehensive indicators such as the first packet time, packet loss rate and download rate corresponding to the two adjacent nodes during the network transmission process, and the method of obtaining the network detection data may be, but is not limited to, detection calculation and reporting by the edge agent component corresponding to the node, which is not limited to this here.
[0062] Furthermore, after obtaining the network detection data between any two adjacent nodes in the starting node, each source station node and all parent layer nodes, the network detection data can be weighted and summed according to the preset weight value to obtain the path value between any two adjacent nodes. Here, the network detection data between any two adjacent nodes are taken as the first packet time A, packet loss rate B and download rate C as an example. The preset weight value can be a for the first packet time, b for the packet loss rate and c for the download rate, a+b+c=1, then the path value between any two adjacent nodes can be expressed as: A*a+B*b+C*c
[0063] It can be understood that, the smaller the path value between any two adjacent nodes is, the better the network quality between the two adjacent nodes is, that is, the shorter the data transmission time between the two adjacent nodes is.
[0064] Step 106: Construct a directed graph based on the starting node, the source station address, all parent layer nodes, and the path values between any two adjacent nodes, and determine whether the path calculation function is enabled between the starting node and each source station node.
[0065] Specifically, after obtaining the path value between the starting node, each source station node and any two adjacent nodes in all parent layer nodes, the starting node, each source station node and all parent layer nodes can be integrated but not limited to being integrated, for example, all parent layer nodes adjacent to the starting node are regarded as the first layer in the directed graph; then all adjacent parent layer nodes can be determined respectively among all parent layer nodes in the first layer, and all parent layer nodes determined again are regarded as the second layer in the directed graph, and so on, until the last layer in the directed graph is determined; wherein, the last layer in the directed graph can be understood as all parent layer nodes adjacent to each source station node, and since each source station node is obtained by resolving the same source station address, all source station nodes can be represented as a source station address (that is, source station IP) in the directed graph here, and the starting node can also be represented as a starting address (that is, starting IP), and values are assigned between any two adjacent nodes in combination with the path value between any two adjacent nodes to construct a directed graph.
[0066] Please also refer to Figure 3, which is a structural diagram of a directed graph provided by an embodiment of the present application. As shown in Figure 3, two layers are set between the source station IP and the starting IP in the directed graph, wherein the first layer includes parent node 1, parent node 2 and parent node 3, and the starting IP and the parent node 1, parent node 2 and parent node 3 all have network transmission functions. The second layer includes parent node 4 and parent node 5, wherein the parent node 1 has a network transmission function with the parent node 4, the parent node 2 has a network transmission function with the parent node 4 and the parent node 5, the parent node 3 has a network transmission function with the parent node 5, and the parent node 4 and the parent node 5 both have a network transmission function with the source station IP. It can be understood that a path value is set between each adjacent two nodes with network transmission function in the directed graph (not shown in Figure 3), and in the directed graph, there is no network transmission function between parent node 1 and parent node 2, there is no network transmission function between parent node 2 and parent node 3, and there is no network transmission function between parent node 4 and parent node 5.
[0067] Furthermore, after constructing the directed graph, it is possible to determine whether the path calculation function is enabled between the starting node and each source station node based on the source station address corresponding to the user request. The determination method may be, but is not limited to, extracting the corresponding downlink configuration from the source station address according to the domain name, and determining whether the path calculation function is enabled based on the character data read from the downlink configuration. For example, when the character data corresponding to the path calculation function is 1, it indicates that the path calculation function is enabled; when the character data corresponding to the path calculation function is 0, it indicates that the path calculation function is not enabled.
[0068] It can be understood that by determining whether the path calculation function is enabled between the starting node and each source station node, it is possible to quickly determine multiple better paths between the starting node and the source station address, and effectively screen out other paths that cannot meet the needs in advance.
[0069] Step 108: When it is detected that the path calculation function is turned on between the starting node and each source station node, the path of the directed graph is solved based on the depth-first traversal algorithm, and when it is detected that the total path value of the mth solution path does not exceed the preset path threshold, it is determined whether the mth solution path is written into the mini-heap data structure.
[0070] Specifically, when it is detected that the path calculation function is turned on between the starting node and each source station node, the path solution of the directed graph can be performed based on the depth-first traversal algorithm, and the total path value corresponding to each solution path obtained can be judged. Possibly, when it is detected that the total path value of the mth solution path does not exceed the preset path threshold, it indicates that the mth solution path can be used as an alternative path for multiple better paths, and then it can be judged whether the mth solution path can be written into the mini-top heap data structure. Among them, the mth solution path can be, but is not limited to, including the starting node, the source station address, and at least one parent layer node, and the corresponding total path value can be obtained by accumulating the path values between any two adjacent nodes in the mth solution path, and m is a positive integer. Here, the depth-first traversal algorithm is a commonly used technical means in this field, which can calculate all feasible solution paths in a directed graph, and will not be described in detail in the embodiments of this application.
[0071] It is possible that when it is detected that the total path value of the mth solution path exceeds the preset path threshold, it indicates that the mth solution path cannot be used as an alternative path for multiple better paths, and then the path solution of the directed graph can be continued based on the depth-first traversal algorithm to obtain the m+1th solution path, and then the total path value of the m+1th solution path can be judged.
[0072] It is understood that in the embodiment of the present application, the mth solution path may also include, but is not limited to, a starting node and at least one parent node. In other words, the total path value calculated in the mth solution path may also be calculated in real time, and it may be determined in real time whether the total path value exceeds a preset path threshold. For example, if the currently obtained mth solution path includes a starting node and parent node 1, when it is detected that the path value between the starting node and parent node 1 in the mth solution path does not exceed the preset path threshold, the calculation may continue based on the depth-first traversal algorithm on the basis of the mth solution path; then, when the mth solution path includes a starting node, parent node 1, and parent node 2, the path value between the starting node and parent node 1 in the mth solution path, as well as the sum of the path values between parent node 1 and parent node 2, may be calculated. When it is detected that the sum still does not exceed the preset path threshold, the calculation may continue based on the depth-first traversal algorithm on the basis of the current solution path to obtain the next parent node or source station address, and the above operation may be repeated. It should be noted that when it is detected that the total path value in the mth solution path exceeds the preset path threshold, the subsequent calculation of the mth solution path is stopped, and the method returns to the second-to-last node in the mth solution path to continue the calculation of other solution paths based on the second-to-last node. If no other solution paths are found, it indicates that the mth solution path is not applicable, and the calculation of the m+1th solution path can be performed.
[0073] As an optional embodiment of the present application, after determining whether the path calculation function is enabled between the start node and each source station node, the method further includes:
[0074] When it is detected that the path calculation function is not enabled between the starting node and each source station node, the first parent node with the smallest path value is determined among all parent nodes adjacent to the starting node;
[0075] Determine the second parent node with the smallest path value among all parent nodes adjacent to the first parent node, and until it is determined that all nodes adjacent to the j-th parent node contain the source station address, use the path corresponding to the starting node, j parent nodes, and the source station address as the target solution path; where j is a positive integer greater than 2;
[0076] When it is detected that the path calculation function is not enabled between the starting node and each source station node, it indicates that multiple optimal paths cannot be effectively solved between the starting node and the source station address at this time, and the optimal path between the starting node and the source station address can be directly determined.
[0077] Specifically, when it is detected that the path calculation function between the starting node and each source station node is not enabled, the first parent node with the smallest path value can be determined among all parent nodes adjacent to the starting node, and then the second parent node with the smallest path value can be determined among all parent nodes adjacent to the first parent node, and the method of determining the second parent node can be repeated until all nodes adjacent to the determined j-th parent node contain the source station address. At this time, the path corresponding to the starting node, j parent nodes and the source station address can be used as the target solution path.
[0078] Here, please refer to Figure 4, which is a schematic diagram of the calculation effect of a target solution path provided by an embodiment of the present application. As shown in Figure 4, the upper part can correspond to a constructed directed graph, which includes a starting node A, a parent node B, a parent node C, a parent node D and a source station address E. The first step in the lower part is to determine the parent node with the smallest path value between the starting node A and the parent node B, the parent node C, and the parent node D, and determine that the first parent node is the parent node B; the second step is to determine the parent node with the smallest path value between the parent node B and the parent node D and the source station address E, and determine that the second parent node is the parent node D; the third step is to determine the parent node with the smallest path value between the parent node D and the parent node C and the source station address E, and determine that the third parent node is the parent node C; the fourth step is to determine that the target solution path is from the starting node A to the parent node B to the parent node D to the parent node C to the source station address E.
[0079] As another optional embodiment of the present application, after solving a path for the directed graph based on the depth-first traversal algorithm, and before detecting that the total path value of the mth solution path does not exceed a preset path threshold, the method further includes:
[0080] Get the number of parent nodes in the current solution path, and determine the number of path hops based on the number of parent nodes;
[0081] When it is detected that the path hop count does not exceed the preset hop count threshold, the current solution path is used as the mth solution path, and the total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path;
[0082] When it is detected that the path hop count exceeds the preset hop count threshold, it is determined whether all nodes adjacent to the penultimate parent node in the current solution path contain the source station address;
[0083] When it is detected that all nodes adjacent to the second-to-last parent node contain the source station address, the first-to-last parent node in the current solution path is replaced with the source station address, and the replaced current solution path is used as the mth solution path. The total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path.
[0084] Specifically, after performing a path solution on a directed graph based on a depth-first traversal algorithm, the number of parent nodes in the current solution path can be obtained in real time, and the path hop count can be determined based on the number of parent nodes. The path hop count can be, but is not limited to, the number of parent nodes + 1. Next, when it is detected that the path hop count exceeds a preset hop count threshold, indicating that the current solution path cannot be used as the mth solution path (i.e., cannot be used as an alternative path among multiple preferred paths), it can be determined whether all nodes adjacent to the second-to-last parent node in the current solution path contain the source station address. Optionally, if it is determined that all nodes adjacent to the second-to-last parent node in the current solution path contain the source station address, the penultimate parent node in the current solution path is replaced with the source station address, and the number of parent nodes in the current solution path is obtained again. If the path hop count is determined to be within the preset hop count threshold, the replaced current solution path is used as the mth solution path. It can be understood that if the number of path hops determined again still exceeds the preset hop threshold, the first-to-last parent node in the current solution path can be eliminated, and it can be determined whether all nodes adjacent to the third-to-last parent node in the current solution path contain the source station address, and so on.
[0085] When it is detected that the number of path hops does not exceed the preset hop threshold, it indicates that the current solution path can be used as the mth solution path (that is, as an alternative path among multiple better paths). Then the current solution path is used as the mth solution path, and the total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path, so as to facilitate subsequent judgment operations with the preset path threshold.
[0086] In the embodiments of the present application, the following two optimization indicators can be used to control the backtracking nodes to achieve the goal of converging the computational load: 1) Path hop control: Configuring the path hop count during the path calculation process to control the path depth. Obviously, a path hop count that is too large will not have a good effect on actual dynamic acceleration. Limiting the path hop count while achieving the ultimate dynamic acceleration effect can greatly reduce the computational load; 2) Path threshold control: During the path calculation process, it can also be determined whether the current path value exceeds the threshold. If so, the current path calculation is stopped and the previous node is immediately traced back to continue trying other unvisited reachable adjacent nodes. This can filter out paths with excessively large path values in advance, reducing the computational load while also ensuring the quality of the return path.
[0087] As another optional embodiment of the present application, determining whether the mth solution path is written into the small top heap data structure includes:
[0088] When it is detected that the source station address is included in the mth solution path, if m is less than or equal to n, the mth solution path is written into the mini-heap data structure, and all solution paths in the mini-heap data structure are sorted in descending order of total path value; among which, the tail of the mini-heap data structure is the solution path with the largest total path value.
[0089] Among them, the small top heap data structure is provided with n solution path storage locations, where n can be understood as the specific numerical value of multiple better paths, that is, the preset number threshold, and when all the n solution path storage locations in the small top heap data structure are occupied, if other solution paths are still calculated, it can be determined whether to replace any one of the solution paths stored in the small top heap data structure according to the total path value of the other solution paths, so as to ensure that the n solution paths stored in the small top heap data structure are real-time target better paths.
[0090] Specifically, in the process of judging whether the mth solution path is written into the small top heap data structure, when it is detected that the source station address is included in the mth solution path, if m is less than or equal to n, indicating that the n solution path storage locations in the small top heap data structure are not all occupied at this time, then the mth solution path can be directly written into the small top heap data structure, and all the solution paths in the small top heap data structure are sorted in the order of total path value from large to small. It is understandable that the tail of the heap in the small top heap data structure can be used as the solution path with the largest total path value here, so that when the solution path storage locations in the small top heap data structure are all occupied, it can be quickly determined by the total path value corresponding to the tail of the heap whether to update the small top heap data structure.
[0091] When m is greater than n, it indicates that the n solution path storage locations in the small heap data structure are all occupied at this time, and then it can be determined whether the total path value of the mth solution path exceeds the total path value corresponding to the tail of the heap in the small heap data structure; when it is detected that the total path value exceeds the total path value corresponding to the tail of the heap in the small heap data structure, it indicates that the small heap data structure needs to be updated, and then the solution path corresponding to the tail of the heap in the small heap data structure can be deleted, and the mth solution path is written into the small heap data structure. At this time, all the solution paths in the small heap data structure can be sorted again in order from large to small according to the total path value, so that the tail of the heap in the small heap data structure is used as the solution path with the largest current total path value.
[0092] When it is detected that the total path value corresponding to the tail of the small top heap data structure is not exceeded, it indicates that the mth solution path cannot be used as an alternative to multiple better paths, and the mth solution path may not be written into the small top heap data structure.
[0093] Step 110: When it is detected that no solution path is written into the small top heap data structure within a preset time interval, all solution paths in the small top heap data structure are used as target solution paths.
[0094] Specifically, when it is detected that no solution path is written into the mini-heap data structure within a preset time interval, it indicates that the depth-first traversal algorithm has completed or has just completed the path solution for the directed graph. Then, all the solution paths in the mini-heap data structure can be directly used as target solution paths, thereby efficiently solving the sorting problem of calculating multiple better paths and improving overall efficiency.
[0095] Please refer to FIG5 , which shows a schematic structural diagram of a path calculation device based on a content distribution network provided in an embodiment of the present application.
[0096] As shown in FIG5 , the path calculation device based on the content distribution network may include at least a request processing module 501, a path calculation module 502, a graph construction module 503, a data update module 504, and a target determination module 505, wherein:
[0097] The request processing module 501 is configured to determine a starting node and a source station address according to a received client request, and obtain at least two source station nodes based on a resolution result of the source station address;
[0098] Path calculation module 502 is used to find all parent nodes between the starting node and each source station node based on a preset database, obtain network detection data between any two adjacent nodes in the starting node, each source station node, and all parent nodes, and calculate the path value between any two adjacent nodes based on preset weight values and network detection data;
[0099] The graph construction module 503 is used to construct a directed graph based on the starting node, the source station address, all parent nodes, and the path values between any two adjacent nodes, and determine whether the path calculation function is enabled between the starting node and each source station node;
[0100] The data update module 504 is configured to, upon detecting that the path calculation function is enabled between the starting node and each source station node, perform path solving on the directed graph based on a depth-first traversal algorithm, and upon detecting that the total path value of the mth solution path does not exceed a preset path threshold, determine whether the mth solution path is written into a mini-heap data structure; wherein the mth solution path includes the starting node and at least one parent node, m is a positive integer, and the mini-heap data structure is configured with n solution path storage locations, where n is a preset number threshold;
[0101] The target determination module 505 is configured to use all solution paths in the small top heap data structure as target solution paths when it is detected that no solution path is written into the small top heap data structure within a preset time interval.
[0102] In some possible embodiments, the device further includes:
[0103] After determining whether the path calculation function is enabled between the starting node and each source station node, if it is detected that the path calculation function is not enabled between the starting node and each source station node, determine the first parent node with the smallest path value among all parent nodes adjacent to the starting node;
[0104] Determine the second parent node with the smallest path value among all parent nodes adjacent to the first parent node, and until it is determined that all nodes adjacent to the j-th parent node contain the source station address, take the path corresponding to the starting node, j parent nodes and the source station address as the target solution path; where j is a positive integer greater than 2.
[0105] In some possible embodiments, the device further includes:
[0106] After solving the path of the directed graph based on the depth-first traversal algorithm, before detecting that the total path value of the m-th solution path does not exceed the preset path threshold, the number of parent layer nodes in the current solution path is obtained, and the number of path hops is determined according to the number of parent layer nodes;
[0107] When it is detected that the path hop count does not exceed the preset hop count threshold, the current solution path is used as the mth solution path, and the total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path;
[0108] When it is detected that the path hop count exceeds the preset hop count threshold, it is determined whether all nodes adjacent to the penultimate parent node in the current solution path contain the source station address;
[0109] When it is detected that all nodes adjacent to the second-to-last parent node contain the source station address, the first-to-last parent node in the current solution path is replaced with the source station address, and the replaced current solution path is used as the mth solution path. The total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path.
[0110] In some possible embodiments, the data updating module is specifically configured to:
[0111] When it is detected that the source station address is included in the mth solution path, if m is less than or equal to n, the mth solution path is written into the mini-heap data structure, and all solution paths in the mini-heap data structure are sorted in descending order of total path value; among which, the tail of the mini-heap data structure is the solution path with the largest total path value.
[0112] In some possible embodiments, the data updating module is specifically configured to:
[0113] When it is detected that the source station address is included in the mth solution path, if m is greater than n, determine whether the total path value of the mth solution path exceeds the total path value corresponding to the tail of the heap in the mini-heap data structure;
[0114] When it is detected that the total path value of the mth solution path exceeds the total path value corresponding to the end of the heap, the mth solution path is not written into the small top heap data structure;
[0115] When it is detected that the total path value of the mth solution path does not exceed the total path value corresponding to the tail of the heap, the solution path corresponding to the tail of the heap in the mini-heap data structure is deleted, and the mth solution path is written into the mini-heap data structure.
[0116] In some possible embodiments, the data updating module is specifically configured to:
[0117] After writing the mth solution path into the mini-heap data structure, all solution paths in the mini-heap data structure are re-sorted in descending order of total path value, and the solution path with the largest total path value is re-used as the tail of the mini-heap data structure.
[0118] In some possible embodiments, the network detection data includes at least two types, such as packet loss rate, first packet time, and download rate.
[0119] Those skilled in the art will clearly understand that the technical solutions of the embodiments of the present application can be implemented with the help of software and / or hardware. "Unit" and "module" in this specification refer to software and / or hardware that can independently perform or cooperate with other components to perform specific functions, where the hardware can be, for example, a field programmable gate array (FPGA), an integrated circuit (IC), etc.
[0120] Please refer to FIG. 6 , which shows a schematic structural diagram of another path calculation device based on a content distribution network provided in an embodiment of the present application.
[0121] As shown in FIG6 , the content distribution network-based path calculation device 600 may include at least one processor 601 , at least one network interface 604 , a user interface 603 , a memory 605 , and at least one communication bus 602 .
[0122] The communication bus 602 may be used to implement connection and communication among the above components.
[0123] The user interface 603 may include buttons, and the optional user interface may also include a standard wired interface or a wireless interface.
[0124] The network interface 604 may include, but is not limited to, a Bluetooth module, an NFC module, a Wi-Fi module, and the like.
[0125] Processor 601 may include one or more processing cores. Using various interfaces and circuits, processor 601 connects various components within the content delivery network-based path calculation device 600. By running or executing instructions, programs, code sets, or instruction sets stored in memory 605, and accessing data stored in memory 605, processor 601 performs various routing functions and processes data within the content delivery network-based path calculation device 600. Optionally, processor 601 may be implemented in hardware using at least one of a DSP, FPGA, and PLA. Processor 601 may integrate one or a combination of a CPU, GPU, and modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing content displayed on the display; and the modem handles wireless communications. It is understood that the modem may also be implemented independently of the processor 601 and implemented on a separate chip.
[0126] Among them, the memory 605 may include RAM or ROM. Optionally, the memory 605 includes a non-transitory computer-readable medium. The memory 605 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 605 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 605 may also be at least one storage device located away from the aforementioned processor 601. As shown in Figure 6, the memory 605 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a path calculation application based on a content distribution network.
[0127] Specifically, the processor 601 may be configured to call a content distribution network-based path calculation application stored in the memory 605 and specifically perform the following operations:
[0128] Determine the starting node and the source station address according to the received client request, and obtain at least two source station nodes based on the resolution result of the source station address;
[0129] Based on the preset database, all parent nodes between the starting node and each source station node are found, and network detection data between any two adjacent nodes in the starting node, each source station node and all parent nodes are obtained. The path value between any two adjacent nodes is calculated based on the preset weight value and the network detection data;
[0130] Construct a directed graph based on the starting node, source station address, all parent nodes, and the path values between any two adjacent nodes, and determine whether the path calculation function is enabled between the starting node and each source station node;
[0131] When it is detected that the path calculation function is enabled between the starting node and each source station node, a path is solved for the directed graph based on a depth-first traversal algorithm, and when it is detected that the total path value of the m-th solution path does not exceed a preset path threshold, it is determined whether the m-th solution path is written into a mini-heap data structure; wherein the m-th solution path includes the starting node and at least one parent node, m is a positive integer, and the mini-heap data structure sets n solution path storage locations, where n is a preset number threshold;
[0132] When it is detected within a preset time interval that no solution path is written into the small top heap data structure, all solution paths in the small top heap data structure are used as target solution paths.
[0133] In some possible embodiments, after determining whether the path calculation function is enabled between the start node and each source station node, the method further includes:
[0134] When it is detected that the path calculation function is not enabled between the starting node and each source station node, the first parent node with the smallest path value is determined among all parent nodes adjacent to the starting node;
[0135] Determine the second parent node with the smallest path value among all parent nodes adjacent to the first parent node, and until it is determined that all nodes adjacent to the j-th parent node contain the source station address, take the path corresponding to the starting node, j parent nodes and the source station address as the target solution path; where j is a positive integer greater than 2.
[0136] In some possible embodiments, after performing path solving on the directed graph based on the depth-first traversal algorithm and before detecting that the total path value of the m-th solved path does not exceed a preset path threshold, the method further includes:
[0137] Get the number of parent nodes in the current solution path, and determine the number of path hops based on the number of parent nodes;
[0138] When it is detected that the path hop count does not exceed the preset hop count threshold, the current solution path is used as the mth solution path, and the total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path;
[0139] When it is detected that the path hop count exceeds the preset hop count threshold, it is determined whether all nodes adjacent to the penultimate parent node in the current solution path contain the source station address;
[0140] When it is detected that all nodes adjacent to the second-to-last parent node contain the source station address, the first-to-last parent node in the current solution path is replaced with the source station address, and the replaced current solution path is used as the mth solution path. The total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path.
[0141] In some possible embodiments, determining whether the mth solution path is written into the mini-top heap data structure includes:
[0142] When it is detected that the source station address is included in the mth solution path, if m is less than or equal to n, the mth solution path is written into the mini-heap data structure, and all solution paths in the mini-heap data structure are sorted in descending order of total path value; among which, the tail of the mini-heap data structure is the solution path with the largest total path value.
[0143] In some possible embodiments, determining whether the mth solution path is written into the mini-top heap data structure further includes:
[0144] When it is detected that the source station address is included in the mth solution path, if m is greater than n, determine whether the total path value of the mth solution path exceeds the total path value corresponding to the tail of the heap in the mini-heap data structure;
[0145] When it is detected that the total path value of the mth solution path exceeds the total path value corresponding to the end of the heap, the mth solution path is not written into the small top heap data structure;
[0146] When it is detected that the total path value of the mth solution path does not exceed the total path value corresponding to the tail of the heap, the solution path corresponding to the tail of the heap in the mini-heap data structure is deleted, and the mth solution path is written into the mini-heap data structure.
[0147] In some possible embodiments, after writing the mth solution path into the small top heap data structure, the method further includes:
[0148] All solution paths in the mini-heap data structure are re-sorted in descending order of total path value, and the solution path with the largest total path value is re-used as the tail of the mini-heap data structure.
[0149] In some possible embodiments, the network detection data includes at least two types, such as packet loss rate, first packet time, and download rate.
[0150] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the above method. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a microdrive, a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), or any type of medium or device suitable for storing instructions and / or data.
[0151] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0152] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0153] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interface, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0154] Units described as separate components may or may not be physically separate, and components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0155] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0156] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory and includes several instructions for enabling a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.
[0157] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0158] The above are merely exemplary embodiments of the present disclosure and are not intended to limit the scope of the present disclosure. That is, any equivalent changes and modifications made in accordance with the teachings of the present disclosure are still within the scope of the present disclosure. After considering the specification and practicing the disclosure herein, those skilled in the art will easily think of the implementation scheme of the present disclosure. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not recorded in the present disclosure. The description and examples are to be regarded as exemplary only, and the scope and spirit of the present disclosure are defined by the claims.
Claims
1. A path calculation method based on a content distribution network, characterized in that: include: Determine a starting node and a source station address according to the received client request, and obtain at least two source station nodes based on the resolution processing result of the source station address; Based on a preset database, all parent nodes between the starting node and each of the source station nodes are found, and network detection data between any two adjacent nodes is obtained in the starting node, each of the source station nodes and all of the parent nodes, and the path value between any two adjacent nodes is calculated according to a preset weight value and the network detection data; Constructing a directed graph according to the starting node, the source station address, all the parent nodes, and the path values between any two adjacent nodes, and determining whether a path calculation function is enabled between the starting node and each of the source station nodes; When it is detected that the calculation path function is turned on between the starting node and each of the source station nodes, the directed graph is solved based on the depth-first traversal algorithm, and when it is detected that the total path value of the m-th solution path does not exceed the preset path threshold, it is determined whether the m-th solution path is written into the mini-heap data structure; wherein the m-th solution path includes the starting node and at least one of the parent layer nodes, m is a positive integer, and the mini-heap data structure sets n solution path storage locations, and n is a preset number threshold; When it is detected within a preset time interval that no solution path is written into the small top heap data structure, all solution paths in the small top heap data structure are used as target solution paths.
2. The method according to claim 1, characterized in that After determining whether the path calculation function is enabled between the starting node and each of the source station nodes, the method further includes: When it is detected that the path calculation function is not enabled between the starting node and each of the source station nodes, a first parent node with the smallest path value is determined among all the parent nodes adjacent to the starting node; Determine the second parent node with the smallest path value among all the parent nodes adjacent to the first parent node, and until it is determined that all the nodes adjacent to the j-th parent node contain the source station address, take the path corresponding to the starting node, j parent nodes and the source station address as the target solution path; wherein j is a positive integer greater than 2.
3. The method according to claim 1, characterized in that After performing path solving on the directed graph based on the depth-first traversal algorithm and before detecting that the total path value of the m-th solved path does not exceed a preset path threshold, the method further includes: Obtain the number of parent layer nodes in the current solution path, and determine the number of path hops according to the number of parent layer nodes; When it is detected that the number of path hops does not exceed the preset hop count threshold, the current solution path is used as the mth solution path. path, and calculate the total path value of the m-th solution path according to the path value between any two adjacent nodes in the m-th solution path; When it is detected that the path hop count exceeds the preset hop count threshold, determining whether all nodes adjacent to the penultimate parent node in the current solution path contain the source station address; When it is detected that all nodes adjacent to the second-to-last parent node contain the source station address, the first-to-last parent node in the current solution path is replaced with the source station address, and the replaced current solution path is used as the mth solution path, and the total path value of the mth solution path is calculated based on the path value between any two adjacent nodes in the mth solution path.
4. The method according to claim 1, characterized in that: The determining whether the mth solution path is written into the mini-top heap data structure comprises: When it is detected that the source station address is included in the mth solution path, if m is less than or equal to n, the mth solution path is written into the mini-heap data structure, and all solution paths in the mini-heap data structure are sorted in descending order of total path value; wherein the tail of the mini-heap data structure is the solution path with the largest total path value.
5. The method according to claim 4, characterized in that The step of determining whether the mth solution path is written into the mini-heap data structure also includes: When it is detected that the source station address is included in the mth solution path, if m is greater than n, determining whether the total path value of the mth solution path exceeds the total path value corresponding to the tail of the heap in the mini-heap data structure; When it is detected that the total path value of the mth solution path exceeds the total path value corresponding to the tail of the heap, the mth solution path is not written into the small top heap data structure; When it is detected that the total path value of the mth solution path does not exceed the total path value corresponding to the tail of the heap, the solution path corresponding to the tail of the heap in the mini-heap data structure is deleted, and the mth solution path is written into the mini-heap data structure.
6. The method according to claim 5, characterized in that After writing the mth solution path into the small top heap data structure, the method further includes: All solution paths in the mini-heap data structure are reordered in descending order of total path value, and the solution path with the largest total path value is re-used as the tail of the mini-heap data structure.
7. The method according to claim 1, characterized in that The network detection data includes at least two types such as packet loss rate, first packet time and download rate.
8. A path calculation device based on a content distribution network, characterized in that: include: The request processing module is used to determine the starting node and the source station address according to the received client request, and The parsing result of the station address is to obtain at least two source station nodes; A path calculation module, used to find out all parent nodes between the starting node and each of the source station nodes based on a preset database, and obtain network detection data between any two adjacent nodes in the starting node, each of the source station nodes and all the parent nodes, and calculate the path value between any two adjacent nodes according to a preset weight value and the network detection data; A graph construction module, used to construct a directed graph according to the starting node, the source station address, all the parent layer nodes and the path values between any two adjacent nodes, and determine whether the path calculation function is enabled between the starting node and each of the source station nodes; A data update module, for, when it is detected that the calculation path function is turned on between the starting node and each of the source station nodes, performing path solving on the directed graph based on a depth-first traversal algorithm, and when it is detected that the total path value of the mth solution path does not exceed a preset path threshold, determining whether the mth solution path is written into a mini-heap data structure; wherein the mth solution path includes the starting node and at least one of the parent layer nodes, m is a positive integer, and the mini-heap data structure sets n solution path storage locations, and n is a preset number threshold; The target determination module is used to use all solution paths in the small top heap data structure as target solution paths when it is detected that no solution path is written into the small top heap data structure within a preset time interval.
9. A path calculation device based on a content distribution network, characterized in that: including a processor and a memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Path optimization method and path optimization system based on Dijkstra
CN106096783A
CDN (Content Delivery Network) system and network source returning method thereof
CN107995314A
Path calculation method and device based on content distribution network
CN116366524A
Content distribution system distribution route calculation method and device
JP2013162393A
Method, apparatus and system for determining accessible paths between two nodes
US20210097079A1
