Time series data compression method and collection method, device and readable storage medium
Through the time series data compression method, the statistical change value and change indication data are used to generate compression results, which solves the problem of large amount of time series data and limited storage space, and improves storage efficiency and data analysis capabilities.
Patent Information
- Application Number
- PCT/CN2023/137135
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2023-12-07
- Publication Date
- 2024-09-06
AI Technical Summary
In limited storage space, how to effectively record and store a large amount of time series data, especially in intelligent operation and maintenance and intelligent security application scenarios, the time series data generated by network element equipment is large, takes up storage space, and is difficult to record more data. .
Through the time series data compression method, the statistical change values in the time series data are obtained, the non-zero change values are encoded, the change indication data is generated, and the compression results are generated by combining these data to reduce the amount of stored data and improve storage efficiency.
It achieves efficient compression of time series data, increases the amount of time series data that can be recorded in limited storage space, enhances data analysis capabilities, and reduces storage requirements.
Smart Images

Figure CN2023137135_06092024_PF_FP
Abstract
Description
Time series data compression method, acquisition method, device and readable storage medium
[0001] Related applications
[0002] This application claims priority to Chinese patent application No. 202310223511.9 filed on February 28, 2023, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of time series data technology, and in particular to a time series data compression method, collection method, device, and computer-readable storage medium. Background Art
[0004] Time series data refers to data sequences recorded in chronological order. In some application scenarios, time series data is required for statistical analysis. For example, network element devices in communication networks generate a large amount of time series data, such as CPU utilization and memory utilization, when executing message transmission and reception services. In application scenarios such as intelligent operations and maintenance and intelligent security, statistical analysis of time series data from network element devices is necessary. Time series data is often large in volume and occupies a large amount of storage space. However, in actual application scenarios, the devices that collect and store time series data (such as network elements) often have limited storage space. Therefore, how to record as much time series data as possible within this limited storage space is an urgent problem that needs to be solved.
[0005] Summary of the Invention
[0006] The main purpose of this application is to provide a time series data compression method, acquisition method, device and computer-readable storage medium, aiming to provide a time series data compression solution to increase the amount of time series data that can be recorded in a limited storage space.
[0007] To achieve the above objectives, the present application provides a time series data compression method, which includes the following steps:
[0008] Acquire time series data, where the time series data includes statistical values of at least one statistic at multiple time points;
[0009] For any target statistic among the at least one statistic, and for any target time point among the multiple time points, obtaining a change value of the target statistic at the target time point according to the time series data, wherein the change value at the target time point is a change value of the statistical value of the target statistic at the target time point relative to the statistical value of the target statistic at a time point before the target time point;
[0010] encoding, based on a non-zero value in a change value corresponding to the at least one statistic at a time point with a change, to obtain compressed data corresponding to the time point with a change, wherein the time point with a change is a time point corresponding to at least one non-zero change value among the multiple time points;
[0011] generating change indication data, wherein the change indication data is configured to indicate whether a change value of the at least one statistic at each of the plurality of time points is zero;
[0012] A time series data compression result is generated according to the compressed data corresponding to the changed time point and the change indication data.
[0013] To achieve the above-mentioned purpose, the present application further provides a time series data collection method, which is applied to any line card device in a network element device, and the time series data collection method includes:
[0014] According to the preset time series data collection requirements, collect the time series data generated during the operation of the service process of the line card device;
[0015] Compress the time series data according to the time series data compression method described above to obtain a time series data compression result;
[0016] The time series data compression result is cached.
[0017] To achieve the above-mentioned purpose, the present application also provides a time series data compression device, which includes: a memory, a processor, and a time series data compression program stored in the memory and runnable on the processor. When the time series data compression program is executed by the processor, the steps of the time series data compression method described above are implemented.
[0018] To achieve the above-mentioned purpose, the present application also provides a time series data acquisition device, which includes: a memory, a processor, and a time series data acquisition program stored in the memory and runnable on the processor. When the time series data acquisition program is executed by the processor, the steps of the time series data acquisition method described above are implemented.
[0019] To achieve the above objectives, the present application also proposes a computer-readable storage medium, on which a time series data compression program is stored. When the time series data compression program is executed by a processor, the steps of the time series data compression method described above are implemented.
[0020] In addition, to achieve the above-mentioned purpose, the present application also proposes a computer-readable storage medium, on which a timing data acquisition program is stored. When the timing data acquisition program is executed by a processor, the steps of the timing data acquisition method described above are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] FIG1 is a flow chart of an embodiment of a time series data compression method of the present application;
[0022] FIG2 is a schematic diagram of a time series data compression result structure involved in an embodiment of the time series data compression method of the present application;
[0023] FIG3 is a schematic diagram of the architecture of a time series data collection and storage system according to an embodiment of the time series data collection method of the present application;
[0024] FIG4 is a schematic diagram of a feasible time series data collection and storage process involved in an embodiment of the time series data collection method of the present application;
[0025] FIG5 is a schematic structural diagram of a time series data compression device involved in an embodiment of the present application;
[0026] FIG6 is a schematic structural diagram of a time series data acquisition device involved in an embodiment of the present application;
[0027] FIG7 is a schematic diagram of a computer-readable storage medium involved in an embodiment of the present application;
[0028] FIG8 is a schematic diagram of another computer-readable storage medium involved in an embodiment of the present application.
[0029] The realization of the objectives, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0030] It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application.
[0031] Based on the above structure, various embodiments of the time series data compression method are proposed.
[0032] Refer to Figure 1, which is a flow chart of the first embodiment of the time series data compression method of the present application. The embodiment of the present application provides an embodiment of the time series data compression method. It should be noted that although the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in an order different from that here. In this embodiment, there is no restriction on the execution subject of the time series data compression method. For example, it can be a personal computer, a server, a smart phone, a network element device, and the like. For the sake of convenience of description, the following description of each embodiment of the execution subject is omitted. In this embodiment, the time series data compression method includes:
[0033] Step S10: Acquire time series data, wherein the time series data includes statistical values of at least one statistic at multiple time points;
[0034] Depending on the needs of the specific application scenario, the number of statistics and the number of time points in the acquired time series data may vary, and this is not limited in this embodiment. A statistic refers to a data item that changes over time and needs to be counted. The statistical value of a statistic at a certain time point refers to the specific value of the statistic collected at that time point. For example, the utilization rate of CPU core 1 in a line card device of a network element device is a statistic. If the utilization rate of CPU core 1 collected at time point T is 90%, then 90% is the statistical value of the statistic of CPU core 1 at time point T.
[0035] The method of obtaining time series data is not limited in this embodiment. For example, after the time series data is collected, it is cached in a cache space, and the device can obtain the time series data from the cache space for compression.
[0036] Step S20: for any target statistic among the at least one statistic, and for any target time point among the multiple time points, obtaining a change value of the target statistic at the target time point according to the time series data, wherein the change value at the target time point is a change value of the statistical value of the target statistic at the target time point relative to the statistical value of the target statistic at the previous time point of the target time point;
[0037] For each statistic, the change value of the statistic at each time point can be obtained based on the time series data. Taking the target statistic and the target time point as an example, the change value of the target statistic at the target time point can be obtained based on the time series data. The change value of the target statistic at the target time point is the change value of the statistical value of the target statistic at the target time point relative to the statistical value of the target statistic at the previous time point of the target time point. For example, the statistical value of the target statistic at time point T-1 is 3, and the statistical value at time point T is 4, T-1 is the previous time point of T, and the change value of the target statistic at time point T is 1 (4-3=1).
[0038] In a specific implementation, for the first time point, since there is actually no previous time point, it can be assumed by default that the statistical value of the statistic at the previous time point of the first time point is 0; or it can be assumed that the statistical value of the statistic at the previous time point of the first time point is a preset value, and the statistical value of the target statistic at the first time point is subtracted from the preset value to obtain the change value of the target statistic at the first time point. The preset value can be pre-set as needed and recorded in the time series data compression result, so that the statistical value of the target statistic at the first time point can be restored according to the preset value during decompression.
[0039] Most statistics in time series data are monotonically increasing, which means that the statistical value at a certain point in time may be very large, but the change value at another point in time is small or even 0, which means that there is no change compared to the previous point in time.
[0040] Step S30: encoding, based on a non-zero value among the change values corresponding to the at least one statistic at the time point with a change, to obtain compressed data corresponding to the time point with a change, wherein the time point with a change is a time point corresponding to at least one non-zero change value among the multiple time points;
[0041] Since there is at least one statistic, and each statistic corresponds to a change value at each time point, each time point corresponds to at least one change value. The change value may be zero or non-zero. To distinguish, time points corresponding to at least one non-zero change value are called change time points. Therefore, if the change values of all statistics at a certain time point are all zero, that time point is not a change time point (hereinafter referred to as a no-change time point for distinction).
[0042] For a time point with a change, the compressed data corresponding to the time point with a change can be obtained by encoding based on the non-zero value of the change value corresponding to each statistic at the time point with a change. For the change value of zero corresponding to each statistic at the time point with a change, and the change value of each statistic at the time point without a change (i.e., 0), encoding is not required, so that the data is compressed. That is, compared to the original need to record the statistical value of each statistic at each time point, in this embodiment, only the change value of some statistics at some time points needs to be recorded, and the numerical value of the change value is generally smaller than the statistical value, thereby also reducing the bytes required for the data.
[0043] The method of encoding to obtain compressed data corresponding to a change time point is not limited in this embodiment. For example, in one feasible implementation, the non-zero values in the change value corresponding to the change time point can be directly spliced to obtain the compressed data corresponding to the change time point. Splicing refers to splicing the bytes of each non-zero value in a certain order; for example, there are 5 change values corresponding to the change time point, of which there are 3 non-zero values, namely 3 (00000011), 2 (00000010), and 4 (00000100), then splicing to obtain 000000110000001000000100. In other feasible implementations, the non-zero values in the change value corresponding to the change time point can be further encoded using an encoding algorithm, and then the encoding results can be spliced to achieve further compression.
[0044] Step S40, generating change indication data, wherein the change indication data is used to indicate whether the change values of the at least one statistic at the multiple time points are zero;
[0045] The change indication data may be data used to indicate whether the change value of each statistic at each time point is zero. In this embodiment, the data form of the change indication data is not limited. For example, it may be a change value of each statistic at each time point, and a bit is used to indicate whether the change value is zero. The data in each bit is the change indication data. According to the change indication data, after generating the time series data compression result, the time series data compression result can be decompressed according to the change indication data. That is, according to the change indication data, it can be determined whether the change value of the statistic at a time point is zero. Then, in the case of zero change value, the statistical value of the statistic at the previous time point at the time point is directly used as the statistical value of the statistic at the time point. In the case of non-zero change value, the statistical value of the statistic at the time point is restored according to the statistical value of the statistic at the previous time point at the time point and the change value at the time point.
[0046] Step S50 : generating a time series data compression result according to the compressed data corresponding to the change time point and the change indication data.
[0047] In this embodiment, the specific implementation method for generating a time series data compression result based on the compressed data and change indication data corresponding to a change time point is not limited. For example, in one feasible implementation, the compressed data corresponding to a change time point and the indicator data in the change indication data used to indicate whether each change value at the change time point is zero can be concatenated to obtain a compression result corresponding to the change time point, and at least the data used to indicate whether each change value at a non-change time point is zero is used as the compression result corresponding to the non-change time point. The compression results of each time point are then concatenated in the order of the time points to obtain a time series data compression result.
[0048] Compared to directly recording the statistical values of each statistic at each time point, this embodiment generates a time series data compression result based on the compressed data and change indication data corresponding to the change time point, utilizing the monotonically increasing characteristic of the statistics of the time series data, recording the non-zero change values of the statistics at each time point, and reducing the amount of data required to be recorded as much as possible. By generating change indication data and generating a time series data compression result based on the change indication data, during the decompression process of the time series data compression result, the statistic with a change value of zero can be determined through the change indication data in the time series data compression result, and then the original time series data can be decompressed. The embodiment of the present application achieves efficient compression of time series data and increases the amount of time series data that can be recorded in a limited storage space.
[0049] Based on the above first embodiment, a second embodiment of the time series data compression method of the present application is proposed. In this embodiment, step S30 includes:
[0050] Step S301, encoding non-zero values of the change value corresponding to the at least one statistic at the time point with the change using Varint encoding to obtain at least one encoded data at the time point with the change;
[0051] Varint encoding is a variable-length encoding method. Smaller numbers use fewer bytes, and data compression is achieved by reducing the number of bytes required to represent numbers. Varint encoding requires 1 to 5 bytes, with small numbers using 1 byte and large numbers using 5 bytes. In this embodiment, the small numbers in the change values of the statistics at each time point in the time series data far outnumber the large numbers. By encoding the non-zero values of the change values corresponding to each statistic at the time point of change using Varint encoding, at least one encoded data at the time point of change is obtained, further reducing the amount of data required to be recorded, thereby further increasing the amount of time series data that can be recorded in a limited storage space.
[0052] Step S302: splicing the encoded data at the time point with the change to obtain compressed data corresponding to the time point with the change.
[0053] The various coded data at the changing time point can be spliced together to obtain the compressed data corresponding to the changing time point. Splicing refers to splicing the bytes of the various coded data in a certain order. In this embodiment, there is no restriction on the order of splicing. In a feasible implementation, indication data for indicating the splicing order of the various coded data can be generated, and a time series data compression result can be generated based on the indication data, so that when the time series data compression result is decompressed, the order of the various coded data in the compressed data corresponding to the changing time point can be parsed based on the indication data, thereby corresponding the various coded data to the various statistics according to the order, and thus restoring the statistical value of each statistic based on each coded data.
[0054] In one feasible implementation, step S302 includes:
[0055] Step S3021 , according to the order of the statistics corresponding to the coded data at the time point with changes in the preset statistics ranking, splicing the coded data at the time point with changes to obtain compressed data corresponding to the time point with changes.
[0056] The ranking of each statistic can be pre-set, i.e., a preset statistic ranking. When encoding each coded data, the coded data at the time point of change can be spliced according to the order of the statistics corresponding to the coded data in the preset statistic ranking to obtain the compressed data corresponding to the time point of change. For example, there are three statistics, and the preset statistic ranking order is: statistic 1, statistic 2, statistic 3. Among them, statistics 1 and statistics 3 have coded data at the time point of change, namely coded data 1 and coded data 3, respectively. In this case, coded data 1 and coded data 3 can be byte-spliced, with coded data 1 in front and coded data 2 in the back.
[0057] In one feasible implementation, step S40 includes:
[0058] Step S401: Generate a change value indicator sequence corresponding to the target time point, wherein the change value indicator sequence includes an indicator value for indicating whether the change value of the at least one statistic at the target time point is zero, and the position of the indicator value in the change value indicator sequence is the same as the position of the statistic corresponding to the indicator value in the preset statistic ranking;
[0059] When generating change indication data, a change value indication sequence corresponding to each time point can be generated first. Taking the target time point as an example, the change value indication sequence at the target time point can include an indicator value for indicating whether the change value of each statistic at the target time point is zero, and the position of each indicator value in the change value indication sequence is the same as the position of the statistic corresponding to the indicator value in the preset statistic ranking. It is understandable that the indicator value used to indicate that the change value is zero is different from the indicator value used to indicate that the change value is non-zero, thereby achieving the purpose of distinguishing whether the change value is zero. The specific values of the indicator value are not limited in this embodiment. For example, 0 can be used to indicate that the change value is zero, and 1 can be used to indicate that the change value is non-zero. Assuming there are three statistics, the preset statistical ranking order is: statistic 1, statistic 2, statistic 3, where the change values of statistics 1 and 3 at the target time point are non-zero, and the change value of statistic 2 at the target time point is zero, then the corresponding change value indication sequence at the target viewing point is 101.
[0060] Step S402 : Concatenate the change value indication sequences corresponding to the multiple time points to obtain the change indication data.
[0061] After generating corresponding change value indication sequences for each time point (including time points with changes and time points without changes), each change value indication sequence can be byte-concatenated to obtain change value indication data. In this embodiment, there is no restriction on the order in which the change value indication sequences are concatenated; for example, the change value indication sequences can be concatenated in the order in which the time points correspond to the change value indication sequences.
[0062] In this embodiment, the indicator values corresponding to the target time points are sorted according to the order of the corresponding statistics in the preset statistical ranking, and the encoded data corresponding to the changed time points are sorted according to the order of the corresponding statistics in the preset statistical ranking. When the time series data compression results are decompressed, the order of the encoded data of each statistic in the compressed data of the changed time points can be directly determined according to the order of the indicator values in the change indicator sequence, thereby eliminating the need to use additional data to record the position of the encoded data of each statistic in the compressed data of the changed time points, thereby further reducing the amount of data required to be recorded and further improving the compression efficiency.
[0063] For example, in one feasible implementation, step S50 includes:
[0064] Step S501, concatenating the compressed data corresponding to each of the change time points in chronological order to obtain a compressed data sequence;
[0065] The compressed data corresponding to each change time point can be byte-concatenated in the chronological order of the change time points. The result is called a compressed data sequence for identification. For example, as shown in Figure 2, the compressed data corresponding to three change time points is recorded and byte-concatenated in the chronological order of the three change time points to obtain a compressed data sequence.
[0066] Step S502, generating header data according to the data length of the change indication data and the data length of the compressed data sequence;
[0067] To facilitate parsing the time series data compression results, header data can be generated based on the data length of the change indication data and the data length of the compressed data sequence. When parsing the time series data compression results, the header data can be used to quickly locate the locations of the change indication data and the compressed data sequence, and can also facilitate verification of the completeness of the decompressed time series data compression results. In specific implementations, the header data can also include other information, which is not limited here. For example, it can include the number of statistics to address the situation where the number of statistics in specific application scenarios is not fixed.
[0068] Step S503: sequentially concatenate the header data, the change indication data, and the compressed data sequence to obtain a time series data compression result.
[0069] As shown in Figure 2, the various components of the time series data compression result are given as an example. In Figure 2, the time series data includes three statistics as an example, 0 is used to indicate that the change value corresponding to the statistic is zero, and 1 is used to indicate that the change value corresponding to the statistic is non-zero; time points 1, 2 and 4 in Figure 2 are time points with changes, and time point 3 is a time point without changes. When decompressing the time series data compression result, the change indication data and the compressed data sequence can be found from the time series data compression result according to the data length of the change indication data recorded in the header data and the data length of the compressed data sequence; according to the change indication sequence corresponding to each time point in the change indication data, it can be obtained whether the change value of each statistic at each time point is zero. If the change value of the statistic at a time point is zero, the statistical value of the statistic at the previous time point at the time point is used as the statistical value of the statistic at the time point. If the change value of the statistic at a time point is non-zero, the change value of the statistic at the time point is restored according to the change value of the statistic at the time point and the statistical value of the statistic at the previous time point at the time point.
[0070] Based on the above-mentioned first and / or second embodiments, a third embodiment of the time series data collection method of the present application is proposed. In this embodiment, the time series data collection method is applied to any line card device in the network element device, and the time series data collection method includes:
[0071] Step A10: collecting time series data generated during the operation of the service process of the line card device according to the preset time series data collection requirements;
[0072] A communications network consists of multiple interconnected network elements (NEs), which are primarily responsible for receiving and sending packets. These NEs include a master control device and at least one line card. The master control device controls each line card, while the line card handles service logic, specifically receiving and sending packets. Expanding the line card functionality increases the service processing capabilities of the NEs.
[0073] The line card device can collect the time series data generated by the business process of the line card device according to the preset time series data collection requirements. Among them, the time series data collection requirements may include the time series data type that needs to be collected (also called the time series data name), the number of statistics corresponding to the time series data type, the statistics sampling interval, etc., which can be pre-set according to needs and are not limited in this embodiment. CPU utilization, memory utilization, network rate, etc. belong to different types of time series data. The same type of time series data may have one or more statistics that need to be counted. For example, the CPU has N cores, and the utilization of N cores can be counted. The business process refers to the process responsible for the message sending and receiving business. During the movement of the business process, time series data will be generated. According to specific needs, the time series data collection requirements can be pre-set in the line card device, so that the line card device collects the time series data generated by the business process according to the time series data collection requirements.
[0074] Step A20: compress the time series data according to the time series data compression method described in the above embodiment to obtain a time series data compression result;
[0075] Step A30: caching the time series data compression result.
[0076] The line card device can compress the collected time series data according to the compression method described in the above embodiment, thereby allowing more time series data to be recorded within the same storage space. In a specific embodiment, the line card device can collect time series data in real time, compress the collected time series data in real time, and cache it in real time. The cached time series data compression results can be output to other devices or persistently stored in the line card device. The specific configuration can be as needed and is not limited here.
[0077] In this embodiment, the line card device compresses and caches the collected timing data according to the timing data compression method in the above embodiment, so that the amount of timing data that can be recorded by the line card device can be increased as much as possible. Therefore, when it is necessary to analyze the timing data generated in the line card device in a specific application scenario, better analysis results can be obtained based on the line card timing data with a larger data volume.
[0078] In one feasible implementation manner, after step A30, the method further includes:
[0079] Step A40: After detecting that a preset data persistence trigger condition is met, the cached time series data compression result is subjected to data persistence processing.
[0080] During the process of caching the time series data compression results, the line card device can detect whether the preset data persistence trigger conditions are met. Among them, the data persistence trigger conditions can be set in advance as needed, for example, it can be a timed trigger, a trigger when the cache amount reaches a certain upper limit, or a trigger when a persistence instruction sent by the master device is received. When it is detected that the data persistence trigger conditions are met, the line card device can perform data persistence processing on the cached time series data compression results, for example, it can use a file for data persistence and store the compressed data in a file, or use a database for persistence and write the time series data into the database. After the line card device performs data persistence on the cached time series data compression results, the freed cache space can be used to cache new time series data compression results, thereby increasing the amount of time series data that can be recorded by circular recording. In a specific embodiment, a storage model can be established for the collected time series data using a description language such as lua or xml, so as to facilitate the use of a database to store time series data. In this embodiment, the cached time series data compression results are persisted in the line card device, without the need to deploy other devices for storage. In addition, since the time series data in the above-mentioned embodiment of the present application is compressed, as much time series data as possible can be stored in the limited storage space of the network element device, which also makes the persistence of time series data in the line card device more feasible.
[0081] Based on the third embodiment above, a fourth embodiment of the time series data acquisition method of the present application is proposed. In this embodiment, step A20 includes:
[0082] Step A201: After the service process of the line card device is started, a time series data statistics package is registered in a cache space through the service process according to the preset time series data collection requirements. The time series data statistics package includes service information, and the service information includes a time series data type, a number of statistics corresponding to the time series data type, an interface for obtaining a statistical value of each statistic, and a statistic sampling interval.
[0083] In this embodiment, a feasible implementation method for performing time series data collection in a line card device is proposed, and time series data is collected by a data collection agent residing in a business process. Specifically, after the business process in the line card device is started and running, a time series data statistics package is registered in the cache space through the business process according to the preset time series data collection requirements, and the time series data statistics package may include business information. Among them, the statistical value acquisition interface of each statistical quantity in the business information refers to an interface for obtaining the statistical value of the statistical quantity from the business process, that is, the data collection agent can obtain the statistical value corresponding to the statistical quantity through the statistical value acquisition interface. The statistical quantity sampling interval refers to the time interval for collecting the statistical value of the statistical quantity, for example, once per second.
[0084] Step A202 : The business process calls a preset data collection agent to collect time series data generated during the operation of the business process according to the business information.
[0085] A data collection agent is a pre-written program for collecting time series data. This data collection agent is called by a business process to collect time series data. In one embodiment, the line card device can use the data collection agent to compress the collected time series data according to the time series data compression method described in the above embodiment to obtain a time series data compression result.
[0086] In one feasible implementation, step A30 includes:
[0087] Step A301: Cache the time series data compression result into the time series data statistics package through the data acquisition agent.
[0088] For example, the time series data statistics package may use the following data format:
[0089] Statistics package = table, statistics = column, callback = row
[0090] ---------------------------------------
[0091] time|statistic1|statistic2|statistic3|…|statisticn
[0092] xxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxx|xxxxxxx
[0093] xxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxx|xxxxxxx
[0094] xxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxx|xxxxxxx
[0095] xxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxx|xxxxxxx
[0096] Among them, table represents the name of the statistical package (also known as the time series data type), column represents the number of statistics, and row represents the interface for obtaining the statistical values of the statistics.
[0097] In one feasible implementation manner, after step A30, the method further includes:
[0098] In step A50 , the cached time series data compression result is reported to the data collector in the master device through the data collection agent, so that the master device performs data persistence processing on the time series data compression result through the data collector.
[0099] The line card device can also report the timing data compression result to the main control device, and the main control device will perform data persistence. In a specific embodiment, the line card device can use the data acquisition agent to report the cached timing data compression result to the data collector in the main control device after detecting that the preset data persistence trigger condition is met. The data collector is a program deployed in the main control device for integrating and storing the timing data compression results reported by each line card device. The main control device performs data persistence processing on the timing data compression results reported by each line card device through the data collector. By setting up a data collector in the main control device for data persistence, it is convenient to uniformly manage the timing data in each line card device in the main control device, such as exporting it uniformly without exporting it separately from each line card device, thereby improving the management efficiency of timing data.
[0100] In one feasible implementation, the architecture of a time series data collection and storage system in a network element device can be as shown in Figure 3, where the data collection agent is deployed within the service process of the line card device, and the data collector is deployed in the master control device. In Figure 3, count statistics refer to statistics of the counting type, periodic statistics refer to statistics that change periodically, and oscillation statistics refer to statistics that oscillate in time series, such as CPU utilization.
[0101] In a feasible implementation, the line card device may collect, compress, and store time series data according to the process shown in FIG4 .
[0102] 1. The business process (also known as the "business" in the figure) initializes the data collection agent.
[0103] 2. The business registers the time series data to be collected based on the time series data collection requirements. The registration information includes the time series data type, the statistical value acquisition interface of the statistic, the number of statistics corresponding to the time series data type, the statistical sampling interval, etc.
[0104] 3. The data collection agent regularly calls the statistical value acquisition interface to collect data according to the sampling interval.
[0105] 4. The data collection agent compresses and caches the collected time series data.
[0106] 5. When the cache in the data collection agent is full or the reporting cycle is up, the time series data is reported to the data collector.
[0107] 6. The data collector integrates the time series data collected by multiple data collection agents and prepares the data for data persistence.
[0108] 7. Determine the subsequent process based on the data persistence method. If using files for data persistence, directly store the compressed data in the files. If using a database to persist time series data, first use Lua to build a data storage model, and then write the time series data to the database based on the model.
[0109] In addition, an embodiment of the present application further provides a time series data compression device, the time series data compression device comprising:
[0110] An acquisition module, configured to acquire time series data, wherein the time series data includes statistical values of at least one statistic at multiple time points;
[0111] a determination module, configured to obtain, for any target statistic among the at least one statistic and for any target time point among the multiple time points, a change value of the target statistic at the target time point based on the time series data, wherein the change value at the target time point is a change value of the statistical value of the target statistic at the target time point relative to the statistical value of the target statistic at a time point previous to the target time point;
[0112] an encoding module, configured to encode, based on a non-zero value in a change value corresponding to the at least one statistic at a time point with a change, to obtain compressed data corresponding to the time point with a change, wherein the time point with a change is a time point corresponding to at least one non-zero change value among the multiple time points;
[0113] A first generating module is configured to generate change indication data, wherein the change indication data is configured to indicate whether a change value of the at least one statistic at each of the plurality of time points is zero;
[0114] The second generating module is configured to generate a time series data compression result according to the compressed data corresponding to the change time point and the change indication data.
[0115] The encoding module is also used for:
[0116] Encoding non-zero values of the change value corresponding to the at least one statistic at the time point with the change using Varint encoding to obtain at least one encoded data at the time point with the change;
[0117] The encoded data at the time point with changes are spliced to obtain compressed data corresponding to the time point with changes.
[0118] The encoding module is also used for:
[0119] According to the order of the statistics corresponding to the respective encoded data at the time point with changes in the preset statistics ranking, the respective encoded data at the time point with changes are spliced to obtain the compressed data corresponding to the time point with changes.
[0120] The first generating module is further configured to:
[0121] generating a change value indication sequence corresponding to the target time point, wherein the change value indication sequence includes an indicator value for indicating whether the change value of the at least one statistic at the target time point is zero, and a position of the indicator value in the change value indication sequence is the same as a position of the statistic corresponding to the indicator value in the preset statistic ranking;
[0122] The change indication data are obtained by splicing the change value indication sequences corresponding to the multiple time points.
[0123] The second generating module is further configured to:
[0124] splicing the compressed data corresponding to each of the change time points in a chronological order of the change time points to obtain a compressed data sequence;
[0125] generating header data according to the data length of the change indication data and the data length of the compressed data sequence;
[0126] The header data, the change indication data and the compressed data sequence are sequentially spliced to obtain a time series data compression result.
[0127] In addition, an embodiment of the present application further provides a time series data acquisition device, which is applied to any line card device in a network element device, and includes:
[0128] A collection module, configured to collect time series data generated during the operation of the service process of the line card device according to a preset time series data collection requirement;
[0129] The time series data compression device as described above;
[0130] The cache module is used to cache the compression result of the time series data.
[0131] The time series data acquisition device further includes:
[0132] The persistence module is used to perform data persistence processing on the cached time series data compression result after detecting that a preset data persistence trigger condition is met.
[0133] The acquisition module is also used for:
[0134] After the service process of the line card device is started and run, a time series data statistics package is registered in the cache space through the service process according to the preset time series data collection requirements, wherein the time series data statistics package includes service information, and the service information includes the time series data type, the number of statistics corresponding to the time series data type, the statistical value acquisition interface of each statistic, and the statistic sampling interval;
[0135] The business process calls a preset data collection agent to collect time series data generated during the operation of the business process according to the business information.
[0136] The cache module is also used for:
[0137] The time series data compression result is cached in the time series data statistics package through the data acquisition agent.
[0138] The time series data acquisition device further includes:
[0139] The reporting module is used to report the cached time series data compression result to the data collector in the main control device through the data collection agent, so that the main control device can perform data persistence processing on the time series data compression result through the data collector.
[0140] An embodiment of the present application also provides a time series data compression device, which includes: a memory, a processor, and a time series data compression program stored in the memory and executable on the processor. When the time series data compression program is executed by the processor, the steps of the time series data compression method described in each embodiment above are implemented. In a specific embodiment, as shown in Figure 5, the time series data compression device may also include a network interface, a user interface, and a communication bus. The communication bus is used to achieve connection and communication between these components. The user interface may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory may also be a storage device independent of the aforementioned processor. The memory, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a time series data compression program. The operating system is a program that manages and controls the hardware and software resources of the device and supports the operation of the time series data compression program and other software or programs. Those skilled in the art will understand that the device structure shown in FIG5 does not constitute a limitation on the time series data compression device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.
[0141] An embodiment of the present application also provides a time series data acquisition device, comprising: a memory, a processor, and a time series data acquisition program stored in the memory and executable on the processor. When the time series data acquisition program is executed by the processor, the steps of the time series data acquisition method described in each of the above embodiments are implemented. In a specific embodiment, the time series data acquisition device may be a line card device in a network element device. In a specific embodiment, as shown in FIG6 , the time series data acquisition device may further include a network interface, a user interface, and a communication bus. The communication bus is used to enable connection and communication between these components. The user interface may include a display screen and an input unit such as a keyboard. The user interface may also include a standard wired interface and a wireless interface. The network interface may include a standard wired interface and a wireless interface (such as a Wi-Fi interface). The memory may be a high-speed RAM memory or a non-volatile memory, such as a disk storage device. The memory may optionally be a storage device independent of the aforementioned processor. The memory, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and the time series data acquisition program. An operating system is a program that manages and controls the hardware and software resources of a device, supporting the execution of the time series data acquisition program and other software or programs. Those skilled in the art will appreciate that the device structure shown in FIG6 does not limit the time series data acquisition device and may include more or fewer components than shown, or combine certain components or arrange the components differently.
[0142] Referring to Figure 7 , an embodiment of the present application further provides a computer-readable storage medium storing a time series data compression program. When executed by a processor, the time series data compression program implements the steps of the time series data compression method described in the above embodiments. As shown in Figure 7 , in a specific embodiment, a memory serving as a computer-readable storage medium can be connected to and communicated with a processor via a communication bus.
[0143] Referring to Figure 8 , an embodiment of the present application further provides a computer-readable storage medium storing a time series data acquisition program. When executed by a processor, the time series data acquisition program implements the steps of the time series data acquisition method described in the above embodiments. As shown in Figure 8 , in a specific embodiment, a memory serving as a computer-readable storage medium can be connected to and communicated with a processor via a communication bus.
[0144] The various embodiments of the time series data compression device, compression equipment, time series data acquisition device, acquisition equipment and computer-readable storage medium of the present application can refer to the various embodiments of the time series data compression method and time series data acquisition method of the present application, and will not be repeated here.
[0145] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0146] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0147] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0148] The above are merely optional embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A time series data compression method, wherein: The time series data compression method comprises: Acquire time series data, wherein the time series data includes statistical values of at least one statistic at multiple time points; For any target statistic among the at least one statistic, and for any target time point among the multiple time points, obtaining a change value of the target statistic at the target time point according to the time series data, wherein the change value at the target time point is a change value of the statistical value of the target statistic at the target time point relative to the statistical value of the target statistic at the previous time point of the target time point; According to a non-zero value in a change value corresponding to the at least one statistic at a change time point, encoding obtains compressed data corresponding to the change time point, wherein the change time point is a time point corresponding to at least one non-zero change value among the multiple time points; Generate change indication data, where the change indication data is used to indicate whether the change values of the at least one statistic at the multiple time points are zero; Generate a time series data compression result according to the compressed data corresponding to the changed time point and the change indication data.
2. The time series data compression method according to claim 1, wherein: The step of encoding, according to a non-zero value in a change value corresponding to the at least one statistic at a change time point, to obtain compressed data corresponding to the change time point comprises: Encoding non-zero values of the change value corresponding to the at least one statistic at the time point with the change respectively by using Varint encoding to obtain at least one encoded data at the time point with the change; The encoded data at the changed time point are concatenated to obtain compressed data corresponding to the changed time point.
3. The time series data compression method according to claim 2, wherein: The step of splicing the coded data at the time point with changes to obtain compressed data corresponding to the time point with changes comprises: According to the order of the statistics corresponding to the respective encoded data at the changed time points in the preset statistics ranking, the respective encoded data at the changed time points are concatenated to obtain the compressed data corresponding to the changed time points.
4. The time series data compression method according to claim 3, wherein: The step of generating change indication data comprises: Generate a change value indication sequence corresponding to the target time point, wherein the change value indication sequence includes an indication value for indicating whether the change value of the at least one statistic at the target time point is zero, and the position of the indication value in the change value indication sequence is the same as the position of the statistic corresponding to the indication value in the preset statistic ranking; The change indication data are obtained by splicing the change value indication sequences corresponding to the multiple time points respectively.
5. The time series data compression method according to claim 3, wherein: The step of generating a time series data compression result according to the compressed data corresponding to the change time point and the change indication data comprises: splicing the compressed data corresponding to each of the changed time points according to the time sequence of the changed time points to obtain a compressed data sequence; generating header data according to the data length of the change indication data and the data length of the compressed data sequence; The header data, the change indication data and the compressed data sequence are sequentially spliced to obtain a time series data compression result.
6. A time series data collection method, wherein: The timing data collection method is applied to any line card device in the network element device, and the timing data collection method includes: According to the preset time series data collection requirements, collect the time series data generated during the operation of the service process of the line card device; Compressing the time series data according to the time series data compression method according to any one of claims 1 to 5 to obtain a time series data compression result; The time series data compression result is cached.
7. The time series data acquisition method according to claim 6, wherein: After the step of caching the time series data compression result, the method further includes: After it is detected that a preset data persistence trigger condition is met, data persistence processing is performed on the cached time series data compression result.
8. The time series data acquisition method according to claim 6, wherein: The step of collecting the time series data generated during the operation of the service process of the line card device according to the preset time series data collection requirement includes: After the service process of the line card device is started and run, a time series data statistics package is registered in the cache space through the service process according to the preset time series data collection requirements, and the time series data statistics package includes service information, and the service information includes the time series data type, the number of statistics corresponding to the time series data type, the statistical value acquisition interface of each statistic, and the statistic sampling interval; The business process calls a preset data collection agent to collect the time series data generated during the operation of the business process according to the business information.
9. The time series data acquisition method according to claim 8, wherein: The step of caching the time series data compression result comprises: The time series data compression result is cached in the time series data statistics package through the data acquisition agent.
10. The time series data acquisition method according to claim 9, wherein: After the step of caching the time series data compression result, the method further includes: The cached time series data compression result is reported to the data collector in the main control device through the data collection agent, so that the main control device can perform data persistence on the time series data compression result through the data collection device. Chemical processing.
11. A time series data compression device, wherein: The time series data compression device includes: a memory, a processor, and a time series data compression program stored in the memory and executable on the processor. When the time series data compression program is executed by the processor, the time series data compression method according to any one of claims 1 to 5 is implemented.
12. A time series data acquisition device, wherein: The time series data acquisition device includes: a memory, a processor, and a time series data acquisition program stored in the memory and executable on the processor. When the time series data acquisition program is executed by the processor, the time series data acquisition method according to any one of claims 6 to 10 is implemented.
13. A computer-readable storage medium, wherein: The computer-readable storage medium stores a time series data compression program, and when the time series data compression program is executed by a processor, the time series data compression method according to any one of claims 1 to 5 is implemented.
14. A computer-readable storage medium, wherein: The computer-readable storage medium stores a time series data acquisition program, and when the time series data acquisition program is executed by the processor, the time series data acquisition method according to any one of claims 6 to 10 is implemented.
Citation Information
Patent Citations
Data compression coding method and device and storage electronic equipment
CN109981111A
Industrial time sequence data compression method and system
CN112968751A
Method and system for accelerating ai training with advanced interconnect technologies
CN113272854A
Compression method and device for time sequence data of Internet of Vehicles and electronic equipment
CN114759929A
Data processing method, corresponding processing system, sensor device and computer program product
US20220051081A1
Cited By
Industrial time series data re-characterization method and device based on constant approximation and medium
CN118796914A
Industrial time series data re-characterization method, equipment and medium based on constant approximation
CN118796914B
Lightweight processing method and device for power consumption data and electronic equipment
CN120316798A
