A method for long-period index millisecond-level query
By using streaming computing and tiered storage technologies in the time-series database ElasticSearch, the high cost and resource consumption issues in existing OLAP scenarios are solved, enabling millisecond-level metric queries in OLTP scenarios, reducing pre-computation workload, and seamlessly integrating with the ElasticSearch ecosystem.
Patent Information
- Application Number
- CN202311552477.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2043-11-22
AI Technical Summary
Existing technologies in OLAP scenarios suffer from high construction and maintenance costs, large pre-computation volume, high consumption of computing and storage resources, inability to achieve ultimate real-time queries, and limited support for OLTP scenarios.
We employ streaming computing technology to collect and process metric data in the time-series database Elasticsearch. The streaming computing engine divides the data into multiple computing windows for metric aggregation and calculation, and stores the results in Elasticsearch. Combined with the time-series database gateway layer, we perform query routing and index management to achieve millisecond-level queries.
It enables millisecond-level metric query capabilities over long periods, supports OLTP scenarios, reduces pre-computation and resource consumption, and seamlessly integrates with the ElasticSearch ecosystem, avoiding page freezing issues.
Smart Images

Figure CN118535597B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of communication query technology, specifically relating to a method for querying indicators at the millisecond level over a long period. Background Technology
[0002] Existing big data analytics platforms use Spark technology as their build engine through Kylin. It automatically tunes Spark parameters based on cluster resources and build task status to improve build speed, and stores pre-computed data in Parquet format on the file system. Parquet is an open-source and mature columnar storage format that is more cloud-friendly, compatible with various file systems, and integrates well with Hadoop, Hive, Spark, Impala, and other technologies. Kylin's query engine also uses Spark technology at its core, improving the performance of complex queries.
[0003] However, Kylin is a heavyweight technical solution. It relies on technologies like Apache Parquet and Spark for pre-computation capabilities, trading space for time to achieve sub-second response times for user query requests. However, when building analytical systems using Hadoop and Spark, and when querying, it faces numerous challenges, such as high construction and maintenance costs, and large pre-computation loads during communication queries, leading to significant consumption of computing and storage resources. Although Kylin uses Spark as its query engine and employs micro-batch technology, it still cannot achieve truly real-time querying. Furthermore, existing technologies are primarily used in OLAP scenarios, offering limited support for OLTP scenarios. Summary of the Invention
[0004] Purpose of the invention: In order to overcome the shortcomings of the prior art, the present invention provides a method for querying indicators at the millisecond level over a long period of time. By utilizing the streaming computing capabilities of streaming technology in a time-series database (ElasticSearch), the method of the present invention supports millisecond-level queries, thereby realizing the ability to query corresponding indicators at the millisecond level.
[0005] Technical Solution: Firstly, this invention provides a method for millisecond-level querying of indicators over a long period, comprising:
[0006] Collect indicator data and send the collected indicator data to the message middleware;
[0007] The message middleware receives indicator data and uses a streaming computing engine to calculate the received indicator data, obtaining the processed detailed indicator results and the aggregated calculation results of different indicators. The streaming computing engine divides the data into multiple calculation windows according to the duration, generating the aggregated calculation results of indicators for different duration calculation windows, which are used for the cyclical aggregation of indicators between multiple calculation windows.
[0008] The processed detailed indicator results and the aggregated calculation results of different indicators are stored separately in the time series database (ElasticSearch); the processed detailed indicator results are written to the current date index table (Metrics-yyyymmdd) of the time series database (ElasticSearch); the aggregated calculation results of different indicators are written to the index tables of different time categories of the time series database (ElasticSearch) according to the time correspondence.
[0009] According to the gateway protocol configured in the ElasticSearch gateway, the ElasticSearch gateway is invoked to receive external requests for metric queries;
[0010] Parse the received external request to obtain the query parameters in the external request;
[0011] Based on the query parameters in the external request, the path for querying the index table of the time series database (ElasticSearch) gateway is determined, which is used to quickly respond to the metric query service and return the queried metric results.
[0012] In a further embodiment, collecting metrics and sending the collected metrics to the message middleware also includes: before sending the metrics, creating an index table in the time series database (ElasticSearch), with the table name prefixed with Metrics and suffixed with yyyymmdd, where yyyymmdd corresponds to the current date, and the table name is connected by the symbol "-".
[0013] In a further embodiment, the content of the indicator includes: indicator name (key), numerical indicator value (value), and timestamp (timestamp).
[0014] In a further embodiment, the streaming computing engine divides the computation into multiple computation windows based on duration, generating aggregated metric calculation results for computation windows of different durations. The specific method for cyclical aggregation of metrics across multiple computation windows is as follows:
[0015] The streaming computing engine is divided into multiple computing windows with different durations; and each computing window performs an aggregation operation according to the indicator key value to obtain indicator aggregation calculation results of different durations, where the indicator aggregation calculation results are the aggregated data of indicator key values in the indicator stream.
[0016] The aggregated calculation results of metrics of different durations are stored in index tables of different times in the time series database (ElasticSearch), and serve as the data input source for the corresponding previous duration calculation window. This is used for cyclical aggregation operations between multiple calculation windows of different durations to meet query requests across different time spans.
[0017] In a further embodiment, the aggregation action includes three categories: calculating the average (AVG), maximum (MAX), and minimum (MIN) values of the indicator key values within the window.
[0018] In a further embodiment, storing the processed detailed indicator results and the aggregated calculation results of different indicators in the time series database (ElasticSearch) by partitioning them further includes writing the detailed indicator results and the aggregated calculation results of different indicators into the index table of the time series database (ElasticSearch) with the index name prefixed with "Metrics".
[0019] In a further embodiment, the index of the time-series database (ElasticSearch) is categorized by preset time and the aggregated calculation results of indicators with different calculation windows of different durations are stored in batches; and different caching periods are preset for the aggregated calculation results of indicators with different calculation windows of different durations.
[0020] In a further embodiment, the ElasticSearch gateway supports writing routing logic based on a dynamic language to support external services for ElasticSearch queries.
[0021] The gateway protocol is configured with time values, which are in hours, and the number of time values is related to the number of calculation windows.
[0022] In a further embodiment, the method for determining the path to the Elasticsearch gateway query index table based on query parameters in an external request includes:
[0023] Obtain the time range based on the query parameters in the external request;
[0024] Based on the time value configured in the gateway protocol and the current time, determine the time range of the external request query, and determine whether the time series database (ElasticSearch) gateway queries the corresponding time category index table according to the time span or directly queries the current time index table (Metrics-yyyymmdd) of the time series database ElasticSearch gateway.
[0025] In a further embodiment, the method for determining the time span of an external request query based on the time value, current time, and time range configured in the gateway protocol, and determining whether the Elasticsearch gateway queries the index table of the corresponding time category according to the time span or directly queries the index table of the current time (Metrics-yyyymmdd), includes:
[0026] The time values configured in the preset gateway are time value A, time value B, and time value C, satisfying A < B < C; preset three calculation windows with different durations, generate indicator aggregation calculation results for the three durations, and write them into the index tables of three different time categories in the time-series database (ElasticSearch) according to the corresponding time relationship. The index table names of the three different time categories are customized as: Metrics-1m-yyyymmdd, Metrics-10m-yyyymmdd, Metrics-1h-yyyymmdd; and the current date is preset as time value T;
[0027] If the time range is greater than or equal to the part of time value T minus time value A, determine the time-series database (ElasticSearch) gateway routing query index table (Metrics-yyyymmdd), and return the processed detailed indicator results in the index table (Metrics-yyyymmdd) externally;
[0028] If the time range is greater than or equal to the part of time value T minus time value B and less than the part of time value T minus time value A, the time-series database (ElasticSearch) gateway queries the corresponding index table (Metrics-1m-yyyymmdd), and returns the indicator aggregation calculation results in the index table (Metrics-1m-yyyymmdd) externally;
[0029] If the time range is greater than or equal to the part of time value T minus time value C and less than the part of time value T minus time value B, the time-series database (ElasticSearch) gateway queries the corresponding index table (Metrics-10m-yyyymmdd), and returns the indicator aggregation calculation results in the index table (Metrics-10m-yyyymmdd) externally;
[0030] If the time range is less than the part of time value T minus time value C, the time-series database (ElasticSearch) gateway queries the corresponding index table (Metrics-1h-yyyymmdd), and returns the indicator aggregation calculation results in the index table (Metrics-1h-yyyymmdd) externally.
[0031] Beneficial effects: Compared with the prior art, the present invention has the following advantages:
[0032] (1) Adopt Flink stream computing technology, which fundamentally achieves stream computing capabilities and can support millisecond-level queries. Combining stream computing technology with the time-series database (ElasticSearch) realizes the capability of corresponding millisecond-level indicator queries;
[0033] (2) Different time windows are aggregated on top of the streaming computing technology engine. For short periods, the storage granularity is fine and the storage period is short, while for long periods, the storage granularity is coarse and the storage period is long, so that the overall pre-computation of the query service is controllable.
[0034] (3) The time-series database (ElasticSearch) gateway layer selects and integrates indexes with different aggregation levels based on query duration, reasonably controls the total number of queries, and relies on the capabilities of the time-series database (ElasticSearch) to achieve millisecond-level query return capability, which is fully capable of OLTP scenarios;
[0035] (4) By adapting the ElasticSearch protocol through the time series database (ElasticSearch) gateway, it can be seamlessly connected with the time series database (ElasticSearch) ecosystem, such as the connection between the time series database (ElasticSearch) and the monitoring instrument system (Grafana). Using the time series database (ElasticSearch), reports can be displayed in seconds for any time period, avoiding the problem of page freezing in excessively long periods. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating the query method of the present invention. Detailed Implementation
[0037] To better understand the technical content of the present invention, the technical solution of the present invention will be further introduced and explained below with reference to specific embodiments, but is not limited thereto.
[0038] Combination Figure 1 Further illustrating embodiments of the method of the present invention, the embodiments provide a method for millisecond-level querying of metrics over long periods. Based on a streaming computing engine and the time-series database Elasticsearch, it employs layered computing and layered storage technologies to achieve real-time pre-computation capabilities. The streaming computing engine utilizes metric aggregation technology for different time windows, while Elasticsearch employs index management technology for metrics across different periods. The Elasticsearch gateway layer uses query duration routing index technology to reasonably control the total number of queries, thereby achieving millisecond-level query return capabilities. This method is fully capable of handling OLTP scenarios. The steps are as follows:
[0039] S1: Collect metrics and send the collected metrics to the message middleware.
[0040] S2: The message middleware receives metrics and uses a streaming computing engine to calculate the received metric data to obtain processed detailed metrics and metric aggregation calculation results. The streaming computing engine is divided into multiple calculation windows according to the duration, generating metric aggregation calculation results for calculation windows of different durations, which are used for cyclical aggregation of metrics between multiple calculation windows. In this embodiment, the calculation window durations in the streaming computing engine are divided into 1 minute, 10 minutes, and 1 hour.
[0041] S3: Store the processed detailed indicator results and indicator aggregation calculation results separately in the time series database ElasticSearch. Write the processed detailed indicator results into the index table (Metrics-yyyymmdd) of the time series database ElasticSearch (where yyyymmdd corresponds to the current date). Write the different indicator aggregation calculation results into the corresponding index table of the time series database ElasticSearch. For example, in this embodiment, the aggregation calculation results for 1 minute are written into Metrics-1m-yyyymmdd, the aggregation calculation results for 10 minutes are written into Metrics-10m-yyyymmdd, and the aggregation calculation results for 1 hour are written into Metrics-1h-yyyymmdd.
[0042] S4: Based on the gateway protocol configured in the ElasticSearch time series database gateway, call the ElasticSearch time series database gateway to receive external requests for metric queries within a certain time range; the ElasticSearch time series database gateway supports writing routing logic based on dynamic languages;
[0043] S5: Parse the received external request and obtain the query parameters in the external request;
[0044] S6: Based on the query parameters in the external request, determine the path of the ElasticSearch gateway query index for fast response to metric query services.
[0045] The process of collecting metrics and sending them to the message middleware in S1 also includes: before sending the metrics, creating an index table in the time-series database ElasticSearch. The table name starts with "Metrics" and ends with "yyyymmdd" (where "yyyymmdd" represents the current time), with hyphens connecting the table names. For example, in this embodiment, the index table for storing detailed metrics is named "Metrics-yyyymmdd", the table for 1-minute aggregate calculation results is named "Metrics-1m-yyyymmdd", the table for 10-minute aggregate calculation results is named "Metrics-10m-yyyymmdd", and the table for 1-hour aggregate calculation results is named "Metrics-1h-yyyymmdd" (where "yyyymmdd" represents the current time).
[0046] Preferably, the content of the indicator includes: indicator name (key), numerical indicator value (value), and timestamp (timestamp).
[0047] The streaming computing engine in S2 divides the time frame into multiple computing windows, generating aggregated metric calculation results for different time windows. This is used for iterative aggregation of metrics across multiple computing windows.
[0048] The streaming computing engine is divided into multiple computing windows with different durations; and each computing window performs an aggregation operation according to the indicator key value to obtain indicator aggregation calculation results of different durations. The indicator aggregation calculation results are the aggregated data of indicator key values in the indicator stream.
[0049] The aggregated calculation results of metrics of different durations are stored in the index tables of different time categories in ElasticSearch and serve as the data input source for the corresponding previous duration calculation window. This is used for cyclical aggregation operations between multiple calculation windows of different durations to meet query requests with different time spans. In this embodiment, each calculation window aggregates according to the value of the metric key. The result of the 1-minute calculation serves as the input source for the 10-minute calculation, and similarly, the result of the 10-minute calculation serves as the input source for the 1-hour calculation. This is not limited to this embodiment.
[0050] Preferably, the aggregation action includes three categories: calculating the average (AVG), maximum (MAX), and minimum (MIN) of the key values within the calculation window. During the calculation process, the data stream within the first minute is placed within a calculation window to obtain the aggregated data for the first minute, which is then stored in the Elasticsearch index `Metrics-1m-yyyymmdd`. Similarly, the aggregated data for the second, third, ..., tenth minutes are also stored sequentially in `Metrics-1m-yyyymmdd`. Furthermore, the aggregated data for the first, second, ..., tenth minutes are themselves placed into a new calculation window, and a 10-minute aggregated value is generated based on these 10 values and written to the Elasticsearch index `Metrics-10m-yyyymmdd`. Similarly, the six values for the 10th, 20th, ..., 60th minutes are also used to generate an hourly aggregated value, which is written to the Elasticsearch index `Metrics-1h-yyyymmdd`.
[0051] S3 also includes partitioning and storing the processed detailed indicator results and indicator aggregation calculation results into the time series database ElasticSearch. The indicator aggregation calculation results are written into the time series database ElasticSearch index table Metrics-yyyymmdd with the index name prefixed with Metrics.
[0052] Preferably, in this method, the index table of the time-series database ElasticSearch is categorized by preset time and stores the aggregated calculation results of metrics for different calculation windows in batches; and different caching periods are preset for the aggregated calculation results of metrics for different calculation windows, such as: the storage period for Metrics-yyyymmdd is within one week; the storage period for Metrics-1m-yyyymmdd is within one month; the storage period for Metrics-10m-yyyymmdd is within six months; the storage period for Metrics-1h-yyyymmdd is more than one year, and permanent storage is allowed if storage permits.
[0053] Preferably, the time-series database ElasticSearch gateway in this method supports writing routing logic based on a dynamic language to support external services for time-series database (ElasticSearch) queries;
[0054] In the gateway protocol, the unit of time value is configured to be hours, and the number of time values is related to the number of calculation windows.
[0055] In S6, the path to the ElasticSearch gateway query index is determined based on the query parameters in the external request, enabling fast response to metric query services, including:
[0056] Obtain the time range according to the query parameters in the external request;
[0057] Determine the metric aggregation calculation result in the ElasticSearch gateway query index of the time-series database or determine that the ElasticSearch gateway of the time-series database directly queries the index table Metrics-yyyymmdd (yyyymmdd is the current time) by judging the time range queried by the external request based on the time value configured in the gateway protocol.
[0058] Preferably, the method for determining the metric aggregation calculation result in the ElasticSearch gateway query index of the time-series database or determining that the ElasticSearch gateway of the time-series database routes direct queries or a combination of the two by judging the time span based on the time value configured in the gateway protocol includes: the preset configured time values are time value A, time value B, and time value C respectively, satisfying A<B<C. For example, A is configured as 1 day, B as 10 days, and C as 30 days. In this case, set 23:59:59 of the current date as the time value T, and then combine A, B, and C to generate three key time points T-A, T-B, and T-C;
[0059] Preset three calculation windows with different durations: for example, three calculation windows with different durations of 1 minute, 10 minutes, and 1 hour; the generated calculation results are stored in the index tables Metrics-1m-yyyymmdd, Metrics-10m-yyyymmdd, and Metrics-1h-yyyymmdd respectively;
[0060] Calculate the time value configured in the gateway protocol with the current time to analyze the specific time interval of the time range in the request query, and judge the time span of the request;
[0061] If there is a part in the request query whose time range is greater than or equal to the time value T-A, it means that the time of this segment of the request is the current day and the span is within 1 day, and the routed query index of the ElasticSearch gateway of the time-series database is determined to be the processed detailed metric result in Metrics-yyyymmdd;
[0062] If there is a part whose time range is greater than or equal to the time value T–B and less than the time value T–A, it means that the time span of this segment of the request is more than 1 days and less than 10 days, and the ElasticSearch gateway of the time-series database queries the metric aggregation calculation result of Metrics-1m-yyyymmdd;
[0063] If there is a portion with a time range greater than or equal to the time value T–C and less than the time value TB, it means that the time span of the request is more than 10 days and less than 30 days. The time series database ElasticSearch gateway queries the aggregated calculation results of the metrics Metrics-10m-yyyymmdd.
[0064] If there is a portion of the time range that is less than the time value TC, it means that the time span of the request is more than 30 days ago. The time series database ElasticSearch gateway queries the aggregated calculation results of the metrics Metrics-1h-yyyymmdd.
[0065] The above integrates all existing partial query results and returns them externally;
[0066] In summary, this invention employs Flink streaming computing technology to fundamentally achieve streaming computing capabilities, supporting millisecond-level queries. It combines streaming computing technology with the time-series database Elasticsearch to achieve millisecond-level metric query capabilities. The streaming computing engine utilizes different time windows for aggregation, with finer storage granularity and shorter storage periods for short periods, and coarser storage granularity and longer storage periods for long periods, making the overall pre-computation workload of the query service controllable. The Elasticsearch gateway layer selects and integrates indexes with different aggregation levels based on query duration, reasonably controlling the total number of queries. Relying on the capabilities of the Elasticsearch database, it achieves millisecond-level query return capabilities, fully capable of handling OLTP scenarios. Through the Elasticsearch gateway's adaptation to the Elasticsearch protocol, it can seamlessly integrate with the Elasticsearch ecosystem, such as integrating Elasticsearch with the Grafana monitoring system. Using Elasticsearch, reports can be easily displayed in seconds for any time period, avoiding page freezes during excessively long periods.
[0067] Embodiments of this application may be provided as methods, systems, or computer program products. Therefore, this application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0068] Embodiments of this application may be provided as methods, systems, or computer program products. Therefore, this application may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0069] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0070] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0071] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0072] The above description is only a preferred embodiment of the present invention. Without departing from the technical principle of the present invention, several improvements and modifications can be made, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for millisecond-level query of indicators over a long period, characterized in that, include: Collect indicator data and send the collected indicator data to the message middleware; The message middleware receives indicator data and uses a streaming computing engine to calculate the received indicator data, obtaining the processed detailed indicator results and the aggregated calculation results of different indicators. The streaming computing engine divides the data into multiple calculation windows according to the duration, generating the aggregated calculation results of indicators for different duration calculation windows, which are used for the cyclical aggregation of indicators between multiple calculation windows. The processed detailed indicator results and the aggregated calculation results of different indicators are stored separately in the time series database ElasticSearch. Specifically, the processed detailed indicator results are written to the current date index table Metrics-yyyymmdd in the time series database ElasticSearch. The aggregated calculation results of different indicators are written to the index tables of different time categories in the time series database ElasticSearch according to the time correspondence. Based on the gateway protocol configured in the ElasticSearch time series database gateway, the ElasticSearch time series database gateway is invoked to receive external requests for metric queries. Parse the received external request to obtain the query parameters in the external request; Based on the query parameters in the external request, the path for querying the index table of the time series database ElasticSearch gateway is determined, which is used to quickly respond to the metric query service and return the queried metric results to the outside world; The streaming computing engine divides the computation window into multiple computation windows based on duration, generating aggregated metric calculation results for different duration windows. The specific method for iterative aggregation of metrics across multiple computation windows is as follows: The streaming computing engine is divided into multiple computing windows with different durations; and each computing window performs an aggregation operation according to the indicator key value to obtain indicator aggregation calculation results of different durations, where the indicator aggregation calculation results are the aggregated data of indicator key values in the indicator stream. The aggregated calculation results of metrics of different durations are stored in index tables of different times in the time series database ElasticSearch, and used as the data input source for the corresponding previous duration calculation window. This is used for cyclical aggregation operations between multiple calculation windows of different durations to meet the query requests of different time spans.
2. The method for millisecond-level index query over a long period according to claim 1, characterized in that, Collecting metrics and sending them to the message middleware also includes: Before sending metrics, creating an index table in the time-series database ElasticSearch, with the table name prefixed with "Metrics" and suffixed with "yyyymmdd", where "yyyymmdd" corresponds to the current date, and the table name is connected by the symbol "-".
3. The method for millisecond-level index query over a long period according to claim 2, characterized in that, The content of the indicator includes: indicator name, numerical indicator value, and timestamp.
4. The method for millisecond-level query of indicators over a long period according to claim 1, characterized in that, The aggregation action includes three categories: calculating the average value (AVG), maximum value (MAX), and minimum value (MIN) of the indicator key values within the window.
5. The method for millisecond-level query of indicators over a long period according to claim 1, characterized in that, Storing the processed detailed indicator results and the aggregated calculation results of different indicators in partitions into the time-series database ElasticSearch further includes: writing the detailed indicator results and the aggregated calculation results of different indicators into the index table of the time-series database ElasticSearch with an index name prefixed with Metrics.
6. The method for millisecond-level query of indicators over a long period according to claim 1, characterized in that, In the index of the time-series database ElasticSearch, the aggregated calculation results of indicators for calculation windows of different durations are stored in batches according to a preset time classification, and different cache periods are preset for the aggregated calculation results of indicators for calculation windows of different durations.
7. The method for millisecond-level index query over a long period according to claim 1, characterized in that, The time-series database ElasticSearch gateway supports routing logic written in a dynamic language, and is used to support external services for time-series database ElasticSearch queries. A time value is configured in the gateway protocol, the time value is in hours, and the number of time values is related to the number of calculation windows.
8. The method for millisecond-level query of indicators over a long period according to claim 7, characterized in that, The method for determining the path of the time-series database ElasticSearch gateway to query the index table based on the query parameters in the external request includes: Obtaining a time range according to the query parameters in the external request. Judging the time range queried by the external request based on the time value configured in the gateway protocol and the current time, and determining the index table of the corresponding time category queried by the time-series database ElasticSearch gateway according to the time span and / or the time-series database ElasticSearch gateway directly queries the current date index table Metrics-yyyymmdd.
9. The method for millisecond-level query of indicators over a long period according to claim 8, characterized in that, The method for judging the time range queried by the external request based on the time value configured in the gateway protocol and the current time, and determining that the time-series database ElasticSearch gateway queries the index table of the corresponding time category according to the time span or the time-series database ElasticSearch gateway directly queries the current date index table Metrics-yyyymmdd includes: The preset time values configured in the gateway are time value A, time value B, and time value C respectively, and satisfy A<B<C; preset three calculation windows of different durations, generate indicator aggregation calculation results of three durations, and write them into the index tables of three different time categories of the time-series database ElasticSearch according to the time correspondence, and the index table names of the three different time categories are respectively customized as: Metrics-1m-yyyymmdd, Metrics-10m-yyyymmdd, Metrics-1h-yyyymmdd. The preset current date is the time value T. If the time range is greater than or equal to the part of the time value T minus the time value A, determine that the time-series database ElasticSearch gateway routes to query the current date index table, and returns the processed detailed indicator results in the current date index table. If the time range is greater than or equal to the portion of time value T minus time value B and less than the portion of time value T minus time value A, the ElasticSearch time series database gateway queries the corresponding index table Metrics-1m-yyyymmdd and returns the aggregated calculation results of the metrics in the index table Metrics-1m-yyyymmdd. If the time range is greater than or equal to the portion of time value T minus time value C and less than the portion of time value T minus time value B, the ElasticSearch time series database gateway queries the corresponding index table Metrics-10m-yyyymmdd and returns the aggregated calculation results of the metrics in the index table Metrics-10m-yyyymmdd. If the time range is less than the time value T minus the time value C, the ElasticSearch time series database gateway queries the corresponding index table Metrics-1h-yyyymmdd and returns the aggregated calculation results of the metrics in the index table Metrics-1h-yyyymmdd.
Citation Information
Patent Citations
Index data pre-aggregation method
CN113868248A
Kapactor clustering method based on table routing proxy mode
CN115002205A
