CPC G06F 16/22 (2019.01) [G06F 16/2474 (2019.01)] | 9 Claims |
1. A method for storing time series data, comprising:
caching, by a processor, the time series data containing at least one record from a network to a memory in a row-based storage manner;
determining, by the processor, whether the time series data cached in the memory needs to be written to the disk, and when the time series data cached in the memory needs to be written to a disk, determining a sum of number of records according to number of records of to-be-written-to-disk time series data and number of records of the time series data in a LAST file of the disk, wherein the determining whether the time series data cached in the memory needs to be written to the disk comprises: checking the memory and an offset list of the time series data in the memory to determine if the memory is insufficient or the offset list of the time series data in the memory is full; and
in response to the determining that the time series data cached in the memory needs to be written to the disk:
when the sum of number of the records is less than a pre-set number N, writing, by the processor, the to-be-written-to-disk time series data to the LAST file of the disk, wherein the pre-set number N is a minimum number of records; and
when the sum of number of the records is greater than or equal to the pre-set number N, merging, by the processor, the to-be-written-to-disk time series data and the time series data in the LAST file of the disk to obtain a merged time series data, and writing the merged time series data to a new or existing DATA file for permanently saving data of the disk in a column-based storage manner.
|