Call chain data compression method and system based on information redundancy
Through the KMeans algorithm and hierarchical clustering sampling technology, combined with lossless compression, the problem of low efficiency of call chain data compression and information loss is solved, and efficient, real-time data compression and integrity preservation are achieved.
Patent Information
- Application Number
- CN202410715232.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-06-04
AI Technical Summary
Existing call chain data compression technology is inefficient when processing large amounts of structured data and cannot effectively process redundant information in the data. Moreover, lossy compression technology may cause the loss of key information, making it difficult to ensure data integrity and adapt to dynamically changing systems. environment.
The KMeans algorithm is used to extract similar data, group the call chain data, and perform sampling processing through an offline tail sampling strategy based on hierarchical clustering. After outputting the structured file, it performs lossless compression to ensure data integrity and generalization capabilities.
It achieves efficient and real-time call chain data compression, reduces storage burden and processing time, ensures data integrity and analysis value, and adapts to dynamically changing system environments.
Smart Images

Figure CN118713677A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a call chain data compression method and system based on information redundancy. Background Art
[0002] In today's distributed systems environment, a single user request may activate a sequence of operations across multiple services, which are often scattered across servers or computing nodes. This complex service interaction is carefully recorded in call chain data, or trace data, which tracks in detail the timestamp, execution path, response time, and any errors encountered for each service call. Collectively, these data form a comprehensive "trace" of the request processing, providing a transparent view of the entire process from request initiation to completion.
[0003] As the correctness and performance issues of distributed systems become more prominent, end-to-end tracing technology has become a key tool to solve these problems in the past decade. This technology can not only accurately model system load, resource usage, and time series, but also detect abnormal requests in real time, providing solid support for system stability monitoring and fault diagnosis. Its importance has been recognized in the industry, standardization work is underway, and it has been applied in multiple enterprises and development frameworks. In today's evolving technology ecosystem, the consistent view provided by end-to-end tracing has become the key to gaining insight into the complex interactions of systems across various components, layers, machines, and management domains.
[0004] However, with the expansion of system scale and the popularity of microservice architecture, the recording of call chain data has become more critical and more challenging. This data is not only essential for the continuous operation of the system, rapid fault location and performance monitoring, but also the volume of data has shown exponential growth as the complexity of the system increases. Such growth has brought unprecedented challenges to data storage, processing and analysis, and innovative technical solutions are urgently needed to cope with it. Therefore, it has become urgent to develop effective call chain data compression methods to reduce storage costs and improve processing efficiency.
[0005] With the development of information technology, distributed systems, especially microservice architectures, have become increasingly common. In these systems, the management of call chain data or trace data is crucial for system performance monitoring and fault diagnosis. Call chain data records the mutual calls and responses between services in detail, providing necessary information for optimizing system performance. However, with the increase in the number of services, the amount of call chain data has expanded dramatically, and traditional data storage and processing methods have been unable to meet the needs of modern applications.
[0006] Existing text compression technologies can be divided into two categories:
[0007] (1) Lossless compression technology: Lossless compression technology ensures that data can be completely restored to its original state after compression. Common algorithms include:
[0008] Entropy coding methods: such as Huffman coding and arithmetic coding, these methods optimize the code length based on the probability model of the data and are applicable to various data types, including text and images.
[0009] Dictionary encoding method: such as GZIP and LZMA, which identifies and replaces repeated data sequences by establishing a dictionary and is widely used in file compression.
[0010] Predictive coding methods, such as PPMd and DeepZip, rely on historical data to predict future data and then encode the prediction results.
[0011] (2) Lossy compression technology: Lossy compression technology provides a higher compression ratio while allowing for the loss of some data. Common methods include:
[0012] Uniform random sampling: simplifies the data set, but may ignore the potential value of the data and cause key information to be lost.
[0013] Feature-based biased sampling: Selectively sample based on the “interestingness” or information richness of the data, which is more suitable for dynamic and changing call chain data types.
[0014] The above-mentioned related technologies have the following disadvantages:
[0015] (1) Limitations of lossless compression techniques: Although lossless compression techniques can maintain data integrity, they usually face the following challenges:
[0016] Low efficiency: When processing large amounts of structured data, such as call chain data, existing lossless compression algorithms often cannot effectively handle redundant information in the data, resulting in limited compression ratios and processing speeds. High complexity: Efficient lossless compression algorithms such as arithmetic coding require high computing resources, which is not practical in resource-constrained environments or where fast responses are required. Poor generalization: Predictive coding methods rely on the analysis of historical data, and the models trained by these methods have limited generalization capabilities and may not work well when faced with variable data distributions.
[0017] (2) Disadvantages of lossy compression technology: Although lossy compression technology can improve the efficiency of data processing, it has the following problems: Data loss: Lossy compression methods such as sampling discard some data to reduce storage requirements, but this method often fails to ensure the integrity of key data and may lead to the loss of important information. Low coverage: Uniform random sampling technology cannot effectively capture abnormal or rare execution paths, which is particularly important for fault diagnosis and system performance optimization. Complex configuration: Advanced lossy compression technology requires complex configuration and tuning. For dynamically changing system environments, this method lacks adaptability and flexibility. Summary of the invention
[0018] In view of this, an embodiment of the present invention provides an efficient and real-time call chain data compression method and system based on information redundancy to ensure data integrity and enhance generalization capabilities.
[0019] An aspect of an embodiment of the present invention provides a call chain data compression method based on information redundancy, comprising the following steps:
[0020] For the collected call chain data, the KMeans algorithm is used to extract similar data, and the data points in the call chain data are grouped to obtain various cluster groups; wherein, the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low;
[0021] The clustering group is sampled using an offline tail sampling strategy based on hierarchical clustering, and a structured file is output;
[0022] The structured file is losslessly compressed by using a lossless compression method to complete the compression of the call chain data.
[0023] Optionally, the method of extracting similar data from the collected call chain data using a KMeans algorithm, grouping data points in the call chain data to obtain cluster groups includes the following steps:
[0024] The call chain data of microservices is collected through the OpenTe lemetry framework, and processed by a graph generation unit constructed by a networkx library function to obtain a corresponding directed graph; wherein the directed graph is used to represent the call relationship between each service component in the call chain data;
[0025] Processing the nodes in the directed graph by applying the Node2Vec algorithm through a node vectorization unit to convert the node data in the graph structure into a vector form;
[0026] The vectorized node data is normalized by using a standardization tool through a standardization processing unit to obtain a standardized data stream;
[0027] Performing feature selection on the standardized data stream by a feature selection unit to obtain a target feature set;
[0028] The Kmeans algorithm is implemented by the clustering processing unit to cluster the data points, and the data is divided into a plurality of different clusters, each of which has a corresponding cluster label.
[0029] Optionally, the adopting of the offline tail sampling strategy based on hierarchical clustering to perform sampling processing on the cluster group and outputting a structured file comprises the following steps:
[0030] Calculate the relative proportion of each KMeans cluster in the overall data set and determine the number of samples required to be extracted from each cluster;
[0031] For the data within each KMeans cluster, the linkage function in the scipy library is used to calculate the linkage matrix of the hierarchical clustering, and the AgglomerativeClustering function in the sk learn library is used to execute the hierarchical clustering algorithm to build a tree structure. The purity principle of the tree structure is used to place data points with high similarity in the same branch to obtain the hierarchical clustering result.
[0032] According to the hierarchical clustering results, samples are extracted from each sub-cluster to complete sampling;
[0033] After sampling, the silhouette_score function of the sk learn library is used to calculate the silhouette coefficient for each cluster to measure the clustering quality.
[0034] All extracted samples are deduplicated, integrated into a new data structure, and output to obtain the structured file.
[0035] Optionally, extracting samples from each sub-cluster according to the hierarchical clustering result is specifically:
[0036] The established tree structure randomly traverses each child node from the root node to the leaf node and performs sampling.
[0037] Optionally, the calculation formula for calculating the silhouette coefficient is:
[0038]
[0039] Among them, S(i) represents the silhouette coefficient of data point i; b(i) represents the average distance from data point i to the nearest cluster, which is called inter-cluster dissimilarity; a(i) represents the average distance from data point i to other data points in its cluster, which is called intra-cluster dissimilarity;
[0040] The calculation formula of the intra-cluster dissimilarity is:
[0041]
[0042] The calculation formula of the inter-cluster dissimilarity is:
[0043]
[0044] Among them, C i represents the cluster where data point i is located; d(i,j) represents the distance between data points i and j; C k Different from C i Other clusters of .
[0045] Optionally, the lossless compression processing of the structured file in a lossless compression manner to complete the compression of the call chain data includes the following steps:
[0046] Constructing a data mapping construction unit for recording the mapping of each unique value in the data to a new digital identifier; when the data preprocessing unit receives the structured file, each value is checked and encoded by the mapping construction unit, English characters are mapped to integers, a reversible compressed mapping relationship is retained, and a pickle library is used for serialization and storage of the dictionary;
[0047] Calculating the relative center value of each predefined data cluster using the data processing unit, performing median calculation on the data points of each cluster by reading the cluster index, thereby obtaining the center value associated with the cluster;
[0048] receiving the processed data through a data compression unit and performing compression conversion to convert the obtained compressed data into a specific data type;
[0049] The compressed data is compressed twice by using the bz2 general compression algorithm through the data storage unit to complete the compression of the call chain data.
[0050] Optionally, the method further comprises the following steps:
[0051] Decompress using the bz2 algorithm, match the compressed data with the corresponding center value and add them together;
[0052] Use the mapping relationship to restore the data item by item to obtain the intermediate data set;
[0053] By deserializing and querying the compression dictionary, the original value corresponding to each compressed value is found to complete the complete decompression of the data.
[0054] Another aspect of the embodiment of the present invention further provides a call chain data compression system based on information redundancy, including:
[0055] The first module is used to extract similar data from the collected call chain data using the KMeans algorithm, and group the data points in the call chain data to obtain various cluster groups; wherein the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low;
[0056] The second module is used to perform sampling processing on the cluster group using an offline tail sampling strategy based on hierarchical clustering, and output a structured file;
[0057] The third module is used to perform lossless compression processing on the structured file in a lossless compression manner to complete the compression of the call chain data.
[0058] Another aspect of an embodiment of the present invention further provides an electronic device, including a processor and a memory;
[0059] The memory is used to store programs;
[0060] The processor executes the program to implement the method described above.
[0061] Another aspect of the embodiments of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a program, and the program is executed by a processor to implement the method described above.
[0062] The embodiment of the present invention also discloses a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device can read the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above method.
[0063] The embodiment of the present invention uses the KMeans algorithm to extract similar data from the collected call chain data, groups the data points in the call chain data, and obtains various cluster groups; wherein the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low; the cluster groups are sampled using an offline tail sampling strategy based on hierarchical clustering, and a structured file is output; the structured file is losslessly compressed using a lossless compression method to complete the compression of the call chain data. The present invention combines the sampling idea of lossy compression with the characteristics of the call chain data, greatly reduces the size and storage burden of the compressed file on the basis of maintaining the value of data analysis, improves efficiency and real-time performance, can ensure data integrity and enhance generalization capabilities. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0065] Figure 1 An overall step flow chart provided for an embodiment of the present invention;
[0066] Figure 2 A flow chart of a clustering process provided by an embodiment of the present invention;
[0067] Figure 3 A flow chart of a sampling process provided by an embodiment of the present invention;
[0068] Figure 4 A flowchart of a lossless compression process provided by an embodiment of the present invention;
[0069] Figure 5 A schematic diagram of hierarchical clustering tree construction provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0070] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present invention. They are only examples of devices and methods consistent with some aspects of the embodiments of the present invention as detailed in the attached claims.
[0071] It is understood that the terms "first", "second", etc. used in the present invention may be used herein to describe various concepts, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of the present invention, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0072] The terms "at least one", "multiple", "each", "any", etc. used in the present invention, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0073] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0074] Before describing the embodiments of the present invention in detail, some related technologies involved in the embodiments of the present invention are first described as follows:
[0075] Call chain: A sequence used to describe a series of method or function calls from one execution point to another. This concept is mainly used in software development, especially in performance analysis, debugging, and system design. The call chain can help developers understand the running flow of the program and the dependencies between the various parts. Specifically, when a program is executed, it may call from one function to another. These functions may further call other functions, forming a sequence or chain of calls. Each function call is a link in the chain, which can help trace the execution path of the program. For example, in a complex application, understanding the call chain can help determine which parts of the code may cause performance bottlenecks or errors.
[0076] Clustering: Clustering is a technique for dividing objects in a data set into multiple groups or classes, where objects within each group have similar properties or characteristics, while objects in different groups have large differences. The core purpose of clustering algorithms is to automatically classify data based on its intrinsic structure without pre-given class labels. It is a form of unsupervised learning and is often used for data preprocessing, data compression, and as an auxiliary means for other complex analysis tasks.
[0077] OpenTe lemetry: OpenTe lemetry is an open source project for capturing, generating, managing, and exporting telemetry data (such as metrics, logs, and tracing information), aiming to provide a unified and standardized telemetry solution for cloud-native software and services. OpenTe lemetry provides a comprehensive toolset and API that enables developers to collect detailed data about software performance and behavior in a variety of programming languages and environments. It aims to provide a seamless integration method to help developers automatically collect system data without rewriting or redeploying applications.
[0078] The call chain data compression method based on information redundancy provided in an embodiment of the present invention relates to the field of computer technology. The call chain data compression method based on information redundancy provided in an embodiment of the present invention can be applied to a terminal, can be applied to a server, or can be software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application that implements a call chain data compression method based on information redundancy, etc., but is not limited to the above forms.
[0079] The present invention can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present invention can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present invention can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0080] Specifically, in response to the problems existing in the prior art, the embodiments of the present invention analyze and explore the characteristics and structural features of the call chain data to discover and eliminate information redundancy. The clustering part of the embodiment of the present invention uses the KMeans algorithm based on the call graph to extract similar data and group the data points in the data set so that the data points in the same group have high similarity and the data points in different groups have low similarity. The sampling part greatly reduces the amount of data through hierarchical clustering and intelligent sampling strategies, while retaining the representativeness of the data and improving the efficiency and effect of data analysis. The theory is that similar execution paths in the tree building process are likely to be placed in the same branch, so these branches are relatively deeper. Uncommon tracking paths are often located in independent branches with fewer nodes, so the hierarchy is shallow and easier to be sampled. The lossless compression part ensures that no information is lost while compressing the data volume, and the compression of the call chain data and the elimination of redundancy are carried out to the greatest extent.
[0081] The input of the embodiment of the present invention is the standard format of microservice call chain data collected by the OpenTe lemetry framework, which is a structured table format (CSV file format), including call type, call start timestamp, call duration, call success flag, complete call chain and single call ID, parent call ID, ID in the configuration management database and called service name, etc. The output of the embodiment of the present invention is a compressed source data package and two important intermediate products in data recovery, namely, a dictionary file and a central value file compressed by bz2.
[0082] Specifically, Figure 1 As shown, a call chain data compression method based on information redundancy according to an embodiment of the present invention comprises the following steps:
[0083] For the collected call chain data, the KMeans algorithm is used to extract similar data, and the data points in the call chain data are grouped to obtain various cluster groups; wherein, the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low;
[0084] The clustering group is sampled using an offline tail sampling strategy based on hierarchical clustering, and a structured file is output;
[0085] The structured file is losslessly compressed by using a lossless compression method to complete the compression of the call chain data.
[0086] Optionally, the method of extracting similar data from the collected call chain data using a KMeans algorithm, grouping data points in the call chain data to obtain cluster groups includes the following steps:
[0087] The call chain data of microservices is collected through the OpenTe lemetry framework, and processed by a graph generation unit constructed by a networkx library function to obtain a corresponding directed graph; wherein the directed graph is used to represent the call relationship between each service component in the call chain data;
[0088] Processing the nodes in the directed graph by applying the Node2Vec algorithm through a node vectorization unit to convert the node data in the graph structure into a vector form;
[0089] The vectorized node data is normalized by using a standardization tool through a standardization processing unit to obtain a standardized data stream;
[0090] Performing feature selection on the standardized data stream by a feature selection unit to obtain a target feature set;
[0091] The Kmeans algorithm is implemented by the clustering processing unit to cluster the data points, and the data is divided into a plurality of different clusters, each of which has a corresponding cluster label.
[0092] Optionally, the adopting of the offline tail sampling strategy based on hierarchical clustering to perform sampling processing on the cluster group and outputting a structured file comprises the following steps:
[0093] Calculate the relative proportion of each KMeans cluster in the overall data set and determine the number of samples required to be extracted from each cluster;
[0094] For the data within each KMeans cluster, the linkage function in the scipy library is used to calculate the linkage matrix of the hierarchical clustering, and the AgglomerativeClustering function in the sk learn library is used to execute the hierarchical clustering algorithm to build a tree structure. The purity principle of the tree structure is used to place data points with high similarity in the same branch to obtain the hierarchical clustering result.
[0095] According to the hierarchical clustering results, samples are extracted from each sub-cluster to complete sampling;
[0096] After sampling, the silhouette_score function of the sk learn library is used to calculate the silhouette coefficient for each cluster to measure the clustering quality.
[0097] All extracted samples are deduplicated, integrated into a new data structure, and output to obtain the structured file.
[0098] Optionally, extracting samples from each sub-cluster according to the hierarchical clustering result is specifically:
[0099] The established tree structure randomly traverses each child node from the root node to the leaf node and performs sampling.
[0100] Optionally, the calculation formula for calculating the silhouette coefficient is:
[0101]
[0102] Among them, S(i) represents the silhouette coefficient of data point i; b(i) represents the average distance from data point i to the nearest cluster, which is called inter-cluster dissimilarity; a(i) represents the average distance from data point i to other data points in its cluster, which is called intra-cluster dissimilarity;
[0103] The calculation formula of the intra-cluster dissimilarity is:
[0104]
[0105] The calculation formula of the inter-cluster dissimilarity is:
[0106]
[0107] Among them, C i represents the cluster where data point i is located; d(i,j) represents the distance between data points i and j; C k Different from C i Other clusters of .
[0108] Optionally, the lossless compression processing of the structured file in a lossless compression manner to complete the compression of the call chain data includes the following steps:
[0109] Constructing a data mapping construction unit for recording the mapping of each unique value in the data to a new digital identifier; when the data preprocessing unit receives the structured file, each value is checked and encoded by the mapping construction unit, English characters are mapped to integers, a reversible compressed mapping relationship is retained, and a pickle library is used for serialization and storage of the dictionary;
[0110] Calculating the relative center value of each predefined data cluster using the data processing unit, performing median calculation on the data points of each cluster by reading the cluster index, thereby obtaining the center value associated with the cluster;
[0111] receiving the processed data through a data compression unit and performing compression conversion to convert the obtained compressed data into a specific data type;
[0112] The compressed data is compressed twice by using the bz2 general compression algorithm through the data storage unit to complete the compression of the call chain data.
[0113] Optionally, the method further comprises the following steps:
[0114] Decompress using the bz2 algorithm, match the compressed data with the corresponding center value and add them together;
[0115] Use the mapping relationship to restore the data item by item to obtain the intermediate data set;
[0116] By deserializing and querying the compression dictionary, the original value corresponding to each compressed value is found to complete the complete decompression of the data.
[0117] The following describes the specific implementation process of the present invention in detail by taking a specific application scenario as an example:
[0118] The technical solution of the present invention consists of three parts, namely a clustering part, a sampling part and a lossless compression part.
[0119] The main process of the present invention is:
[0120] 1.Reference Figure 2 The clustering part mainly designs the KMeans clustering method based on the call graph, which can extract similar information to a large extent. The process is:
[0121] (1) The microservice call data collected by the OpenTe lemetry framework is processed by a graph generation unit built by a networkx library function. This unit is responsible for converting the input data into a directed graph to more accurately represent the call relationship between the service components in the call chain data.
[0122] (2) After the graph data is formed, the node vectorization unit applies the Node2Vec algorithm to process the nodes in the directed graph and converts the nodes in the graph structure into vector form so that they can be mathematically processed and analyzed in subsequent steps.
[0123] (3) Subsequently, the normalization processing unit uses a variety of normalization methods to process the vectorized node data to ensure that the comparison of data of different dimensions has a uniform scale. The normalization processing methods available in this solution include but are not limited to:
[0124] StandardSca ler: Transforms the data to a standard normal distribution with mean 0 and standard deviation 1 by subtracting the mean and dividing by the standard deviation.
[0125] MinMaxScaler: Scales the data to between the specified minimum and maximum values (usually 0 to 1), which is suitable for cases where the features are within the known minimum and maximum ranges.
[0126] Normalizer: Scales each sample to unit norm, usually used for normalization of sparse matrices or eigenvectors.
[0127] (4) The standardized data flows to the feature selection unit, which selects the feature set that has the greatest impact on the clustering results based on advanced algorithms. This step is the key to ensuring the efficiency and effectiveness of the clustering algorithm. The feature selection algorithms available in this solution include but are not limited to:
[0128] Variance Thresholding: Select the most effective features by removing features whose variance is lower than a certain threshold.
[0129] Mutual Information Method: Calculate the mutual information between each feature and the target variable, and select features with high mutual information.
[0130] Recursive Feature Elimination (RFE): Recursively train the model to gradually remove the least important features.
[0131] (5) After feature selection, the data enters the clustering processing unit, which implements the KMeans algorithm to cluster the data points. Through this algorithm, the system can divide the data into multiple different clusters. The data points in each cluster are close to each other in the feature space, while the data points between different clusters are far apart. In this way, the call chain data can be divided into different clusters, where the information represented by the data in each cluster is similar and has a certain similarity. Based on this, the redundancy within the cluster can be eliminated, which is what is done in the subsequent part. The data obtained in this part will have cluster labels.
[0132] 2. If Figure 3 As shown, the sampling part of the embodiment of the present invention designs an offline tail sampling strategy based on hierarchical clustering, which is specially designed for the data compression problem in call chain data analysis. The tail sampling strategy performs better than the head abstract strategy in eliminating a large amount of redundant data and retaining edge cases such as anomalies. This technical solution takes the following steps to intelligently sample the pre-clustered data to ensure that the data volume is effectively reduced while maintaining the value of data analysis. The process is:
[0133] (1) This part calculates the relative proportion of each KMeans cluster in the overall data set, and intelligently determines the number of samples required to be drawn from each cluster while ensuring the minimum number of samples for each cluster, ensuring that the number of samples drawn can reflect the distribution of the original data set.
[0134] (2) For the data within each KMeans cluster, this section uses the linkage function in the scipy library to calculate the linkage matrix of the hierarchical clustering, and uses the AgglomerativeClustering function of the sk learn library to execute the hierarchical clustering algorithm, build a tree structure, and use the purity principle of the tree structure to place data points with high similarity in the same branch, providing a logical basis for subsequent sampling. The theory based on this section is that similar and common execution paths are likely to be placed in the same branch, so these branches are relatively deeper. Uncommon tracking paths and unique data are often located in independent branches with fewer nodes, so the hierarchy is shallow and easier to be sampled.
[0135] (3) Based on the hierarchical clustering results, this part extracts samples from each sub-cluster. Specifically, this part randomly traverses each sub-node from the root node to the leaf node of the established tree structure and performs sampling, while ensuring that at least one sample can be extracted from each sub-cluster even when the sub-cluster size is small, so as to maintain the diversity of samples and the representativeness of the data set.
[0136] (4) After sampling, this part calculates the silhouette coefficient for each cluster through the silhouette_score function of the sk learn library. The silhouette coefficient is a measure used to evaluate the quality of clustering. Its calculation formula is as follows:
[0137]
[0138] Among them, S(i) represents the silhouette coefficient of data point i, and its value range is [-1,1]. The specific definition is as follows:
[0139] a(i) is the average distance from data point i to other data points in its cluster, called intra-cluster dissimilarity, and the calculation formula is:
[0140]
[0141] Among them, C i is the cluster where data point i is located, and d(i,j) is the distance between data points i and j.
[0142] b(i) is the average distance from data point i to the nearest cluster, called inter-cluster dissimilarity, and is calculated as:
[0143]
[0144] Among them, C k Different from C i Other clusters of .
[0145] The closer the silhouette coefficient S(i) is to 1, the better the clustering effect of data point i is; the closer S(i) is to -1, the more suitable it is for data point i to be assigned to other clusters; S(i) is close to 0, which means that data point i is on the boundary of two clusters.
[0146] Through the above steps, this step evaluates the aggregation effect of clusters at each level of clustering, identifies the best and worst performing clusters, and pays extra attention to these clusters in sampling, sampling them again to ensure that the key edge cases in the data set are captured.
[0147] (5) Finally, all extracted samples are integrated into a new data structure after deduplication and output as a structured file for further analysis.
[0148] 3. Such as Figure 4 As shown, the lossless compression part of the embodiment of the present invention further reduces the data volume on the basis of lossy compression, and ensures that the compressed data can be completely restored to its original state. The process is:
[0149] (1) Dictionary Compression: In the dictionary stage of the present invention, a data mapping construction unit is set up to record the mapping of each unique value in the data to a new digital identifier. After the data preprocessing unit receives the data, the mapping construction unit checks and encodes each value, mainly mapping English characters to integers, retaining a reversible compression mapping relationship, and using the pickle library for dictionary serialization and storage.
[0150] (2) Storing center values and offsets: The present invention uses a data processing unit to calculate the relative center value of each predefined data cluster. By reading the cluster index and performing median calculation on the data points of each cluster, the center value associated with the cluster is obtained, and the introduction of floating point numbers to expand the storage space is avoided. The calculation process of the median is as follows:
[0151] 1) Sorting: Arrange all data points belonging to the same cluster in ascending order.
[0152] 2) Take the median: If the number of data points is an odd number, the median is the value of the data point in the middle after sorting. If the number of data points is an even number, the median is the average of the two data points in the middle after sorting. To avoid introducing floating point numbers here, the final result will retain integers.
[0153] 3) After that, this part subtracts each data point from the center value of its cluster and stores the obtained offset.
[0154] (3) Data compression and storage: The data compression unit receives the processed data and performs compression conversion, and the obtained compressed data is further converted into a specific data type to reduce memory usage. At the same time, the compression technology of the present invention also includes a data storage unit, which uses the bz2 general compression algorithm to perform secondary compression on the compressed data to maximize the storage efficiency.
[0155] (4) Restoration process: First, decompress the data using the bz2 algorithm, match and add the compressed data to its corresponding central value, and use the mapping relationship to restore the data item by item to obtain an intermediate data set. Then, by deserializing and querying the compression dictionary, find the original value corresponding to each compressed value to complete the complete decompression of the data.
[0156] The data set used in the experiment of the technical solution of the present invention is the real production data of the enterprise, and the data format is specifically the call chain data collected by the OpenTe lemetry framework.
[0157] In general, the embodiment of the present invention uses clustering, sampling, and lossless compression. In actual experiments on call chain data of different scales, the technical solution of the present invention achieves the compression ratio results shown in Table 1:
[0158] Table 1 Overall compression ratio of data of different sizes
[0159]
[0160] As shown in Table 1, on the real call chain data sets of enterprises of different sizes, the overall average compression ratio of the scheme of the present invention reached 3.2%, which is significantly higher than the current common compression schemes, indicating that the scheme has a strong compression effect on the call chain data and effectively reduces data redundancy.
[0161] At the same time, the intermediate product of this solution has certain practical application value. The sampling part extracts the key call chain data, so that operation and maintenance personnel can use a small data set in most scenarios. In addition, the data after the dictionary-based centralization process of the lossless compression part can still reflect their mutual call relationship, which has certain practicality.
[0162] Specifically, the key experimental results of each part are as follows:
[0163] 1. Clustering part: The clustering part tests the KMeans clustering algorithm based on the call graph under different clustering cluster settings, and obtains the experimental results shown in Table 2 below:
[0164] Table 2 Clustering experimental results
[0165] Cluster settings Silhouette Coefficient Calinski-Harabasz Index 3 0.6335 43282.25 4 0.6357 42124.13 5 0.5982 48201.18 6 0.6709 54885.71
[0166] As shown in Table 2, under different cluster number settings, the KMeans clustering algorithm based on the call graph maintains a high silhouette coefficient and variance ratio criterion, indicating that the clustering effect is good and the similarity extraction is relatively successful.
[0167] 2. Sampling part: The main experimental result in the sampling part is the sampling ratio, which has been specifically described in Table 1 of the overall results. The experiment visualizes the hierarchical clustering tree based on the dendrogram function of the pyplot library, as shown in Figure 5 As shown, the sampling part successfully built a tree, and thus tree sampling was performed based on it.
[0168] 3. Lossless compression part: The experimental results of the lossless compression part are mainly compression ratio. In addition to the compression ratio test of the complete compression process in Table 1, the additional single-step experimental results of this part are shown in Table 3 below. The experiment was conducted using the original call chain dataset.
[0169] Table 3 Lossless compression experimental results
[0170] Original data size Data size after lossless compression Compression ratio 3,902,636 bytes 581,092 bytes 14.89% 6,454,247 bytes 965,404 bytes 14.96% 9,106,016 bytes 1,315,819 bytes 14.45% 13,008,565 bytes 1,938,235 bytes 14.90%
[0171] As shown in Table 3, the lossless compression part can achieve a compression ratio of 14.9% under the existing call chain data set, indicating that the lossless compression part also has a strong compression effect on the call chain data.
[0172] In summary, compared with the prior art, the present invention has the following characteristics:
[0173] 1. The KMeans algorithm based on the directed call graph can capture the key information of mutual calls in the call chain data to the greatest extent, extract the commonalities of related structures, and assign appropriate cluster labels.
[0174] 2. The offline tail sampling strategy based on hierarchical clustering makes full use of the cluster labels generated by the previous process for hierarchical clustering tree sampling. The cluster labels of the previous clustering provide convenience for the best and worst clustering judgment of the sampling part, and can further focus on marginal data.
[0175] 3. The combination of lossless compression and sampling, a lossy compression form, minimizes the storage space required for call chain data while maintaining the value of data analysis.
[0176] 4. The reuse of clusters reduces the cost and running time required for each process.
[0177] 5. For different forms of call chain data, the procedures adopted are basically the same and have high generalization.
[0178] Compared with the prior art, the present invention has the following advantages:
[0179] 1. In view of the characteristics of call chain data, the sampling idea of lossy compression is combined to greatly reduce the size and storage burden of compressed files while maintaining the value of data analysis.
[0180] 2. After obtaining the similarity of the call chain data and performing cluster analysis and sampling, it is convenient for operation and maintenance personnel to observe and process the call chain data without having to analyze it from massive amounts of raw data.
[0181] 3. Similar to the structured analysis method logshrink for log data, the present invention provides a structured analysis and compression method for call chain data, supports single-step and single-column operation compression, and has greater flexibility.
[0182] The embodiment of the present invention further provides a call chain data compression system based on information redundancy, comprising:
[0183] The first module is used to extract similar data from the collected call chain data using the KMeans algorithm, and group the data points in the call chain data to obtain various cluster groups; wherein the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low;
[0184] The second module is used to perform sampling processing on the cluster group using an offline tail sampling strategy based on hierarchical clustering, and output a structured file;
[0185] The third module is used to perform lossless compression processing on the structured file in a lossless compression manner to complete the compression of the call chain data.
[0186] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0187] The embodiment of the present invention further provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned call chain data compression method based on information redundancy when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0188] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0189] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned call chain data compression method based on information redundancy is implemented.
[0190] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0191] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0192] In some selectable embodiments, the function / operation mentioned in the block diagram may not occur in the order mentioned in the operation diagram. For example, depending on the function / operation involved, the two boxes shown in succession can actually be executed substantially simultaneously or the boxes can sometimes be executed in reverse order. In addition, the embodiment presented and described in the flow chart of the present invention is provided by way of example, for the purpose of providing a more comprehensive understanding of technology. The disclosed method is not limited to the operation and logic flow presented herein. Selectable embodiments are expected, wherein the order of various operations is changed and the sub-operation of a part for which is described as a larger operation is performed independently.
[0193] In addition, although the present invention is described in the context of functional modules, it should be understood that, unless otherwise specified, one or more of the functions and / or features described may be integrated into a single physical device and / or software module, or one or more functions and / or features may be implemented in separate physical devices or software modules. It is also understood that a detailed discussion of the actual implementation of each module is unnecessary for understanding the present invention. More specifically, in view of the properties, functions, and internal relationships of the various functional modules in the device disclosed herein, the actual implementation of the module will be understood within the conventional skills of the engineer. Therefore, those skilled in the art can implement the present invention set forth in the claims without excessive experimentation using ordinary techniques. It is also understood that the specific concepts disclosed are merely illustrative and are not intended to limit the scope of the present invention, which is determined by the full scope of the appended claims and their equivalents.
[0194] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0195] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0196] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0197] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0198] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0199] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
[0200] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the described embodiments. Those skilled in the art may make various equivalent modifications or substitutions without violating the spirit of the present invention. These equivalent modifications or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A call chain data compression method based on information redundancy, characterized in that: The following steps are involved: For the collected call chain data, the KMeans algorithm is used to extract similar data, and the data points in the call chain data are grouped to obtain various cluster groups; wherein, the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low; The clustering group is sampled using an offline tail sampling strategy based on hierarchical clustering, and a structured file is output; The structured file is losslessly compressed by using a lossless compression method to complete the compression of the call chain data.
2. A call chain data compression method based on information redundancy according to claim 1, characterized in that: The collected call chain data is extracted using the KMeans algorithm, and the data points in the call chain data are grouped to obtain various cluster groups, including the following steps: The call chain data of microservices is collected through the OpenTelemetry framework, and processed by a graph generation unit constructed by a networkx library function to obtain a corresponding directed graph; wherein the directed graph is used to represent the call relationship between each service component in the call chain data; Processing the nodes in the directed graph by applying the Node2Vec algorithm through a node vectorization unit to convert the node data in the graph structure into a vector form; The vectorized node data is normalized by using a standardization tool through a standardization processing unit to obtain a standardized data stream; Performing feature selection on the standardized data stream by a feature selection unit to obtain a target feature set; The Kmeans algorithm is implemented by the clustering processing unit to cluster the data points, and the data is divided into a plurality of different clusters, each of which has a corresponding cluster label.
3. The method for compressing call chain data based on information redundancy according to claim 1, characterized in that: The clustering group is sampled using the offline tail sampling strategy based on hierarchical clustering, and a structured file is output, including the following steps: Calculate the relative proportion of each KMeans cluster in the overall data set and determine the number of samples required to be extracted from each cluster; For the data within each KMeans cluster, the linkage function in the scipy library is used to calculate the linkage matrix of the hierarchical clustering, and the AgglomerativeClustering function of the sklearn library is used to execute the hierarchical clustering algorithm to build a tree structure. The purity principle of the tree structure is used to place data points with high similarity in the same branch to obtain the hierarchical clustering result. According to the hierarchical clustering results, samples are extracted from each sub-cluster to complete sampling; After sampling, the silhouette_score function of the sklearn library is used to calculate the silhouette coefficient for each cluster to measure the clustering quality. All extracted samples are deduplicated, integrated into a new data structure, and output to obtain the structured file.
4. The method for compressing call chain data based on information redundancy according to claim 3, characterized in that: The step of extracting samples from each sub-cluster according to the hierarchical clustering result is as follows: The established tree structure randomly traverses each child node from the root node to the leaf node and performs sampling.
5. The method for compressing call chain data based on information redundancy according to claim 3, characterized in that: The calculation formula for calculating the silhouette coefficient is: Among them, S(i) represents the silhouette coefficient of data point i; b(i) represents the average distance from data point i to the nearest cluster, which is called inter-cluster dissimilarity; a(i) represents the average distance from data point i to other data points in its cluster, which is called intra-cluster dissimilarity; The calculation formula of the intra-cluster dissimilarity is: The calculation formula of the inter-cluster dissimilarity is: Among them, C i represents the cluster where data point i is located; d(i,j) represents the distance between data points i and j; C k Different from C i Other clusters of .
6. The method for compressing call chain data based on information redundancy according to claim 1, characterized in that: The method of performing lossless compression on the structured file to complete the compression of the call chain data includes the following steps: Construct a data mapping construction unit for recording the mapping of each unique value in the data to a new digital identifier; when the data preprocessing unit receives the structured file, each value is checked and encoded by the mapping construction unit, English characters are mapped to integers, a reversible compressed mapping relationship is retained, and the pickle library is used for the serialization and preservation of the dictionary; Calculating the relative center value of each predefined data cluster using the data processing unit, performing median calculation on the data points of each cluster by reading the cluster index, thereby obtaining the center value associated with the cluster; receiving the processed data through a data compression unit and performing compression conversion to convert the obtained compressed data into a specific data type; The compressed data is compressed twice by using the bz2 general compression algorithm through the data storage unit to complete the compression of the call chain data.
7. A call chain data compression method based on information redundancy according to any one of claims 1 to 6, characterized in that: The method further comprises the following steps: Decompress using the bz2 algorithm, match the compressed data with the corresponding center value and add them together; Use the mapping relationship to restore the data item by item to obtain the intermediate data set; By deserializing and querying the compression dictionary, the original value corresponding to each compressed value is found to complete the complete decompression of the data.
8. A call chain data compression system based on information redundancy, characterized in that: include: The first module is used to extract similar data from the collected call chain data using the KMeans algorithm, and group the data points in the call chain data to obtain various cluster groups; wherein the data similarity within the same cluster group is high, and the data similarity between different cluster groups is low; The second module is used to perform sampling processing on the cluster group using an offline tail sampling strategy based on hierarchical clustering, and output a structured file; The third module is used to perform lossless compression processing on the structured file in a lossless compression manner to complete the compression of the call chain data.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The storage medium stores a program, and the program is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
High-throughput genome sequence data compression parallel optimization method
CN117059181A
File compression method based on inter-group loss optimization compression-friendly metric learning
CN117353750A
Method And System For The On-Demand Generation Of Graph-Like Models Out Of Multidimensional Observation Data
US20220358023A1
Method and apparatus for calculating indicator data
WO2024021630A1
