Embedded time sequence database system and access method thereof
Through the embedded timing database system, memory IO is used for data management, the problem of poor delay and poor concurrency performance caused by network dependence in the prior art is solved, and high-performance services with lower latency and higher concurrency are achieved.
Patent Information
- Application Number
- CN202411168281.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-12-17
AI Technical Summary
The existing time-series database system's external services rely on the network, resulting in high delays and poor concurrency performance. Especially in low delays and high concurrency data query and computing scenarios, network IO has become a bottleneck, increasing the cost of software and hardware.
Provide an embedded timing database system, which embeds the timing data module into a third-party application through an interface service module, uses memory IO for data writing and query, adopts a single timing data storage structure and a time series storage structure, combined with two Level indexing and algorithm modules realize high-performance data management and processing.
It reduces the read and write delay of timing data, improves concurrency performance, makes full use of memory IO high performance, reduces dependence on network bandwidth and server resources, and reduces costs.
Smart Images

Figure CN119149651A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of time series databases, and in particular to an embedded time series database system and an access method thereof. Background Art
[0002] A time series database is a database system specially designed to store and process time series data. Time series data is a sequence of data arranged in chronological order. It is usually used to record and analyze data that changes over time, such as sensor data, log data, financial data, etc. It has the advantages of fast and efficient storage, fast query, and real-time processing. With the development of the Internet of Things, big data analysis and other fields, time series databases play an increasingly important role in data management and analysis.
[0003] At present, time series databases are mainly independent software with C / S or B / S architectures, which provide services such as data writing, querying, and conventional computing to third-party applications through network protocols such as TCP or HTTP. The external services of C / S and B / S architectures rely on the network, and the network IO performance is several orders of magnitude lower than the memory IO, resulting in high latency and poor concurrency performance of the time series database system's external services. In scenarios where third-party applications require low latency and high concurrency data query and data computing, network IO becomes an application bottleneck, which often requires more server resources and network bandwidth to compensate, increasing software and hardware costs.
[0004] Therefore, there is an urgent need to provide an embedded time series database system and its access method to realize data writing, query and other services between the time series database and third-party applications based on memory IO, reduce data transmission delay, and improve concurrency performance. Summary of the invention
[0005] In view of this, it is necessary to provide an embedded time series database system and its access method to solve the technical problem in the prior art that external services depend on the network, resulting in high latency and poor concurrency performance of the time series database system's external services.
[0006] On the one hand, in order to solve the above technical problems, the present invention provides an embedded time series database system, including: an interface service module and a time series data module; The time series data module is used to define the data storage structure and sequence basic method of time series data; The interface service module is used to provide a data application program interface, and call the sequence basic method based on the data application program interface to write and read the time series data in the data storage structure.
[0007] In a possible implementation, the data storage structure includes a single time series data storage structure and a time series storage structure, the sequence basic method includes a single time series data basic method and a time series sequence basic method; the time series data module includes a time series sequence library and a time series data warehouse; The time series library is used to define the single time series data storage structure and the single time series data basic method; The time series data warehouse is used to define the time series storage structure and the time series basic method.
[0008] In a possible implementation, the single time series data storage structure includes a monitoring value data structure, a monitoring value container data structure, and a query data structure; The monitoring value data structure includes a monitoring value field and a timestamp field, wherein the monitoring value field is used to represent the monitoring value, and the timestamp field is used to represent the time corresponding to the monitoring value; The monitoring value container data structure includes a monitoring field, a device identification field, a monitoring factor field and a maximum value field, wherein the device identification field is used to indicate the device corresponding to the monitoring value, the monitoring factor field is used to indicate the data type corresponding to the monitoring value, and the maximum value field is used to indicate the maximum value of the data; The query data structure includes a start time field, an end time field, a query type field, a query device identification field, a query monitoring factor field and a query volume field; the start time field is used to indicate the start time of the query data, the end time field is used to indicate the end time of the query data, the query type field is used to indicate the query intention, the query device identification field is used to indicate the device corresponding to the query data, the monitoring factor field is used to indicate the data type corresponding to the query data, and the query volume field is used to indicate the data volume of the query data.
[0009] In a possible implementation, the single time series data storage structure also includes a time series data structure, which includes a sequence field, a lock field, a maximum quantity field, a correction value field, a deletion trigger quantity field, an actual quantity field, a sequence first time field, a sequence latest time field, a device identification field and a monitoring factor field; the sequence field is used to represent a time series, and the time series is a collection of monitoring values. The lock field is used to ensure the exclusivity of the thread when multiple threads access the time series. The maximum quantity field is used to represent the maximum storage capacity of the time series, the correction value field is used to represent the correction value, the deletion trigger quantity field is used to represent the sum of the maximum quantity and the correction value, the actual quantity field is used to represent the number of monitoring values in the time series, the sequence first time field is used to represent the minimum time of the monitoring value in the time series, the sequence latest time field is used to represent the maximum time of the monitoring value in the time series, the device identification field is used to represent the device corresponding to the monitoring value, and the monitoring factor field is used to represent the type corresponding to the monitoring value.
[0010] In a possible implementation, the single time series data basic method includes a single time series data deletion method, a single time series data addition method, a single time series data query method, and a single time series data update method; The single time series data deletion method is used to delete expired data when the amount of data in the time series is greater than the sum of the maximum amount and the correction value; The single time series adding method is used to call the single time series data deleting method to ensure that the number of the time series is within a set range, and add the newly obtained monitoring value to the time series; The single time series data query method is used to determine the target time series data in the time series based on the query requirements; The single time series data updating method is used to update the monitoring value of a specified time node.
[0011] In one possible implementation, the time series storage structure includes a device identification factor dictionary table and a time series data set. The time series storage structure caches all device identifications and monitoring factors. The time series data set caches all time series. The monitoring factors and the time series correspond one to one.
[0012] In a possible implementation, the basic time series method includes a new sequence method, a query sequence method and a delete sequence method; The newly added sequence method is used to add time series data to the time series data set based on the equipment-monitoring factor-time series secondary index; The query sequence method is used to determine target time series data from the time series data set based on the device-monitoring factor-time series secondary index; The deletion sequence method is used to delete specified time series data from the time series data set based on the device-monitoring factor-time series secondary index.
[0013] In a possible implementation, the interface service module includes a query data application program interface and an edit data application program interface; The data query application program interface provides a variety of data query methods; The editing data application program interface provides a variety of data editing methods; Wherein, the data editing method includes a single-point data writing method and a batch data writing method.
[0014] In a possible implementation, the system further includes an algorithm module, which is used to process the time series data obtained from the time series data module based on actual needs; The algorithm module includes built-in algorithms and custom algorithms.
[0015] On the other hand, the present invention further provides an access method for an embedded time series database system, which is applicable to the embedded time series database system described in any one of the possible implementations above, and the method includes: Embedding the time series data module into a third-party application for execution based on the interface service module; Setting default parameters for the time series data module; Encode the monitoring data to be written based on the data storage structure defined by the time series data module to obtain the target data to be written, and write the target data to be written into the time series data module by calling the sequence basic method based on the interface service module; The query conditions are encapsulated based on the data storage structure defined by the time series data module to obtain the query instruction, and the sequence basic method is called based on the interface service module to obtain the target time series data from the time series data module based on the query instruction and the sequence basic method.
[0016] The beneficial effects of the present invention are as follows: the embedded time series database system provided by the present invention, by setting an interface service module, can directly call the time series data module as a program package by a third-party application through the memory based on the data application program interface provided by the interface service module, and make full use of the high-performance reading and writing capabilities of the memory IO, providing lower-cost and more concurrent high-performance services for the reading and writing of time series data, thereby reducing the reading and writing delays of time series data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] 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 those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0018] Figure 1 A schematic diagram of the structure of an embodiment of the embedded time series database system provided by the present invention; Figure 2 A code schematic diagram of a monitoring value data structure, a monitoring value container data structure and a query data structure provided by the present invention; Figure 3 A schematic diagram of a code of a time series data structure provided by the present invention; Figure 4 A schematic diagram of the code of the basic method of the timing sequence provided by the present invention; Figure 5 A flowchart of an embodiment of a method for accessing an embedded time series database system provided by the present invention. DETAILED DESCRIPTION
[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0020] It should be understood that the schematic drawings are not drawn to scale. The flowchart used in the present invention shows the operations implemented according to some embodiments of the present invention. It should be understood that the operations of the flowchart can be implemented out of order, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present invention, and can also remove one or more operations from the flowchart. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor systems and / or microcontroller systems.
[0021] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0022] The present invention provides an embedded time series database system and an access method thereof, which are described below respectively.
[0023] Figure 1 A schematic diagram of the structure of an embodiment of the embedded time series database system provided by the present invention is shown in FIG. Figure 1 As shown, the embedded time series database system 10 includes: an interface service module 100 and a time series data module 200; The time series data module 200 is used to define the data storage structure and sequence basic method of time series data; The interface service module 100 is used to provide a data application program interface (Application Program Interface, API), and call a sequence basic method based on the data application program interface to write and read the time series data in a data storage structure.
[0024] Among them, time series data refers to the data sequence related to time.
[0025] It should be noted that the interface service module 100 serves as a channel between the time series data module 200 and third-party applications, and is used to shield the business logic inside the time series data module 200 to achieve the purpose of efficiently using the time series data module 200 in the memory.
[0026] Compared with the prior art, the embedded time series database system 10 provided in the embodiment of the present invention, by setting an interface service module 100, can use the time series data module 200 as a program package to be directly called by a third-party application through the memory based on the data application program interface provided by the interface service module 100, thereby making full use of the high-performance reading and writing capabilities of the memory IO, providing lower-cost and more concurrent high-performance services for the reading and writing of time series data, and reducing the reading and writing delays of time series data.
[0027] When the amount of time series data is huge, in order to further improve the orderliness and read-write efficiency of the time series data module 200, in some embodiments of the present invention, the data storage structure includes a single time series data storage structure and a time series storage structure, and the sequence basic method includes a single time series data basic method and a time series sequence basic method; Figure 1 As shown, the time series data module 200 includes a time series library 210 and a time series data warehouse 220; The time series library 210 is used to define a single time series data storage structure and a single time series data basic method; The time series data warehouse 220 is used to define the time series storage structure and the basic method of time series.
[0028] The time series library 210 is a database formed by a single time series data, which provides atomic-level services for the time series data warehouse 220 . The time series data warehouse is a database formed by time series.
[0029] Specifically, the time series library 210 includes a plurality of single time series data, and the time series data warehouse 220 is a database consisting of a plurality of time series by dividing the plurality of single time series data into a plurality of time series based on a certain parameter.
[0030] The time series data warehouse 220 provides a unified entry for the interface service module 100 and is the basis for managing time series data in the embodiment of the present invention.
[0031] In some embodiments of the present invention, a single time series data storage structure includes a monitoring value data structure, a monitoring value container data structure, and a query data structure.
[0032] Specifically, Figure 2 As shown, the monitoring value data structure includes a monitoring value field V and a timestamp field T. The monitoring value field V is used to indicate the monitoring value, and the timestamp field T is used to indicate the time corresponding to the monitoring value.
[0033] Specifically, Figure 2 As shown, the monitoring value container data structure includes a monitoring field Data, a device identification field DeviceId, a monitoring factor field Code, and a maximum value field MaxCount. The device identification field is used to indicate the device corresponding to the monitoring value, the monitoring factor field is used to indicate the data type corresponding to the monitoring value, and the maximum value field is used to indicate the maximum value of the data.
[0034] The monitoring field Data includes a monitoring value field V and a timestamp field T.
[0035] Among them, the monitoring factor represents the monitoring variable code.
[0036] The monitoring value container data structure is used to bind the monitoring value with the device and monitoring factor, so as to facilitate writing the monitoring value into the appropriate time series data structure.
[0037] Specifically, Figure 2As shown, the query data structure includes a start time field StartTime, an end time field EndTime, a query type field QueryType, a query device identification field DeviceId, a query monitoring factor field Code, and a query quantity field Count; the start time field is used to indicate the start time of the query data, the end time field is used to indicate the end time of the query data, the query type field is used to indicate the query intention, the query device identification field is used to indicate the device corresponding to the query data, the monitoring factor field is used to indicate the data type corresponding to the query data, and the query quantity field is used to indicate the data volume of the query data.
[0038] The query intent refers to the time series data type. For example, time series data includes different types of data such as voltage and current. The query type field is used to indicate whether the query is for voltage or current.
[0039] To achieve storage of a large amount of time series data, in some embodiments of the present invention, the single time series data storage structure also includes a time series data structure, such as Figure 3 As shown, the time series data structure includes a sequence field TimeSeries, a lock field lockObj, a maximum field MaxCount, a correction value field Ratio, a deletion trigger field triggereCount, an actual field Count, a sequence first time field lastTime, a sequence latest time field newTime, a device identification field DeviceId, and a monitoring factor field Code; the sequence field is used to represent a time series, and a time series is a collection of monitoring values. The lock field is used to ensure the exclusivity of threads when multiple threads access the time series. The maximum field is used to represent the maximum storage capacity of the time series. The correction value field is used to represent the correction value. The deletion trigger field is used to represent the sum of the maximum and the correction value. The actual field is used to represent the number of monitoring values in the time series. The sequence first time field is used to represent the minimum time of the monitoring value in the time series. The sequence latest time field is used to represent the maximum time of the monitoring value in the time series. The device identification field is used to represent the device corresponding to the monitoring value. The monitoring factor field is used to represent the type corresponding to the monitoring value.
[0040] It should be noted that the device identification and monitoring factors jointly determine the uniqueness of the time series data.
[0041] It should be understood that the monitoring values in the time series are sorted in chronological order. By setting the lock field, it can be ensured that when multiple threads access the sequence, each thread has exclusive access to the sequence, thereby ensuring thread safety. Among them, the correction value is a uniformly distributed random number between 600-1200.
[0042] In order to realize the basic requirements of querying, deleting, adding and updating the time series data in the time series library 210, in some embodiments of the present invention, the single time series data basic method includes a single time series data deletion method, a single time series data addition method, a single time series data query method and a single time series data update method; The single time series data deletion method is used to delete expired data when the amount of time series data is greater than the sum of the maximum amount and the correction value; The single time series addition method is used to call the single time series data deletion method to ensure that the number of time series is within the set range and add the newly obtained monitoring value to the time series; The single time series data query method is used to determine the target time series data in the time series based on the query requirements; The single time series data update method is used to update the monitoring value of a specified time node.
[0043] Expired data refers to time series data whose timestamp is outside the time range formed by the sum of the maximum value and the correction value.
[0044] The embodiment of the present invention ensures that multiple time series data will not be deleted in a centralized manner by setting up the deletion of expired data, thereby ensuring the stable performance of the embedded time series database system 10.
[0045] It should be noted that when adding a newly acquired monitoring value to a time series, the single time series addition method will also call the lock byte to ensure robustness under multi-threaded operations. In addition, when adding a monitoring value to a time series, it is necessary to add the monitoring value to the appropriate position based on the timestamp from small to large, that is, after adding the newly acquired monitoring value, the data in the time series is still arranged in ascending order of time, which is convenient for the rapid location of subsequent time series data.
[0046] In a specific embodiment of the present invention, Figure 3 As shown, the single time series data query method includes the standard query method, Top method, Max method, Min method, and Avg method. The standard query method can query data in a specified time period. The Top method is used to query the latest data of a specified number. The Max method is used to query the maximum monitoring value within a specified time period. The Min method is used to query the minimum monitoring value within a specified time period. The Avg method is used to query the average value within a specified time period.
[0047] It should be noted that when a single time series data update method is used, if the time series does not contain the specified time node, the update operation will not be performed.
[0048] In some embodiments of the present invention, the time series storage structure includes a device identification factor dictionary table and a time series data set. The time series storage structure caches all device identifications and monitoring factors, and the time series data set caches all time series. The monitoring factors and time series correspond one to one.
[0049] The embodiment of the present invention can determine the target time series data to be obtained through the device identification and monitoring factor in the device identification factor dictionary table, and query the time series library 210 based on the index of the device identification and monitoring factor to obtain the corresponding data, or write the time series data into the time series library 210 based on this index.
[0050] The embodiment of the present invention adopts a two-level index of device ID->(monitoring factor->time series), that is, the device ID points to the monitoring factor and time series relationship pair, and the monitoring factor points to the corresponding time series. The advantage of this structure is that according to the device ID, all monitoring factor time series under the specified device ID can be hit through only one query, and according to the device and the monitoring factor, the target time series can be hit through only two queries, thereby realizing high-performance management of time series.
[0051] To achieve query, addition and deletion of the time series data warehouse 220, in a specific embodiment of the present invention, the basic time series sequence method includes a method for adding a sequence, a method for querying a sequence and a method for deleting a sequence; New sequence method is added to add time series data to the time series data collection based on the device-monitoring factor-time series secondary index; The query sequence method is used to determine the target time series data from the time series data set based on the device-monitoring factor-time series secondary index; The delete sequence method is used to delete specified time series data from a time series data set based on the device-monitoring factor-time series secondary index.
[0052] like Figure 4As shown, a new sequence method AddDb is added, which creates a new time series according to the provided device ID and monitoring factor, and adds it to the time series data set through the secondary index. When the maximum storage capacity of the time series is not specified, the default value is taken. This method is a private method of the time series data warehouse and cannot be called by other modules; the query sequence method GetDb retrieves the time series from the time series data set according to the device ID and monitoring factor. When the time series data set is empty, the above-mentioned new sequence method is called to add a sequence to the time series data set according to the device ID and monitoring factor and return the newly added sequence, otherwise the retrieved sequence is returned. By automatically maintaining the addition of sequences, the complexity of other module operations can be reduced; the deletion sequence method DeleteDb provides the deletion of sequences according to the device ID or according to the device ID and monitoring factor, wherein all monitoring factor sequences under the device can be deleted from the time series data set according to the device ID, and the specified monitoring factor sequence under the device can be deleted from the time series data set according to the device ID and monitoring factor.
[0053] Since the operations on the time series database include query and edit, and edit means write, therefore, in a specific embodiment of the present invention, the interface service module 100 includes a query data application program interface and an edit data application program interface; The query data application program interface provides a variety of data query methods; The Edit Data API provides multiple data editing methods; Among them, the data editing method includes a single-point data writing method and a batch data writing method.
[0054] The data query method can be based on query items: time range, device ID, query volume, etc. For example, if you need to obtain the time series data of all devices within a period of time, you only need to set the start time and end time.
[0055] It should be noted that the single-point data writing method is specifically: receiving monitoring value container data, parsing the device ID and monitoring factors, and writing the data into the time series data warehouse, and returning the number of successful operations; the batch data writing method is specifically: receiving a monitoring value container data set, used to write multiple groups of data into the time series data warehouse in batches, and returning the number of successful operations.
[0056] Since the time series database in the prior art cannot extend user-defined algorithms, even if some time series databases allow users to extend custom algorithms, the architecture determines that these databases can only support scripting languages, which are insufficient in both coding inspection and running performance compared to static languages. Therefore, in many time series database application scenarios, especially in IoT devices or high-frequency data query and analysis applications, a more flexible time series database system is needed.
[0057] Therefore, in some embodiments of the present invention, Figure 1 As shown, the embedded time series database system 10 further includes an algorithm module 300, and the algorithm module 300 is used to process the time series data obtained from the time series data module based on actual needs; The algorithm module 300 includes a built-in algorithm and a custom algorithm, and the custom algorithm is an algorithm written based on a static language.
[0058] In a specific embodiment of the present invention, the built-in algorithm solidifies the data completion algorithm, data thinning algorithm, data transformation algorithm, and data snapshot algorithm. Among them, the data completion algorithm is used to complete the missing data. According to different complement principles, it is divided into forward completion method, backward completion method, and linear interpolation method; the data thinning algorithm is used to control the sequence frequency and reduce the amount of data processing. According to different thinning rules, it is divided into mean thinning method, maximum thinning method, median thinning method, and minimum thinning method; the data change algorithm is used to perform multiple transformations on the original sequence; the data snapshot algorithm is used to obtain the data of a specified device set at a certain moment, which is used in scenarios such as data tracing and comparative analysis.
[0059] User-defined algorithms place user-edited algorithms and manage them separately from the algorithms provided by the system to ensure the robustness and maintainability of the source code. Users can customize data thinning algorithms based on project application scenarios and develop unique data thinning services.
[0060] In a specific embodiment of the present invention, the data query method is specifically as follows: based on the six fields of start time, end time, query type, device ID, monitoring factor, and query amount, one or more algorithms in the time series sequence library, time series data warehouse, and algorithm module are called to perform chain processing on the data within the specified range, and the processing results are returned to the caller.
[0061] To summarize, the embedded time series database system 10 proposed in the embodiment of the present invention, as a program package, can be directly called by third-party applications through the memory through the interface, making full use of the high-performance reading capability of memory IO to provide applications with lower latency and more concurrent high-performance services; on the other hand, it allows users to extend custom algorithms for this time series database through static languages, providing support for third-party applications to implement more complex calculations, and has the characteristics of lightweight, scalable, high-performance, and nestable.
[0062] The present invention also provides an access method for an embedded time series database system, which is applicable to the embedded time series database system in any of the above embodiments, such as Figure 5 As shown, the access method of the embedded time series database system includes: S501, embedding the time series data module 200 into a third-party application based on the interface service module 100 for operation; S502, setting default parameters for the time series data module 200; S503, encoding the monitoring data to be written based on the data storage structure defined by the time series data module 200, obtaining the target data to be written, and writing the target data to be written into the time series data module 200 by calling the sequence basic method based on the interface service module 100; S504, encapsulate the query conditions based on the data storage structure defined by the time series data module 200, obtain the query instruction, call the sequence basic method based on the interface service module 100, and obtain the target time series data from the time series data module 200 based on the query instruction and the sequence basic method.
[0063] In step S504 , the target data to be written into the time series data module 200 may be written one by one or in batches.
[0064] Those skilled in the art will appreciate that all or part of the processes of the above-mentioned embodiments can be implemented by instructing related hardware (such as a processor, a controller, etc.) through a computer program, and the computer program can be stored in a computer-readable storage medium, wherein the computer-readable storage medium is a disk, an optical disk, a read-only storage memory, or a random access memory, etc.
[0065] The above is a detailed introduction to an embedded time series database system and its access method provided by the present invention. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. An embedded time series database system, characterized in that: include: Interface service module and timing data module; The time series data module is used to define the data storage structure and sequence basic method of time series data; The interface service module is used to provide a data application program interface, and call the sequence basic method based on the data application program interface to write and read the time series data in the data storage structure.
2. The embedded time series database system according to claim 1, characterized in that: The data storage structure includes a single time series data storage structure and a time series storage structure, and the sequence basic method includes a single time series data basic method and a time series sequence basic method; The time series data module includes a time series library and a time series data warehouse; The time series library is used to define the single time series data storage structure and the single time series data basic method; The time series data warehouse is used to define the time series storage structure and the time series basic method.
3. The embedded time series database system according to claim 2, characterized in that: The single time series data storage structure includes a monitoring value data structure, a monitoring value container data structure and a query data structure; The monitoring value data structure includes a monitoring value field and a timestamp field, wherein the monitoring value field is used to represent the monitoring value, and the timestamp field is used to represent the time corresponding to the monitoring value; The monitoring value container data structure includes a monitoring field, a device identification field, a monitoring factor field and a maximum value field, wherein the device identification field is used to indicate the device corresponding to the monitoring value, the monitoring factor field is used to indicate the data type corresponding to the monitoring value, and the maximum value field is used to indicate the maximum value of the data; The query data structure includes a start time field, an end time field, a query type field, a query device identification field, a query monitoring factor field and a query volume field; the start time field is used to indicate the start time of the query data, the end time field is used to indicate the end time of the query data, the query type field is used to indicate the query intention, the query device identification field is used to indicate the device corresponding to the query data, the monitoring factor field is used to indicate the data type corresponding to the query data, and the query volume field is used to indicate the data volume of the query data.
4. The embedded time series database system according to claim 3, characterized in that: The single time series data storage structure also includes a time series data structure, which includes a sequence field, a lock field, a maximum amount field, a correction value field, a deletion trigger amount field, an actual amount field, a sequence first time field, a sequence latest time field, a device identification field and a monitoring factor field; the sequence field is used to represent a time series, and the time series is a collection of the monitoring values. The lock field is used to ensure the exclusivity of the thread when multiple threads access the time series. The maximum amount field is used to represent the maximum storage capacity of the time series, the correction value field is used to represent the correction value, the deletion trigger amount field is used to represent the sum of the maximum amount and the correction value, the actual amount field is used to represent the number of monitoring values in the time series, the sequence first time field is used to represent the minimum time of the monitoring value in the time series, the sequence latest time field is used to represent the maximum time of the monitoring value in the time series, the device identification field is used to represent the device corresponding to the monitoring value, and the monitoring factor field is used to represent the type corresponding to the monitoring value.
5. The embedded time series database system according to claim 4, characterized in that: The single time series data basic method includes a single time series data deletion method, a single time series data addition method, a single time series data query method and a single time series data update method; The single time series data deletion method is used to delete expired data when the amount of data in the time series is greater than the sum of the maximum amount and the correction value; The single time series adding method is used to call the single time series data deleting method to ensure that the number of the time series is within a set range, and add the newly obtained monitoring value to the time series; The single time series data query method is used to determine the target time series data in the time series based on the query requirements; The single time series data updating method is used to update the monitoring value of a specified time node.
6. The embedded time series database system according to claim 2, characterized in that: The time series storage structure includes a device identification factor dictionary table and a time series data set. The time series storage structure caches all device identifications and monitoring factors. The time series data set caches all time series. The monitoring factors and the time series correspond one to one.
7. The embedded time series database system according to claim 6, characterized in that: The basic methods of time series include adding sequence method, querying sequence method and deleting sequence method; The newly added sequence method is used to add time series data to the time series data set based on the equipment-monitoring factor-time series secondary index; The query sequence method is used to determine target time series data from the time series data set based on the device-monitoring factor-time series secondary index; The deletion sequence method is used to delete specified time series data from the time series data set based on the device-monitoring factor-time series secondary index.
8. The embedded time series database system according to claim 1, characterized in that: The interface service module includes a query data application program interface and an edit data application program interface; The data query application program interface provides a variety of data query methods; The editing data application program interface provides a variety of data editing methods; Wherein, the data editing method includes a single-point data writing method and a batch data writing method.
9. The embedded time series database system according to claim 1, characterized in that: The system further includes an algorithm module, which is used to process the time series data obtained from the time series data module based on actual needs; The algorithm module includes built-in algorithms and custom algorithms.
10. A method for accessing an embedded time series database system, characterized in that: Applicable to the embedded time series database system according to any one of claims 1 to 9, the method comprising: Embedding the time series data module into a third-party application for execution based on the interface service module; Setting default parameters for the time series data module; Encode the monitoring data to be written based on the data storage structure defined by the time series data module to obtain the target data to be written, and write the target data to be written into the time series data module by calling the sequence basic method based on the interface service module; The query conditions are encapsulated based on the data storage structure defined by the time series data module to obtain the query instruction, and the sequence basic method is called based on the interface service module to obtain the target time series data from the time series data module based on the query instruction and the sequence basic method.
