Real-time calculation method, device, and storage medium
By arranging and processing the trigger events of real-time computing tasks in sequence in the event queue, the problem of computing resource pressure caused by the end of multiple time windows in real-time computing is solved, and the rational allocation of computing resources and more efficient real-time computing processing is realized. .
Patent Information
- Application Number
- PCT/CN2024/093507
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-05-31
- Filing Date
- 2024-05-15
- Publication Date
- 2024-12-05
AI Technical Summary
In the real-time computing field, multiple time windows end at the same time lead to an instantaneous excessive consumption of computing resources, which puts huge pressure on computing resources.
By monitoring whether the time window for real-time calculation requests has reached the end time point, create a task trigger event and add it to the event queue. The task trigger events in the event queue are arranged in the order of addition, read and start the corresponding calculation tasks in the order. This converts concurrent calculations into serialization.
It effectively reduces the instantaneous excessive consumption of computing resources caused by concurrent computing, reduces the pressure on computing resources by real-time computing, and supports larger-scale real-time computing requests.
Smart Images

Figure CN2024093507_05122024_PF_FP_ABST
Abstract
Description
Real-time computing method, device and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on May 31, 2023, with application number 202310641050.7 and application name “A real-time computing method, device and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of data processing technology, and in particular to a real-time computing method, device, and storage medium. Background Art
[0003] Currently, in the field of real-time computing, the computational granularity of real-time computing tasks is often divided into time windows. Therefore, when the time windows of multiple real-time computing tasks end simultaneously, computing resources must be processed in parallel on the relevant data within these time windows. This causes an instantaneous surge in computing resource consumption, placing enormous pressure on computing resources.
[0004] Summary of the Invention
[0005] Various aspects of the present application provide a real-time computing method, device, and storage medium to reduce the pressure that real-time computing brings to computing resources.
[0006] The present invention provides a real-time computing method, including:
[0007] In response to monitoring that a time window corresponding to any real-time computing request reaches an end time point, adding a task trigger event created for the time window to an event queue, wherein the task trigger events in the event queue are arranged in the order of addition;
[0008] Reading task trigger events from the event queue in sequence;
[0009] In response to any task triggering event read from the event queue, a computing task is started for the time window corresponding to the task triggering event.
[0010] An embodiment of the present application further provides a computing device, including a memory, a processor, and a communication component;
[0011] The memory is used to store one or more computer instructions;
[0012] The processor is coupled to the memory and the communication component and is configured to execute the one or more computer instructions for:
[0013] In response to monitoring that a time window corresponding to any real-time computing request reaches an end time point, adding a task trigger event created for the time window to an event queue, wherein the task trigger events in the event queue are arranged in the order of addition;
[0014] Reading task trigger events from the event queue in sequence;
[0015] In response to any task triggering event read from the event queue, a computing task is started for the time window corresponding to the task triggering event.
[0016] An embodiment of the present application also provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the aforementioned real-time computing method.
[0017] In an embodiment of the present application, it is possible to monitor whether the time window corresponding to each real-time computing request has reached the end time point, and in response to monitoring that the time window corresponding to any real-time computing request has reached the end time point, the task trigger event created for the time window is added to the event queue, wherein the task trigger events in the event queue are arranged in the order of addition. In this way, the end time points of the time windows corresponding to each real-time computing request can be converted into sequentially arranged task trigger events, and the task trigger events can be serialized. On this basis, the task trigger events can be read from the event queue in sequence, and the corresponding real-time computing tasks can be triggered and started in response to reading the task trigger events. In this way, the timing of reading the task trigger events from the event queue can be flexibly controlled to flexibly control the start timing of the computing tasks required for each time window. This can effectively improve the problem of instantaneous excessive consumption of computing resources due to concurrent computing, thereby reducing the pressure that real-time computing brings to computing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] FIG1 is a flow chart of a real-time computing method provided by an exemplary embodiment of the present application;
[0020] FIG2 is a logic diagram of a real-time computing method provided by an exemplary embodiment of the present application;
[0021] FIG3 is a schematic diagram of the structure of an event queue provided by an exemplary embodiment of the present application;
[0022] FIG4 is a schematic structural diagram of a computing device provided by another exemplary embodiment of the present application. DETAILED DESCRIPTION
[0023] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the specific embodiments of this application and the corresponding drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0024] Currently, concurrent computing often occurs during real-time computing, leading to instantaneous overconsumption of computing resources and placing significant pressure on computing resources. To this end, in some embodiments of the present application, the time windows corresponding to each real-time computing request can be monitored to determine whether they have reached their end time points. In response to monitoring that the time window corresponding to any real-time computing request has reached its end time point, a task triggering event created for that time window can be added to an event queue, wherein the task triggering events in the event queue are arranged in the order in which they were added. In this way, the end time points of the time windows corresponding to each real-time computing request can be converted into sequentially arranged task triggering events, and the task triggering events can be serialized. Based on this, the task triggering events can be read from the event queue in sequence, and the corresponding real-time computing tasks can be triggered and started in response to the reading of the task triggering events. In this way, by flexibly controlling the timing of reading the task triggering events from the event queue, the startup timing of the computing tasks required for each time window can be flexibly controlled. This can effectively alleviate the problem of instantaneous overconsumption of computing resources caused by concurrent computing, thereby reducing the pressure that real-time computing places on computing resources.
[0025] The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0026] FIG1 is a flow chart of a real-time computing method provided by an exemplary embodiment of the present application. The method may be executed by a data processing device, which may be implemented as software, hardware, or a combination of software and hardware. The data processing device may be integrated into a computing device. Referring to FIG1 , the method may include:
[0027] Step 100: In response to monitoring that a time window corresponding to any real-time computing request reaches an end time point, a task trigger event created for the time window is added to an event queue. The task trigger events in the event queue are arranged in the order of addition.
[0028] Step 101: Read task trigger events from the event queue in order;
[0029] Step 102: In response to any task triggering event read from the event queue, start a computing task for the time window corresponding to the task triggering event.
[0030] The real-time calculation method provided in this embodiment can be applied to various scenarios that require real-time calculation, such as industrial Internet of Things and data application scenarios, log analysis scenarios, or system risk monitoring scenarios. This embodiment does not limit the application scenarios. In different application scenarios, the source or content of the data involved in real-time calculation may be different. For example, in the industrial Internet of Things and data application scenarios, the data involved in real-time calculation may come from Internet of Things devices, that is, devices used to collect data, such as sensors or smart terminals. Accordingly, the content of the data involved in real-time calculation may mainly involve Internet of Things data, such as temperature, wind speed, or pressure. For another example, in the log analysis scenario, the data involved in real-time calculation may come from the device to be analyzed, and the content of the data involved in real-time calculation may be the content in the log file of the device to be analyzed. This embodiment does not limit the source and content of the data involved in real-time calculation.
[0031] Figure 2 is a logical diagram of a real-time computing method provided by an exemplary embodiment of the present application. Referring to Figure 2, the real-time computing method of this embodiment can be implemented via a real-time computing engine deployed in a computing device. The real-time computing method provided by this embodiment can serve as an innovative function within the real-time computing engine. Other functions that can be included in the real-time computing engine are not described in detail here and are not limited by this embodiment.
[0032] Among them, preferably, an edge node can be selected as a computing device for executing the real-time computing method provided in this embodiment. Edge node is a concept in the edge cloud. Edge nodes are usually closer to where the data is generated, so that the data required for calculation can be obtained more efficiently. To complete the real-time calculation on the edge node, it is only necessary to send the calculation results of the real-time calculation to the cloud, which can effectively reduce the amount of data on the cloud and improve the real-time performance of data processing. Of course, in this embodiment, the deployment location of the technical solution provided in this embodiment can be determined according to the actual needs in the application scenario, and this embodiment does not limit the deployment location.
[0033] As the demand for real-time computing continues to grow, the pressure placed on computing devices by real-time computing is also increasing. In particular, when edge nodes are used to handle real-time computing, computing resources on edge nodes are limited and the cost of capacity expansion is relatively high. Therefore, the technical concept of this embodiment is proposed to reduce the pressure placed on computing resources by real-time computing, thereby enabling computing devices to handle more or larger-scale real-time computing requests.
[0034] With reference to FIG1 , in step 100, it is possible to monitor whether the time windows corresponding to the respective accepted real-time computing requests have reached the end time point. The number of accepted real-time computing requests may be multiple. As described in the background art, in this embodiment, time windows can be used to divide the calculation granularity of real-time computing. For example, if the length of the time window is 5 hours, the calculation can be performed periodically with 5 hours as a cycle. In an actual application scenario, the length of the time window of a real-time computing request is 5 hours. If the starting time point is 0 o'clock, the corresponding end time point is 5 o'clock. Accordingly, when 5 o'clock is reached, the calculation of the standby data generated between 0 o'clock and 5 o'clock can be triggered. The next time window will be from 5 o'clock to 10 o'clock, and so on.
[0035] It is worth noting that, in this embodiment, after accepting the real-time computing request, the real-time computing task will not be started immediately as in the traditional solution, but as shown in steps 100-103, the computing task will be started at a specified time.
[0036] Referring to Figure 1, in step 100, in response to monitoring that the time window corresponding to any real-time computing request has reached its end time point, a task trigger event created for the time window can be added to the event queue. In other words, when monitoring that the time window corresponding to a real-time computing request has reached its end time point, the task trigger event created for the real-time computing request can be added to the event queue.
[0037] In this embodiment, a task trigger event can be created for a time window. This task trigger event is used to indicate that the time window has reached its end time, and therefore can serve as a trigger event for initiating a computing task. This embodiment does not limit the timing of creating a task trigger event. An exemplary creation timing may be: creating a task trigger event for the time window when the time window corresponding to the real-time computing request reaches its end time point. In this case, in step 100, in response to monitoring that the time window corresponding to any real-time computing request has reached its end time point, a task trigger event can be created for the time window and added to the event queue. Another exemplary creation timing may be: pre-creating a task trigger event for the time window before the time window corresponding to the real-time computing request reaches its end time point. In this case, since the length of the time window of the real-time computing request and the start time point of the starting time window are known parameters, all time windows required for the duration of the real-time computing request can be pre-calculated based on these known parameters, and a corresponding task trigger event can be pre-created for each time window.
[0038] In this embodiment, after creating a task trigger event, event description information of the task trigger event can be generated, including but not limited to the start time point and end time point of the time window corresponding to the task trigger event, the request identifier or device point identifier of the real-time computing request corresponding to the task trigger event, etc.
[0039] It should be understood that in this embodiment, the task trigger event will not be processed immediately after it is created, but as mentioned in step 100, the task trigger event will be added to the event queue. Specifically, in this embodiment, the event description information corresponding to the task trigger event can be written into the event queue. In actual application, the event queue can be maintained in the memory. In this way, only the relevant event description information needs to be submitted to the memory, and there is no need to submit the event-related data to the memory. This makes the event queue in this embodiment take up very little memory and does not put pressure on the computing device.
[0040] In this embodiment, the task triggering events in the event queue are arranged in the order of addition, that is, the task triggering events are arranged one by one in the event queue. Therefore, based on the event queue, the task triggering events can be serialized.
[0041] FIG3 is a schematic diagram of the structure of an event queue provided by an exemplary embodiment of the present application. Referring to FIG3 , in this embodiment, the number of accepted real-time computing requests can be multiple, and for different real-time computing requests, due to the different lengths and / or starting time points of the time windows, the end time points of the time windows corresponding to different real-time computing requests may not be exactly the same. For example, referring to FIG3 , the end time point corresponding to the time window of real-time computing request a is 6:00, while the end time points corresponding to the time windows of real-time computing requests b, c, and d are all 4:00. In this way, at 4:00, it will be monitored that the time windows of real-time computing requests b, c, and d have all reached their end time points; and at 6:00, it will be monitored that the time window of real-time computing request a has reached its end time point. Based on step 100, in FIG3 , the task trigger events created for real-time computing requests b, c, and d will be added to the event queue before the task trigger event created for real-time computing request a.
[0042] There's a special case where multiple real-time computing requests might have their corresponding time windows ending at the same time. To ensure sequential ordering of task trigger events in the event queue, one exemplary implementation involves adding the task trigger events created for the time windows corresponding to each of the multiple real-time computing requests to the event queue in parallel. Within the event queue, these task trigger events can be arranged randomly, by window size, or by priority. In one practical application of this exemplary implementation, the computing device may allocate a monitoring thread to each accepted real-time computing request, so that each monitoring thread may monitor whether the time window corresponding to the real-time computing request for which it is responsible has reached the end time point. If the time windows corresponding to multiple real-time computing requests reach the end time point at the same time, the monitoring threads corresponding to these real-time computing requests may add the task trigger events corresponding to their respective monitored time windows to the event queue in parallel. The computing device may also allocate a management thread to the event queue, and the management thread may arrange the multiple concurrently written task trigger events in the event queue according to the arrangement method of the aforementioned example, thereby ensuring the serial structure between the task trigger events in the event queue. It should be understood that in this exemplary implementation, the task trigger events corresponding to the multiple time windows that reach the time point at the same time may be regarded as an event group, and the sorting process in the event queue may be understood as sorting within the group, which will not affect the sorting of other task trigger events outside the group.
[0043] Of course, in this embodiment, under this special case, other implementation schemes can also be used to ensure that the task triggering events in the event queue are arranged in sequence. For example, the sorting relationship between the task triggering events created for the time windows corresponding to the multiple real-time computing requests can be determined according to the aforementioned arrangement method, and these task triggering events can be added to the event queue in sequence according to the sorting relationship. In this exemplary implementation scheme, the computing device can only allocate one monitoring thread to monitor the time windows corresponding to all the real-time computing requests that have been undertaken, and the monitoring thread can determine the aforementioned sorting relationship. This embodiment does not limit the implementation method of adding concurrent task triggering events to the event queue. It only needs to ensure that such task triggering events are arranged in sequence in the event queue.
[0044] Continuing with the time windows corresponding to several exemplary real-time computing requests shown in Figure 3, the time windows of real-time computing requests b, c, and d reach their end time points simultaneously. The task triggering events created for these time windows can be randomly arranged in the event queue. The resulting arrangement is shown in Figure 3: task triggering event D - task triggering event C - task triggering event B. Task triggering event D is created within the illustrated time window of real-time computing request d; task triggering event B is created within the illustrated time window of real-time computing request b; and task triggering event C is created within the illustrated time window of real-time computing request c. Of course, these task triggering events can also be arranged by window size. Referring to Figure 3, the time window size of real-time computing request c is the smallest, so task triggering event C can be arranged first, followed by task triggering event B, and then task triggering event C. Of course, this is merely an example, and this embodiment is not limited to this.
[0045] At this point, the task triggering events created for each time window during the real-time calculation can be serialized based on the event queue.
[0046] On this basis, referring to Figure 1, in step 101, task triggering events can be read from the event queue in sequence. By reading the task triggering events, the event description information corresponding to each task triggering event can be obtained, which serves as the basis for subsequent creation of computing tasks.
[0047] Continuing with reference to Figure 1, in step 102, a computing task can be started for the time window corresponding to the task triggering event in response to any task triggering event read from the event queue. That is, in step 101, each time a task triggering event is read, a computing task can be started for the time window corresponding to the task triggering event. By reading in sequence, the serialization mechanism can be inherited from the event queue, so that the time windows that originally required parallel processing can be converted into serialized task triggering events, and then the computing tasks required for the time windows that originally required parallel processing can be serialized. The serialization of computing tasks can effectively reduce the instantaneous occupation of computing resources.
[0048] It is worth noting that the real-time calculation method provided in this embodiment is transparent to the user. The user can still initiate real-time calculation requests in the original way, and the user will not have a significant sense of delay in perceiving the settlement results. Especially for real-time calculation requests with a relatively long time window, the user himself is not particularly sensitive to calculation delays. Therefore, the small delay caused by serialization will not affect the user experience.
[0049] In summary, in this embodiment, it is possible to monitor whether the time window corresponding to each real-time computing request has reached its end time point, and in response to monitoring that the time window corresponding to any real-time computing request has reached its end time point, the task trigger event created for the time window can be added to the event queue, wherein the task trigger events in the event queue are arranged in the order of addition. In this way, the end time points of the time windows corresponding to each real-time computing request can be converted into sequentially arranged task trigger events, and the task trigger events can be serialized. On this basis, the task trigger events can be read from the event queue in sequence, and the corresponding real-time computing tasks can be triggered and started in response to the reading of the task trigger events. In this way, the timing of reading the task trigger events from the event queue can be flexibly controlled to flexibly control the startup timing of the computing tasks required for each time window. This can effectively improve the problem of instantaneous excessive consumption of computing resources caused by concurrent computing, thereby reducing the pressure brought to computing resources by real-time computing.
[0050] In the above or below embodiments, the timing of reading the task triggering event from the event queue on demand can be controlled.
[0051] In an optional implementation, in response to detecting that the execution status of a started computing task satisfies a specified condition, the first task trigger event can be read from the event queue. Here, the started computing task is the computing task started in step 102 in the aforementioned embodiment. The execution status of the computing task may include, but is not limited to, starting execution, executing, and completed.
[0052] In a preferred design, this embodiment proposes that task triggering events can be sequentially read from an event queue using at least one event processing thread. By using a dedicated event processing thread to read task triggering events, the process of adding the task triggering event to the event queue in step 100 of the above embodiment can be separated from the process of reading the task triggering event from the event queue and starting the computing task for the relevant time window based on the task triggering event in steps 101-102. The event queue can be used as a transit medium between the two processes.
[0053] After combining the above-mentioned optional implementation method and the preferred design scheme, in this embodiment, if the number of event processing threads is 1, the event processing process can read the task trigger event from the event queue in sequence, and when the task trigger event is read, start the computing task for the corresponding time window. In this case, the aforementioned specified condition can be that the execution status of the computing task started by the event queue is completed. Based on this, in this embodiment, in response to the execution status of the computing task started by the transaction processing thread being completed, the transaction processing thread can be used to read the task trigger event at the first position from the event queue. That is, after the specified condition is met, the event processing thread continues to read the next task trigger event from the event queue. In this case, the computing tasks corresponding to different time windows will be completely serial.
[0054] After combining the above optional implementation and the preferred design scheme, in this embodiment, if there are multiple event processing threads, multiple time processing processes can read task trigger events from the event queue in parallel. In this case, from the perspective of a single event processing thread, its logic for reading task trigger events from the event queue, starting the corresponding computing task, and executing the computing task is consistent with the logic when the number of event processing threads is one. However, from the perspective of multiple event processing threads as a whole, it can support parallel reading of task trigger events, parallel starting of computing tasks, and parallel execution of computing tasks. In addition, in this case, the aforementioned specified condition can be that the execution status of the computing task started by any transaction processing thread is completed. Based on this, in this embodiment, in response to the execution status of the computing task started by any transaction processing thread being completed, the transaction processing thread can be used to read the task trigger event at the top from the event queue. In this case, since the transaction processing threads are parallel, parallelism may occur between the computing tasks corresponding to different time windows.
[0055] For example, referring to Figure 3, if two event processing threads are assigned to a computing device, event processing thread 1 can read task triggering event D from the event queue and initiate a computing task for that task triggering event D, continuing to execute that computing task. During the same process of event processing thread 1, event processing thread 2 can read task triggering event C from the event queue and initiate a computing task for that task triggering event C, continuing to execute that computing task. In this way, the two computing tasks triggered by task triggering event D and task triggering event D will execute in parallel. Compared to a completely serial approach, this can effectively improve computing task execution efficiency and reduce real-time computing latency.
[0056] Among them, the number of event processing threads used can be determined based on the concurrency of the event processing threads. In one optional solution: the concurrency of the event processing threads can be pre-configured. For example, it can be pre-configured by the administrator based on the computing resource specifications of the computing device. In this case, the concurrency of the event processing threads will remain unchanged after being configured unless a reconfiguration event occurs. In another optional solution: the first specification of the current remaining resources and the second specification of the resources required for the trigger time of unprocessed tasks in the event queue can be determined; the concurrency of the event processing thread is calculated based on the first specification and the second specification. In this optional solution, the processing logic for calculating the concurrency can be executed periodically or according to other triggering timings to dynamically adjust the concurrency. This solution for dynamically adjusting the concurrency can make more reasonable and full use of computing resources.
[0057] It should be understood that, in this embodiment, the above-mentioned event processing thread may also be adjusted to an event processing process or other units for executing calculations, and is not limited to threads.
[0058] Accordingly, a dedicated event processing thread is used to undertake the tasks of sequentially reading task trigger events from the event queue, starting computing tasks for the corresponding time windows, and executing computing tasks. This allows for more flexible scheduling of computing tasks required to be started under each time window after the processing timing of the time window is serialized based on the event queue. This allows for more flexible scheduling of computing tasks based on the technical concept of serializing computing tasks, and by adjusting the concurrency of the event processing thread, to fully utilize the computing resources in the computing device, thereby improving the response rate to real-time computing requests.
[0059] It is worth noting that in this embodiment, other implementation methods can also be used to control the reading timing of on-demand reading of task trigger events from the event queue, for example, periodic reading at specified time intervals, or single reading of a limited number of data trigger events, etc. This embodiment does not limit this.
[0060] In summary, in this embodiment, based on the serialized task trigger events in the event queue, the start timing of the computing tasks required for each time window can be flexibly controlled by controlling the timing of reading the task trigger events from the event queue, thereby flexibly controlling the parallelism between computing tasks and reducing the pressure on computing resources.
[0061] In the above or following embodiments, after a computing task is started for the time window corresponding to the task triggering event, the computing function specified in the computing task can be used to perform computing on the standby data generated within the time window corresponding to the task triggering event and used to participate in the real-time computing request corresponding to the task triggering time, to generate a computing result. The computing function specified in the computing task can be inherited from the real-time computing request to which it corresponds. The computing function in this embodiment can be various aggregation functions or a combination of multiple aggregation functions. The types of aggregate functions supported may include but are not limited to max, min, count, avg, stat_if, stattime, statchange, delta, first_value, last_value, stat_failure_time, etc. For example, the computing function can be: max(a), max(a)+max(b), max(a)+min(b)+avg(c), etc. This embodiment does not limit the type of computing function, and the real-time computing method provided in this embodiment can be generally applicable to various computing functions.
[0062] In an optional implementation, a time series database can be used to store data required for real-time computing. In practical applications, data providers can send the data generated by them to the time series database for storage. The time series database can be connected to the computing device in this embodiment so that the computing device can access the time series database when needed. We will not elaborate on the time series database here. In this embodiment, users can select an appropriate time series database based on their needs, and there are no restrictions on the type or structure of the time series database.
[0063] Typically, data providers and time series databases are deployed in the same cluster or network. This ensures stable data transmission between the two, preventing data loss and ensuring data integrity within the time series database. Compared to traditional real-time computing solutions, computing devices no longer need to obtain data directly from data providers, effectively avoiding data loss caused by unstable networks between the computing devices and data providers. The time series database provides a complete computing foundation for this embodiment, effectively improving the accuracy of real-time computing.
[0064] Furthermore, based on a time series database, this alternative implementation eliminates the need to use memory to cache data for a time window before starting a computation task for that window. Compared to traditional real-time computing solutions, this eliminates the issue of multiple parallel time windows simultaneously occupying memory for data caching, effectively reducing memory pressure.
[0065] Based on a time series database, this optional implementation can read the corresponding standby data from the time series database into memory after starting a computing task, serving as the basis for executing the computing task. This optional implementation also proposes further improvements to this process.
[0066] In the improved solution, if the computation function is supported by a time series database, a query request is initiated to the time series database based on the computation function, so that the time series database can execute query operations on the pending data according to the computation function to generate computation results; and the computation results returned by the time series database are received. The time series database has the ability to respond to query requests. Thus, by initiating a query request to the time series database, the time series database can complete the relevant computation work and provide computation results. In this improved solution, there is no need to read data from the time series database into memory for caching. Instead, computations are performed directly in the time series database, further reducing the memory resource usage of the computing device. In other words, for real-time computation requests whose indicated computation functions are supported by the time series database, based on this improved solution, almost no memory resources are required to respond to these real-time computation requests.
[0067] In this improved solution, if the calculation function specified in the computation task is not supported by the time series database, the standby data is read from the time series database; a window buffer is allocated in memory for the time window corresponding to the task triggering event to store the standby data; the standby data in the window buffer is calculated according to the calculation function to generate a calculation result; and the window buffer is released. That is, for real-time computation requests whose specified calculation function is not supported by the time series database, based on this improved solution, memory is only occupied after the relevant computation task is started. Moreover, the memory occupation is very short and is released immediately after the computation task is completed, eliminating the need for long-term occupation as in traditional solutions. Furthermore, in this case, if an error occurs while reading the standby data from the time series database, the operation of reading the standby data from the time series database can be re-executed. This ensures that the computing device can obtain complete and correct standby data, thereby ensuring the accuracy of real-time computations.
[0068] It should be noted that in some of the processes described in the above embodiments and the accompanying drawings, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or may be executed in parallel. The sequence numbers of the operations, such as 101, 102, etc., are only used to distinguish between different operations, and the sequence numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that descriptions such as "first" and "second" in this article are used to distinguish different specifications, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to be different types.
[0069] FIG4 is a schematic diagram of a computing device according to another exemplary embodiment of the present application. As shown in FIG4 , the computing device includes a memory 40 , a processor 41 , and a communication component 42 .
[0070] The processor 41 is coupled to the memory 40 and is configured to execute the computer program in the memory 40 to:
[0071] In response to monitoring that a time window corresponding to any real-time computing request reaches an end time point, adding a task trigger event created for the time window to an event queue, wherein the task trigger events in the event queue are arranged in the order of addition;
[0072] Reading task trigger events from the event queue in sequence;
[0073] In response to any task triggering event read from the event queue, a computing task is started for the time window corresponding to the task triggering event.
[0074] In an optional embodiment, when the processor 41 sequentially reads the task triggering events from the event queue, it may be specifically configured to:
[0075] In response to monitoring that the execution status of the started computing task meets a specified condition, a task triggering event at the top of the event queue is read from the event queue.
[0076] In an optional embodiment, in response to monitoring that the execution status of the started computing task satisfies a specified condition, the processor 41 reads the first task triggering event from the event queue, and specifically may be used to:
[0077] In response to the execution status of the computing task started by any transaction processing thread being completed, reading the task triggering event at the top from the event queue by the transaction processing thread;
[0078] Among them, a single transaction processing thread is used to start and execute the computing task for the time window corresponding to the task triggering event it reads.
[0079] In an optional embodiment, if there are multiple event processing threads, the processor 41 may also be configured to:
[0080] Pre-configure the concurrency of the event processing thread; or,
[0081] Determine a first specification of currently remaining resources and a second specification of resources required for triggering time of unprocessed tasks in the event queue; and calculate the concurrency of the event processing thread based on the first specification and the second specification.
[0082] In an optional embodiment, when the processor 41 adds the task triggering event created for the time window to the event queue, it is specifically configured to:
[0083] If the time windows corresponding to multiple real-time computing requests reach the end time point at the same time, the task triggering events created for the time windows corresponding to the multiple real-time computing requests are added to the event queue in parallel;
[0084] Wherein, in the event queue, the task triggering events created for the time windows corresponding to the multiple real-time computing requests are arranged in a random arrangement, an arrangement according to the window size, or an arrangement according to the priority.
[0085] In an optional embodiment, the processor 41 may also be configured to:
[0086] When the time window corresponding to the real-time computing request reaches an end time point, a task triggering event is created for the time window; or,
[0087] Before a time window corresponding to the real-time computing request reaches an end time point, a task triggering event is pre-created for the time window.
[0088] In an optional embodiment, after starting the computing task for the time window corresponding to the task triggering event, the processor 41 may further be configured to:
[0089] According to the calculation function specified in the calculation task, calculation is performed on the standby data generated within the time window corresponding to the task triggering event and used to participate in the real-time calculation request corresponding to the task triggering time to generate a calculation result.
[0090] In an optional embodiment, when the processor 41 performs calculations on the standby data generated within the time window corresponding to the task triggering event and used to participate in the real-time computing request corresponding to the task triggering time according to the calculation function specified in the calculation task to generate a calculation result, it can specifically be used to:
[0091] If the calculation function is a function supported by the time series database, a query request is initiated to the time series database based on the calculation function, so as to use the time series database to perform a query operation on the unused data according to the calculation function to generate a calculation result;
[0092] Receiving the calculation results returned by the time series database;
[0093] The time series database is used to store the standby data.
[0094] In an optional embodiment, the processor 41 may also be configured to:
[0095] If the calculation function specified in the calculation task is not a function supported by the time series database, reading the standby data from the time series database;
[0096] A time window corresponding to the task triggering event occupies a window buffer in the memory for storing the standby data;
[0097] Calculating the unused data in the window buffer area according to the calculation function to generate a calculation result;
[0098] Release the window buffer area.
[0099] In an optional embodiment, the processor 41 may also be configured to:
[0100] If an error occurs in the process of reading the standby data from the time series database, the operation of reading the standby data from the time series database is re-executed.
[0101] In an optional embodiment, when the processor 41 adds the task triggering event created for the time window to the event queue, it may be specifically configured to:
[0102] Writing the event description information corresponding to the task triggering event into the event queue;
[0103] The event description information includes one or more of the start time point and end time point of the time window corresponding to the task triggering event, the request identifier of the real-time computing request corresponding to the task triggering event, and the device point identifier.
[0104] Furthermore, as shown in Figure 4 , the computing device further includes other components such as a power supply component 43. Figure 4 only schematically illustrates some components, which does not mean that the computing device only includes the components shown in Figure 4 .
[0105] It is worth noting that the technical details in the above-mentioned embodiments of the computing device can refer to the relevant description of the second type of application end in the aforementioned system embodiment. In order to save space, they will not be repeated here, but this should not cause any loss of the scope of protection of this application.
[0106] Accordingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program, which, when executed, can implement the steps that can be executed by a computing device in the above method embodiment.
[0107] The memory in Figure 4 is used to store computer programs and can be configured to store various other data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, images, videos, etc. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0108] The communication component in Figure 4 above is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G / LTE, 5G and other mobile communication networks, or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0109] The power supply assembly in Figure 4 provides power to various components of the device in which the power supply assembly is located. The power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply assembly is located.
[0110] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can 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 can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0111] The present application is described with reference to the flow chart and / or block diagram of the method, device (system), and computer program product according to the embodiment of the present application. It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized 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 processing machine 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 produce a device for realizing the function specified in one flow chart flow or multiple flows and / or one box or multiple boxes of the block diagram.
[0112] These computer program instructions may also be stored in a computer-readable memory that can direct 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 a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0113] 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, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0114] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0115] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0116] The foregoing is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A real-time computing method, comprising: In response to monitoring that a time window corresponding to any real-time computing request reaches an end time point, adding a task trigger event created for the time window to an event queue, wherein the task trigger events in the event queue are arranged in the order of addition; Reading task triggering events from the event queue in order; In response to any task triggering event read from the event queue, a computing task is started for the time window corresponding to the task triggering event.
2. The method according to claim 1, wherein the sequentially reading task triggering events from the event queue comprises: In response to monitoring that the execution status of the started computing task meets the specified condition, the task triggering event at the first position in the event queue is read.
3. The method according to claim 1, wherein in response to monitoring that the execution status of the started computing task satisfies a specified condition, reading the first task triggering event from the event queue comprises: In response to the execution status of the computing task started by any transaction processing thread being completed, using the transaction processing thread to read the first task triggering event from the event queue; Among them, a single transaction processing thread is used to start and execute the computing task for the time window corresponding to the task triggering event it reads.
4. The method according to claim 3, if there are multiple event processing threads, the method further comprises: Pre-configure the concurrency of event processing threads; or, Determine a first specification of currently remaining resources and a second specification of resources required for triggering time of unprocessed tasks in the event queue; and calculate the concurrency of the event processing thread according to the first specification and the second specification.
5. The method according to claim 1, wherein adding the task triggering event created for the time window to an event queue comprises: If there are multiple time windows corresponding to real-time computing requests that reach the end time point at the same time, the task triggering events created for the time windows corresponding to the multiple real-time computing requests are added to the event queue in parallel; Wherein, in the event queue, the arrangement of the task triggering events created for the time windows corresponding to the multiple real-time computing requests is random arrangement, arrangement by window size or arrangement by priority.
6. The method according to claim 1, further comprising: When the time window corresponding to the real-time computing request reaches an end time point, creating a task trigger event for the time window; or, Before the time window corresponding to the real-time computing request reaches an end time point, a task triggering event is pre-created for the time window.
7. The method according to claim 1, after starting the computing task for the time window corresponding to the task triggering event, the method further comprises: According to the calculation function specified in the calculation task, calculation is performed on the standby data generated within the time window corresponding to the task triggering event and used to participate in the real-time calculation request corresponding to the task triggering time to generate a calculation result.
8. The method according to claim 7, performing calculations on the standby data generated within the time window corresponding to the task triggering event and used to participate in the real-time computing request corresponding to the task triggering time according to the calculation function specified in the calculation task to generate a calculation result, comprising: If the calculation function is a function supported by the time series database, a query request is initiated to the time series database based on the calculation function, so as to use the time series database to perform a query operation on the stand-by data according to the calculation function to generate a calculation result; Receiving the calculation result returned by the time series database; Wherein, the time series database is used to store the standby data.
9. The method according to claim 8, further comprising: If the calculation function specified in the calculation task is not a function supported by the time series database, reading the standby data from the time series database; A time window corresponding to the task triggering event occupies a window buffer in the memory for storing the standby data; Calculating the unused data in the window buffer area according to the calculation function to generate a calculation result; Release the window buffer.
10. The method according to claim 9, further comprising: If an error occurs in the process of reading the standby data from the time series database, the operation of reading the standby data from the time series database is re-executed.
11. The method according to claim 1, wherein adding the task triggering event created for the time window to an event queue comprises: Writing the event description information corresponding to the task triggering event into the event queue; The event description information includes one or more of the start time point and end time point of the time window corresponding to the task triggering event, the request identifier of the real-time computing request corresponding to the task triggering event, and the device point identifier.
12. A computing device comprising a memory, a processor, and a communication component; The memory is used to store one or more computer instructions; The processor is coupled to the memory and the communication component, and is configured to execute the one or more computer instructions for executing the real-time computing method according to any one of claims 1 to 11.
13. A computer-readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to execute the real-time computing method according to any one of claims 1 to 11.
Citation Information
Patent Citations
Server application designing method, request event processing method and device
CN107818016A
Message sending method, device and system
CN108521382A
Discrete event parallel processing method, terminal equipment and storage medium
CN115686789A
Real-time calculation method and device and storage medium
CN116841765A
Window minimization trigger
US20090183107A1
