Time series data loading method and device, equipment and medium

By caching time series data in blocks with pre-calculated aggregation values, the method addresses the inefficiencies in querying time series data, enhancing loading efficiency and reducing resource consumption.

CN119226359APending Publication Date: 2024-12-31WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411353646.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

High-frequency and large-volume query operations for time series data increase the operating pressure on backend servers, network data transmission, and resource consumption, leading to decreased user experience.

Method used

Caching time series data in blocks with pre-calculated aggregation values, allowing front-end devices to determine and provide query results directly from local cache if blocks are available, and fetching missing blocks from the backend as needed.

Benefits of technology

Reduces the number of queries and calculations, minimizing resource usage and improving loading efficiency by leveraging local cache and pre-computed aggregation values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226359A_ABST
    Figure CN119226359A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of data processing, in particular to a time series data loading method and device, equipment and a medium, and aims to improve the loading efficiency of time series data. The method comprises the following steps: according to a time sequence range indicated in a to-be-queried request, determining a target block serial number to which target time sequence data in the time sequence range belongs and a target block internal serial number; and if it is determined that the locally cached blocks of the front-end equipment include target blocks of all the target block serial numbers, determining target time sequence data and a target aggregation value of the target time sequence data according to the target block serial numbers and the target block internal serial numbers, and feeding back a query result including the target aggregation value. According to the method, the time series data are cached in the blocks, repeated caching of the time series data and waste of storage resource space are avoided, the aggregation value of the service data contained in the time series data is calculated in advance and cached in the blocks, the query frequency of the time series data and the calculation frequency of the service data can be reduced, and the loading efficiency of the time series data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and medium for loading time series data. Background Art

[0002] Time series data is generally generated continuously at a high frequency and in order by time, such as system operation logs, business indicator logs, etc. The system collects multiple features or indicators at each time point, so that each time series data contains a large amount of business data. Figure 1 It is a schematic diagram of time series data and terminal interaction. Figure 1 As shown in the figure, the terminal includes a backend server, a frontend device, and a buffer area (Output Buffer, OB). Time series data usually consists of two main parts: a timestamp and a corresponding observation value. Time series data is usually stored in a backend server, and the frontend device selects the time range through human-computer interaction, such as dragging a cursor on the web page of the frontend device to select the date and time range, using the mouse to select the date and time range, etc., and then calling the backend interface to load and display the time series data details and business aggregation data, such as the total, average, maximum and minimum values, success and failure rates, and quantiles. High-frequency and large-volume query operations will increase the operating pressure of the backend server, the amount of network transmission data, and the time consumption of data transmission, resulting in a decrease in user experience. In addition, the relevant aggregation calculations of time series data according to business rules consume CPU and memory resources.

[0003] Therefore, how to improve the loading efficiency of time series data by front-end devices has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The present application provides a time series data loading method, apparatus, device and medium for improving the loading efficiency of time series data by front-end devices.

[0005] In a first aspect, the present application provides a time series data loading method applicable to a front-end device, the method comprising:

[0006] According to the time series range indicated in the query request, determine the target block sequence number and the target block intra-sequence number to which the target time series data within the time series range belongs; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block intra-sequence number is used to represent the position of the time series data in the block to which it belongs;

[0007] If it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, the target time series data and the target aggregation value of the target time series data are determined according to the target block sequence number and the sequence number in the target block; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data;

[0008] Feedback is a query result containing the target aggregate value.

[0009] In a possible implementation manner, if it is determined that the front-end device lacks at least one target block with the target block sequence number in the blocks cached locally, the method further includes:

[0010] Determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the local cache in the form of blocks;

[0011] Determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number;

[0012] Feedback is a query result containing the target aggregate value.

[0013] In a possible implementation manner, storing in a local cache in a block form includes:

[0014] For a group of time series data starting with the first time, determine the block sequence number of each time series data in the group of time series data in the corresponding block and the block sequence number of the corresponding block;

[0015] Determine an aggregate value of a set of time series data starting with the first time;

[0016] The block number is used as the key, and the aggregate value, each time series data, and the corresponding block number are used as the value, and stored in the local cache in the form of blocks.

[0017] In a possible implementation, determining, according to the time series range indicated in the request to be queried, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs includes:

[0018] According to the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background and the preset time interval, the target block sequence number and the sequence number within the target block to which the target time series data belongs are determined.

[0019] In a possible implementation, determining the target block sequence number and the sequence number within the target block to which the target time series data belongs according to the start time and the end time in the time series range, the second time of the first time series data stored in the background, and the preset time interval includes:

[0020] Determine, according to the difference between the start time and the second time, and the preset time interval, the block sequence number of the first block in the target block sequence number and the block sequence number of the first block;

[0021] According to the difference between the end time and the second time, and the preset time interval, the block sequence number of the tail block in the target block sequence number and the intra-block sequence number of the tail block are determined.

[0022] In a possible implementation manner, determining the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number includes:

[0023] Determine the target time series data in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data in the first block is part of the time series data in the first block, determine the first aggregation value corresponding to the target time series data in the first block;

[0024] Determine the target time series data in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data in the tail block is part of the time series data in the tail block, determine the second aggregate value corresponding to the target time series data in the tail block;

[0025] Determine an aggregate value of an intermediate block corresponding to the target time series data;

[0026] A target aggregate value of the target time series data is determined according to the first aggregate value, the second aggregate value, and the aggregate value of the intermediate block.

[0027] In a second aspect, the present application provides a time series data loading device, which is applied to a front-end device, and the device includes:

[0028] A query module, used to determine, according to the time series range indicated in the query request, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block sequence number is used to characterize the position of the time series data in the block to which it belongs; if it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, then determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the target block sequence number; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data;

[0029] The feedback module is used to feed back the query result including the target aggregate value.

[0030] In a possible implementation, the query module is specifically used to determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the form of blocks to the local cache; determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the sequence number in the target block; and feed back the query result containing the target aggregation value.

[0031] In a possible implementation, the query module is specifically used to determine, for a group of time series data starting with the first time, the block number of each time series data in the group of time series data in the corresponding block and the block number of the corresponding block; determine the aggregation value of the group of time series data starting with the first time; use the block number as the key, and the aggregation value, each time series data and the corresponding block number as the value, and store them in the local cache in the form of blocks.

[0032] In one possible implementation, the query module is specifically used to determine the target block sequence number and the sequence number within the target block to which the target time series data belongs based on the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background, and the preset time interval.

[0033] In a possible implementation, the query module is specifically used to determine the block number of the first block and the block number of the first block in the target block number based on the difference between the start time and the second time, and the preset time interval; and to determine the block number of the last block and the block number of the last block in the target block number based on the difference between the end time and the second time, and the preset time interval.

[0034] In a possible implementation, the query module is specifically used to determine the target time series data located in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data located in the first block is partial time series data in the first block, determine the first aggregation value corresponding to the target time series data located in the first block; determine the target time series data located in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data located in the tail block is partial time series data in the tail block, determine the second aggregation value corresponding to the target time series data located in the tail block; determine the aggregation value of the middle block corresponding to the target time series data; determine the target aggregation value of the target time series data according to the first aggregation value, the second aggregation value and the aggregation value of the middle block.

[0035] In a third aspect, the present application further provides an electronic device, which comprises at least a processor and a memory, wherein the processor is configured to implement the steps of any method described in the first aspect when executing a computer program stored in the memory.

[0036] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any method described in the first aspect.

[0037] In a fifth aspect, the present application provides a computer program product, comprising: a computer program code, which, when executed on a computer, enables the computer to execute the steps of any method described in the first aspect.

[0038] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs are determined according to the time series range indicated in the query request; any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; if it is determined that the front-end device contains a target block with all target block sequence numbers in the locally cached block, the target time series data and the target aggregation value of the target time series data can be directly determined according to the target block sequence number and the sequence number within the target block, and the query result containing the target aggregation value is fed back. By caching the time series data blocks, repeated caching of time series data and waste of storage resource space are avoided, and the aggregation value of the business data contained in the time series data is pre-calculated and cached in the blocks, which can reduce the number of queries for time series data and the number of business data calculations, and improve the loading efficiency of time series data. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the implementation methods in the embodiments of the present application or the related technologies, the following is a brief introduction to the drawings required for use in the embodiments or the related technology descriptions. Obviously, the drawings described below are some embodiments of the present application, and a person skilled in the art can also obtain other drawings based on these drawings.

[0040] Figure 1 It is a schematic diagram of time series data and terminal interaction;

[0041] Figure 2 A schematic diagram of a time series data loading process provided for some embodiments of the present application;

[0042] Figure 3 A schematic diagram of a time series data block cache provided for some embodiments of the present application;

[0043] Figure 4 A schematic diagram of time series data stored in a local cache in a block form provided for some embodiments of the present application;

[0044] Figure 5 A schematic diagram of timing data of a first block provided for some embodiments of the present application;

[0045] Figure 6 A schematic diagram of timing data of a tail block provided for some embodiments of the present application;

[0046] Figure 7 Another schematic diagram of time series data stored in a local cache in a block form is provided for some embodiments of the present application;

[0047] Figure 8 A schematic diagram of the structure of a time series data loading device provided for some embodiments of the present application;

[0048] Fig. 9 A schematic diagram of the structure of an electronic device provided for some embodiments of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of this application clearer, this application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the embodiments described in this application are only part of the embodiments of this application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0050] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0051] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0052] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0053] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0054] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0055] Before introducing the time series data loading method provided in the embodiment of the present application, in order to facilitate understanding, the technical background and professional terms of the embodiment of the present application are first introduced.

[0056] Time series data: is a collection of data recorded in chronological order. It is data collected, recorded or observed at certain time intervals or timestamps over a period of time.

[0057] Cache: A hardware or software component embedded in an application or device's memory that automatically and temporarily stores data used by the user to reduce the data retrieval time and effort the next time the application or device is accessed.

[0058] Precomputation: Compute and store intermediate results in advance so that further queries can be accelerated using these precomputed results.

[0059] Business data: In addition to system data such as timestamps and device information, time series data is used to record business characteristics and business indicators.

[0060] Business aggregate data: data that has been aggregated and processed based on business data, such as the total, average, maximum and minimum values, success and failure rates, and quantiles.

[0061] Network IO: The transmission of data in a computer network.

[0062] Time series data is generally generated continuously at a high frequency and in order by time, such as system operation logs, business indicator logs, etc. The system collects multiple features or indicators at each time point, so that each time series data contains a large amount of business data. Time series data is usually stored in the background server, and the front-end device selects the time range through human-computer interaction, such as dragging the cursor to select the date and time range, using the mouse to select the date and time range, etc., and then calls the background interface to load and display the time series data details and business aggregation data, such as the total, average, maximum and minimum values, success and failure rates, and quantiles. High-frequency and large-volume query operations will increase the operating pressure of the back-end server, the amount of network transmission data, and the time consumption of data transmission, resulting in a decrease in user experience. In addition, the relevant aggregation calculations of time series data according to business rules consume CPU and memory resources.

[0063] Based on this, in order to improve the loading efficiency of time series data by the front-end device, the embodiments of the present application provide a time series data loading method, apparatus, device and medium. In the method, according to the time series range indicated in the query request, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs are determined; wherein the timing of any time series data in the block sequence number i is later than the timing of any time series data in the block sequence number i-1; the block sequence number is used to characterize the position of the time series data in the block to which it belongs; if it is determined that the front-end device contains the target block with the target block sequence number in the locally cached block, then according to the target block sequence number and the target block sequence number, the target time series data and the target aggregation value of the target time series data are determined; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; and the query result containing the target aggregation value is fed back.

[0064] Embodiment 1:

[0065] Figure 2 A schematic diagram of a time series data loading process is provided for some embodiments of the present application. Figure 2 As shown, the process includes the following steps:

[0066] S201: Determine the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs according to the time series range indicated in the query request; wherein the timing of any time series data in the block sequence number i is later than the timing of any time series data in the block sequence number i-1; the sequence number within the block is used to characterize the position of the time series data in the block to which it belongs.

[0067] The timing data loading method in the embodiment of the present application is applicable to a front-end device, wherein the front-end device may be an electronic device such as a PC or a smart phone.

[0068] At present, the following problems exist when visualizing time series data query and analysis on the web page of the front-end device: each time the user selects a new date and time series range on the front-end, even if the query time series range overlaps with the historical query time series range, the back-end interface needs to be called to reload all the data needed this time, which leads to a waste of back-end server resources and network IO. Moreover, after reloading, the system needs to recalculate the related business aggregation data, and the high-density and complex data calculation requires a large amount of CPU resources and memory resources.

[0069] In order to solve the above problems, in an embodiment of the present application, the time series data can be divided into blocks according to a preset time interval, and each block (Block) corresponds to a block number, which is used to characterize the order of the blocks, wherein the timing of any time series data in the block number i is later than the timing of any time series data in the block number i-1. For example, the block number of the first block is 1, which can be recorded as Block1. The block number of the second block is 2, which can be recorded as Block2. The timing, i.e., the timestamp, of any time series data in Block2 is later than the timestamp of any time series data in Block1. Each block contains multiple time series data within a preset time interval, i.e., a time period, wherein each time series data includes a timestamp and the business data corresponding to the timestamp. Each time series data also corresponds to an intra-block number, which is used to characterize the position of the time series data in the block to which it belongs. For example, the intra-block number corresponding to the first time series data in any block is 0, and the intra-block number corresponding to the second time series data is 1.

[0070] For example, as mentioned above Figure 1 The time unit of a certain time series data shown is 1 second, that is, one time series data is generated in 1 second, and the business data contained in each time series data is the total number of transfers and the number of successful transfers corresponding to the timestamp. For another example, Figure 3 A schematic diagram of a time series data block cache is provided for some embodiments of the present application. Figure 3As shown, the preset time interval for block size selection is 10 seconds, and the start time is 20240601T00:00:00. Starting from the start time, the time series data within the first 10 seconds can be divided into the first block Block0, and the time series data within the second 10 seconds can be divided into the second block Block1. After a period of time, the set of blocks cached locally by the front-end device is {0, 1, 4}. Each block can also include aggregate data of business data contained in a set of time series data in the block, that is, aggregate value. Aggregate data is data that has been aggregated and processed based on business data, such as the sum, average, maximum and minimum values, success and failure rates, quantiles, etc., which can be freely set according to actual needs, and this application does not limit this. For example, Figure 3 The aggregate data in any of the blocks shown is the sum of the business data contained in that block.

[0071] It should be noted that the time series data in each block is continuous time series data, and the time series data between blocks with adjacent block numbers are also continuous. For example, the time series data in Block0 is continuous with the time series data in Block1, but not continuous with the time series data in Block4.

[0072] The query request input by the user may include a time series range indicating the time series data to be queried, which is a time period. According to the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background, and the preset time interval corresponding to each block, the target block number and the target block number to which the target time series data belongs can be determined.

[0073] S202: If it is determined that the front-end device contains a target block with the target block sequence number in the locally cached blocks, the target time series data and the target aggregation value of the target time series data are determined according to the target block sequence number and the sequence number within the target block; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data.

[0074] Since each block also includes a group of time series data in the block and the aggregate value of the business data contained in the group of time series data. The aggregate value can be a data value after aggregation processing based on the business data, such as the sum, average, maximum and minimum values, success and failure rates, quantiles, etc. If it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, the target time series data and the target aggregate value of the target time series data are determined according to the target block sequence number and the sequence number in the target block.

[0075] Specifically, the target blocks to which the target time series data belongs can be divided into the first block, the last block and the middle block. Among them, the target block with the smallest target block sequence number is the first block, the target block with the largest target block sequence number is the last block, and the target blocks between the first block and the last block are all middle blocks. The target time series data located in the first block can be determined according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block. If the target time series data located in the first block is part of the time series data in the first block, the first aggregation value corresponding to the time series data located in the first block can be determined; if the target time series data located in the first block is all the time series data in the first block, the aggregation value stored in the first block can be directly determined as the first aggregation value. According to the tail block corresponding to the target time series data and the block sequence number of the tail block, the target time series data located in the tail block can be determined. If the target time series data in the tail block is part of the time series data in the tail block, the second aggregation value corresponding to the target time series data in the tail block can be determined; if the target time series data in the tail block is all the time series data in the first block, the aggregation value stored in the tail block can be directly determined as the first aggregation value. Determine the aggregation value of the middle block corresponding to the target time series data; determine the target aggregation value of the target time series data according to the first aggregation value, the second aggregation value and the aggregation value of the middle block.

[0076] S203: Feedback a query result including the target aggregate value.

[0077] The front-end device can display the query results including the target time series data and the target aggregate value on the query page.

[0078] The time series data loading method provided in the embodiment of the present application can be used in the payment business intelligent monitoring alarm and report analysis subsystem to support payment system transaction summary query, transaction anomaly monitoring alarm and system operation status analysis, solving the performance bottleneck problem of loading a large amount of time series data and calculating business indicators on the front-end page during the interaction between the front and back ends of the system.

[0079] Two notable characteristics of time series data are that the data is ordered in time and updated less frequently, and in most scenarios, there is only appending but no updating. In an embodiment of the present application, according to these characteristics of time series data, a front-end cache mechanism is designed, and the front-end device can divide the cached time series data into blocks according to preset time intervals, and each block stores all time series data records within the preset time interval. Blocks are used as the minimum unit for cache storage and query. Block cache can speed up the local cache query speed, while reducing cache fragmentation, reducing the number of background queries, and increasing the speed of time series data loading. In addition to storing the timestamps and business data contained in the time series data in each block of the cache, the local aggregate data of this block is also stored in each block data structure, and the part of the aggregate data is pre-calculated when the block is cached. Each time a user queries, the target block sequence number and the target block sequence number to which the required target time series data belongs are first calculated according to the time series range selected by the user, that is, the time range, to determine whether the locally cached blocks contain target blocks with all target block sequence numbers. If so, when calculating the aggregate data of the time series data in the time series range indicated in the query request, the local aggregate data of the cached blocks and the incrementally loaded aggregate data are directly used for merge calculation to avoid repeated calculations to save calculation amount and improve calculation performance.

[0080] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs are determined according to the time series range indicated in the query request; any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; if it is determined that the front-end device contains a target block with all target block sequence numbers in the locally cached block, the target time series data and the target aggregation value of the target time series data can be directly determined according to the target block sequence number and the sequence number within the target block, and the query result containing the target aggregation value is fed back. By caching the time series data blocks, repeated caching of time series data and waste of storage resource space are avoided, and the aggregation value of the business data contained in the time series data is pre-calculated and cached in the blocks, which can reduce the number of queries for time series data and the number of business data calculations, and improve the loading efficiency of time series data.

[0081] Embodiment 2:

[0082] In order to further improve the loading efficiency of time series data, based on the above embodiment, in the embodiment of the present application, if it is determined that the front-end device lacks at least one target block with the target block sequence number in the locally cached blocks, the method further includes:

[0083] Determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the local cache in the form of blocks;

[0084] Determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number;

[0085] Feedback is a query result containing the target aggregate value.

[0086] In order to further improve the loading efficiency of time series data, if it is determined that the front-end device lacks at least one target block with a target block number in the locally cached blocks, that is, it does not contain all the target blocks, the first time corresponding to the first time series data in each missing target block can be determined, and each time the background interface is called to obtain a set of time series data within a preset time interval starting with the first time, and stored in the local cache area in the form of blocks. According to the obtained sequence numbers of all target blocks and the sequence numbers within the target blocks, the target aggregation value of the target time series data is determined, and the query result containing the target aggregation value is fed back.

[0087] In a possible implementation, if it is determined that a target block is missing, the backend interface can be directly called once to obtain the time series data contained in the target block. Specifically, the first time corresponding to the first time series data in the missing target block is determined, and the backend interface is called to obtain a set of time series data within a preset time interval starting with the first time, and stored in the local cache in the form of blocks.

[0088] In another possible implementation, if it is determined that at least two target blocks are missing, it can be determined whether the serial numbers of the missing target blocks are continuous. If so, the background interface can be directly called at one time to obtain target blocks with at least two consecutive target block serial numbers. Specifically, the first time corresponding to the first time series data in the at least two missing target blocks is determined, and the background interface is called to obtain at least two sets of time series data within at least two preset time intervals headed by the first time, and stored in the local cache in the form of blocks. Since frequent query operations will increase the operating pressure of the backend server, the amount of network transmission data, and the time consumption of data transmission, resulting in a decrease in user experience, it is possible to directly obtain target blocks with multiple consecutive target block serial numbers at one time, and then store them in the local cache in the form of blocks.

[0089] In another possible implementation, if it is determined that at least two target blocks are missing, and the target block numbers of at least two target blocks are not continuous, for example, the missing target block numbers are 2, 3, and 5. Among them, Block2 and Block3 are continuous, and Block5 is a separate block. Taking into account that the process of calling the background interface to obtain time series data takes time, the number of background queries should be minimized without exceeding the maximum number of records returned by the interface. Therefore, without exceeding the maximum number of query records of the interface, the background interface queries of continuous target blocks can be merged into one background query. Specifically, taking the above example as an example to illustrate, the continuous target block numbers of the three missing target blocks are determined, and for the two continuous target blocks Block2 and Block3, the first time corresponding to the first time series data in the two target blocks is determined, and the background interface is called to obtain at least two sets of time series data within two preset time intervals headed by the first time, and stored in the local cache in the form of blocks. For the non-continuous target block Block5, determine the first time corresponding to the first time series data in Block5, call the background interface to obtain a set of time series data within a preset time interval starting with the first time, and store it in the local cache in the form of blocks. By minimizing the number of background queries, the loading efficiency of time series data is further improved. And each time, only the missing multiple target blocks are queried through the background interface, avoiding repeated acquisition of the same target blocks, avoiding data redundancy, and further saving cache space.

[0090] In the embodiment of the present application, for the target block that is not cached locally, the background interface is called to load it, and then it is merged with the target block cached locally to form the data required by the client request, that is, the target aggregate value. Block caching can speed up the local cache query speed, reduce cache fragmentation, reduce the number of background queries, and increase the speed of time series data loading.

[0091] Embodiment 3:

[0092] In order to further improve the loading efficiency of time series data, based on the above embodiments, in the embodiment of the present application, the storage in the local cache in the form of blocks includes:

[0093] For a group of time series data starting with the first time, determine the block sequence number of each time series data in the group of time series data in the corresponding block and the block sequence number of the corresponding block;

[0094] Determine an aggregate value of a set of time series data starting with the first time;

[0095] The block number is used as the key, and the aggregate value, each time series data, and the corresponding block number are used as the value, and stored in the local cache in the form of blocks.

[0096] In order to further improve the loading efficiency of time series data, the time series data obtained through the background interface is stored in the local cache in the form of blocks. Specifically, for a group of time series data starting with the first time, the block number of each time series data in the group of time series data and the block number of the block to which it belongs can be determined, and the aggregate value of the group of time series data starting with the first time can be determined. It is stored in the form of key-value pairs, with the block number as the key, and the aggregate value, each time series data and the corresponding block number as the value, and stored in the local cache in the form of blocks, where each time series data includes a timestamp and the business data corresponding to the timestamp.

[0097] In an embodiment of the present application, a front-end cache and aggregate data pre-calculation solution based on time series data is provided. Specifically, the time series data can be logically divided into blocks according to the time series, and divided into blocks according to fixed preset time intervals, for example, every 10 seconds, 1 minute, 10 minutes, etc., and each block stores all time series data records within the time period, that is, the time interval, which is called a Block. A block is used as the minimum unit of cache.

[0098] In addition to storing the timestamp, block number, sequence number within the block and business data of the time series data, the block metadata structure also stores the business aggregation data, namely the aggregation value, pre-calculated by the cache records within the block.

[0099] Specifically, for example, the block metadata (BlockMeta) structure may be abstractly defined as shown in Table 1 below, where the block size n may be a preset number of items in the table below, or may be a preset time interval.

[0100]

[0101] Table 1

[0102] The cache data structure stores the mapping of block data objects in the form of a block map (BlockMap), with the key being the block number and the value being the block metadata, including the aggregate value, each time series data, and the corresponding block number. When the user selects a time range, the target block required for the selected time range is calculated. The BlockMap can be queried to determine whether the required target block has been cached. For cached blocks, their data is stored in BlockMeta. For details, please refer to Figure 3 , I will not go into details here.

[0103] In an embodiment of the present application, the acquired time series data can be cached in blocks according to preset time intervals, and each block stores all time series data records within the preset time interval. Blocks are the smallest unit for cache storage and query. Block caching can speed up local cache query speed, while reducing cache fragmentation, reducing the number of background queries, and increasing the speed of time series data loading. In addition to storing the timestamp and business data contained in the time series data in the data structure of each block of the cache, local aggregate data of the block is also stored in each block data structure. This part of the aggregate data is pre-calculated when the block is cached, further improving the efficiency of loading time series data.

[0104] Embodiment 4:

[0105] In order to further improve the loading efficiency of time series data, based on the above embodiments, in the embodiment of the present application, the target block sequence number and the target block sequence number of the target time series data within the time series range are determined according to the time series range indicated in the query request, including:

[0106] According to the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background and the preset time interval, the target block sequence number and the sequence number within the target block to which the target time series data belongs are determined.

[0107] The query request input by the user may include a time series range indicating the time series data to be queried, and the time series range is a time period, for example, the time series range is [20240601T00:00:13, 20240601T00:00:56]. According to the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background, and the preset time interval, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs can be determined.

[0108] Specifically, the second time of the first time series data stored in the background can be defined, that is, the starting time of the time series data set is Start0, the block size, that is, the preset time interval is N, the time unit of the time series data is unit, and the definition of the i-th block is: Blocki=[Starti, Endi).

[0109] Among them, Starti=Start0+i*N*unit;Endi=Starti+N*unit;

[0110] Starti is the starting timestamp of the i-th block, and Endi is the ending timestamp.

[0111] According to the above formula, the start timestamp and end timestamp of each block can be calculated. For example, the start time of the time series data set, that is, the second time of the first time series data, is 20240601T00:00:00, the block size, that is, the time interval corresponding to each block, is 10 seconds, and the time unit of the time series data is 1 second, that is, each block contains 10 time series data. The start time of the time series data in the time series range is Rs = 20240601T00:00:13, and the end time is Re = 2024T0601T00:00:56. According to the above formula, the start timestamp of the block with block number 2 can be calculated:

[0112] Start1 = 20240601T00:00:00 + 2*10*1 seconds = 20240601T00:00:20

[0113] End1 = 20240601T00:00:20 + 10*1 seconds = 20240601T00:00:30

[0114] Then, Block2 = [20240601T00:00:20, 20240601T00:00:30)

[0115] Similarly, for a time series data, the block number to which it belongs and the block number within the block to which it belongs can be calculated based on its timestamp. It is used to indicate the block number and the block number to which a time series data belongs, where n is the block number and idx is the block number recorded in the block. The numbering rule is:

[0116] n=(time series record timestamp-Start0) / N*unit

[0117] idx = (time series record timestamp - Start0) mod N*unit

[0118] Accordingly, Used to represent continuous time series data in a block with block number n It can also be expressed as

[0119] For another example, the timestamp of a time series data is 20240601T00:00:35. The block number and the intra-block number to which the time series data belongs can be calculated according to the above formula:

[0120] n=(20240601T00:00:35-20240601T00:00:00) / 10*1 seconds=3

[0121] idx = (20240601T00:00:35-20240601T00:00:00) mod 10*1 seconds = 5

[0122] The block number of this time series data is 3, and the block number is 5, which can be expressed as

[0123] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data belongs can be accurately and quickly determined based on the start time and end time in the time series range indicated in the query request, the second time and the preset time interval of the first time series data stored in the background, thereby further improving the loading efficiency of the time series data.

[0124] Embodiment 5:

[0125] In order to further improve the loading efficiency of time series data, on the basis of the above embodiments, in the embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data belongs are determined according to the start time and the end time in the time series range, the second time of the first time series data stored in the background and the preset time interval, including:

[0126] Determine, according to the difference between the start time and the second time, and the preset time interval, the block sequence number of the first block in the target block sequence number and the block sequence number of the first block;

[0127] According to the difference between the end time and the second time, and the preset time interval, the block sequence number of the tail block in the target block sequence number and the intra-block sequence number of the tail block are determined.

[0128] The target blocks to which the target time series data belongs can be divided into the first block, the last block and the middle block. The target block with the smallest target block sequence number is the first block, the target block with the largest target block sequence number is the last block, and the target blocks between the first block and the last block are all middle blocks. Since the target time series data contained in the first block or the last block may not be the entire block, it is necessary to determine the block sequence number of the first block and the block sequence number of the first block in the target block sequence number, as well as the block sequence number of the last block and the block sequence number of the last block in the target block sequence number.

[0129] The difference between the start time in the time series range and the second time of the first time series data stored in the background can be determined, and then the ratio of the difference to the preset time interval can be determined. According to the ratio, the block number of the first block in the target block number can be obtained, and the modulus of the ratio of the difference to the preset time interval can be obtained to obtain the block number of the first block. Similarly, the difference between the end time in the time series range and the second time of the first time series data stored in the background can be determined, and then the ratio of the difference to the preset time interval can be determined. According to the ratio, the block number of the last block in the target block number can be obtained, and the modulus of the ratio of the difference to the preset time interval can be obtained to obtain the block number of the last block.

[0130] In an embodiment of the present application, based on the start time and end time in the time series range, the second time of the first time series data stored in the background and the preset time interval, the first block and the last block corresponding to the target block sequence number to which the target time series data belongs, as well as the target block sequence number located in the first block and the last block can be determined.

[0131] Embodiment 6:

[0132] In order to further improve the loading efficiency of time series data, based on the above embodiments, in the embodiment of the present application, the target aggregation value of the target time series data is determined according to the target block sequence number and the target block intra-sequence number, including:

[0133] Determine the target time series data in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data in the first block is part of the time series data in the first block, determine the first aggregation value corresponding to the target time series data in the first block;

[0134] Determine the target time series data in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data in the tail block is part of the time series data in the tail block, determine the second aggregate value corresponding to the target time series data in the tail block;

[0135] Determine an aggregate value of an intermediate block corresponding to the target time series data;

[0136] A target aggregate value of the target time series data is determined according to the first aggregate value, the second aggregate value, and the aggregate value of the intermediate block.

[0137] The target blocks to which the target time series data belongs can be divided into the first block, the last block and the middle block. Among them, the target block with the smallest target block sequence number is the first block, the target block with the largest target block sequence number is the last block, and the target blocks between the first block and the last block are all middle blocks. The target time series data located in the first block can be determined according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block. If the target time series data located in the first block is part of the time series data in the first block, the first aggregation value corresponding to the time series data located in the first block can be determined; if the target time series data located in the first block is all the time series data in the first block, the aggregation value saved in the first block can be directly determined as the first aggregation value. According to the tail block corresponding to the target time series data and the block sequence number of the tail block, the target time series data located in the tail block can be determined. If the target time series data in the tail block is part of the time series data in the tail block, the second aggregation value corresponding to the target time series data in the tail block can be determined; if the target time series data in the tail block is all the time series data in the first block, the aggregation value stored in the tail block can be directly determined as the first aggregation value. Determine the aggregation value of the middle block corresponding to the target time series data; according to the first aggregation value, the second aggregation value and the aggregation value of the middle block, the target aggregation value of the target time series data can be determined.

[0138] In an embodiment of the present application, by determining the first aggregation value corresponding to the target time series data located in the first block, determining the second aggregation value corresponding to the target time series data located in the last block, and the aggregation value of the middle block, the target aggregation value of the target time series data can be determined quickly and accurately.

[0139] The whole process of the time series data loading method in the embodiment of the present application is further explained below with a specific example.

[0140] Taking the above user query range of [20240601T00:00:13,20240601T00:00:56] as an example, the start time of the time series data set, that is, the second time of the first time series data, is 20240601T00:00:00, the block size, that is, the time interval N corresponding to each block, is 10 seconds, and the time unit of the time series data is 1 second. The execution steps are as follows:

[0141] Step 101: First, the target block number and the target block intra-sequence number are calculated according to the time series range that the user wants to query.

[0142] Specifically, it can be calculated according to the above formula:

[0143] ns=(Rs-R0) / 10=(20240601T00:00:13-20240601T00:00:00) / 10=1

[0144] ne=(Re-R0) / 10=(20240601T00:00:56-20240601T00:00:00) / 10=5

[0145] idxs=(Rs-R0)%10=(20240601T00:00:13-20240601T00:00:00)%10=3

[0146] idxe=(Re-R0)%10=(20240601T00:00:56-20240601T00:00:00)%10=6

[0147] Among them, ns is the first block sequence number, idxs is the block sequence number of the first block, ne is the last block sequence number, and idxe is the block sequence number of the last block.

[0148] It can be seen that the target block range required for this user query is [1, 5], the block number in the first block is 3, and the block number in the last block is 6. That is, the time series record range of the target time series data can be expressed as

[0149] Step 102: According to the range of the target block calculated in the previous step, query the locally cached block set to find the locally cached block sequence number list and the uncached block sequence number list.

[0150] The locally cached block number list is {0, 1, 4}, as mentioned above Figure 3 In Bmap, the block number is used as the key to query the locally cached block set, and the cached block number list is {1, 4}, and the uncached block number list is {2, 3, 5}.

[0151] Step 103: For the locally uncached block list, call the background interface to obtain data. Among them, the input parameter is the start time of the time series range to be queried. Taking into account that it takes time to return the query results, the number of background queries should be minimized without exceeding the maximum number of records returned by the interface. Therefore, without exceeding the maximum number of query records of the interface, the background interface queries of consecutive blocks are merged into one background query. For the uncached block sequence number list, because its block sequence number is non-continuously increasing, multiple continuous increasing block number subsequences can be quickly obtained according to the longest continuous subsequence algorithm. The input parameter start time when calling the background interface is the timestamp of the first target time series data in the first target block of each continuously increasing subsequence, and the end time is the timestamp of the last target time series data in the last target block.

[0152] In this example, the block number list calculated in the above steps is {2, 3, 5}, and the lists of consecutive increasing subsequences after segmentation according to the longest consecutive subsequence algorithm are [2, 3] and [5]. There are two subsequence lists, and two background queries need to be initiated.

[0153] One of the queries is for the time series data of the continuously increasing subsequence [2, 3], and the query input parameters are:

[0154] Start time is

[0155] End time is

[0156] Query the target time series data of the continuously increasing subsequence [5]. The query input parameters are:

[0157] Start time is

[0158] End time is

[0159] Step 104: For each continuous increasing subsequence, the background interface is called to obtain time series data, and the business aggregation data of each block is calculated for the query result, and then the query result and the calculated business aggregation data are updated to the local cache. Backend queries are initiated in parallel for different increasing subsequences to reduce query time.

[0160] In this example, first call the backend interface to query the time series data for the block interval [2, 3]. Pass in the start time calculated in the previous step (20240601T00:00:20, 20240601T00:00:39), call the backend interface to query, and the interface returns the following results:

[0161] {

[0162] "20240601T00:00:20": "6,5";

[0163] "20240601T00:00:21": "10,10";

[0164] "20240601T00:00:22": "10,9";

[0165] "20240601T00:00:23": "12,12";

[0166] "20240601T00:00:24": "9,9";

[0167] "20240601T00:00:25": "3, 3";

[0168] "20240601T00:00:26": "6, 4";

[0169] "20240601T00:00:27": "11,10";

[0170] "20240601T00:00:28": "20,18";

[0171] "20240601T00:00:29": "10,10";

[0172] "20240601T00:00:30": "18,18";

[0173] "20240601T00:00:31": "11,9";

[0174] "20240601T00:00:32": "8,7";

[0175] "20240601T00:00:33": "6, 6";

[0176] "20240601T00:00:34": "3, 2";

[0177] "20240601T00:00:35": "17,15";

[0178] "20240601T00:00:36": "10,10";

[0179] "20240601T00:00:37": "11,8";

[0180] "20240601T00:00:38": "10,8";

[0181] "20240601T00:00:39": "11,11";

[0182] }

[0183] Calculate the aggregate value of block number 2 based on the returned results:

[0184] Total transfers = 6+10+10+12+9+3+6+11+20+10=97

[0185] Total number of successes = 5+10+9+12+9+3+4+10+18+10 = 90

[0186] Calculate the aggregate value of block number 3:

[0187] Total transfers = 18+11+8+6+3+17+10+11+10+11=105

[0188] Total number of successes = 18+9+7+6+2+15+10+8+8+11 = 94

[0189] Similarly, a backend interface is provided to query the time series data of the block interval [5] and calculate the aggregate data locally.

[0190] The local cache after two queries is as follows Figure 4 As shown, Figure 4 A schematic diagram of time series data stored in a local cache in a block form is provided for some embodiments of the present application.

[0191] Step 105: Recalculate the aggregate value of the target time series data in the first and last blocks. Since the time series range selected by the customer does not include the entire block of data in the first block, the time series data and aggregate value of the entire block cannot be used directly for the first and last blocks. It is necessary to find the starting time series record of the customer's query in the first and last blocks according to the block sequence number calculated in the previous step, and then perform aggregate calculation on the partial record data in the first and last blocks that are included in the query range, and then merge it with the aggregate data of non-first and last blocks to obtain the final data.

[0192] Figure 5 A schematic diagram of timing data of a first block is provided for some embodiments of the present application. Figure 5 As shown, the first block record calculated in step 101 in this example is That is, the first block number is 1, the start timestamp is 20240601T00:00:13, and the end timestamp is 20240601T00:00:19. Then the time series record set number required in the first block is [3, 9], and the aggregate data is calculated:

[0193] Total transfers = 9+3+12+11+13+3+2=53

[0194] Total number of successes = 9+3+12+11+12+3+2=52

[0195] Figure 6 A schematic diagram of timing data of a tail block is provided for some embodiments of the present application. Figure 6 As shown, the tail block record is That is, the tail block number is 5, the start timestamp is 20240601T00:00:50, and the end timestamp is 20240601T00:00:56. Then the time series record set number required in the tail block is [0,6], and the aggregate data is calculated:

[0196] Total transfers = 10 + 9 + 8 + 7 + 13 + 15 + 11 = 77

[0197] Total number of successes = 8+9+7+6+12+15+10 = 74

[0198] Step 106: Combine the partial time series records and aggregate data of the first and last blocks calculated in step 105 with the time series records and aggregate data of the middle blocks retrieved from the local cache to obtain the final query result of the customer, load it into the front-end component for rendering and display.

[0199] Figure 7 Another schematic diagram of time series data stored in a local cache in a block form is provided for some embodiments of the present application. Figure 7 As shown, in this example, the first block number is 1, the last block number is 5, the middle block number is {2, 3, 4}, and the time series recording range is Aggregate data is calculated as follows:

[0200] Total transfers = 53 + 97 + 105 + 105 + 77 = 437

[0201] Total number of successes = 52 + 90 + 94 + 97 + 74 = 407

[0202] The final result is Figure 7 shown.

[0203] The method in the embodiment of the present application is used to cache the time series data in blocks and pre-calculate the business aggregation data, which can reduce the number of cache queries and the number of business data calculations. In the above example, the user query range is [20240601T00:00:13, 20240601T00:00:56], involving a total of 44 time series records. Using the traditional one-by-one caching solution, 44 queries are required. However, after calculating the required block sequence number list {1,2,3,4,5} and the sequence numbers in the first and last blocks, the present solution requires 5 queries for the block number and 2 queries for the sequence numbers in the first and last blocks, for a total of 7 queries. The number of queries is reduced by 37 times, reducing the number of cache queries by 84%.

[0204] In the above example, the traditional solution requires calculating the business aggregation data one by one in the time series, which requires 88 calculations in total (44 times for the number of transfers and 44 times for the number of successful transfers). However, since the business aggregation data of the {1,4} blocks has been pre-calculated in the previous cache, there is no need to repeat the calculation this time, reducing the number of calculations by 40 times (20 times for the number of transfers and 20 times for the number of successful transfers). The first and last blocks increase the number of calculations by 28 times (14 times for the number of transfers and 14 times for the number of successful transfers), and the actual number of calculations is reduced by 12 times. The amount of business data calculations is reduced by 12 / 88=13%.

[0205] The timeout configuration provided by the method of the embodiment of the present application is more flexible and can be dynamically adjusted according to the current system response time and success rate. The number of retries can be dynamically adjusted according to the downstream response situation, and even the purpose of service degradation can be achieved. Even if an interface is abnormal, it can avoid causing an avalanche and dragging down the entire system.

[0206] Embodiment 7:

[0207] Based on the same technical concept, on the basis of the above embodiments, in an embodiment of the present application, a timing data loading device is provided. Figure 8 A schematic diagram of a time series data loading device provided in some embodiments of the present application. Figure 8 As shown, the device comprises:

[0208] The query module 801 is used to determine the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs according to the time series range indicated in the query request; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block sequence number is used to characterize the position of the time series data in the block to which it belongs; if it is determined that the target block with the target block sequence number is included in the blocks locally cached by the front-end device, then the target time series data and the target aggregation value of the target time series data are determined according to the target block sequence number and the target block sequence number; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data;

[0209] The feedback module 802 is used to feed back the query result including the target aggregate value.

[0210] In a possible implementation, the query module 801 is specifically used to determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the form of blocks to the local cache; determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the sequence number in the target block; and feed back the query result containing the target aggregation value.

[0211] In a possible implementation, the query module 801 is specifically used to determine, for a group of time series data starting with the first time, the block number of each time series data in the group of time series data in the corresponding block and the block number of the corresponding block; determine the aggregation value of the group of time series data starting with the first time; use the block number as the key, and the aggregation value, each time series data and the corresponding block number as the value, and store them in the local cache in the form of blocks.

[0212] In a possible implementation, the query module 801 is specifically used to determine the target block sequence number and the sequence number within the target block to which the target time series data belongs based on the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background, and the preset time interval.

[0213] In a possible implementation, the query module 801 is specifically used to determine the block number of the first block and the block number of the first block in the target block number based on the difference between the start time and the second time, and the preset time interval; determine the block number of the last block and the block number of the last block in the target block number based on the difference between the end time and the second time, and the preset time interval.

[0214] In a possible implementation, the query module 801 is specifically used to determine the target time series data located in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data located in the first block is partial time series data in the first block, determine the first aggregation value corresponding to the target time series data located in the first block; determine the target time series data located in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data located in the tail block is partial time series data in the tail block, determine the second aggregation value corresponding to the target time series data located in the tail block; determine the aggregation value of the middle block corresponding to the target time series data; determine the target aggregation value of the target time series data according to the first aggregation value, the second aggregation value and the aggregation value of the middle block.

[0215] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs are determined according to the time series range indicated in the query request; any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; if it is determined that the front-end device contains a target block with all target block sequence numbers in the locally cached block, the target time series data and the target aggregation value of the target time series data can be directly determined according to the target block sequence number and the sequence number within the target block, and the query result containing the target aggregation value is fed back. By caching the time series data blocks, repeated caching of time series data and waste of storage resource space are avoided, and the aggregation value of the business data contained in the time series data is pre-calculated and cached in the blocks, which can reduce the number of queries for time series data and the number of business data calculations, and improve the loading efficiency of time series data.

[0216] Embodiment 8:

[0217] Based on the same technical concept, on the basis of the above embodiments, in an embodiment of the present application, an electronic device is provided, which can realize the functions of the information disclosure device mentioned above. Fig. 9 A schematic diagram of the structure of an electronic device provided in some embodiments of the present application. Fig. 9 As shown, the electronic device includes: a processor 901, a communication interface 902, a memory 903 and a communication bus 904, wherein the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904;

[0218] The memory 903 stores a computer program. When the program is executed by the processor 901, the processor 901 performs the following steps:

[0219] According to the time series range indicated in the query request, determine the target block sequence number and the target block intra-sequence number to which the target time series data within the time series range belongs; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block intra-sequence number is used to represent the position of the time series data in the block to which it belongs;

[0220] If it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, the target time series data and the target aggregation value of the target time series data are determined according to the target block sequence number and the sequence number in the target block; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data;

[0221] Feedback is a query result containing the target aggregate value.

[0222] In a possible implementation, the processor 901 is further used to, if it is determined that the front-end device lacks at least one target block with the target block sequence number in the locally cached blocks, determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the local cache in the form of blocks; determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the sequence number in the target block; and feed back the query result containing the target aggregation value.

[0223] In a possible implementation, the processor 901 is further used to determine, for a group of time series data starting with the first time, the block number of each time series data in the group of time series data in the corresponding block and the block number of the corresponding block; determine the aggregation value of the group of time series data starting with the first time; and store them in the local cache in the form of blocks using the block number as the key and the aggregation value, each time series data and the corresponding block number as the value.

[0224] In a possible implementation, the processor 901 is also used to determine the target block sequence number and the sequence number within the target block to which the target time series data belongs based on the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background, and the preset time interval.

[0225] In a possible implementation, the processor 901 is further used to determine the block number of the first block and the block number of the first block in the target block number based on the difference between the start time and the second time, and the preset time interval; and to determine the block number of the last block and the block number of the last block in the target block number based on the difference between the end time and the second time, and the preset time interval.

[0226] In a possible implementation, the processor 901 is further used to determine the target time series data located in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data located in the first block is partial time series data in the first block, determine the first aggregation value corresponding to the target time series data located in the first block; determine the target time series data located in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data located in the tail block is partial time series data in the tail block, determine the second aggregation value corresponding to the target time series data located in the tail block; determine the aggregation value of the middle block corresponding to the target time series data; determine the target aggregation value of the target time series data according to the first aggregation value, the second aggregation value and the aggregation value of the middle block.

[0227] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0228] The communication interface 902 is used for communication between the electronic device and other devices.

[0229] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0230] The above-mentioned processor can be a general-purpose processor, including a central processing unit, a network processor (Network Processor, NP), etc.; it can also be a digital signal processing processor (Digital Signal Processing, DSP), an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, etc.

[0231] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs are determined according to the time series range indicated in the query request; any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; if it is determined that the front-end device contains a target block with all target block sequence numbers in the locally cached block, the target time series data and the target aggregation value of the target time series data can be directly determined according to the target block sequence number and the sequence number within the target block, and the query result containing the target aggregation value is fed back. By caching the time series data blocks, repeated caching of time series data and waste of storage resource space are avoided, and the aggregation value of the business data contained in the time series data is pre-calculated and cached in the blocks, which can reduce the number of queries for time series data and the number of business data calculations, and improve the loading efficiency of time series data.

[0232] Embodiment 9:

[0233] Based on the same inventive concept, on the basis of the above embodiments, in an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program executable by a processor is stored. When the program runs on the processor, the processor implements the following steps when executing:

[0234] According to the time series range indicated in the query request, determine the target block sequence number and the target block intra-sequence number to which the target time series data within the time series range belongs; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block intra-sequence number is used to represent the position of the time series data in the block to which it belongs;

[0235] If it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, the target time series data and the target aggregation value of the target time series data are determined according to the target block sequence number and the sequence number in the target block; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data;

[0236] Feedback is a query result containing the target aggregate value.

[0237] In a possible implementation manner, if it is determined that the front-end device lacks at least one target block with the target block sequence number in the blocks cached locally, the method further includes:

[0238] Determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the local cache in the form of blocks;

[0239] Determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number;

[0240] Feedback is a query result containing the target aggregate value.

[0241] In a possible implementation manner, storing in a local cache in a block form includes:

[0242] For a group of time series data starting with the first time, determine the block sequence number of each time series data in the group of time series data in the corresponding block and the block sequence number of the corresponding block;

[0243] Determine an aggregate value of a set of time series data starting with the first time;

[0244] The block number is used as the key, and the aggregate value, each time series data, and the corresponding block number are used as the value, and stored in the local cache in the form of blocks.

[0245] In a possible implementation, determining, according to the time series range indicated in the request to be queried, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs includes:

[0246] According to the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background and the preset time interval, the target block sequence number and the sequence number within the target block to which the target time series data belongs are determined.

[0247] In a possible implementation, determining the target block sequence number and the sequence number within the target block to which the target time series data belongs according to the start time and the end time in the time series range, the second time of the first time series data stored in the background, and the preset time interval includes:

[0248] Determine, according to the difference between the start time and the second time, and the preset time interval, the block sequence number of the first block in the target block sequence number and the block sequence number of the first block;

[0249] According to the difference between the end time and the second time, and the preset time interval, the block sequence number of the tail block in the target block sequence number and the intra-block sequence number of the tail block are determined.

[0250] In a possible implementation manner, determining the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number includes:

[0251] Determine the target time series data in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data in the first block is part of the time series data in the first block, determine the first aggregation value corresponding to the target time series data in the first block;

[0252] Determine the target time series data in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data in the tail block is part of the time series data in the tail block, determine the second aggregate value corresponding to the target time series data in the tail block;

[0253] Determine an aggregate value of an intermediate block corresponding to the target time series data;

[0254] A target aggregate value of the target time series data is determined according to the first aggregate value, the second aggregate value, and the aggregate value of the intermediate block.

[0255] The above-mentioned computer-readable storage medium can be any available medium or data storage device that can be accessed by the processor in the electronic device, including but not limited to magnetic storage such as floppy disks, hard disks, magnetic tapes, magneto-optical disks (MO), etc., optical storage such as CD, DVD, BD, HVD, etc., and semiconductor storage such as ROM, EPROM, EEPROM, non-volatile memory (NANDFLASH), solid-state drive (SSD), etc.

[0256] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs are determined according to the time series range indicated in the query request; any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; if it is determined that the front-end device contains a target block with all target block sequence numbers in the locally cached block, the target time series data and the target aggregation value of the target time series data can be directly determined according to the target block sequence number and the sequence number within the target block, and the query result containing the target aggregation value is fed back. By caching the time series data blocks, repeated caching of time series data and waste of storage resource space are avoided, and the aggregation value of the business data contained in the time series data is pre-calculated and cached in the blocks, which can reduce the number of queries for time series data and the number of business data calculations, and improve the loading efficiency of time series data.

[0257] Based on the same inventive concept, the embodiment of the present application also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the time series data loading methods discussed above. Since the principle of solving the problem by the above computer program product is similar to that of the related transaction reporting method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.

[0258] In an embodiment of the present application, the target block sequence number and the sequence number within the target block to which the target time series data within the time series range belongs are determined according to the time series range indicated in the query request; any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; if it is determined that the front-end device contains a target block with all target block sequence numbers in the locally cached block, the target time series data and the target aggregation value of the target time series data can be directly determined according to the target block sequence number and the sequence number within the target block, and the query result containing the target aggregation value is fed back. By caching the time series data blocks, repeated caching of time series data and waste of storage resource space are avoided, and the aggregation value of the business data contained in the time series data is pre-calculated and cached in the blocks, which can reduce the number of queries for time series data and the number of business data calculations, and improve the loading efficiency of time series data.

[0259] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0260] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0261] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0262] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0263] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A time series data loading method, characterized in that: Applicable to the front-end device, the method comprises: According to the time series range indicated in the query request, determine the target block sequence number and the target block intra-sequence number to which the target time series data within the time series range belongs; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block intra-sequence number is used to represent the position of the time series data in the block to which it belongs; If it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, the target time series data and the target aggregation value of the target time series data are determined according to the target block sequence number and the sequence number in the target block; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; Feedback is a query result containing the target aggregate value.

2. The method according to claim 1, characterized in that If it is determined that the front-end device lacks at least one target block with the target block sequence number in the locally cached blocks, the method further includes: Determine the first time corresponding to the first time series data in the missing target block, call the background interface to obtain a group of time series data headed by the first time, and store them in the local cache in the form of blocks; Determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number; Feedback is a query result containing the target aggregate value.

3. The method according to claim 2, characterized in that The storing in the local cache in the form of blocks includes: For a group of time series data starting with the first time, determine the block sequence number of each time series data in the group of time series data in the corresponding block and the block sequence number of the corresponding block; Determine an aggregate value of a set of time series data starting with the first time; The block number is used as the key, and the aggregate value, each time series data, and the corresponding block number are used as the value, and stored in the local cache in the form of blocks.

4. The method according to claim 1, characterized in that: The step of determining, according to the time series range indicated in the query request, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs includes: According to the start time and end time in the time series range indicated in the query request, the second time of the first time series data stored in the background and the preset time interval, the target block sequence number and the sequence number within the target block to which the target time series data belongs are determined.

5. The method according to claim 4, characterized in that Determining the target block sequence number and the sequence number within the target block to which the target time series data belongs according to the start time and the end time in the time series range, the second time of the first time series data stored in the background, and the preset time interval, includes: Determine, according to the difference between the start time and the second time, and the preset time interval, the block sequence number of the first block in the target block sequence number and the block sequence number of the first block; According to the difference between the end time and the second time, and the preset time interval, the block sequence number of the tail block in the target block sequence number and the intra-block sequence number of the tail block are determined.

6. The method according to any one of claims 1 to 5, characterized in that: The step of determining the target aggregation value of the target time series data according to the target block sequence number and the target block intra-sequence number includes: Determine the target time series data in the first block according to the block sequence number of the first block corresponding to the target time series data and the block sequence number of the first block; if the target time series data in the first block is part of the time series data in the first block, determine the first aggregation value corresponding to the target time series data in the first block; Determine the target time series data in the tail block according to the block sequence number of the tail block corresponding to the target time series data and the block sequence number of the tail block; if the target time series data in the tail block is part of the time series data in the tail block, determine the second aggregate value corresponding to the target time series data in the tail block; Determine an aggregate value of an intermediate block corresponding to the target time series data; A target aggregate value of the target time series data is determined according to the first aggregate value, the second aggregate value, and the aggregate value of the intermediate block.

7. A time series data loading device, characterized in that: Applied to front-end equipment, the device comprises: A query module, used to determine, according to the time series range indicated in the query request, the target block sequence number and the target block sequence number to which the target time series data within the time series range belongs; wherein the time series of any time series data in the block sequence number i is later than the time series of any time series data in the block sequence number i-1; the block sequence number is used to characterize the position of the time series data in the block to which it belongs; if it is determined that the front-end device contains the target block with the target block sequence number in the locally cached blocks, then determine the target time series data and the target aggregation value of the target time series data according to the target block sequence number and the target block sequence number; wherein any block contains a group of time series data divided according to a preset time interval and an aggregation value corresponding to a group of time series data; The feedback module is used to feed back the query result including the target aggregate value.

8. An electronic device, characterized in that: include: A memory for storing program instructions; A processor is used to call the program instructions stored in the memory, and execute the steps included in any one of claims 1-6 according to the obtained program instructions.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a computer, the computer executes the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The computer program product comprises: a computer program code, and when the computer program code is run on a computer, the computer is enabled to execute the method according to any one of claims 1 to 6.