A method and system for dynamic sub-packet loading of applications based on hierarchical coding
By adopting a dynamic sub-packet loading method based on hierarchical coding and distributed edge nodes, the problem of long startup time for large applications is solved, achieving efficient loading and reliability verification, and improving user experience and system stability.
Patent Information
- Application Number
- CN202511109110.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-08
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-08-08
AI Technical Summary
Existing application dynamic sub-packet loading technology has shortcomings in optimizing application startup performance and user experience, especially when large applications load too many resources, leading to prolonged startup time.
A hierarchical coding approach is adopted, which divides the data into hierarchical parts by generating a dependency graph. Sub-packages are generated by combining locality-sensitive hashing (LSH) and random walk algorithms. A distributed edge node network is used for cache preheating, and blockchain technology is used to verify the integrity and consistency of the sub-packages.
It significantly improves application loading efficiency, reduces redundant loading, optimizes startup time, increases response speed, enhances user experience, and ensures the reliability of subpackage content and system stability.
Smart Images

Figure CN120653328B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of application loading technology, and in particular to a method and system for dynamic sub-packet loading of applications based on hierarchical coding. Background Technology
[0002] With the rapid development of mobile internet, the scale and complexity of applications are constantly increasing, leading to a continuous expansion of application installation package sizes. Large applications require loading a large amount of resources upon initial launch, resulting in prolonged startup time and a poor user experience. To address this issue, dynamic application sub-package loading technology has emerged. This technology splits the application into multiple independent sub-packages and loads them on demand according to the actual user needs, effectively reducing the initial installation package size and optimizing startup performance.
[0003] Existing dynamic application loading techniques primarily rely on static code analysis and manual partitioning to split the application into functional modules or usage scenarios. While these methods improve application startup performance and user experience to some extent, they still present some technical challenges. Summary of the Invention
[0004] This invention provides a method and system for dynamic sub-packet loading of applications based on hierarchical coding, which can solve the problems in the prior art.
[0005] A first aspect of the present invention provides a method for dynamically loading application packages based on hierarchical coding, comprising:
[0006] Obtain the application's code package, and generate a dependency graph based on the function call relationships of each program module in the code package; divide the program modules in the dependency graph into hierarchical levels, and group program modules with the same call level into the same level;
[0007] For each program module in each level, extract the call chain characteristics, memory resource usage characteristics, and update iteration frequency characteristics of the program module to generate a multi-dimensional feature vector;
[0008] The feature hash value sequence of the multidimensional feature vector is calculated based on the locality-sensitive hash algorithm, and the feature hash value sequence is mapped to the multidimensional feature space to obtain the multidimensional feature hash value; the multidimensional feature hash value is converted into a position index through position encoding technology to generate the binary feature code of the program module; the program module is aggregated into a sub-package based on the random walk algorithm;
[0009] After receiving the application's startup command, the system assigns a hierarchy identifier, a clustering identifier, and a checksum to each sub-package and generates the dynamic encoding of the sub-package.
[0010] The system selects the set of edge nodes with the lowest transmission latency from the distributed edge node network, distributes each sub-packet to the set of edge nodes for caching and preheating, records the storage status and version information of the sub-packets in the blockchain network, and verifies the integrity and consistency of the sub-packets through smart contracts to ensure the reliability of the sub-packet content.
[0011] Parse the dynamic encoding in the call request, obtain the target sub-package from the optimal edge node, and complete the loading.
[0012] A dependency graph is generated based on the function call relationships of each program module in the code package; the program modules in the dependency graph are hierarchically divided, and program modules with the same call level are grouped into the same level, including:
[0013] Obtain the function call relationships between program modules in the code package and generate a function call relationship matrix;
[0014] Monitor the running status of each program module in the test environment and collect the call path length between program modules; use the call path length as an exponent to perform an exponentiation operation on the function call relationship matrix to obtain the call complexity between program modules; use the program module as a node and the call complexity as the weight value of the directed edge to generate a dependency graph.
[0015] Detect circular call paths in the dependency graph and calculate the cumulative call complexity of each circular call path; when the cumulative call complexity of a circular call path is greater than a complexity threshold, select the call relationship with the highest call complexity from the circular call paths and disconnect it;
[0016] Based on the dependency graph after breaking the loop call, when the call complexity between adjacent program modules is less than the level threshold, the two program modules are divided into the same level; the level division operation is repeated until all program modules have completed the level division.
[0017] The feature hash value sequence of the multidimensional feature vector is calculated based on the locality-sensitive hashing algorithm, and the feature hash value sequence is mapped to the multidimensional feature space to obtain multidimensional feature hash values, including:
[0018] Calculate the covariance matrix of the multidimensional feature vectors, and calculate the feature sensitivity based on the eigenvalue distribution of the covariance matrix; multiply the feature sensitivity by a preset parameter to obtain the number of target hash functions; randomly generate a projection vector group equal to the number of target hash functions using a normal distribution; multiply the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group; perform an inner product operation between the multidimensional feature vectors and each hash projection vector to obtain a sequence of feature hash values.
[0019] Calculate the distance distribution of adjacent feature hash values in the feature hash value sequence; calculate the mean of the distance distribution, and use the mean as the density boundary value. When the distance between adjacent feature hash values is greater than the density boundary value, perform a logarithmic mapping on the corresponding feature hash values; when the distance between adjacent feature hash values is less than the density boundary value, perform a linear mapping on the corresponding feature hash values; combine the mapped hash value sequences to form a multidimensional feature hash value.
[0020] The multidimensional feature hash value is converted into a position index using positional encoding technology to generate the binary feature code of the program module; the program modules are aggregated into sub-packages based on the random walk algorithm, including:
[0021] Calculate the data distribution entropy for each feature dimension, multiply the data distribution entropy by the multidimensional feature hash value to obtain the position index; perform a Fourier transform to convert the position index to the frequency domain space, divide the frequency domain signal into multiple frequency band signals based on the frequency distribution, and calculate the energy distribution density of each frequency band signal;
[0022] The gain coefficient of each frequency band is adjusted according to the energy distribution density, and the gain is adjusted for the detailed features and structural features of each frequency band signal to obtain the multi-band signal after gain. Based on the multi-band signal after gain, the phase difference between adjacent frequency band signals is calculated, and a phase compensation factor is introduced to eliminate frequency aliasing to obtain the enhanced position index.
[0023] Multiple orthogonal perturbation vectors are sequentially superimposed onto an enhanced position index to generate a multi-layer position coding sequence; the multi-layer position coding sequence is input into a projection matrix for linear transformation, and after adding a bias vector, a sign function is used to obtain a binary feature code;
[0024] The binary feature encoding of the program modules is used as network nodes, and the transition probability between nodes is calculated based on Hamming distance. The random walk algorithm is executed to update the cluster labels of the nodes. The iteration stops when the rate of change of node labels in two consecutive iterations is less than the convergence threshold. Program modules with the same cluster labels are aggregated into a sub-package.
[0025] Select the set of edge nodes with the lowest transmission latency from the distributed edge node network, and distribute each sub-packet to the set of edge nodes for buffering and warming, including:
[0026] Construct a network topology graph between edge nodes and calculate the link overlap between two adjacent edge nodes; use the Euclidean distance between two adjacent edge nodes as an exponential term, perform an exponential operation on the product of the link overlap and the node bandwidth occupancy value to obtain the resource contention degree, and form an edge node contention vector by combining the resource contention degree of the corresponding edge node with that of other edge nodes.
[0027] The node contention degree is calculated by multiplying the norm of the edge node contention vector by the node bandwidth capacity, and then weighted and summed with the link overlap degree to obtain the contention correction coefficient. The contention correction coefficient is then multiplied by the node's transmission delay to obtain the contention weighted score.
[0028] Based on the historical location sequence of user equipment, the historical number of moves to the target location is divided by the total number of moves to obtain the location migration probability. The service request frequency of the target location is also counted. The location migration probability is multiplied by the service request frequency to obtain the load migration probability. Based on the historical location sequence, a state transition matrix is constructed. The state transition matrix is used to iteratively predict the load migration probability within a future time window to obtain the load prediction value.
[0029] The weighted sum of the competition-weighted score and the load prediction value is used as the node score. Edge nodes with node scores higher than the edge threshold are selected as the target edge node set. Sub-packets are distributed to the target edge node set for cache preheating based on the access frequency of sub-packets.
[0030] The blockchain network records the storage status and version information of sub-packages at edge nodes, and verifies the integrity and consistency of sub-packages through smart contracts to ensure the reliability of sub-package content, including:
[0031] Extract the identification information, version information, and node location information of sub-packages from the edge nodes; based on the identification information of the sub-packages, read the complete content of the sub-packages, perform hash calculation on the complete content to obtain the content hash value; combine the identification information, the version information, the node location information, and the content hash value to form a sub-package status record, and store it in the blockchain network;
[0032] When a sub-packet status update is detected, the current content hash value of the sub-packet is calculated, and the current content hash value is compared with the content hash value in the sub-packet status record to generate an integrity verification result.
[0033] Obtain the version number of the sub-package stored at each edge node, determine whether the version numbers are consistent, and generate a consistency verification result;
[0034] Calculate the time difference between the sub-packet status update time and the current time, compare the time difference with a time threshold, and generate a timeliness verification result;
[0035] When the integrity verification result, the consistency verification result, and the timeliness verification result are all valid, the sub-package status is confirmed to be valid, a sub-package status record is generated, and updated to the blockchain network.
[0036] A second aspect of the present invention provides a hierarchical coding-based application dynamic sub-packet loading system, comprising:
[0037] The first unit is used to obtain the application's code package, generate a dependency graph based on the function call relationships of each program module in the code package, and hierarchically divide the program modules in the dependency graph, grouping program modules with the same call level into the same level.
[0038] The second unit is used to extract the call chain characteristics, memory resource usage characteristics, and update iteration frequency characteristics of the program modules in each level, and generate a multi-dimensional feature vector.
[0039] The third unit is used to calculate the feature hash value sequence of the multidimensional feature vector based on the locality-sensitive hashing algorithm, map the feature hash value sequence to the multidimensional feature space to obtain the multidimensional feature hash value; convert the multidimensional feature hash value into a position index through position encoding technology to generate the binary feature code of the program module; and aggregate the program modules to form sub-packages based on the random walk algorithm.
[0040] The fourth unit is used to receive the application's startup command, assign a hierarchy identifier, a cluster identifier, and a check bit to each sub-package, and generate the dynamic code of the sub-package.
[0041] The fifth unit is used to select the set of edge nodes with the minimum transmission latency from the distributed edge node network, distribute each sub-packet to the set of edge nodes for caching and preheating; record the storage status and version information of the sub-packets of the edge nodes in the blockchain network, and verify the integrity and consistency of the sub-packets through smart contracts to ensure the reliability of the sub-packet content;
[0042] The sixth unit is used to parse the dynamic encoding in the call request, obtain the target sub-package from the optimal edge node, and complete the loading.
[0043] A third aspect of the embodiments of the present invention,
[0044] An electronic device is provided, comprising:
[0045] processor;
[0046] Memory used to store processor-executable instructions;
[0047] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0048] Fourth aspect of the embodiments of the present invention,
[0049] A computer-readable storage medium is provided, having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0050] The beneficial effects of this application are as follows:
[0051] This invention significantly improves application loading efficiency through a dynamic sub-packet loading method based on hierarchical coding. By employing hierarchical partitioning and feature encoding techniques, program modules can be effectively organized according to call relationships and resource characteristics, reducing redundant loading and optimizing startup time.
[0052] This invention introduces a distributed edge node caching mechanism, which selects the set of edge nodes with the lowest transmission latency for sub-packet distribution and preheating, significantly reducing network transmission latency, improving application response speed, and enhancing user experience. It is particularly suitable for use scenarios with complex and ever-changing network conditions.
[0053] This invention combines blockchain technology and smart contract verification mechanisms to ensure the integrity, consistency, and reliability of sub-package content, effectively solving the problems of code package version management and security in a distributed environment. At the same time, it improves the system's fault tolerance and stability, providing a reliable guarantee for the dynamic updates and long-term maintenance of applications. Attached Figure Description
[0054] Figure 1 This is a flowchart illustrating the application dynamic sub-packet loading method based on hierarchical coding according to an embodiment of the present invention;
[0055] Figure 2 This is a schematic diagram of the location encoding and program module aggregation architecture. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0057] The technical solution of the present invention will be described in detail below with reference to specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments.
[0058] Figure 1 This is a flowchart illustrating the application dynamic sub-packet loading method based on hierarchical coding according to an embodiment of the present invention, as shown below. Figure 1 As shown, the method includes:
[0059] Obtain the application's code package, and generate a dependency graph based on the function call relationships of each program module in the code package; divide the program modules in the dependency graph into hierarchical levels, and group program modules with the same call level into the same level;
[0060] For each program module in each level, extract the call chain characteristics, memory resource usage characteristics, and update iteration frequency characteristics of the program module to generate a multi-dimensional feature vector;
[0061] The feature hash value sequence of the multidimensional feature vector is calculated based on the locality-sensitive hash algorithm, and the feature hash value sequence is mapped to the multidimensional feature space to obtain the multidimensional feature hash value; the multidimensional feature hash value is converted into a position index through position encoding technology to generate the binary feature code of the program module; the program module is aggregated into a sub-package based on the random walk algorithm;
[0062] After receiving the application's startup command, the system assigns a hierarchy identifier, a clustering identifier, and a checksum to each sub-package and generates the dynamic encoding of the sub-package.
[0063] The system selects the set of edge nodes with the lowest transmission latency from the distributed edge node network, distributes each sub-packet to the set of edge nodes for caching and preheating, records the storage status and version information of the sub-packets in the blockchain network, and verifies the integrity and consistency of the sub-packets through smart contracts to ensure the reliability of the sub-packet content.
[0064] Parse the dynamic encoding in the call request, obtain the target sub-package from the optimal edge node, and complete the loading.
[0065] In one optional implementation, a dependency graph is generated based on the function call relationships of each program module in the code package; the program modules in the dependency graph are then hierarchically divided, with program modules at the same call level grouped into the same level, including:
[0066] Obtain the function call relationships between program modules in the code package and generate a function call relationship matrix;
[0067] Monitor the running status of each program module in the test environment and collect the call path length between program modules; use the call path length as an exponent to perform an exponentiation operation on the function call relationship matrix to obtain the call complexity between program modules; use the program module as a node and the call complexity as the weight value of the directed edge to generate a dependency graph.
[0068] Detect circular call paths in the dependency graph and calculate the cumulative call complexity of each circular call path; when the cumulative call complexity of a circular call path is greater than a complexity threshold, select the call relationship with the highest call complexity from the circular call paths and disconnect it;
[0069] Based on the dependency graph after breaking the loop call, when the call complexity between adjacent program modules is less than the level threshold, the two program modules are divided into the same level; the level division operation is repeated until all program modules have completed the level division.
[0070] The method described above can effectively analyze the dependencies between program modules in a code package and rationally divide the hierarchy. The specific implementation of this method is as follows:
[0071] In a practical application, the system obtains the function call relationships between program modules in a code package and generates a function call relationship matrix. For example, for a code package containing modules A, B, C, D, and E, static code analysis tools are used to extract function call information and identify the call dependencies between modules. Assume module A calls modules B and C, module B calls module D, module C calls module E, module D calls module B, and module E calls module A, thus generating a 5×5 function call relationship matrix M. In this matrix, elements M... i,j This indicates whether module i calls module j; a value of 1 indicates a call, and a value of 0 indicates otherwise. In this example, M... 0,1 =1 indicates that module A calls module B, M 0,2 =1 indicates that module A calls module C, M 1,3 =1 indicates that module B calls module D, and so on.
[0072] The system is deployed in a test environment to monitor the code package and collect the call path lengths between program modules. Through instrumentation or log analysis, the path information for each call is recorded. For example, monitoring might reveal that the call path length from module A to module D is 2 (A calls B, B calls D), and the call path length from module C to module A is 2 (C calls E, E calls A). For each pair of modules (i,j), its average call path length L is calculated. ij .
[0073] The system uses the collected call path length as the exponent and performs a power operation on the function call relationship matrix to obtain the call complexity between program modules. Specifically, the call complexity C between module i and module j is... ij If module i directly calls module j, then C ij L is equal to a basic complexity value (e.g., 1.0). ij The power; if no direct call exists, then C ij The complexity is 0. For example, if the average call path length from module A to module D is 2, then the complexity C is 0. AD It is 1.0 raised to the power of 2, i.e., 1.0. The system fills these calculated complexity values into a new matrix, forming the calling complexity matrix C.
[0074] Based on the call complexity matrix, the system uses program modules as nodes and call complexity as the weight of directed edges to generate a dependency graph G. In graph G, each node represents a program module, and a directed edge from node i to node j indicates that module i calls module j, with the weight of the edge being the call complexity C. ij For example, the edge weight from node A to node B is C. AB This represents the complexity of module A calling module B.
[0075] The system detects circular call paths in the dependency graph G. A depth-first search algorithm is used to find all paths that start from a given node and eventually return to that node. In this example, there are circular paths: B→D→B and A→C→E→A. For each circular path, its cumulative call complexity is calculated, which is the sum of the weights of all edges on the path. For example, the cumulative complexity of B→D→B is C. BD +C DB The cumulative complexity of A→C→E→A is C. AC +C CE +C EA .
[0076] When the cumulative call complexity of a loop path exceeds a preset complexity threshold (e.g., set to 2.5), the system selects the call relationship with the highest call complexity within that loop path and disconnects it. Assume the cumulative complexity of A→C→E→A is 3.0, exceeding the threshold of 2.5, and C... EA If the maximum complexity is 1.5, the system will break the call relationship from E to A and update the dependency graph. This break can be achieved by setting the corresponding complexity value to 0, i.e., setting C... EA =0.
[0077] Based on the dependency graph after breaking the circular call, the system performs hierarchical partitioning. When the call complexity between adjacent program modules i and j is C... ij If the value is less than the level threshold (e.g., set to 0.8), the two program modules are grouped into the same level. For example, if C... AB If the value is 0.7, which is less than the level threshold of 0.8, then modules A and B are assigned to the same level.
[0078] The system repeatedly performs the hierarchical partitioning operation until all program modules have been partitioned. During the partitioning process, if modules i and j are at the same level, and modules j and k are at the same level, then modules i, j, and k should all be partitioned into the same level. Through this transitive relationship, the complete hierarchical partitioning result is finally obtained. For example, the final hierarchical partitioning is as follows: the first level contains modules A and B, the second level contains modules C and D, and the third level contains module E.
[0079] The hierarchical division above clearly reflects the dependency structure of program modules within the code package, helping developers understand code organization and optimize module design. For example, it can be observed that modules at the first level are heavily depended upon by other levels, and their stability should be a primary focus; modules at the third level have many dependencies, and their external dependencies need to be reduced to improve cohesion. In this way, the development team can better manage code complexity and improve system maintainability.
[0080] In one optional implementation, the feature hash value sequence of the multidimensional feature vector is calculated based on the locality-sensitive hashing algorithm, and the feature hash value sequence is mapped to a multidimensional feature space to obtain a multidimensional feature hash value, including:
[0081] Calculate the covariance matrix of the multidimensional feature vectors, and calculate the feature sensitivity based on the eigenvalue distribution of the covariance matrix; multiply the feature sensitivity by a preset parameter to obtain the number of target hash functions; randomly generate a projection vector group equal to the number of target hash functions using a normal distribution; multiply the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group; perform an inner product operation between the multidimensional feature vectors and each hash projection vector to obtain a sequence of feature hash values.
[0082] Calculate the distance distribution of adjacent feature hash values in the feature hash value sequence; calculate the mean of the distance distribution, and use the mean as the density boundary value. When the distance between adjacent feature hash values is greater than the density boundary value, perform a logarithmic mapping on the corresponding feature hash values; when the distance between adjacent feature hash values is less than the density boundary value, perform a linear mapping on the corresponding feature hash values; combine the mapped hash value sequences to form a multidimensional feature hash value.
[0083] In this embodiment, a method for calculating the feature hash value sequence of multidimensional feature vectors based on the locality-sensitive hashing algorithm is provided. This method can effectively process high-dimensional data features and improve the efficiency of feature matching.
[0084] In this embodiment, the input multidimensional feature vector needs to be processed to calculate its covariance matrix. The covariance matrix reflects the correlation between the dimensions of the feature vector. Specifically, assuming the input multidimensional feature vector is a 5-dimensional vector [1.83, 2.27, 2.07, 1.53, 1.17], a 5×5 covariance matrix can be obtained by calculating the covariance between the dimensions of this vector.
[0085] Based on the calculated covariance matrix, its eigenvalue distribution is further calculated to determine the feature sensitivity. The eigenvalue distribution can be obtained by performing eigenvalue decomposition on the covariance matrix. For example, for the 5×5 covariance matrix mentioned above, five eigenvalues can be obtained: 5.83, 2.76, 1.54, 1.14, and 0.73. Normalizing these five eigenvalues yields sensitivity values of 0.486, 0.230, 0.128, 0.09, and 0.061.
[0086] Multiply the calculated feature sensitivity by a preset parameter to obtain the target number of hash functions. The preset parameter can be set according to the actual application scenario and requirements, for example, set to 100. Assuming the calculated feature sensitivity is 0.8, then the target number of hash functions is 0.8 × 100 = 80.
[0087] We use a normal distribution to randomly generate a set of projection vectors equal in number to the target hash function. In this example, we need to generate 80 projection vectors, each with the same dimension as the original feature vectors, i.e., 128 dimensions. These projection vectors can be generated by randomly sampling from a normal distribution with a mean of 0 and a standard deviation of 1.
[0088] The feature sensitivity is multiplied by each projection vector in the projection vector group to obtain the hash projection vector group. For example, if the feature sensitivity is 0.8, then each component of each projection vector is multiplied by 0.8 to obtain 80 scaled hash projection vectors.
[0089] The feature vector is inner-producted with each hash projection vector to obtain a sequence of feature hash values. In this example, the 128-dimensional feature vector is inner-producted with each of the 80 hash projection vectors to obtain a sequence of feature hash values of length 80.
[0090] Calculate the distance distribution between adjacent feature hash values in a feature hash value sequence. Specifically, for a feature hash value sequence of length 80, calculate the absolute value of the difference between adjacent elements to obtain 79 distance values. For example, if the first few values of the hash value sequence are [2.5, 3.1, 1.8, 4.2], then the corresponding distance values are [|3.1-2.5|, |1.8-3.1|, |4.2-1.8|] = [0.6, 1.3, 2.4].
[0091] Calculate the mean of the distance distribution and use it as the density cutoff value. In the example above, the mean of the distance distribution is (0.6+1.3+2.4) / 3 = 1.43, which is used as the density cutoff value.
[0092] Based on the comparison between the distance to adjacent feature hash values and the density boundary value, feature hash values are mapped. When the distance between adjacent feature hash values is greater than the density boundary value, a logarithmic mapping is performed on the corresponding feature hash values; when the distance between adjacent feature hash values is less than the density boundary value, a linear mapping is performed on the corresponding feature hash values.
[0093] Logarithmic mapping can be achieved by taking the logarithm of the feature hash value. For example, if the feature hash value is 10, its logarithmic mapping result is lg(10) = 1. Linear mapping can be achieved by multiplying the feature hash value by a coefficient. For example, if the feature hash value is 5 and the coefficient is 0.1, its linear mapping result is 5 × 0.1 = 0.5.
[0094] Specifically, assuming the feature hash value sequence is [2.5, 3.1, 1.8, 4.2, 7.0], the adjacent distances are [0.6, 1.3, 2.4, 2.8], and the density threshold is 1.43. Then, the first distance 0.6 is less than the density threshold 1.43, and the corresponding feature hash values 2.5 and 3.1, when linearly mapped, yield 0.25 and 0.31; the second distance 1.3 is less than the density threshold 1.43, and the corresponding feature hash values 3.1 and 1.8, when linearly mapped, yield 0.31 and 0.18; the third distance 2.4 is greater than the density threshold 1.43, and the corresponding feature hash values 1.8 and 4.2, when logarithmically mapped, yield 0.26 and 0.62; the fourth distance 2.8 is greater than the density threshold 1.43, and the corresponding feature hash values 4.2 and 7.0, when logarithmically mapped, yield 0.62 and 0.85.
[0095] The mapped hash value sequence is combined to form a multidimensional feature hash value. In the example above, the mapped hash value sequence is [0.25, 0.31, 0.18, 0.26, 0.62, 0.85], which is then combined into a multidimensional feature hash value.
[0096] Through the above processing, the original high-dimensional feature vectors are transformed into more compact multi-dimensional feature hash values, which retains the key information of the original features while greatly reducing the data dimensionality and improving the efficiency of feature matching. This method based on locality-sensitive hashing and adaptive mapping is particularly suitable for processing large-scale high-dimensional feature data, such as image features and text features.
[0097] In practical applications, preset parameters and mapping functions can be adjusted according to specific data characteristics and application requirements to obtain the best feature representation effect. For example, for sparsely distributed feature data, the preset parameters can be increased to generate more hash functions; for densely distributed feature data, more complex mapping functions can be used to better distinguish similar features.
[0098] Figure 2 This is a schematic diagram of the location encoding and program module aggregation architecture. In one optional implementation, a multi-dimensional feature hash value is converted into a location index using location encoding technology to generate the binary feature code of the program module; the program modules are aggregated into sub-packages based on a random walk algorithm, including:
[0099] Calculate the data distribution entropy for each feature dimension, multiply the data distribution entropy by the multidimensional feature hash value to obtain the position index; perform a Fourier transform to convert the position index to the frequency domain space, divide the frequency domain signal into multiple frequency band signals based on the frequency distribution, and calculate the energy distribution density of each frequency band signal;
[0100] The gain coefficient of each frequency band is adjusted according to the energy distribution density, and the gain is adjusted for the detailed features and structural features of each frequency band signal to obtain the multi-band signal after gain. Based on the multi-band signal after gain, the phase difference between adjacent frequency band signals is calculated, and a phase compensation factor is introduced to eliminate frequency aliasing to obtain the enhanced position index.
[0101] Multiple orthogonal perturbation vectors are sequentially superimposed onto an enhanced position index to generate a multi-layer position coding sequence; the multi-layer position coding sequence is input into a projection matrix for linear transformation, and after adding a bias vector, a sign function is used to obtain a binary feature code;
[0102] The binary feature encoding of the program modules is used as network nodes, and the transition probability between nodes is calculated based on Hamming distance. The random walk algorithm is executed to update the cluster labels of the nodes. The iteration stops when the rate of change of node labels in two consecutive iterations is less than the convergence threshold. Program modules with the same cluster labels are aggregated into a sub-package.
[0103] This embodiment provides a method for converting multidimensional feature hash values into position indices and generating binary feature codes for program modules. The method also includes aggregating program modules into sub-packages based on a random walk algorithm.
[0104] In the specific implementation process, the multi-dimensional feature hash values of the program modules are obtained. For example, features extracted from the program modules include function call relationships, control flow graph features, and data flow features. These features are converted into 128-dimensional feature vectors using a hash function, where each element in the vector takes values in the range [-1, 1]. For each feature dimension, the data distribution entropy is calculated. Taking the i-th dimension as an example, the data in this dimension can be divided into 10 equally wide intervals, and the probability distribution of data points in each interval is statistically analyzed. Assuming the probability of the j-th interval is p... ij Then the data distribution entropy of this dimension can be accumulated by adding -p ij ×log(p ijThe calculated entropy value typically falls within the range of [0, log(10)]. For example, for uniformly distributed data, the entropy value is close to 2.30, while for highly concentrated distributions, the entropy value is close to 0.3. The calculated data distribution entropy is multiplied by the feature hash value of the corresponding dimension to obtain the location index. For example, if the feature hash value of a certain dimension is 0.75 and the entropy value is 1.8, then the corresponding location index component is 1.35.
[0105] Perform a Fourier transform to convert the position index to the frequency domain. Taking a 128-dimensional position index as an example, the Fast Fourier Transform algorithm yields 64 complex frequency domain signals. Based on frequency magnitude, the frequency domain signals are divided into four bands: 0-15Hz for low frequency, 16-31Hz for mid-low frequency, 32-47Hz for mid-high frequency, and 48-63Hz for high frequency. The energy distribution density is calculated for each band. For example, the energy density of the low frequency band is the sum of the squares of the signal amplitudes within that band divided by the band width, resulting in energy densities of [8.2, 4.5, 2.1, 0.9] for the four bands.
[0106] The gain coefficient of each frequency band is adjusted based on the energy distribution density. For the low-frequency band, the gain coefficient is set to 1.0 and remains unchanged; for the mid-low-frequency band, the gain coefficient is set to 1.2; for the mid-high-frequency band, the gain coefficient is set to 1.5; and for the high-frequency band, the gain coefficient is set to 1.8. Gain adjustment is applied separately for structural features (low-frequency signals) and detail features (high-frequency signals), multiplying the signal amplitude of each frequency band by the corresponding gain coefficient. For example, the high-frequency signal amplitude is increased from 0.5 to 0.9. The phase difference between adjacent frequency band signals is calculated; for example, at the boundary between the low-frequency and mid-low-frequency bands, the phase difference is 45 degrees. A phase compensation factor is introduced to eliminate frequency aliasing. For a 45-degree phase difference, the compensation factor is set to 0.85. This factor is applied to the signal at the frequency band boundary to obtain the enhanced position index.
[0107] When generating the multi-layer location-coded sequence, four orthogonal perturbation vectors are created, each with the same dimension as the enhanced location index. These perturbation vectors are obtained through a Gram-Schmidt orthogonalization process, and the elements in the vectors range from -0.1 to 0.1. These perturbation vectors are then sequentially superimposed on the enhanced location index to generate a four-layer location-coded sequence. For example, the first layer is the original enhanced location index, the second layer is the enhanced location index plus the first perturbation vector, and so on.
[0108] The multi-layer positional coding sequence is input into a projection matrix for linear transformation. The projection matrix is 256×128 in size, and its elements are randomly initialized, with values ranging from -0.05 to 0.05. The four-layer positional coding sequences are transformed using this matrix, resulting in four 256-dimensional vectors. A bias vector is added to these vectors; this bias vector is 256-dimensional, with all elements being 0.01. After adding the bias, a sign function is used to convert positive values to 1 and negative values to -1, resulting in a binary feature code. For example, a 256-bit binary feature code might be "1010...0101".
[0109] The binary feature codes of program modules are used as network nodes, and the transition probabilities between nodes are calculated based on Hamming distance. For any two nodes i and j, their Hamming distance is the number of different bits in their corresponding binary feature codes, for example, 80. The transition probability P... ij The threshold is set to exp(-Hamming distance / 50), for example, exp(-80 / 50) ≈ 0.2. After constructing the transition probability matrix, a random walk algorithm is executed to update the cluster labels of the nodes. Initially, each node is assigned a unique label. In each iteration, a node retains its original label with a certain probability (probability 0.3), or adopts the label of its neighboring node (probability 0.7 × P). ij For example, if node A's initial label is 1, its neighbor node B's label is 2, and the transition probability is 0.2, then node A has a probability of 0.7 × 0.2 = 0.14 of updating its label to 2 in the next iteration.
[0110] During the iteration process, the rate of change of node labels is calculated after each iteration, which is the proportion of nodes whose labels have changed out of the total number of nodes. Iteration stops when the rate of change of node labels for two consecutive iterations is less than a convergence threshold (e.g., 0.05). Finally, program modules with the same clustering label are aggregated into a sub-package. For example, all program modules with label 3 are aggregated into "sub-package 3". In this way, program modules are effectively organized into multiple sub-packages with high internal similarity, facilitating subsequent management and analysis.
[0111] In one optional implementation, selecting the set of edge nodes with the lowest transmission latency from the distributed edge node network, and distributing each sub-packet to the set of edge nodes for buffer preheating, includes:
[0112] Construct a network topology graph between edge nodes and calculate the link overlap between two adjacent edge nodes; use the Euclidean distance between two adjacent edge nodes as an exponential term, perform an exponential operation on the product of the link overlap and the node bandwidth occupancy value to obtain the resource contention degree, and form an edge node contention vector by combining the resource contention degree of the corresponding edge node with that of other edge nodes.
[0113] The node contention degree is calculated by multiplying the norm of the edge node contention vector by the node bandwidth capacity, and then weighted and summed with the link overlap degree to obtain the contention correction coefficient. The contention correction coefficient is then multiplied by the node's transmission delay to obtain the contention weighted score.
[0114] Based on the historical location sequence of user equipment, the historical number of moves to the target location is divided by the total number of moves to obtain the location migration probability. The service request frequency of the target location is also counted. The location migration probability is multiplied by the service request frequency to obtain the load migration probability. Based on the historical location sequence, a state transition matrix is constructed. The state transition matrix is used to iteratively predict the load migration probability within a future time window to obtain the load prediction value.
[0115] The weighted sum of the competition-weighted score and the load prediction value is used as the node score. Edge nodes with node scores higher than the edge threshold are selected as the target edge node set. Sub-packets are distributed to the target edge node set for cache preheating based on the access frequency of sub-packets.
[0116] This embodiment provides a method for selecting the set of edge nodes with the minimum transmission latency in a distributed edge node network. This method can be used to distribute each sub-packet to the set of edge nodes for cache preheating.
[0117] In practical applications, edge nodes are typically located at the network edge, close to user devices, to provide low-latency services. To select the optimal set of edge nodes, this embodiment constructs a network topology diagram among the edge nodes. Assume there are 10 edge nodes in the network, labeled N1 to N... 10 Each node has its own geographical coordinates and bandwidth capacity information. For example, N1 has coordinates (10, 20) and a bandwidth capacity of 100Mbps; N2 has coordinates (15, 25) and a bandwidth capacity of 80Mbps.
[0118] For any two adjacent edge nodes, calculate their link overlap. Link overlap represents the proportion of network paths shared by the two nodes, with a value ranging from 0 to 1. For example, the link overlap between N1 and N2 is 0.6, meaning that 60% of their network paths are shared. Link overlap is calculated by analyzing the routing tables and traffic paths of the two nodes.
[0119] Next, the Euclidean distance between the two edge nodes is calculated. Taking N1 and N2 as an example, their Euclidean distance is 7.07, calculated using the coordinates of the two points. This distance is used as an exponent, and the product of the link overlap and the node's bandwidth usage is exponentially calculated to obtain the resource contention degree. Assuming that N1's bandwidth usage is 0.5 (meaning that 50% of the bandwidth capacity is currently used), the resource contention degree between N1 and N2 is calculated as (0.6 × 0.5). 7.07 The result of the exponentiation is 0.12.
[0120] For each edge node, calculate its resource contention degree with all other nodes in the network, forming an edge node contention vector. For example, the contention vector of N1 is [0, 0.12, 0.09, 0.15, 0.08, 0.11, 0.07, 0.14, 0.10], representing its contention with nodes N2 to N... 10 The degree of resource competition.
[0121] Calculate the norm of the competition vector of the edge nodes. The norm is a measure of the vector length and reflects the overall level of competition among nodes. Multiply the norm by the node's bandwidth capacity to obtain the node's competition degree. For example, if the competition vector norm of N1 is 0.32, the node competition degree is 0.32 × 100 = 32.
[0122] Combining link overlap and node contention, a contention correction coefficient is obtained through weighted summation. Assuming weights of 0.6 and 0.4 respectively, the contention correction coefficient for N1 is 0.6 × 0.6 + 0.4 × 32 = 13.24. Multiplying the contention correction coefficient by the node's transmission delay yields the contention weighted score. If N1's transmission delay is 15ms, its contention weighted score is 13.24 × 15 = 198.6.
[0123] Predicting future load based on user equipment's historical location sequence. Assume a user equipment has moved to location P1 25 times out of the past 100 moves. The location migration probability of P1 is 25 / 100 = 0.25. If the service request frequency at P1 is 10 times per hour, then the load migration probability of P1 is 0.25 × 10 = 2.5, meaning that it is expected that 2.5 requests will migrate from the user's current location to P1 per hour.
[0124] A state transition matrix is constructed based on historical location sequences to record the probability of a user moving from one location to another. For example, the probability of a user moving from location P1 to P2 is 0.3, and the probability of moving from P1 to P3 is 0.4. Using the state transition matrix, the load migration probability within a future time window is iteratively predicted. Assuming a load prediction for the next hour, through matrix multiplication iteration, the predicted load value for P1 is 3.2, indicating that 3.2 requests are expected to occur at that location.
[0125] The node score is the weighted sum of the competition-weighted score and the load prediction value. Assuming the weights are 0.7 and 0.3 respectively, the node score of N1 at position P1 is 0.7 × 198.6 + 0.3 × 3.2 = 139.98. An edge threshold of 100 is set, and edge nodes with scores higher than this threshold are selected to form the target edge node set.
[0126] Sub-packets are distributed to the target edge node set for cache preheating based on their access frequency. For example, there are three sub-packets S1, S2, and S3, with access frequencies of 100, 80, and 50 times per hour, respectively. Sub-packets with higher access frequencies are preferentially distributed to edge nodes with higher scores. If nodes N1, N3, and N5 are selected as the target edge node set, and their scores decrease sequentially, then S1 is distributed to N1, S2 to N3, and S3 to N5.
[0127] Using the above method, the system can select the optimal set of edge nodes for cache preheating based on network topology, resource contention, and user load prediction, effectively reducing user access latency and improving system performance. In practical applications, this method can flexibly adjust the weights of each parameter according to network size and business characteristics to achieve the best results.
[0128] In one optional implementation, the storage status and version information of sub-packages at edge nodes are recorded in the blockchain network, and the integrity and consistency of the sub-packages are verified through smart contracts to ensure the reliability of the sub-package content, including:
[0129] Extract the identification information, version information, and node location information of sub-packages from the edge nodes; based on the identification information of the sub-packages, read the complete content of the sub-packages, perform hash calculation on the complete content to obtain the content hash value; combine the identification information, the version information, the node location information, and the content hash value to form a sub-package status record, and store it in the blockchain network;
[0130] When a sub-packet status update is detected, the current content hash value of the sub-packet is calculated, and the current content hash value is compared with the content hash value in the sub-packet status record to generate an integrity verification result.
[0131] Obtain the version number of the sub-package stored at each edge node, determine whether the version numbers are consistent, and generate a consistency verification result;
[0132] Calculate the time difference between the sub-packet status update time and the current time, compare the time difference with a time threshold, and generate a timeliness verification result;
[0133] When the integrity verification result, the consistency verification result, and the timeliness verification result are all valid, the sub-package status is confirmed to be valid, a sub-package status record is generated, and updated to the blockchain network.
[0134] The implementation process of recording the sub-packet storage status and version information of edge nodes in a blockchain network is as follows:
[0135] The sub-packet status record of an edge node can be obtained by extracting the sub-packet's identifier, version information, and node location information. The identifier can be a unique identifier for the sub-packet, such as "pkg". 12345 Version information can be a version number, such as "v1.2.3"; node location information can be the network address of the edge node, such as "10.20.30.40:8080". After obtaining this basic information, the system will read the complete content of the sub-packet based on its identifier. For example, for a sub-packet identified as "pkg"... 12345 For each sub-packet, the system reads all its data files, configuration information, and metadata. Then, it hashes the complete content of the sub-packet using hash algorithms such as SHA-256, resulting in a 64-bit hexadecimal string, such as "8a7b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7". The system combines the identifier, version information, node location information, and content hash value into a complete sub-packet state record and submits this record to the blockchain network for storage via a smart contract. The blockchain network ensures that all nodes can obtain the same sub-packet state record through a consensus mechanism.
[0136] Regarding sub-packet state update detection and integrity verification, the system continuously monitors sub-packet state changes. When a change in the sub-packet content is detected, the system recalculates the current content hash value of the sub-packet. Assuming the sub-packet "pkg"... 12345 When the content of a sub-package is modified, the system performs a hash calculation on the modified content to obtain a new hash value, such as "9b8c7d6e5f4g3h2i1j0k9l8m7n6o5p4q3r2s1t0u9v8w7x6y5z4". Subsequently, the system reads the previous state record of that sub-package from the blockchain network and extracts its content hash value. By comparing the current hash value with the hash value in the record, the system can determine whether the sub-package content has been unauthorizedly altered. If the two hash values match, the integrity of the sub-package content is guaranteed; if they do not match, it indicates that the sub-package content has been tampered with or corrupted.
[0137] During the consistency verification process, the system obtains the version number information of the sub-packages from each edge node. For example, the system obtains the "pkg" version number from five edge nodes. 12345The version numbers are "v1.2.3", "v1.2.3", "v1.2.3", "v1.2.4", and "v1.2.3". The system compares these version numbers to determine if they are consistent. In the example above, because the version number of the fourth node is different from the other nodes, the system determines the consistency verification result to be invalid. Only when the sub-packet version numbers of all edge nodes are completely consistent will the consistency verification result be determined to be valid.
[0138] Timeliness verification is achieved by calculating the difference between the sub-package's state update time and the current time. The system retrieves the timestamp of the sub-package's most recent state update from the blockchain network, such as "2023-05-20 14:30:45". It also retrieves the current system time, such as "2023-05-20 15:30:45". The calculated time difference is 60 minutes. The system compares this time difference with a preset time threshold (e.g., 120 minutes). Since 60 minutes is less than 120 minutes, the timeliness verification result is considered valid. If the time difference exceeds the threshold, it indicates that the sub-package's state has expired and needs to be updated again.
[0139] When the results of integrity verification, consistency verification, and timeliness verification are all valid, the system will confirm the sub-package status is valid and generate a new sub-package status record. The new record will contain updated identifier information, version information, node location information, and content hash value. For example, for a sub-package identified as "pkg"... 12345 The new state record for the sub-package contains the version number "v1.2.5", the node position "10.20.30.40:8080", and the content hash value "1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7". This record will be submitted to the blockchain network via a smart contract, replacing the original state record. The blockchain network will use a consensus mechanism to ensure that all nodes are updated to the same sub-package state record.
[0140] Smart contracts play a crucial role throughout the process. They are responsible not only for storing and updating sub-package state records but also for executing verification logic. Smart contracts can define verification rules, such as hash value comparison, version number consistency checks, and timeliness threshold comparisons. When a verification operation is triggered, the smart contract executes the verification logic according to the preset rules and returns the verification result. The immutability and trusted execution environment of smart contracts ensure the fairness and reliability of the verification process.
[0141] Through the above technical means, the storage status and version information of sub-packages of edge nodes can be effectively recorded and verified in the blockchain network, ensuring the integrity, consistency and timeliness of sub-package content, and providing a reliable data management mechanism for distributed edge computing environments.
[0142] This invention relates to a hierarchical coding-based application dynamic sub-packet loading system, comprising:
[0143] The first unit is used to obtain the application's code package, generate a dependency graph based on the function call relationships of each program module in the code package, and hierarchically divide the program modules in the dependency graph, grouping program modules with the same call level into the same level.
[0144] The second unit is used to extract the call chain characteristics, memory resource usage characteristics, and update iteration frequency characteristics of the program modules in each level, and generate a multi-dimensional feature vector.
[0145] The third unit is used to calculate the feature hash value sequence of the multidimensional feature vector based on the locality-sensitive hashing algorithm, map the feature hash value sequence to the multidimensional feature space to obtain the multidimensional feature hash value; convert the multidimensional feature hash value into a position index through position encoding technology to generate the binary feature code of the program module; and aggregate the program modules to form sub-packages based on the random walk algorithm.
[0146] The fourth unit is used to receive the application's startup command, assign a hierarchy identifier, a cluster identifier, and a check bit to each sub-package, and generate the dynamic code of the sub-package.
[0147] The fifth unit is used to select the set of edge nodes with the minimum transmission latency from the distributed edge node network, distribute each sub-packet to the set of edge nodes for caching and preheating; record the storage status and version information of the sub-packets of the edge nodes in the blockchain network, and verify the integrity and consistency of the sub-packets through smart contracts to ensure the reliability of the sub-packet content;
[0148] The sixth unit is used to parse the dynamic encoding in the call request, obtain the target sub-package from the optimal edge node, and complete the loading.
[0149] A third aspect of the present invention provides an electronic device, comprising:
[0150] processor;
[0151] Memory used to store processor-executable instructions;
[0152] The processor is configured to invoke instructions stored in the memory to execute the aforementioned method.
[0153] A fourth aspect of the present invention provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the aforementioned method.
[0154] This invention can be a method, apparatus, system, and / or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for performing various aspects of the invention.
[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for dynamically loading application packages based on hierarchical coding, characterized in that, include: Obtain the application's code package and generate a dependency graph based on the function call relationships of each program module in the code package; The program modules in the dependency graph are hierarchically divided, and program modules with the same calling level are grouped into the same level; For each program module in each level, extract the call chain characteristics, memory resource usage characteristics, and update iteration frequency characteristics of the program module to generate a multi-dimensional feature vector; The feature hash value sequence of the multidimensional feature vector is calculated based on the locality-sensitive hash algorithm, and the feature hash value sequence is mapped to the multidimensional feature space to obtain the multidimensional feature hash value. The multidimensional feature hash value is converted into a position index by position encoding technology, and the binary feature code of the program module is generated. The program modules are aggregated into sub-packages based on the random walk algorithm; After receiving the application's startup command, the system assigns a hierarchy identifier, a clustering identifier, and a checksum to each sub-package and generates the dynamic encoding of the sub-package. The system selects the set of edge nodes with the lowest transmission latency from the distributed edge node network, distributes each sub-packet to the set of edge nodes for caching and preheating, records the storage status and version information of the sub-packets in the blockchain network, and verifies the integrity and consistency of the sub-packets through smart contracts to ensure the reliability of the sub-packet content. Parse the dynamic encoding in the call request, obtain the target sub-package from the optimal edge node, and complete the loading.
2. The method according to claim 1, characterized in that, Generate a dependency graph based on the function call relationships of each program module in the code package; The program modules in the dependency graph are hierarchically divided, and program modules with the same calling level are grouped into the same level, including: Obtain the function call relationships between program modules in the code package and generate a function call relationship matrix; Monitor the running status of each program module in the test environment and collect the call path length between program modules; use the call path length as an exponent to perform an exponentiation operation on the function call relationship matrix to obtain the call complexity between program modules; use the program module as a node and the call complexity as the weight value of the directed edge to generate a dependency graph. Detect circular call paths in the dependency graph and calculate the cumulative call complexity of each circular call path; when the cumulative call complexity of a circular call path is greater than a complexity threshold, select the call relationship with the highest call complexity from the circular call paths and disconnect it; Based on the dependency graph after breaking the loop call, when the call complexity between adjacent program modules is less than the level threshold, the two program modules are divided into the same level; the level division operation is repeated until all program modules have completed the level division.
3. The method according to claim 1, characterized in that, The feature hash value sequence of the multidimensional feature vector is calculated based on the locality-sensitive hashing algorithm, and the feature hash value sequence is mapped to the multidimensional feature space to obtain multidimensional feature hash values, including: Calculate the covariance matrix of the multidimensional feature vectors, and calculate the feature sensitivity based on the eigenvalue distribution of the covariance matrix; multiply the feature sensitivity by a preset parameter to obtain the number of target hash functions; randomly generate a projection vector group equal to the number of target hash functions using a normal distribution; multiply the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group; perform an inner product operation between the multidimensional feature vectors and each hash projection vector to obtain a sequence of feature hash values. Calculate the distance distribution of adjacent feature hash values in the feature hash value sequence; calculate the mean of the distance distribution, and use the mean as the density boundary value. When the distance between adjacent feature hash values is greater than the density boundary value, perform a logarithmic mapping on the corresponding feature hash values; when the distance between adjacent feature hash values is less than the density boundary value, perform a linear mapping on the corresponding feature hash values; combine the mapped hash value sequences to form a multidimensional feature hash value.
4. The method according to claim 1, characterized in that, The multidimensional feature hash value is converted into a position index by position encoding technology, and the binary feature code of the program module is generated. The program modules are aggregated into sub-packages based on the random walk algorithm, including: Calculate the data distribution entropy for each feature dimension, multiply the data distribution entropy by the multidimensional feature hash value to obtain the position index; perform a Fourier transform to convert the position index to the frequency domain space, divide the frequency domain signal into multiple frequency band signals based on the frequency distribution, and calculate the energy distribution density of each frequency band signal; The gain coefficient of each frequency band is adjusted according to the energy distribution density, and the gain is adjusted for the detailed features and structural features of each frequency band signal to obtain the multi-band signal after gain. Based on the multi-band signal after gain, the phase difference between adjacent frequency band signals is calculated, and a phase compensation factor is introduced to eliminate frequency aliasing to obtain the enhanced position index. Multiple orthogonal perturbation vectors are sequentially superimposed onto an enhanced position index to generate a multi-layer position coding sequence; the multi-layer position coding sequence is input into a projection matrix for linear transformation, and after adding a bias vector, a sign function is used to obtain a binary feature code; The binary feature encoding of the program modules is used as network nodes, and the transition probability between nodes is calculated based on Hamming distance. The random walk algorithm is executed to update the cluster labels of the nodes. The iteration stops when the rate of change of node labels in two consecutive iterations is less than the convergence threshold. Program modules with the same cluster labels are aggregated into a sub-package.
5. The method according to claim 1, characterized in that, Select the set of edge nodes with the lowest transmission latency from the distributed edge node network, and distribute each sub-packet to the set of edge nodes for buffering and warming, including: Construct a network topology graph between edge nodes and calculate the link overlap between two adjacent edge nodes; use the Euclidean distance between two adjacent edge nodes as an exponential term, perform an exponential operation on the product of the link overlap and the node bandwidth occupancy value to obtain the resource contention degree, and form an edge node contention vector by combining the resource contention degree of the corresponding edge node with that of other edge nodes. The node contention degree is calculated by multiplying the norm of the edge node contention vector by the node bandwidth capacity, and then weighted and summed with the link overlap degree to obtain the contention correction coefficient. The contention correction coefficient is then multiplied by the node's transmission delay to obtain the contention weighted score. Based on the historical location sequence of user equipment, the historical number of moves to the target location is divided by the total number of moves to obtain the location migration probability. The service request frequency of the target location is also counted. The location migration probability is multiplied by the service request frequency to obtain the load migration probability. Based on the historical location sequence, a state transition matrix is constructed. The state transition matrix is used to iteratively predict the load migration probability within a future time window to obtain the load prediction value. The weighted sum of the competition-weighted score and the load prediction value is used as the node score. Edge nodes with node scores higher than the edge threshold are selected as the target edge node set. Sub-packets are distributed to the target edge node set for cache preheating based on the access frequency of sub-packets.
6. The method according to claim 1, characterized in that, The blockchain network records the storage status and version information of sub-packages at edge nodes, and verifies the integrity and consistency of sub-packages through smart contracts to ensure the reliability of sub-package content, including: Extract the identification information, version information, and node location information of sub-packages from the edge nodes; based on the identification information of the sub-packages, read the complete content of the sub-packages, perform hash calculation on the complete content to obtain the content hash value; combine the identification information, the version information, the node location information, and the content hash value to form a sub-package status record, and store it in the blockchain network; When a sub-packet status update is detected, the current content hash value of the sub-packet is calculated, and the current content hash value is compared with the content hash value in the sub-packet status record to generate an integrity verification result. Obtain the version number of the sub-package stored at each edge node, determine whether the version numbers are consistent, and generate a consistency verification result; Calculate the time difference between the sub-packet status update time and the current time, compare the time difference with a time threshold, and generate a timeliness verification result; When the integrity verification result, the consistency verification result, and the timeliness verification result are all valid, the sub-package status is confirmed to be valid, a sub-package status record is generated, and updated to the blockchain network.
7. A hierarchical coding-based application dynamic sub-packet loading system, used to implement the method as described in any one of claims 1-6, characterized in that, include: The first unit is used to obtain the application's code package and generate a dependency graph based on the function call relationships of each program module in the code package; The program modules in the dependency graph are hierarchically divided, and program modules with the same calling level are grouped into the same level; The second unit is used to extract the call chain characteristics, memory resource usage characteristics, and update iteration frequency characteristics of the program modules in each level, and generate a multi-dimensional feature vector. The third unit is used to calculate the feature hash value sequence of the multidimensional feature vector based on the locality-sensitive hashing algorithm, and to map the feature hash value sequence to the multidimensional feature space to obtain the multidimensional feature hash value. The multidimensional feature hash value is converted into a position index by position encoding technology, and the binary feature code of the program module is generated. The program modules are aggregated into sub-packages based on the random walk algorithm; The fourth unit is used to receive the application's startup command, assign a hierarchy identifier, a cluster identifier, and a check bit to each sub-package, and generate the dynamic code of the sub-package. The fifth unit is used to select the set of edge nodes with the minimum transmission latency from the distributed edge node network, distribute each sub-packet to the set of edge nodes for caching and preheating; record the storage status and version information of the sub-packets of the edge nodes in the blockchain network, and verify the integrity and consistency of the sub-packets through smart contracts to ensure the reliability of the sub-packet content; The sixth unit is used to parse the dynamic encoding in the call request, obtain the target sub-package from the optimal edge node, and complete the loading.
8. An electronic device, characterized in that, include: processor; Memory used to store processor-executable instructions; The processor is configured to invoke instructions stored in the memory to execute the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having computer program instructions stored thereon, characterized in that, When the computer program instructions are executed by the processor, they implement the method described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and system for loading program modules
CN102810065A
Generating object code from intermediate code that includes hierarchical sub-routine information
CN107710150A