Hierarchical coding-based dynamic subpackage loading method and system for application program

Through a dynamic sub-packaging loading method based on hierarchical coding and distributed edge nodes, the problem of long startup time of large applications is solved, efficient loading and reliability verification are achieved, and user experience and system stability are improved.

CN120653328AActive Publication Date: 2025-09-16BEIJING BLOCK FAST CHAIN TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511109110.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-09-16
Estimated Expiration
2045-08-08

AI Technical Summary

Technical Problem

Existing dynamic application package loading technology has shortcomings in optimizing application startup performance and user experience, especially when loading too many resources at the startup of large applications, resulting in prolonged startup time.

Method used

A hierarchical coding-based method is adopted to perform hierarchical division by generating a dependency graph, and sub-packages are generated by combining the local sensitive hashing algorithm and the random walk algorithm. 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.

Benefits of technology

It significantly improves application loading efficiency, reduces redundant loading, optimizes startup time, improves response speed, enhances user experience, and ensures the reliability of sub-package content and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653328A_ABST
    Figure CN120653328A_ABST
Patent Text Reader

Abstract

The invention provides an application program dynamic subpackage loading method and system based on hierarchical coding, and relates to the technical field of application program loading, and the method comprises the steps: obtaining a code package, carrying out hierarchical division based on a function call relationship, extracting module features to generate a multi-dimensional vector, and generating a feature code by using locality sensitive hashing and a position coding technology; a sub-packet is formed through a random walk algorithm, a dynamic code is allocated to the sub-packet, an optimal edge node is selected to cache the sub-packet, the sub-packet is verified through a block chain, and finally on-demand loading is realized. According to the invention, the application starting time can be shortened, the network transmission load is reduced, and the loading efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of application loading, and in particular to a method and system for dynamically sub-packaging and loading an application based on hierarchical coding. Background Art

[0002] With the rapid development of the mobile internet, the scale and complexity of applications have continued to grow, leading to a continuous expansion in the size of application installation packages. Large applications require loading numerous resources upon initial launch, resulting in extended startup times and a poor user experience. To address this issue, dynamic application package loading technology has emerged. This technology splits an application into multiple independent sub-packages, loading them on demand based on actual user needs, effectively reducing the initial installation package size and optimizing startup performance.

[0003] Existing dynamic application package loading technologies are primarily based on static code analysis and manual segmentation, splitting applications into functional modules or usage scenarios. While these methods have improved application startup performance and user experience to a certain extent, some technical issues remain. Summary of the Invention

[0004] The embodiments of the present invention provide a method and system for dynamically subpackaging and loading an application based on hierarchical coding, which can solve the problems in the prior art.

[0005] A first aspect of an embodiment of the present invention provides a method for dynamically sub-packaging and loading an application based on hierarchical coding, comprising:

[0006] Obtaining a code package of the application, generating a dependency graph based on the function call relationship of each program module in the code package; dividing the program modules in the dependency graph into hierarchies, and dividing program modules with the same call hierarchy into the same hierarchy;

[0007] For each program module in each level, extract the call link features, memory resource usage features, and update iteration frequency features of the program module to generate a multi-dimensional feature vector;

[0008] Calculating a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, mapping the feature hash value sequence to a multidimensional feature space to obtain a multidimensional feature hash value; converting the multidimensional feature hash value into a position index using a position coding technique to generate a binary feature code of the program module; and aggregating the program modules into sub-packages based on a random walk algorithm;

[0009] After receiving the application startup instruction, it assigns a level identification bit, a cluster identification bit and a check bit to each sub-package, and generates a dynamic code for the sub-package;

[0010] Selecting a set of edge nodes with minimal transmission latency from a distributed edge node network and distributing each sub-package to the set of edge nodes for cache pre-warming; recording the sub-package storage status and version information of the edge nodes in the blockchain network, and verifying the integrity and consistency of the sub-package through smart contracts to ensure the reliability of the sub-package content;

[0011] Parse the dynamic code in the call request, obtain the target sub-package from the optimal edge node and complete the loading.

[0012] Generate a dependency graph based on the function call relationship of each program module in the code package; divide the program modules in the dependency graph into levels, and divide program modules with the same call level into the same level, including:

[0013] Obtaining the function call relationship between each program module in the code package and generating 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 exponential term to perform a power operation on the function call relationship matrix to obtain the call complexity between program modules; use the program modules as nodes and the call complexity as the weight value of the directed edge to generate a dependency graph;

[0015] Detecting the circular call paths in the dependency graph and calculating the cumulative call complexity of each circular call path; when the cumulative call complexity of the circular call path is greater than a complexity threshold, selecting the call relationship with the largest call complexity in the circular call path and disconnecting it;

[0016] Based on the dependency graph after breaking the circular 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] Calculating a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, and mapping the feature hash value sequence to a multidimensional feature space to obtain a multidimensional feature hash value, including:

[0018] Calculating the covariance matrix of the multidimensional feature vector, calculating the feature sensitivity based on the eigenvalue distribution of the covariance matrix; multiplying the feature sensitivity by a preset parameter to obtain a target number of hash functions; randomly generating a projection vector group equal to the target number of hash functions using a normal distribution; multiplying the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group; performing an inner product operation on the multidimensional feature vector and each hash projection vector to obtain a feature hash value sequence;

[0019] Calculate the distance distribution of adjacent feature hash values ​​in the feature hash value sequence; calculate the mean of the distance distribution, use the mean as a density cutoff value, and when the distance between adjacent feature hash values ​​is greater than the density cutoff value, perform logarithmic mapping on the corresponding feature hash values; when the distance between adjacent feature hash values ​​is less than the density cutoff value, perform linear mapping on the corresponding feature hash values; and combine the mapped hash value sequences to form a multidimensional feature hash value.

[0020] The multi-dimensional feature hash value is converted into a position index through position coding 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 of each feature dimension, multiply the data distribution entropy by the multidimensional feature hash value to obtain a position index; perform 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] Adjusting the frequency band gain coefficient according to the energy distribution density, performing gain adjustment on the detail features and structural features of each frequency band signal, and obtaining a multi-band signal after gain; calculating the phase difference of adjacent frequency band signals based on the multi-band signal after gain, introducing a phase compensation factor to eliminate frequency aliasing, and obtaining an enhanced position index;

[0023] Multiple orthogonal perturbation vectors are sequentially superimposed on the enhanced position index to generate a multi-layer position code sequence; the multi-layer position code sequence is input into the projection matrix for linear transformation, and after adding the bias vector, a sign function operation is performed to obtain a binary feature code;

[0024] The binary feature codes of program modules are used as network nodes, and the transition probability between nodes is calculated based on the Hamming distance. The random walk algorithm is executed to update the clustering labels of the nodes. The iteration is stopped when the node label change rate of two consecutive iterations is less than the convergence threshold. The program modules with the same clustering label are aggregated into a sub-package.

[0025] Selecting an edge node set with the minimum transmission delay from the distributed edge node network, and distributing each sub-packet to the edge node set for cache preheating, including:

[0026] Construct a network topology diagram between edge nodes and calculate the link overlap between two adjacent edge nodes. Use the Euclidean distance between the 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 combine the resource contention degrees of the corresponding edge node and other edge nodes to form an edge node competition vector.

[0027] Multiplying the norm of the edge node contention vector by the node bandwidth capacity to calculate the node contention degree, performing a weighted summation with the link overlap to obtain a contention correction coefficient, and multiplying the contention correction coefficient by the node's transmission delay to obtain a contention weighted score;

[0028] Based on the historical location sequence of the user device, the historical number of target location moves is divided by the total number of moves to obtain a location migration probability. The service request frequency of the target location is counted and the location migration probability is multiplied by the service request frequency to obtain a load migration probability. Based on the historical location sequence, a state transition matrix is ​​constructed and used to iteratively predict the load migration probability in a future time window to obtain a load prediction value.

[0029] The weighted sum of the competition weighted score and the load prediction value is used as the node score, and the edge nodes with node scores higher than the edge threshold are selected as the target edge node set; the sub-packets are distributed to the target edge node set for cache preheating according to the access frequency of the sub-packets.

[0030] Record the sub-package storage status and version information of edge nodes in the blockchain network, verify the integrity and consistency of the sub-package through smart contracts, and ensure the reliability of the sub-package content, including:

[0031] Extracting the identification information, version information, and node location information of the sub-package in the edge node; based on the identification information of the sub-package, reading the complete content of the sub-package, and performing a hash calculation on the complete content to obtain a content hash value; composing the identification information, the version information, the node location information, and the content hash value into a sub-package status record, and storing it in the blockchain network;

[0032] When a sub-package status update is detected, a current content hash value of the sub-package is calculated, and the current content hash value is compared with the content hash value in the sub-package status record to generate an integrity verification result;

[0033] Obtaining the version number of the sub-package stored in each edge node, determining whether the version numbers are consistent, and generating 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 the 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 an embodiment of the present invention provides a system for dynamically sub-packaging and loading an application based on hierarchical coding, comprising:

[0037] The first unit is configured to obtain a code package of an application program, generate a dependency graph based on the function call relationship of each program module in the code package, divide the program modules in the dependency graph into layers, and divide program modules with the same call layer into the same layer;

[0038] The second unit is configured to extract, for each program module in each level, call link features, memory resource usage features, and update iteration frequency features of the program module, and generate a multi-dimensional feature vector;

[0039] The third unit is configured to calculate a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, map the feature hash value sequence to a multidimensional feature space, and obtain a multidimensional feature hash value; convert the multidimensional feature hash value into a position index using a position coding technique to generate a binary feature code of a program module; and aggregate the program modules into sub-packages based on a random walk algorithm;

[0040] The fourth unit is used to allocate a level identification bit, a cluster identification bit and a check bit to each sub-packet after receiving a startup instruction of the application program, and generate a dynamic code for the sub-packet;

[0041] The fifth unit is used to select a set of edge nodes with the minimum transmission delay from the distributed edge node network, distribute each sub-package to the set of edge nodes for cache preheating, record the sub-package storage status and version information of the edge nodes in the blockchain network, and verify the integrity and consistency of the sub-package through smart contracts to ensure the reliability of the sub-package content;

[0042] The sixth unit is used to parse the dynamic code in the call request, obtain the target sub-package from the optimal edge node and complete the loading.

[0043] According to a third aspect of the embodiments of the present invention,

[0044] An electronic device is provided, comprising:

[0045] processor;

[0046] a memory for storing processor-executable instructions;

[0047] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0048] According to a fourth aspect of the embodiments of the present invention,

[0049] A computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.

[0050] The beneficial effects of this application are as follows:

[0051] This invention significantly improves application loading efficiency through a dynamic subpackaging and loading method based on hierarchical coding. By employing hierarchical division and feature coding techniques, program modules can be effectively organized based on call relationships and resource characteristics, reducing redundant loading and optimizing startup time.

[0052] The present invention introduces a distributed edge node caching mechanism. By selecting a set of edge nodes with the smallest transmission delay to distribute and preheat sub-packets, it significantly reduces network transmission delay, improves the response speed of applications, and enhances user experience. It is particularly suitable for usage scenarios with complex and changeable network conditions.

[0053] This invention combines blockchain technology and smart contract verification mechanism to ensure the integrity, consistency and reliability of sub-package content, effectively solves the code package version management and security issues in a distributed environment, and at the same time improves the system's fault tolerance and stability, providing reliable protection for the dynamic update and long-term maintenance of applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A schematic diagram of a flow chart of a method for dynamically sub-packaging and loading an application based on hierarchical coding according to an embodiment of the present invention;

[0055] Figure 2 Schematic diagram of the position encoding and program module aggregation architecture. DETAILED DESCRIPTION

[0056] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0057] The following specific embodiments are used to describe the technical solution of the present invention in detail. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0058] Figure 1 FIG. 1 is a flow chart of a method for dynamically subpackaging and loading an application based on hierarchical coding according to an embodiment of the present invention. Figure 1 As shown, the method includes:

[0059] Obtaining a code package of the application, generating a dependency graph based on the function call relationship of each program module in the code package; dividing the program modules in the dependency graph into hierarchies, and dividing program modules with the same call hierarchy into the same hierarchy;

[0060] For each program module in each level, extract the call link features, memory resource usage features, and update iteration frequency features of the program module to generate a multi-dimensional feature vector;

[0061] Calculating a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, mapping the feature hash value sequence to a multidimensional feature space to obtain a multidimensional feature hash value; converting the multidimensional feature hash value into a position index using a position coding technique to generate a binary feature code of the program module; and aggregating the program modules into sub-packages based on a random walk algorithm;

[0062] After receiving the application startup instruction, it assigns a level identification bit, a cluster identification bit and a check bit to each sub-package, and generates a dynamic code for the sub-package;

[0063] Selecting a set of edge nodes with minimal transmission latency from a distributed edge node network and distributing each sub-package to the set of edge nodes for cache pre-warming; recording the sub-package storage status and version information of the edge nodes in the blockchain network, and verifying the integrity and consistency of the sub-package through smart contracts to ensure the reliability of the sub-package content;

[0064] Parse the dynamic code in the call request, obtain the target sub-package from the optimal edge node and complete the loading.

[0065] In an optional embodiment, a dependency graph is generated based on the function call relationship of each program module in the code package; and program modules in the dependency graph are hierarchically divided into levels, and program modules with the same call level are divided into the same level, including:

[0066] Obtaining the function call relationship between each program module in the code package and generating 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 exponential term to perform a power operation on the function call relationship matrix to obtain the call complexity between program modules; use the program modules as nodes and the call complexity as the weight value of the directed edge to generate a dependency graph;

[0068] Detecting the circular call paths in the dependency graph and calculating the cumulative call complexity of each circular call path; when the cumulative call complexity of the circular call path is greater than a complexity threshold, selecting the call relationship with the largest call complexity in the circular call path and disconnecting it;

[0069] Based on the dependency graph after breaking the circular 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] According to the method, the dependencies between program modules in a code package can be effectively analyzed and the levels can be reasonably divided. The method is specifically implemented as follows:

[0071] In an actual application, the system obtains the function call relationship between each program module in the code package and generates a function call relationship matrix. For example, for a code package containing modules A, B, C, D, and E, the static code analysis tool extracts the function call information and identifies the call dependencies between modules. Assume that 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, a 5×5 function call relationship matrix M is generated. In this matrix, the element M i,j Indicates whether module i calls module j, which is 1 if it does, and 0 otherwise. In this example, M 0,1 =1 means module A calls module B, M 0,2 =1 means module A calls module C, M 1,3 =1 means module B calls module D, and so on.

[0072] The system is deployed in a test environment, monitoring the code package and collecting the call path lengths between program modules. Through tracking or log analysis, the path information for each call is recorded. For example, monitoring reveals 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), calculate their average call path length L. ij .

[0073] The system uses the collected call path length as an exponential term and performs a power operation on the function call relationship matrix to obtain the call complexity between program modules. Specifically, for the call complexity C between module i and module j, ij , if module i directly calls module j, then C ij L equal to a base complexity value (such as 1.0) ij power; if there is no direct call, C ij is 0. For example, if the average call path length from module A to module D is 2, then the complexity C AD The system fills these calculated complexity values ​​into a new matrix to form the call complexity matrix C.

[0074] Based on the call complexity matrix, the system uses program modules as nodes and call complexity as the weight value of directed edges to generate a dependency graph G. In graph G, each node represents a program module, and the directed edge from node i to node j represents module i calling module j. The weight of the edge is the call complexity C. ij For example, the edge weight from node A to node B is C AB , which represents the complexity of module A calling module B.

[0075] The system detects circular call paths in the dependency graph G. Using a depth-first search algorithm, it finds all paths that start from a node and 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 call path exceeds the preset complexity threshold (for example, set to 2.5), the system selects the call relationship with the largest call complexity in the loop path and disconnects it. Assume that the cumulative complexity of A→C→E→A is 3.0, which exceeds the threshold of 2.5, and C EA If the maximum is 1.5, the system will disconnect the call relationship from E to A and update the dependency graph. The disconnection operation can be achieved by setting the corresponding complexity value to 0, that is, setting C EA =0.

[0077] Based on the dependency graph after breaking the loop call, the system performs hierarchical division. When the call complexity C between adjacent program modules i and j is ij When the value of C is less than the threshold value (e.g. set to 0.8), the two program modules are classified into the same level. AB =0.7 is less than the level threshold 0.8, then modules A and B are classified into the same level.

[0078] The system repeats this hierarchical division process until all program modules have been divided into different levels. During the division 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 assigned to the same level. This transfer relationship ultimately results in a complete hierarchical division. For example, the final hierarchical division might be: 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 above hierarchical division results can intuitively reflect the dependency structure of program modules within a code package, helping developers understand code organization and optimize module design. For example, it can be seen that modules in the first level are heavily dependent on modules in other levels, so their stability should be focused on. Modules in the third level have many dependencies, so it is necessary to consider reducing their external dependencies and improving cohesion. In this way, development teams can better manage code complexity and improve system maintainability.

[0080] In an optional embodiment, calculating a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, mapping the feature hash value sequence to a multidimensional feature space, and obtaining a multidimensional feature hash value includes:

[0081] Calculating the covariance matrix of the multidimensional feature vector, calculating the feature sensitivity based on the eigenvalue distribution of the covariance matrix; multiplying the feature sensitivity by a preset parameter to obtain a target number of hash functions; randomly generating a projection vector group equal to the target number of hash functions using a normal distribution; multiplying the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group; performing an inner product operation on the multidimensional feature vector and each hash projection vector to obtain a feature hash value sequence;

[0082] Calculate the distance distribution of adjacent feature hash values ​​in the feature hash value sequence; calculate the mean of the distance distribution, use the mean as a density cutoff value, and when the distance between adjacent feature hash values ​​is greater than the density cutoff value, perform logarithmic mapping on the corresponding feature hash values; when the distance between adjacent feature hash values ​​is less than the density cutoff value, perform linear mapping on the corresponding feature hash values; and combine the mapped hash value sequences to form a multidimensional feature hash value.

[0083] In this embodiment, a method for calculating a feature hash value sequence of a multidimensional feature vector based on a 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 and its covariance matrix is ​​calculated. The covariance matrix reflects the correlation between the dimensions of the feature vector. Specifically, assuming that 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 the 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 above 5×5 covariance matrix, five eigenvalues ​​can be obtained: 5.83, 2.76, 1.54, 1.14, and 0.73. Normalizing these five eigenvalues, the sensitivities obtained are 0.486, 0.230, 0.128, 0.09, and 0.061.

[0086] Multiply the calculated feature sensitivity by the preset parameter to obtain the target number of hash functions. The preset parameter can be set based on the actual application scenario and requirements, for example, 100. Assuming the calculated feature sensitivity is 0.8, the target number of hash functions is 0.8 × 100 = 80.

[0087] Use a normal distribution to randomly generate a set of projection vectors equal to the number of target hash functions. In this example, 80 projection vectors are required, each with the same dimensions as the original feature vector, i.e., 128 dimensions. These projection vectors can be generated by randomly sampling from a normal distribution with mean 0 and standard deviation 1.

[0088] Multiply the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group. For example, if the feature sensitivity is 0.8, then multiply each component of each projection vector by 0.8 to obtain 80 scaled hash projection vectors.

[0089] The inner product operation is performed on the multidimensional feature vector and each hash projection vector to obtain a feature hash value sequence. In this example, the inner product operation is performed on the 128-dimensional feature vector and 80 hash projection vectors to obtain a feature hash value sequence of length 80.

[0090] Calculate the distance distribution between adjacent feature hash values ​​in the feature hash value sequence. Specifically, for a feature hash value sequence of length 80, calculate the absolute value of the difference between adjacent elements, obtaining 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. In the above example, the mean of the distance distribution is (0.6+1.3+2.4) / 3 = 1.43, which is used as the density cutoff.

[0092] The feature hash values ​​are mapped based on the comparison between the distance between adjacent feature hash values ​​and the density cutoff value. When the distance between adjacent feature hash values ​​is greater than the density cutoff value, the corresponding feature hash values ​​are logarithmically mapped; when the distance between adjacent feature hash values ​​is less than the density cutoff value, the corresponding feature hash values ​​are linearly mapped.

[0093] Logarithmic mapping can be achieved by taking the logarithm of the feature hash value. For example, if the feature hash value is 10, the 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, the 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 cutoff is 1.43. The first distance, 0.6, is less than the density cutoff of 1.43. The corresponding feature hash values ​​2.5 and 3.1 are linearly mapped to 0.25 and 0.31, respectively. The second distance, 1.3, is less than the density cutoff of 1.43. The corresponding feature hash values ​​3.1 and 1.8 are linearly mapped to 0.31 and 0.18, respectively. The third distance, 2.4, is greater than the density cutoff of 1.43. The corresponding feature hash values ​​1.8 and 4.2 are logarithmically mapped to 0.26 and 0.62, respectively. The fourth distance, 2.8, is greater than the density cutoff of 1.43. The corresponding feature hash values ​​4.2 and 7.0 are logarithmically mapped to 0.62 and 0.85, respectively.

[0095] The mapped hash value sequence is combined to form a multi-dimensional feature hash value. In the above example, the mapped hash value sequence is [0.25, 0.31, 0.18, 0.26, 0.62, 0.85], which is combined into a multi-dimensional feature hash value.

[0096] Through this process, the original high-dimensional feature vector is converted into a more compact multi-dimensional feature hash value, which not only retains the key information of the original feature but also greatly reduces the data dimension and improves the efficiency of feature matching. This method based on local 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 based on specific data characteristics and application requirements to achieve optimal feature representation. 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 position coding and program module aggregation architecture. In an optional implementation, the multi-dimensional feature hash value is converted into a position index through position coding technology to generate a binary feature code for the program module; the program modules are aggregated into sub-packages based on a random walk algorithm, including:

[0099] Calculate the data distribution entropy of each feature dimension, multiply the data distribution entropy by the multidimensional feature hash value to obtain a position index; perform 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] Adjusting the frequency band gain coefficient according to the energy distribution density, performing gain adjustment on the detail features and structural features of each frequency band signal, and obtaining a multi-band signal after gain; calculating the phase difference of adjacent frequency band signals based on the multi-band signal after gain, introducing a phase compensation factor to eliminate frequency aliasing, and obtaining an enhanced position index;

[0101] Multiple orthogonal perturbation vectors are sequentially superimposed on the enhanced position index to generate a multi-layer position code sequence; the multi-layer position code sequence is input into the projection matrix for linear transformation, and after adding the bias vector, a sign function operation is performed to obtain a binary feature code;

[0102] The binary feature codes of program modules are used as network nodes, and the transition probability between nodes is calculated based on the Hamming distance. The random walk algorithm is executed to update the clustering labels of the nodes. The iteration is stopped when the node label change rate of two consecutive iterations is less than the convergence threshold. The program modules with the same clustering label are aggregated into a sub-package.

[0103] This embodiment provides a method for converting a multi-dimensional feature hash value into a position index and generating a binary feature code of a program module. The method also includes aggregating the program modules into sub-packages based on a random walk algorithm.

[0104] In the specific implementation process, the multi-dimensional feature hash value of the program module is obtained. For example, the features extracted from the program module include function call relationships, control flow graph features, data flow features, etc. These features are converted into a 128-dimensional feature vector through a hash function. The value range of each element in the vector is [-1, 1]. For each feature dimension, the data distribution entropy is calculated. Taking the i-th dimension as an example, the data of this dimension can be divided into 10 equal-width intervals, and the probability distribution of the data points in each interval is statistically analyzed. Assuming that the probability of the j-th interval is p ij , then the data distribution entropy of this dimension can be obtained by accumulating -p ij ×log(p ij). The calculated entropy value is typically in the range [0, log(10)]. For example, for uniformly distributed data, the entropy is close to 2.30, while for highly concentrated distributions, the entropy is close to 0.3. The calculated data distribution entropy is multiplied by the feature hash value of the corresponding dimension to obtain the position index. For example, if the feature hash value of a dimension is 0.75 and the entropy value is 1.8, the corresponding position index component is 1.35.

[0105] Perform a Fourier transform to convert the position index into the frequency domain. Using a 128-dimensional position index as an example, the Fast Fourier Transform algorithm yields 64 complex-valued frequency domain signals. The frequency domain signals are divided into four frequency bands based on frequency: 0-15 Hz for the low frequency band, 16-31 Hz for the mid-low frequency band, 32-47 Hz for the mid-high frequency band, and 48-63 Hz for the high frequency band. The energy distribution density is calculated for each frequency band. For example, the energy density of the low frequency band is the sum of the squared signal amplitudes within that band divided by the band width. The resulting energy densities for the four bands are [8.2, 4.5, 2.1, 0.9].

[0106] The frequency band gain coefficients are 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 adjustments are performed separately for structural features (low-frequency signals) and detail features (high-frequency signals). The signal amplitude in each frequency band is multiplied 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 band and the mid-low frequency band, 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 signals at the frequency band boundary to obtain an enhanced position index.

[0107] To generate a multi-layer positional encoding sequence, four orthogonal perturbation vectors are created, each with the same dimension as the enhanced position index. These perturbation vectors are obtained through Gram-Schmidt orthogonalization, and their elements range from [-0.1, 0.1]. These perturbation vectors are sequentially added to the enhanced position index to generate a four-layer positional encoding sequence. For example, the first layer is the original enhanced position index, the second layer is the enhanced position index plus the first perturbation vector, and so on.

[0108] The multi-layer position code sequence is linearly transformed by inputting it into a projection matrix. The projection matrix is ​​256×128 in size, and its elements are randomly initialized within the range [-0.05, 0.05]. Each of the four layers of position code sequences is transformed through this matrix, resulting in four 256-dimensional vectors. A 256-dimensional bias vector, with all elements set to 0.01, is added to these vectors. After the bias is added, 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 is "1010...0101."

[0109] The binary feature code of the program module is used as a network node, and the transition probability between nodes is calculated based on the Hamming distance. For any two nodes i and j, the Hamming distance is the number of different bits in the corresponding binary feature code, for example, 80. The transition probability P ij Set to exp(-Hamming distance / 50), for example, exp(-80 / 50) ≈ 0.2. After constructing the transition probability matrix, the random walk algorithm is executed to update the cluster labels of the nodes. Initially, each node is assigned a unique label. In each iteration, the node retains the original label (with a probability of 0.3) or adopts the label of its neighbor node (with a probability of 0.7×P ij For example, if the initial label of node A is 1, the label of its neighbor node B is 2, and the transition probability is 0.2, then node A has a probability of 0.7×0.2=0.14 to update its label to 2 in the next iteration.

[0110] During the iteration process, the node label change rate is calculated after each iteration, that is, the ratio of nodes with changed labels to the total number of nodes. Iterations are terminated when the node label change rate for two consecutive iterations is less than a convergence threshold (e.g., 0.05). Finally, program modules with the same cluster label are clustered into a sub-package. For example, all program modules with label 3 are clustered 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 an optional embodiment, selecting an edge node set with the minimum transmission delay from a distributed edge node network and distributing each sub-packet to the edge node set for cache preheating includes:

[0112] Construct a network topology diagram between edge nodes and calculate the link overlap between two adjacent edge nodes. Use the Euclidean distance between the 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 combine the resource contention degrees of the corresponding edge node and other edge nodes to form an edge node competition vector.

[0113] Multiplying the norm of the edge node contention vector by the node bandwidth capacity to calculate the node contention degree, performing a weighted summation with the link overlap to obtain a contention correction coefficient, and multiplying the contention correction coefficient by the node's transmission delay to obtain a contention weighted score;

[0114] Based on the historical location sequence of the user device, the historical number of target location moves is divided by the total number of moves to obtain a location migration probability. The service request frequency of the target location is counted and the location migration probability is multiplied by the service request frequency to obtain a load migration probability. Based on the historical location sequence, a state transition matrix is ​​constructed and used to iteratively predict the load migration probability in a future time window to obtain a load prediction value.

[0115] The weighted sum of the competition weighted score and the load prediction value is used as the node score, and the edge nodes with node scores higher than the edge threshold are selected as the target edge node set; the sub-packets are distributed to the target edge node set for cache preheating according to the access frequency of the sub-packets.

[0116] This embodiment provides a method for selecting an edge node set with the minimum transmission delay in a distributed edge node network. The method can be used to distribute each sub-packet to the edge node set for cache preheating.

[0117] In actual application scenarios, edge nodes are usually distributed at the edge of the network, close to user devices, to provide low-latency services. In order to select the optimal set of edge nodes, this embodiment constructs a network topology diagram between edge nodes. Assume that there are 10 edge nodes in the network, marked as N1 to N 10 Each node has its geographic coordinates and bandwidth capacity information. For example, N1's coordinates are (10, 20) and its bandwidth capacity is 100 Mbps; N2's coordinates are (15, 25) and its bandwidth capacity is 80 Mbps.

[0118] For any two adjacent edge nodes, calculate the link overlap between them. Link overlap indicates the proportion of network paths shared by two nodes, with a value ranging from 0 to 1. For example, if the link overlap between N1 and N2 is 0.6, it means that they share 60% of their network paths. Link overlap is calculated by analyzing the routing tables and traffic paths of the two nodes.

[0119] Next, calculate the Euclidean distance between two edge nodes. For example, N1 and N2 have a Euclidean distance of 7.07, calculated using the coordinates of the two points. Using this distance as an exponential term, perform an exponential operation on the product of link overlap and node bandwidth utilization to obtain the resource contention. Assuming N1's bandwidth utilization is 0.5 (indicating 50% of its bandwidth capacity is currently utilized), the resource contention between N1 and N2 is calculated as (0.6 × 0.5). 7.07 The result of the exponential operation is 0.12.

[0120] For each edge node, calculate its resource contention with all other nodes in the network to form the edge node competition vector. For example, the competition vector of N1 is [0, 0.12, 0.09, 0.15, 0.08, 0.11, 0.07, 0.14, 0.10], which respectively represent the competition with N2 to N 10 resource competition.

[0121] Calculate the norm of the edge node's contention vector. The norm is a measure of vector length and reflects the overall degree of node contention. Multiply the norm by the node's bandwidth capacity to obtain the node's contention level. For example, if the norm of N1's contention vector is 0.32, the node contention level is 0.32 × 100 = 32.

[0122] The contention correction factor is calculated by combining the link overlap and node contention, taking a weighted sum. Assuming the weights are 0.6 and 0.4, respectively, N1's contention correction factor is 0.6 × 0.6 + 0.4 × 32 = 13.24. Multiplying the contention correction factor by the node's transmission delay yields a weighted contention score. If N1's transmission delay is 15 ms, its weighted contention score is 13.24 × 15 = 198.6.

[0123] Predict future load based on the user device's historical location sequence. Assume that a user device moved to location P1 25 times out of the past 100 movements. The probability of P1's location migration is 25 / 100 = 0.25. If P1's service request frequency is 10 per hour, the probability of P1's load migration is 0.25 × 10 = 2.5, indicating that 2.5 requests are expected to migrate from the user's current location to P1 per hour.

[0124] A state transition matrix is ​​constructed based on the historical location sequence, recording 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, we iteratively predict the probability of load migration within future time windows. Assuming the load is predicted for the next hour, through iterative matrix multiplication, the load prediction value for P1 is 3.2, indicating that 3.2 requests are expected to be generated at this 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. Set the edge threshold to 100 and select edge nodes with node scores above this threshold to form the target edge node set.

[0126] Distribute sub-packets to a target set of edge nodes based on their access frequency for cache preheating. For example, consider three sub-packets, S1, S2, and S3, with access frequencies of 100, 80, and 50 times per hour, respectively. Sub-packets with high access frequencies are preferentially distributed to edge nodes with high scores. If nodes N1, N3, and N5 are selected as the target edge node set, and their scores decrease in descending order, S1 is distributed to N1, S2 to N3, and S3 to N5.

[0127] Through this method, the system can select the optimal set of edge nodes for cache preheating based on network topology, resource contention, and user load forecasts, effectively reducing user access latency and improving system performance. In practical applications, this method can flexibly adjust the weights of various parameters based on network scale and service characteristics to achieve optimal results.

[0128] In an optional implementation, the sub-package storage status and version information of the edge node is recorded in the blockchain network, and the integrity and consistency of the sub-package are verified through a smart contract to ensure the reliability of the sub-package content, including:

[0129] Extracting the identification information, version information, and node location information of the sub-package in the edge node; based on the identification information of the sub-package, reading the complete content of the sub-package, and performing a hash calculation on the complete content to obtain a content hash value; composing the identification information, the version information, the node location information, and the content hash value into a sub-package status record, and storing it in the blockchain network;

[0130] When a sub-package status update is detected, a current content hash value of the sub-package is calculated, and the current content hash value is compared with the content hash value in the sub-package status record to generate an integrity verification result;

[0131] Obtaining the version number of the sub-package stored in each edge node, determining whether the version numbers are consistent, and generating 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 the 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 the method for recording the sub-package storage status and version information of the edge node in the blockchain network is as follows:

[0135] The sub-package status record of the edge node can be realized by extracting the identification information, version information and node location information of the sub-package. The identification information can be a unique identifier of the sub-package, 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 these basic information, the system will read the complete content of the sub-package based on the identification information of the sub-package. For example, for a package identified as "pkg 12345 ", the system reads all its data files, configuration information, metadata, and other contents. It then hashes the complete contents of the sub-package using a hash algorithm such as SHA-256, resulting in a 64-bit hexadecimal string, such as "8a7b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7". The system combines identification information, version information, node location information, and content hash value into a complete sub-package status record and submits this record to the blockchain network for storage through a smart contract. The blockchain network uses a consensus mechanism to ensure that all nodes can obtain the same sub-package status record.

[0136] In terms of sub-package status update detection and integrity verification, the system will continuously monitor the status changes of sub-packages. When a sub-package content change is detected, the system will recalculate the current content hash value of the sub-package. Assume that the sub-package "pkg 12345 If the content of a sub-package is modified, the system will hash the modified content to obtain a new hash value, such as "9b8c7d6e5f4g3h2i1j0k9l8m7n6o5p4q3r2s1t0u9v8w7x6y5z4". The system will then read the previous status record of the sub-package from the blockchain network and extract the 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 modified without authorization. If the two hash values ​​are consistent, the integrity of the sub-package content is guaranteed; if they are inconsistent, it indicates that the sub-package content has been tampered with or damaged.

[0137] During the consistency verification process, the system will obtain the sub-package version number information from each edge node. For example, the system obtains "pkg 12345The system compares these version numbers to determine whether they are consistent. In the above example, because the version number of the fourth node is different from that of the other nodes, the system will determine that the consistency verification result is invalid. The consistency verification result is only considered valid when the sub-package version numbers of all edge nodes are exactly the same.

[0138] Timeliness verification is achieved by calculating the difference between the sub-package status update time and the current time. The system obtains the timestamp of the sub-package's most recent status update from the blockchain network, such as "2023-05-20 14:30:45." The system obtains 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 (for example, 120 minutes). Since 60 minutes is less than 120 minutes, the timeliness verification result is deemed valid. If the time difference exceeds the threshold, the sub-package status has expired and needs to be updated.

[0139] When the results of integrity verification, consistency verification, and timeliness verification are all valid, the system will confirm that the sub-package status is valid and generate a new sub-package status record. The new record will contain the updated identification information, version information, node location information, and content hash value. For example, for a package identified as "pkg 12345 The new state record for the subpackage contains version number "v1.2.5", node location "10.20.30.40:8080", and content hash value "1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t1u2v3w4x5y6z7". This record will be submitted to the blockchain network through 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 subpackage state record.

[0140] Smart contracts play a key role in this entire process. They are responsible not only for storing and updating sub-package status records but also for executing verification logic. Smart contracts can define verification rules, such as hash value comparisons, version number consistency checks, and timeliness threshold comparisons. When a verification action is triggered, the smart contract executes the verification logic according to the pre-set rules and returns the verification results. The immutability of smart contracts and the trusted execution environment ensure the fairness and reliability of the verification process.

[0141] Through the above technical means, the sub-package storage status and version information of the edge node can be effectively recorded and verified in the blockchain network, ensuring the integrity, consistency and timeliness of the sub-package content, and providing a reliable data management mechanism for the distributed edge computing environment.

[0142] The embodiment of the present invention provides a system for dynamically subpackaging and loading applications based on hierarchical coding, including:

[0143] The first unit is configured to obtain a code package of an application program, generate a dependency graph based on the function call relationship of each program module in the code package, divide the program modules in the dependency graph into layers, and divide program modules with the same call layer into the same layer;

[0144] The second unit is configured to extract, for each program module in each level, call link features, memory resource usage features, and update iteration frequency features of the program module, and generate a multi-dimensional feature vector;

[0145] The third unit is configured to calculate a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, map the feature hash value sequence to a multidimensional feature space, and obtain a multidimensional feature hash value; convert the multidimensional feature hash value into a position index using a position coding technique to generate a binary feature code of a program module; and aggregate the program modules into sub-packages based on a random walk algorithm;

[0146] The fourth unit is used to allocate a level identification bit, a cluster identification bit and a check bit to each sub-packet after receiving a startup instruction of the application program, and generate a dynamic code for the sub-packet;

[0147] The fifth unit is used to select a set of edge nodes with the minimum transmission delay from the distributed edge node network, distribute each sub-package to the set of edge nodes for cache preheating, record the sub-package storage status and version information of the edge nodes in the blockchain network, and verify the integrity and consistency of the sub-package through smart contracts to ensure the reliability of the sub-package content;

[0148] The sixth unit is used to parse the dynamic code in the call request, obtain the target sub-package from the optimal edge node and complete the loading.

[0149] According to a third aspect of an embodiment of the present invention, an electronic device is provided, including:

[0150] processor;

[0151] a memory for storing processor-executable instructions;

[0152] The processor is configured to call the instructions stored in the memory to execute the aforementioned method.

[0153] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described above is implemented.

[0154] The present invention may be a method, an apparatus, a system and / or a computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for executing various aspects of the present invention.

[0155] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements 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 subpackaging and loading an application based on hierarchical coding, characterized in that: include: Obtain the code package of the application and generate a dependency graph based on the function call relationship of each program module in the code package; Dividing the program modules in the dependency graph into different levels, and dividing the program modules with the same calling level into the same level; For each program module in each level, extract the call link features, memory resource usage features, and update iteration frequency features of the program module to generate a multi-dimensional feature vector; Calculating a feature hash value sequence of the multidimensional feature vector based on a local sensitive hashing algorithm, and mapping the feature hash value sequence to a multidimensional feature space to obtain a multidimensional feature hash value; The multi-dimensional feature hash value is converted into a position index through the position coding technology to generate the binary feature code of the program module; Aggregate program modules into sub-packages based on random walk algorithm; After receiving the application startup instruction, it assigns a level identification bit, a cluster identification bit and a check bit to each sub-package, and generates a dynamic code for the sub-package; Selecting a set of edge nodes with minimal transmission latency from a distributed edge node network and distributing each sub-package to the set of edge nodes for cache pre-warming; recording the sub-package storage status and version information of the edge nodes in the blockchain network, and verifying the integrity and consistency of the sub-package through smart contracts to ensure the reliability of the sub-package content; Parse the dynamic code 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 relationship of each program module in the code package; Divide the program modules in the dependency graph into different levels, and divide the program modules with the same calling level into the same level, including: Obtaining the function call relationship between each program module in the code package and generating 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 exponential term to perform a power operation on the function call relationship matrix to obtain the call complexity between program modules; use the program modules as nodes and the call complexity as the weight value of the directed edge to generate a dependency graph; Detecting the circular call paths in the dependency graph and calculating the cumulative call complexity of each circular call path; when the cumulative call complexity of the circular call path is greater than a complexity threshold, selecting the call relationship with the largest call complexity in the circular call path and disconnecting it; Based on the dependency graph after breaking the circular 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 Calculating a feature hash value sequence of the multidimensional feature vector based on a locality sensitive hashing algorithm, and mapping the feature hash value sequence to a multidimensional feature space to obtain a multidimensional feature hash value, including: Calculating the covariance matrix of the multidimensional feature vector, calculating the feature sensitivity based on the eigenvalue distribution of the covariance matrix; multiplying the feature sensitivity by a preset parameter to obtain a target number of hash functions; randomly generating a projection vector group equal to the target number of hash functions using a normal distribution; multiplying the feature sensitivity by each projection vector in the projection vector group to obtain a hash projection vector group; performing an inner product operation on the multidimensional feature vector and each hash projection vector to obtain a feature hash value sequence; Calculate the distance distribution of adjacent feature hash values ​​in the feature hash value sequence; calculate the mean of the distance distribution, use the mean as a density cutoff value, and when the distance between adjacent feature hash values ​​is greater than the density cutoff value, perform logarithmic mapping on the corresponding feature hash values; when the distance between adjacent feature hash values ​​is less than the density cutoff value, perform linear mapping on the corresponding feature hash values; and combine the mapped hash value sequences to form a multidimensional feature hash value.

4. The method according to claim 1, wherein The multi-dimensional feature hash value is converted into a position index through the position coding technology to generate the binary feature code of the program module; Based on the random walk algorithm, program modules are aggregated into sub-packages, including: Calculate the data distribution entropy of each feature dimension, multiply the data distribution entropy by the multidimensional feature hash value to obtain a position index; perform 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; Adjusting the frequency band gain coefficient according to the energy distribution density, performing gain adjustment on the detail features and structural features of each frequency band signal, and obtaining a multi-band signal after gain; calculating the phase difference of adjacent frequency band signals based on the multi-band signal after gain, introducing a phase compensation factor to eliminate frequency aliasing, and obtaining an enhanced position index; Multiple orthogonal perturbation vectors are sequentially superimposed on the enhanced position index to generate a multi-layer position code sequence; the multi-layer position code sequence is input into the projection matrix for linear transformation, and after adding the bias vector, a sign function operation is performed to obtain a binary feature code; The binary feature codes of program modules are used as network nodes, and the transition probability between nodes is calculated based on the Hamming distance. The random walk algorithm is executed to update the clustering labels of the nodes. The iteration is stopped when the node label change rate of two consecutive iterations is less than the convergence threshold. The program modules with the same clustering label are aggregated into a sub-package.

5. The method according to claim 1, characterized in that Selecting an edge node set with the minimum transmission delay from the distributed edge node network, and distributing each sub-packet to the edge node set for cache preheating, including: Construct a network topology diagram between edge nodes and calculate the link overlap between two adjacent edge nodes. Use the Euclidean distance between the 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 combine the resource contention degrees of the corresponding edge node and other edge nodes to form an edge node competition vector. Multiplying the norm of the edge node contention vector by the node bandwidth capacity to calculate the node contention degree, performing a weighted summation with the link overlap to obtain a contention correction coefficient, and multiplying the contention correction coefficient by the node's transmission delay to obtain a contention weighted score; Based on the historical location sequence of the user device, the historical number of target location moves is divided by the total number of moves to obtain a location migration probability. The service request frequency of the target location is counted and the location migration probability is multiplied by the service request frequency to obtain a load migration probability. Based on the historical location sequence, a state transition matrix is ​​constructed and used to iteratively predict the load migration probability in a future time window to obtain a load prediction value. The weighted sum of the competition weighted score and the load prediction value is used as the node score, and the edge nodes with node scores higher than the edge threshold are selected as the target edge node set; the sub-packets are distributed to the target edge node set for cache preheating according to the access frequency of the sub-packets.

6. The method according to claim 1, characterized in that Record the sub-package storage status and version information of edge nodes in the blockchain network, verify the integrity and consistency of the sub-package through smart contracts, and ensure the reliability of the sub-package content, including: Extracting the identification information, version information, and node location information of the sub-package in the edge node; based on the identification information of the sub-package, reading the complete content of the sub-package, and performing a hash calculation on the complete content to obtain a content hash value; composing the identification information, the version information, the node location information, and the content hash value into a sub-package status record, and storing it in the blockchain network; When a sub-package status update is detected, a current content hash value of the sub-package is calculated, and the current content hash value is compared with the content hash value in the sub-package status record to generate an integrity verification result; Obtaining the version number of the sub-package stored in each edge node, determining whether the version numbers are consistent, and generating a consistency verification result; Calculate the time difference between the sub-packet status update time and the current time, compare the time difference with the 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 dynamic sub-packaging and loading system for an application, for implementing the method according to any one of claims 1 to 6, characterized in that: include: The first unit is used to obtain a code package of an application program and generate a dependency graph based on the function call relationship of each program module in the code package; Dividing the program modules in the dependency graph into different levels, and dividing the program modules with the same calling level into the same level; The second unit is configured to extract, for each program module in each level, call link features, memory resource usage features, and update iteration frequency features of the program module, and generate a multi-dimensional feature vector; The third unit is configured to calculate a feature hash value sequence of the multidimensional feature vector based on a local sensitive hashing algorithm, and map the feature hash value sequence to a multidimensional feature space to obtain a multidimensional feature hash value; The multi-dimensional feature hash value is converted into a position index through the position coding technology to generate the binary feature code of the program module; Aggregate program modules into sub-packages based on random walk algorithm; The fourth unit is used to allocate a level identification bit, a cluster identification bit and a check bit to each sub-packet after receiving a startup instruction of the application program, and generate a dynamic code for the sub-packet; The fifth unit is used to select a set of edge nodes with the minimum transmission delay from the distributed edge node network, distribute each sub-package to the set of edge nodes for cache preheating, record the sub-package storage status and version information of the edge nodes in the blockchain network, and verify the integrity and consistency of the sub-package through smart contracts to ensure the reliability of the sub-package content; The sixth unit is used to parse the dynamic code 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; a memory for storing processor-executable instructions; The processor is configured to call the 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 a processor, the method according to any one of claims 1 to 6 is implemented.

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

  • Application subpackage method and device, electronic equipment and readable storage medium

    CN116820555A

  • Code package dependency relationship detection method and device

    CN118567710A

  • System and method for integrity verification of banking application using APK file dynamic loading technique

    KR1020180025380A