A scripted sequence calculation and back-weaving method and system for time series data
Through JavaScript script execution engine and cache pool management, parallel computing tasks are generated in real time, solving the performance bottlenecks and insufficient flexibility of the time series data processing system, and achieving efficient and real-time data processing capabilities.
Patent Information
- Application Number
- CN202411313966.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2044-09-20
AI Technical Summary
The existing time-series data processing systems have performance bottlenecks when processing high-frequency and large-scale data, and lack flexibility, which makes it difficult to meet the diverse needs of modern application scenarios, and it is difficult to ensure the real-time and efficient data processing.
Through the JavaScript script execution engine, time-series data preloading is used to use connection pool management and cache pools to generate parallel computing tasks in real time, and process them through calculation thread pools, optimize data management and system status updates, dynamically adjust data points and task priorities, Improve data processing efficiency and system response capabilities.
It improves the flexibility and adaptability of the system, improves data processing speed and responsiveness, optimizes database access efficiency and performance, and meets the needs of high-frequency and large-scale data processing.
Smart Images

Figure CN118838933B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of script calculation of time series databases, and specifically to a scripted sequence calculation and backweaving method for time series data. Background Art
[0002] With the rapid development of big data and cloud computing technologies, time series data is increasingly used in all walks of life. As a data sequence arranged in chronological order, time series data is widely used in tasks such as monitoring, prediction, analysis and decision-making. Its continuity, high concurrency and real-time characteristics put forward high requirements on data processing systems. In the fields of industrial control, financial monitoring, intelligent manufacturing and the Internet of Things, the real-time processing and analysis capabilities of time series data have become an important means to improve production efficiency, optimize resource allocation and improve service quality. Traditional time series data processing methods mainly rely on relational databases and dedicated time series databases to store, query and analyze data to meet the basic needs of users. However, with the continuous increase in data scale and complexity, traditional methods are stretched when dealing with high-frequency and large-scale data processing. The existing time series data processing systems have many limitations in processing flexibility, real-time and efficiency, and it is difficult to meet the diverse needs of modern application scenarios.
[0003] Existing technologies mainly face the following deficiencies when processing time series data. First, traditional database systems often encounter performance bottlenecks when facing large-scale, high-frequency time series data, and cannot achieve efficient data storage and query. Second, existing systems have obvious deficiencies in the flexibility and customization of data processing. It is difficult for users to flexibly adjust the data processing process according to actual needs, resulting in poor performance of the system when dealing with complex computing and analysis tasks. In addition, traditional systems often lack effective solutions when processing data tasks with high real-time and concurrency requirements, and it is difficult to ensure the real-time and efficiency of data processing. Existing solutions usually require frequent access to the database, resulting in query delays and increased system load, further affecting the efficiency and accuracy of data processing. Summary of the invention
[0004] In view of the above-mentioned problems, the present invention is proposed.
[0005] Therefore, the technical problem solved by the present invention is: the existing data processing methods have insufficient flexibility, low data processing efficiency, and are prone to operation delays, as well as the optimization problem of how to improve the script execution efficiency.
[0006] To solve the above technical problems, the present invention provides the following technical solutions: a scripted sequence calculation and weaving method for time series data, including writing and executing JS scripts, managing the connection with the time series database through a connection pool, and preloading commonly used time series data into a cache pool; processing time series data calculations and logical judgments, generating computing tasks in real time and assigning them to a computing thread pool for parallel processing; performing data management on time series data, reading time series data and writing back time series data, updating system status, and optimizing the JS script execution engine.
[0007] As a preferred solution of the scripted sequence calculation and weaving method for time series data described in the present invention, wherein: the connection management with the time series database through the connection pool includes defining the priority of the data block, writing and executing the JS script to define the priority of the time series data, assigning an initial priority to each data point, and performing attenuation processing on the priority according to the timestamp of the data point. The priority of each data point gradually decreases with the passage of time. When processing the time series data, the importance of the data point is dynamically adjusted, and the recent data points are processed first. The priority of the time series data is defined as:
[0008] ,
[0009] in, For the Data points at time The priority of is the initial priority, is the exponential decay constant, For the The timestamp of each data point is used to perform weighted average processing on the priority of each cached data block in multiple time segments, reflecting the access importance and usage of the data block in the entire time period. The priority of the data block is determined as follows:
[0010] ,
[0011] in, For the The priority of each cached data block, For the The data block is in The access frequency of a time slice, is the number of time slices.
[0012] As a preferred solution of the scripted sequence calculation and backweaving method for time series data described in the present invention, the preloading of commonly used time series data into the cache pool includes calculating the data processing results, calculating the cumulative value of the cached data blocks, and generating a cumulative value reflecting the overall importance of the data blocks by accumulating the values and priorities of each data block. In the data processing process, the priority data blocks are quickly accessed and processed, the priority of each cached data block is multiplied by the data point value, and the results are accumulated, which is expressed as:
[0013] ,
[0014] in, For the cache pool The cumulative value of data blocks, For the cache pool The priority of each data block, For the The value of the data point, is the number of data blocks in the cache pool. Combined with the cumulative value of the data block and the time decay factor, the data processing result is calculated. By weighting the cumulative value and time decay factor of each cache data block, the calculation result is generated, which is expressed as:
[0015] ,
[0016] in, The processing result of preloaded data. is the total number of data points.
[0017] As a preferred solution of the scripted sequence calculation and back-weaving method for time series data described in the present invention, the time series data calculation and logic judgment processing includes logic judgment complexity, the complexity of data processing is modeled, the calculation complexity is accumulated through time integration, the data processing requirements at different time points are evaluated, and the logic judgment complexity model is introduced. Combined with various factors of logic judgment, it is expressed as:
[0018] ,
[0019] ,
[0020] in, is the data complexity, For in time The data size at For in time The data type complexity at and is the weight coefficient, is the logic judgment complexity, For the A logical judgment in time The complexity of For the The execution time of a logical judgment, and is the weight coefficient. After determining the complexity of data processing and logical judgment, the overall data processing time is calculated, and the processing time at different time points is accumulated. The real-time data processing is dynamically evaluated, which is expressed as:
[0021] ,
[0022] in, For in time The data complexity at For in time The complexity of logical judgment at is the total data processing time.
[0023] As a preferred solution of the scripted sequence calculation and weaving method for time series data described in the present invention, the real-time generation of computing tasks and allocation to the computing thread pool for parallel processing includes computing the task generation model, determining the initial priority of the task and the time decay effect of the task from generation to the current time, dynamically adjusting the task priority, combining the task complexity, priority and resource requirements, calculating the generation time of the task, and quickly generating high-priority and high-complexity tasks through nonlinear combination functions, which is expressed as:
[0024] ,
[0025] ,
[0026] ,
[0027] ,
[0028] in, is the task complexity, For in time The complexity of the task, For in time The task data size at For in time The complexity of the task data type at and is the weight coefficient, is the task priority, For in time The task priority of is the initial priority of the task, The time from when the task was created to now The elapsed time, is the adjustment coefficient, For task resource requirements, For in time The task resource requirements of For in time The resource requirements of The task generation time is calculated, the thread pool load is calculated, and the high-priority tasks are executed first in the threads with low loads, based on the changes in the thread pool load and the task allocation degree, which is expressed as:
[0029] ,
[0030] ,
[0031] in, For in time The thread pool load at For the Tasks in time The execution time at is the thread pool load, and is the weight coefficient, To optimize task allocation, The total number of tasks within a specific time.
[0032] As a preferred solution of the scripted sequence calculation and weaving method for time series data described in the present invention, the data management of time series data includes data reading and writing back, introducing historical impact factors, determining the impact of historical data on the current data reading process, dynamically adjusting data reading priority, reflecting data access heat through data access frequency, and combining with reading delay time. The data reading model is expressed as:
[0033] ,
[0034] ,
[0035] ,
[0036] ,
[0037] in, is the data reading complexity, For in time The data reading complexity at For in time The complexity of the data format at For in time The historical impact factor of is the access frequency, and For in time The frequency of visits, is the read delay time, For in time The read latency at For the Read operations in time The delay time at To optimize the data reading efficiency, is the adjustment coefficient, For the total number of read operations, a consistency check factor is introduced. Combining the write-back complexity, consistency check factor, priority, write-back frequency, and write-back delay time, the data write-back model is expressed as:
[0038] ,
[0039] ,
[0040] ,
[0041] ,
[0042] in, is the complexity of data writeback, For in time The complexity of data writeback at is the data consistency check factor, is the write-back frequency, For in time The write-back frequency at is the write-back delay time, For in time The write-back delay time at To optimize the data write-back efficiency, is the total number of data write-back operations, is the adjustment coefficient of the write-back frequency, is the adjustment coefficient of the write-back data priority, is the weight coefficient of the write-back delay time.
[0043] As a preferred solution of the scripted sequence calculation and weaving method of time series data described in the present invention, the updating of the system state includes a system state update model, which monitors and manages the system load in a scripted manner based on the usage of the CPU and memory, and dynamically adjusts the allocation and use of system resources by using the defined script function. The system state update model is expressed as:
[0044] ,
[0045] ,
[0046] ,
[0047] ,
[0048] ,
[0049] in, For in time The CPU load at For in time Memory load at For in time The system is in a stable state, For in time The system load fluctuation at For in time The task priority of is the task processing time, For the Update operations at time The delay time at is the adjustment coefficient of data processing efficiency, is the adjustment coefficient of the data processing effect, is the weight coefficient of the system update delay time, is the system load, is the system state stability, For data processing efficiency, Delay time for system update. For data processing effects, To optimize the system status update speed, In order to calculate the total number of items, the script execution engine is optimized. Through specific script functions, the script execution strategy is dynamically adjusted to optimize the execution effect. The data point priority and cache data block priority are combined to enable the engine to run efficiently at different time points. The script execution engine optimization model is expressed as:
[0050] ,
[0051] ,
[0052] ,
[0053] ,
[0054] in, For in time The complexity of the script at is the execution time of the script, For in time The available resources For in time Resource utilization rate at For the The optimization operation is performed in time The execution time at For script execution efficiency, For in time Script execution efficiency at For resource scheduling efficiency, For in time The resource scheduling efficiency at Optimize execution time for the engine, For in time Engine optimization execution time at For the optimized engine execution effect, For in time Resource consumption at For in time The optimized computational complexity at is the adjustment coefficient of computational complexity, is the adjustment coefficient of resource consumption.
[0055] Another object of the present invention is to provide a scripted sequence calculation and weaving system for time series data, which can manage time series data through a read-write module, thereby solving the current problems of low data reading efficiency and large data write-back delay.
[0056] As an optimal solution of the time series data scripted sequence calculation and weaving system described in the present invention, it includes: a connection management module, a processing generation module, and a read-write back module; the connection management module is used to write and execute JS scripts, manage the connection with the time series database through the connection pool, and preload the commonly used time series data into the cache pool; the processing generation module is used to process time series data calculations and logical judgments, generate computing tasks in real time and assign them to the computing thread pool for parallel processing; the read-write back module is used to manage time series data, read time series data and write back time series data, update system status, and optimize the JS script execution engine.
[0057] A computer device includes a memory and a processor, wherein the memory stores a computer program, and is characterized in that the processor executes the computer program to implement the steps of a scripted sequence calculation and weaving method for time series data.
[0058] A computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of a scripted sequence calculation and backweaving method for time series data.
[0059] Beneficial effects of the present invention: The scripted sequence calculation and weaving method for time series data provided by the present invention improves the flexibility and adaptability of the system by introducing a JavaScript script execution engine, improves the data processing speed and system responsiveness by establishing an internal cache pool, improves the computing efficiency and the dynamic adaptability of the system by generating computing tasks in real time according to computing point information, improves the computing efficiency of the system by introducing a computing thread pool, and improves the efficiency and performance of database access by optimizing database connection pool management. The present invention achieves better results in terms of flexibility, adaptability and computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0061] Figure 1 An overall flow chart of a scripted sequence calculation and weaving method for time series data provided in the first embodiment of the present invention.
[0062] Figure 2 An overall module diagram of a time series data scripted sequence calculation and weaving system provided for the second embodiment of the present invention. DETAILED DESCRIPTION
[0063] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0064] Example 1, reference Figure 1 , is an embodiment of the present invention, and provides a scripted sequence calculation and backweaving method for time series data, comprising:
[0065] S1: Write and execute JS scripts, manage the connection with the time series database through the connection pool, and preload commonly used time series data into the cache pool.
[0066] Furthermore, managing connections to a time series database through a connection pool includes defining data block priorities.
[0067] It should be noted that the JS script is written and executed to define the priority of time series data, and an initial priority is assigned to each data point. The priority is decayed according to the timestamp of the data point. The priority of each data point decreases gradually over time. When processing time series data, the importance of the data point is dynamically adjusted, and recent data points are processed first. The priority of time series data is defined as:
[0068] ,
[0069] in, For the Data points at time The priority of is the initial priority, is the exponential decay constant, For the The timestamp of each data point is used to perform weighted average processing on the priority of each cached data block in multiple time segments, reflecting the access importance and usage of the data block in the entire time period. The priority of the data block is determined as follows:
[0070] ,
[0071] in, For the The priority of each cached data block, For the The data block is in The access frequency of a time slice, is the number of time slices.
[0072] Furthermore, preloading commonly used time series data into the cache pool includes calculating data processing results.
[0073] It should be noted that the cumulative value calculation is performed on the cached data blocks. By accumulating the values and priorities of each data block, a cumulative value reflecting the overall importance of the data block is generated. In the data processing process, the priority data block is quickly accessed and processed. The priority of each cached data block is multiplied by the data point value, and the results are accumulated and expressed as:
[0074] ,
[0075] in, For the cache pool The cumulative value of data blocks, For the cache pool The priority of each data block, For the The value of the data point, is the number of data blocks in the cache pool. Combined with the cumulative value of the data block and the time decay factor, the data processing result is calculated. By weighting the cumulative value and time decay factor of each cache data block, the calculation result is generated, which is expressed as:
[0076] ,
[0077] in, The processing result of preloaded data. is the total number of data points.
[0078] S2: Processes time series data calculations and logical judgments, generates computing tasks in real time and distributes them to the computing thread pool for parallel processing.
[0079] Furthermore, processing time series data calculations and logical judgments includes the complexity of logical judgments.
[0080] It should be noted that the complexity of data processing is modeled, the computational complexity is accumulated through time integration, the data processing requirements at different time points are evaluated, and the logic judgment complexity model is introduced. Combining various factors of logic judgment, it is expressed as:
[0081] ,
[0082] ,
[0083] in, is the data complexity, For in time The data size at For in time The data type complexity at and is the weight coefficient, is the logic judgment complexity, For the A logical judgment in time The complexity of For the The execution time of a logical judgment, and is the weight coefficient. After determining the complexity of data processing and logical judgment, the overall data processing time is calculated, and the processing time at different time points is accumulated. The real-time data processing is dynamically evaluated, which is expressed as:
[0084] ,
[0085] in, For in time The data complexity at For in time The complexity of logical judgment at is the total data processing time.
[0086] Furthermore, computing tasks are generated in real time and assigned to a computing thread pool for parallel processing including a computing task generation model.
[0087] It should be noted that the initial priority of the task and the time decay effect of the task from generation to the current time are determined, the task priority is adjusted dynamically, and the task generation time is calculated by combining the task complexity, priority and resource requirements. Through the nonlinear combination function, high-priority and high-complexity tasks are quickly generated, which can be expressed as:
[0088] ,
[0089] ,
[0090] ,
[0091] ,
[0092] in, is the task complexity, For in time The complexity of the task, For in time The task data size at For in time The complexity of the task data type at and is the weight coefficient, is the task priority, For in time The task priority of is the initial priority of the task, The time from when the task was created to now The elapsed time, is the adjustment coefficient, For task resource requirements, For in time The task resource requirements of For in time The resource requirements of The task generation time is calculated, the thread pool load is calculated, and the high-priority tasks are executed first in the threads with low loads, based on the changes in the thread pool load and the task allocation degree, which is expressed as:
[0093] ,
[0094] ,
[0095] in, For in time The thread pool load at For the Tasks in time The execution time at is the thread pool load, and is the weight coefficient, To optimize task allocation, The total number of tasks within a specific time.
[0096] S3: Manage time series data, read time series data and write back time series data, update system status, and optimize the JS script execution engine.
[0097] Furthermore, data management of time series data includes data reading and writing back.
[0098] It should be noted that the historical impact factor is introduced to determine the impact of historical data on the current data reading process, dynamically adjust the data reading priority, and reflect the data access popularity through the data access frequency. Combined with the reading delay time, the data reading model is expressed as:
[0099] ,
[0100] ,
[0101] ,
[0102] ,
[0103] in, is the data reading complexity, For in time The data reading complexity at For in time The complexity of the data format at For in time The historical impact factor of is the access frequency, and For in time The frequency of visits, is the read delay time, For in time The read latency at For the Read operations in time The delay time at To optimize the data reading efficiency, is the adjustment coefficient, For the total number of read operations, a consistency check factor is introduced. Combining the write-back complexity, consistency check factor, priority, write-back frequency, and write-back delay time, the data write-back model is expressed as:
[0104] ,
[0105] ,
[0106] ,
[0107] ,
[0108] in, is the complexity of data writeback, For in time The complexity of data writeback at is the data consistency check factor, is the write-back frequency, For in time The write-back frequency at is the write-back delay time, For in time The write-back delay time at To optimize the data write-back efficiency, is the total number of data write-back operations, is the adjustment coefficient of the write-back frequency, is the adjustment coefficient of the write-back data priority, is the weight coefficient of the write-back delay time.
[0109] Furthermore, updating the system state includes updating a system state model.
[0110] It should be noted that based on the CPU and memory usage, the system load is monitored and managed in a scripted manner, and the allocation and use of system resources are dynamically adjusted using the defined script functions. The system status update model is expressed as:
[0111] ,
[0112] ,
[0113] ,
[0114] ,
[0115] ,
[0116] in, For in time The CPU load at For in time Memory load at For in time The system is in a stable state, For in time The system load fluctuation at For in time The task priority of is the task processing time, For the Update operations at time The delay time at is the adjustment coefficient of data processing efficiency, is the adjustment coefficient of the data processing effect, is the weight coefficient of the system update delay time, is the system load, is the system state stability, For data processing efficiency, Delay time for system update. For data processing effects, To optimize the system status update speed, In order to calculate the total number of items, the script execution engine is optimized. Through specific script functions, the script execution strategy is dynamically adjusted to optimize the execution effect. The data point priority and cache data block priority are combined to enable the engine to run efficiently at different time points. The script execution engine optimization model is expressed as:
[0117] ,
[0118] ,
[0119] ,
[0120] ,
[0121] in, For in time The complexity of the script at is the execution time of the script, For in time The available resources For in time Resource utilization rate at For the The optimization operation is performed in time The execution time at For script execution efficiency, For in time Script execution efficiency at For resource scheduling efficiency, For in time The resource scheduling efficiency at Optimize execution time for the engine, For in time Engine optimization execution time at For the optimized engine execution effect, For in time Resource consumption at For in time The optimized computational complexity at is the adjustment coefficient of computational complexity, is the adjustment coefficient of resource consumption.
[0122] Example 2, an embodiment of the present invention, provides a scripted sequence calculation and weaving method for time series data. In order to verify the beneficial effects of the present invention, scientific demonstration is carried out through economic benefit calculation and simulation experiments.
[0123] First, an internal cache pool is established to uniformly manage the query and writing of real-time data of measurement points. When the system receives a query request, it will first check whether the required data exists in the cache pool. If the data is already in the cache, the system can quickly return the result without querying the time series library, thereby greatly improving the speed and responsiveness of data processing. This caching mechanism not only ensures the real-time and accuracy of the data, but also reduces the load pressure of the system. Secondly, the new version of the script calculation function generates calculation tasks in real time according to the calculation point information, and puts them into the calculation thread pool for calculation. This processing method can make full use of computing resources and realize the rapid processing of calculation point information. The size of the calculation thread pool and the number of threads can be flexibly configured according to actual needs to balance the relationship between system performance and resource consumption. This parallel processing method not only improves the computing efficiency, but also ensures that the system can still maintain stable performance when processing a large number of calculation points.
[0124] The new version of the script calculation function successfully helped a factory solve the performance bottleneck problem of the old version when processing large-scale data. Even if the number of calculation points reaches 10,000, the new version of the system can still maintain a calculation speed of seconds, meeting the factory's needs for high-performance data processing. In order to test the performance limit of the script calculation function, an experiment was conducted. The core of the experiment was to simulate the operation of obtaining data from two different measurement points in real time and adding them. Special attention was paid to ensure that the system memory and network resources did not reach the upper limit to avoid resource bottlenecks affecting the experimental results. In order to improve the accuracy of the experiment, multiple repeated experiments were conducted and the average value was taken as the final result. When the experimental results showed that the maximum response time exceeded 1 second, it was considered that the system could no longer meet the requirements of second-level calculations, indicating that the system had reached the performance upper limit. These experiments provided important information about the performance of the script calculation function, which helped to understand the performance bottlenecks and potential optimization points of the system. Subsequent performance optimization and system upgrades were carried out based on the experimental results to further improve system performance and ensure that users can enjoy a smooth and efficient computing experience.
[0125] As shown in Table 1, according to the actual application results, the method of the present invention has fully proved that it can support the calculation of 10,000 points per second, showing excellent performance and real-time response capability.
[0126] Table 1 Number of calculation points and maximum response time table of measurement points
[0127] ,
[0128] Example 3, reference Figure 2 , as an embodiment of the present invention, provides a time series data scripted sequence calculation and weaving system, including: a connection management module, a processing generation module, and a read-write module.
[0129] The connection management module is used to write and execute JS scripts, manage the connection with the time series database through the connection pool, and preload the commonly used time series data into the cache pool; the processing generation module is used to process time series data calculations and logical judgments, generate computing tasks in real time and assign them to the computing thread pool for parallel processing; the read-write module is used to manage time series data, read time series data and write back time series data, update the system status, and optimize the JS script execution engine.
[0130] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0131] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.
[0132] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk case (magnetic devices), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.
[0133] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logical function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc. It should be noted that the above embodiments are only used to illustrate the technical solution of the present invention and are not limited. Although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention, which should be included in the scope of the claims of the present invention.
[0134] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A scripted sequence calculation and back-weaving method for time series data, characterized in that: include: Write and execute JS scripts to manage the connection with the time series database through the connection pool and preload the commonly used time series data into the cache pool; Process time series data calculation and logical judgment, generate computing tasks in real time and assign them to the computing thread pool for parallel processing; Manage time series data, read and write back time series data, update system status, and optimize the JS script execution engine; Managing the connection with the time series database through the connection pool includes defining the priority of the data block, writing and executing the JS script to define the priority of the time series data, assigning an initial priority to each data point, and decaying the priority according to the timestamp of the data point. The priority of each data point decreases gradually over time. When processing time series data, the importance of the data point is dynamically adjusted, and recent data points are processed first. The priority of time series data is defined as: Among them, P(t i ) is the i-th data point at time t i priority, P0 is the initial priority, λ is the exponential decay constant, t i is the timestamp of the i-th data point. The priority of each cached data block in multiple time segments is weighted averaged to reflect the access importance and usage of the data block in the entire time period. The priority of the data block is determined as: Among them, C i is the priority of the i-th cache data block, R ij is the access frequency of the i-th data block in the j-th time slice, and M is the number of time slices; Preloading common time series data into the cache pool includes calculating the data processing results, calculating the cumulative value of the cached data blocks, and generating a cumulative value reflecting the overall importance of the data blocks by accumulating the values and priorities of each data block. During the data processing process, the priority data blocks are quickly accessed and processed, and the priority of each cached data block is multiplied by the data point value, and the results are accumulated, which can be expressed as: Among them, D i is the cumulative value of the i-th data block in the cache pool, C k is the priority of the kth data block in the cache pool, x k is the value of the kth data point, L is the number of data blocks in the cache pool, and the data processing result is calculated by combining the cumulative value of the data block and the time decay factor. The calculation result is generated by weighted processing of the cumulative value and time decay factor of each cached data block, which is expressed as: Where Y is the processing result of the preloaded data, and N is the total number of data points; Generate computing tasks in real time and assign them to the computing thread pool for parallel processing, including computing task generation model, determining the initial priority of tasks and the time decay effect of tasks from generation to the current time, dynamically adjusting task priority, combining task complexity, priority and resource requirements, calculating task generation time, and quickly generating high-priority and high-complexity tasks through nonlinear combination functions, expressed as: Among them, C t (t) is the task complexity, C t (t') is the task complexity at time t', D s (t') is the task data size at time t', D t (t') is the complexity of the task data type at time t', θ and ζ are weight coefficients, P t (t) is the task priority, P t (t') is the task priority at time t', P i is the initial priority of the task, T e (t) is the time from task generation to the current time t, η is the adjustment coefficient, R t (t) is the task resource requirement, R t (t') is the task resource requirement at time t', r r (t') is the resource demand at time t', T g (t) is the task generation time. The thread pool load is calculated. Combined with the change of thread pool load and task allocation, high-priority tasks are executed first in threads with low load, which is expressed as: Among them, b l (') is the thread pool load at time t', T k (t) is the execution time of the kth task at time t, B k (t) is the load of the thread pool, λ1 and μ are weight coefficients, D a,o (t) is the degree of optimizing task allocation, L1 is the total number of tasks within a specific time; Data management for time series data includes data reading and writing back, introducing historical impact factors, determining the impact of historical data on the current data reading process, dynamically adjusting data reading priority, and reflecting data access popularity through data access frequency. Combined with the reading delay time, the data reading model is expressed as: Among them, C r (t) is the data reading complexity, D r (t') is the data reading complexity at time t', D f (t') is the data format complexity at time t', H r (t') is the historical impact factor at time t', F r (t is the access frequency, F r (t') and f a (t') is the access frequency at time t', D d (t) is the read delay time, D d (t') is the read latency at time t', is the delay time of the jth read operation at time t, R d,o (t) is the optimized data reading efficiency, v is the adjustment coefficient, M1 is the total number of read operations, and the consistency check factor is introduced. Combining the write-back complexity, consistency check factor, priority, write-back frequency and write-back delay time, the data write-back model is expressed as: Among them, C w (t) is the complexity of data write-back, C w (t') is the data write-back complexity at time t', V c (t') is the data consistency check factor, F w (t) is the write-back frequency, F w (t') is the write-back frequency at time t', L d (t) is the write-back delay time, L d (t') is the write-back delay time at time t', W d,o (t) is the optimized data write-back efficiency, O is the total number of data write-back operations, τ is the adjustment coefficient of the write-back frequency, σ is the adjustment coefficient of the write-back data priority, and ∈ is the weight coefficient of the write-back delay time.
2. The scripted sequence calculation and back-weaving method of time series data as claimed in claim 1, characterized in that: The processing of time series data calculation and logic judgment includes logic judgment complexity, which models the complexity of data processing, accumulates the calculation complexity through time integration, evaluates the data processing requirements at different time points, introduces a logic judgment complexity model, and combines various factors of logic judgment to express it as: Among them, C d (t) is the data complexity, D s (t') is the data size at time t', D t (t') is the data type complexity at time t', α and β are weight coefficients, L l (t) is the logic judgment complexity, L i (t) is the complexity of the i-th logical judgment at time t, T i (t) is the execution time of the i-th logical judgment, γ and δ are weight coefficients. After determining the complexity of data processing and logical judgment, the overall data processing time is calculated, and the processing time at different time points is accumulated. The real-time data processing is dynamically evaluated, which is expressed as: Among them, C d (t') is the data complexity at time t', L l (t') is the logic judgment complexity at time t', T p (t) is the total data processing time.
3. The scripted sequence calculation and back-weaving method of time series data as claimed in claim 1, characterized in that: The updating system status includes a system status updating model. Based on the usage of CPU and memory, the system load is monitored and managed in a scripted manner. The allocation and use of system resources are dynamically adjusted using defined script functions. The system status updating model is expressed as: Among them, C c (t') is the CPU load at time t', C m (t') is the memory load at time t', S s (t') is the system stable state at time t', S v (t') is the system load fluctuation at time t', P t (t') is the task priority at time t', T t (t') is the processing time of the task, u d,k (t) is the delay time of the kth update operation at time t, φ is the adjustment coefficient of data processing efficiency, χ is the adjustment coefficient of data processing effect, κ is the weight coefficient of system update delay time, S l (t) is the system load, Q s (t) is the system state stability, E p (t) is the data processing efficiency, U d (t) is the system update delay time, D e (t) is the data processing effect, U s,c (t) is the optimized system status update speed, P is the total number of calculation items, and the script execution engine is optimized. Through specific script functions, the script execution strategy is dynamically adjusted to optimize the execution effect. The data point priority and cache data block priority are combined to enable the engine to run efficiently at different time points. The script execution engine optimization model is expressed as: Among them, C s (t') is the complexity of the script at time t', T ex (t') is the execution time of the script, R a (t') is the available resources at time t', R u (t') is the resource utilization rate at time t', e t,j (t) is the execution time of the jth optimization operation at time t, E s (t) is the script execution efficiency, E s (t') is the script execution efficiency at time t', S re (t) is the resource scheduling efficiency, S re (t') is the resource scheduling efficiency at time t', E t (t) is the engine optimization execution time, E t (t') is the engine optimization execution time at time t', O J,o (t) is the optimized engine execution effect, R re (t') is the resource consumption at time t', C o (t') is the optimized computational complexity at time t', ω is the adjustment coefficient of computational complexity, and ψ is the adjustment coefficient of resource consumption.
4. A system using the scripted sequence calculation and back-weaving method of time series data as claimed in any one of claims 1 to 3, characterized in that: It includes connection management module, processing generation module and read-write back module; The connection management module is used to write and execute JS scripts, manage the connection with the time series database through the connection pool, and preload the commonly used time series data into the cache pool; The processing generation module is used to process time series data calculation and logical judgment, generate computing tasks in real time and distribute them to the computing thread pool for parallel processing; The read-write module is used to manage the time series data, read the time series data and write back the time series data, update the system status, and optimize the JS script execution engine.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the time series data scripted sequence calculation and weaving method described in any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the scripted sequence calculation and weaving method for time series data described in any one of claims 1 to 3 are implemented.
Citation Information
Patent Citations
Method for efficiently storing and retrieving time series data
CN113986824A
Time sequence real-time database data storage and processing method and system and electronic equipment
CN114328468A