Dynamic adjustment method for event sequence records
By adopting dynamic adjustment methods of event sequence recording in the SOE system, including intelligent event recording and spatial dynamic adjustment, the event record loss problem caused by jitter or avalanche is solved, and the security and stability of the system are improved.
Patent Information
- Application Number
- CN202411967927.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-13
AI Technical Summary
The prior art is difficult to effectively solve the problem of SOE event records being lost in jitter or avalanche, resulting in low system security and stability.
Dynamic adjustment methods for event sequence recording are adopted, including initializing event sequence record queues, allocating queues according to the number of system modules, intelligent event records, spatial dynamic adjustments and intelligent discarding strategies to deal with event record loss caused by jitter or avalanche.
Through dynamic adjustment and intelligent discarding strategies, we can effectively prevent event recording loss, improve system security and stability, and can deal with high loads and emergencies, ensuring the record integrity of critical events.
Smart Images

Figure CN119988130A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic digital data processing, and in particular to a method for recording, storing and reading events. Background Art
[0002] Event queue is one of the key technologies to realize SOE function. The design and management of event queue directly affect the real-time, reliability and resource utilization of SOE system. SOE event queue arranges events in the order of occurrence to ensure the order consistency during processing and avoid data loss caused by too high event triggering frequency. SOE event queue is usually implemented as a ring queue method, using a fixed-size storage space and using read-write pointers to realize circular storage. When the queue is full, it will start to overwrite from the oldest record. When the hardware signal is unstable or the algorithm is complex, the switch input of SOE may jitter, resulting in a large number of false alarm SOE event records, resulting in the loss of SOE event records; when a module in the system fails, an avalanche phenomenon may occur, and the module frequently records SOE, overwriting the unread SOE event records of other modules. The memory of embedded devices is usually limited, and the size of the ring queue is fixed. Under normal circumstances, the capacity of the SOE queue is sufficient, but when jitter or avalanche occurs in the system, a large number of event records will be lost, affecting the security and stability of the system.
[0003] For example, the Chinese patent with publication number CN117348797A discloses a method for storing and reading SOE event records, and provides the following technical solutions. The present invention discloses a method for storing and reading SOE event records, which overcomes the problems of low efficiency in reading SOE event records and the risk of under-reading records in the prior art, including the steps of: the SOE card records the SOE events generated by the channel input changes, stores and maintains the SOE records, and clarifies its own SOE information; the controller reads the SOE records of the corresponding SOE card and maintains the read SOE records of the corresponding SOE card, and clarifies the read SOE information: reads the SOE storage queue management information of the SOE card, combines the previous maintenance information of the SOE card, determines the offset and quantity of the subsequent SOE records to be read, and reads the SOE record information of the SOE card. It can efficiently store and read SOE records, effectively prevent packet loss, and effectively prevent multiple readings and repeated reading of past records. However, the above-mentioned method for storing and reading SOE event records cannot solve the problem of SOE event record loss caused by jitter or avalanche, resulting in the loss of a large number of event records, affecting the security and stability of the system. Summary of the invention
[0004] The present invention solves the problems of poor security, low stability and loss of SOE event records caused by jitter or avalanche that are difficult to solve in the prior art, and proposes a dynamic adjustment method for event sequence records, which achieves the purpose of not causing a large number of event losses, being able to cope with high loads, having good safety performance and strong stability.
[0005] To achieve the above object, the present invention adopts the following technical solution: A method for dynamically adjusting event sequence records comprises the following steps: S1: Initialize the event sequence record queue and set the priority of the event; S2: Allocate an event record queue for each module according to the number and type of modules in the system; S3: Recording events according to the state of the event sequence record queue, when the queue is full or the event sequence record array reaches the maximum value stage, overwriting the event record of the first module; S4: When a significant increase in the frequency of a single module event is detected, a dynamic space adjustment algorithm is used to adjust the event sequence recording space; when an abnormal frequency of multiple module events is detected, intelligent discarding is performed dynamically based on the remaining space in the queue.
[0006] The benefit of this design is that it comprehensively improves the system's event management capabilities through initialization, dynamic queue allocation, intelligent event recording, space adjustment, and discard strategies, ensuring that events can be recorded and managed efficiently and accurately in various complex scenarios, preventing and reducing system losses caused by jitter or avalanche.
[0007] Preferably, in step S3, when the event record queue is not full and the module event record queue has not reached the maximum value stage, events are recorded in the order in which system events occur, and the module event record array is maintained, specifically, events are recorded in the order in which they are sent and the write pointer is maintained, and the address of the event in the event record queue is stored in the corresponding module event record queue.
[0008] Preferably, in step S3, when the event record queue is full or the event record array reaches the maximum value stage, the event record of the first module is overwritten, specifically including: when a new event occurs, searching the corresponding event record array, selecting the event record in the event record queue that has been allocated to the nearest node to overwrite, and adding 1 to the circle count, and monitoring that the frequency of occurrence of events in a single module has increased significantly to enter step S4.
[0009] The advantage of this design is that it avoids record loss through the overwriting strategy when the queue is full, ensures that new events are not missed when old events are overwritten through circle counting, optimizes memory usage, and can respond to changes in module event frequency in a timely manner.
[0010] Preferably, in step S4, when the frequency of occurrence of a single module event is detected to be significantly increased, a space dynamic adjustment algorithm is used to adjust the event queue space, which specifically includes the following steps: S4.11: When a significant increase in the frequency of events in a single module is detected, the queue pressure of each module is calculated; S4.12: Calculate the adjustment priority weight of each module according to the queue pressure and priority of each module, and determine the module that needs to increase or decrease the queue space; S4.13: According to the module adjustment priority, calculate the new queue requirements of the module that needs to add queues and the queue space of the module that needs to release queues; S4.14: Check whether there is a risk of data loss. If so, keep the unread event protection area and return to step S4.11. If not, update the module allocation.
[0011] The advantage of this design is that real-time monitoring of module event frequency and calculation of queue pressure can effectively prevent queue overflow, provide data support for dynamic adjustment of queue space, and improve the system's responsiveness.
[0012] Preferably, in step S4, when the frequency of occurrence of multi-module events is detected to be abnormal, intelligent discarding is performed dynamically according to the remaining space of the queue, specifically comprising the following steps: S4.21: When it is detected that the frequency of events in each module is abnormal, the repetitive events are discarded. After a period of time, if there is no abnormality, return to step S3. If there is still an abnormality, go to step S4.22; S4.22: When it is detected that the remaining space in the queue is close to the safety threshold, all timed-out low-priority events are deleted, timed-out medium-priority events are selectively discarded, and timed-out but high-priority events are transferred to the priority queue; S4.23: When it is detected that the remaining space in the queue is lower than the safety threshold, events are gradually discarded according to priority.
[0013] The advantage of this design is that by discarding duplicate events, the system burden can be reduced, meaningless records can be avoided from wasting space, system processing efficiency can be improved, and a priority judgment discarding strategy can be added to reduce the possibility of jitter or avalanche.
[0014] Preferably, the step S3 further includes regularly monitoring the event occurrence frequency and queue usage rate of each module, monitoring the remaining space of the queue in real time, and recording the queue entry time of each event.
[0015] The advantage of this design is that when the system space approaches its limit, it can prioritize important events and discard low-priority events, ensuring that key events are not lost and improving the intelligence of event processing and priority management capabilities.
[0016] Preferably, in step S1, it will be divided into a first module, a second module and a third module, the first module serves as an IO module to record a large number of high-priority events, the second module serves as a control module, and the third module serves as a redundant module, and the queue size of the first module is larger than the queue sizes of the second module and the third module.
[0017] Preferably, in step S1, the initialization event record queue includes a storage queue, a write pointer and a turn count, and sets a priority for a corresponding event according to event characteristics.
[0018] Preferably, in step S4.21, discarding repetitive events specifically includes discarding the repetitive event record if the new event record is the same as the unread event record.
[0019] Preferably, in step S4.11 and step S4.12, the specific method of calculating the current module queue pressure is as follows: the module queue pressure and the queue size currently allocated to the module are equal to the number of new uploaded events of the module in the current time slice plus the number of events that have not been read by the module; The specific method of adjusting the priority weight of each module is as follows: the adjustment priority weight of each module is the product of the weight coefficient α and the current module queue pressure plus the product of the weight coefficient β and the module priority. The higher the priority value of the module, the higher the priority.
[0020] The advantage of this design is that accurate calculation of module queue pressure and priority weight can achieve more intelligent dynamic adjustment, ensuring that the system can still run stably under high load conditions and giving priority to event recording of important modules.
[0021] Compared with the prior art, the invention has the following beneficial effects.
[0022] 1. The present invention can effectively prevent the event record screen-swiping phenomenon caused by signal jitter through intelligent event queue management and dynamic adjustment. When it is detected that the event occurrence frequency of each module is abnormal, especially when the signal is jittered or short-term events are frequently triggered, the system will reduce invalid records by discarding duplicate events to avoid affecting normal event processing due to duplicate events occupying queue space. This approach not only reduces the system burden, but also effectively improves the efficiency of event processing, prevents the repeated recording of a large number of irrelevant events, and ensures that important events can be queued in time and accurately recorded. In this way, the system can cope with frequent signal changes in complex environments and ensure efficient and stable operation.
[0023] 2. In the case of high load or sudden large-scale events, the avalanche effect may cause a large number of event records to be lost, affecting the security and stability of the system. The present invention effectively copes with system overload by introducing dynamic adjustment algorithms and intelligent discard strategies in queue management. When the system detects that the queue space is close to the safety threshold, the system will give priority to discarding low-priority events and transfer high-priority events to the priority queue to ensure that critical events are not lost. In extreme cases, if the queue capacity is completely occupied, the system will replace old events in an orderly manner through an overwriting strategy to avoid data loss. When faced with a large number of sudden events, the present invention can minimize the risk of event loss caused by the avalanche effect through intelligent discarding and priority management.
[0024] 3. The present invention significantly improves the reliability and stability of the system by optimizing the management, real-time monitoring, dynamic adjustment of space and intelligent discarding strategy of the event queue. By continuously monitoring the frequency of module events, queue utilization and remaining space, the queue space can be intelligently adjusted or unnecessary low-priority events can be discarded when frequent events or high loads occur. Through this efficient resource management, it is ensured that data loss or system crashes will not occur due to insufficient resources or frequent emergencies. At the same time, the priority management and dynamic adjustment strategies enable the system to remain flexible in complex environments, ensuring the timely processing and recording of important events, thereby greatly improving the overall stability and reliability of the system in safety instruments.
[0025] 4. The present invention uses an overwriting strategy to overwrite all event records caused by avalanches or jitters to the first module when the event record queue is full. This design helps to quickly locate the root cause of the problem when emergencies such as system abnormalities, avalanches or jitters occur. By centrally recording these events in the first module queue with a higher priority, maintenance personnel can quickly identify and trace the specific time, frequency and related modules of the event, and then accurately determine the cause of the system abnormality. This not only improves the efficiency of troubleshooting, but also provides an important basis for subsequent system optimization and maintenance, ensuring that the system can be quickly restored and downtime reduced after a problem occurs. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 The present invention is an overall flow chart of a method for dynamically adjusting event sequence records.
[0027] Figure 2 This is a specific flow chart of S3-S5 of a method for dynamically adjusting event sequence records of the present invention. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical scheme and advantages of the present disclosure clearer, the following will further describe the embodiments of the present disclosure in detail with reference to the accompanying drawings. The proportions of the components are not drawn according to the actual proportions, and the proportions and sizes shown in the accompanying drawings should not limit the substantial technical scheme of the present invention. These embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described.
[0029] See also Figure 1-2 As shown, a method for dynamically adjusting event sequence records includes the following steps: S1: Initialize the event sequence record queue and set the priority of the event; S2: Allocate an event record queue for each module according to the number and type of modules in the system; S3: Recording events according to the state of the event sequence record queue, when the queue is full or the event sequence record array reaches the maximum value stage, overwriting the event record of the first module; S4: When a significant increase in the frequency of a single module event is detected, a dynamic space adjustment algorithm is used to adjust the event sequence recording space; when an abnormal frequency of multiple module events is detected, intelligent discarding is performed dynamically based on the remaining space in the queue.
[0030] It should be noted that SOE (Sequence of Events) is a function commonly used in industrial automation and process control systems. It is mainly used to accurately record the time of events within the system to facilitate fault analysis, system diagnosis and historical backtracking.
[0031] like Figure 1 In one embodiment shown, Figure 1 This is an overall flow chart of a method for dynamically adjusting event sequence records of the present invention. The present invention solves the problems of low storage efficiency and high risk of data loss in traditional methods through a series of optimization designs. First, in the system initialization stage, the event record queue is set and initialized. By creating a storage queue, a write pointer and a circle count, a basic data storage structure is established. At the same time, the priority is set according to the characteristics of the event to provide a basis for subsequent event processing. The design of this stage ensures that the starting point of the entire system recording events is clear and the logic is clear, which not only lays a framework foundation for event management, but also uses the priority mechanism to make subsequent processing more orderly, thereby avoiding key events from being ignored due to insufficient space.
[0032] Next, an event record queue is allocated to each module based on the number and type of modules in the system. The system divides modules into different categories, such as IO modules, control modules, and redundant modules. Among them, the IO module needs to record a large number of events and has a higher priority, so the allocated queue size will be relatively large, while the queue resources of the control module and redundant module are relatively small. This allocation method optimizes the utilization of storage resources according to actual needs, taking into account the priority of key modules and the storage requirements of other modules, thereby greatly improving the resource management efficiency of the system. This design not only maximizes the use of limited storage space, but also provides flexibility for subsequent dynamic adjustments.
[0033] During the event recording process, the system dynamically processes according to the status of the event recording queue. When the event recording queue is not full and the module event recording queue has not reached the maximum value, the system records the events in the order in which they occur. Each event is written to the queue in order, and the write pointer is maintained. At the same time, the address of the event in the event recording queue is stored in the corresponding module event recording queue. This process ensures the timing consistency of event recording, which helps with subsequent diagnosis and analysis. In addition, the system regularly monitors the event occurrence frequency, queue utilization, and remaining queue space of each module, and records the time of each event entering the queue to ensure that the system can control the queue status in real time. This real-time monitoring mechanism provides transparency in event management during smooth operation, and can capture problems and take measures in time in abnormal situations, thereby significantly improving the stability of the system.
[0034] When the event record queue is full or the module event record array reaches the maximum value, it is determined that jitter occurs, and the system adopts an overwrite strategy to handle new events. At this time, after a new event occurs, the system will search the event record array of the corresponding module, select the nearest node in the queue that has been assigned to the module for overwriting, and increase the circle count by 1. Through this design, the system can efficiently record more events within a limited storage space. During this process, if the frequency of events in a single module is significantly increased, the system will enter a dynamic adjustment phase to deal with possible imbalances in resource allocation.
[0035] When jitter occurs, that is, when the frequency of events in a single module increases significantly, the system uses a dynamic space adjustment algorithm to reallocate the space of the event queue. Specifically, the system calculates the queue pressure of each module, and dynamically adjusts the queue space of each module by evaluating the module's priority weight and current resource usage. For example, for modules with high-frequency events, its queue space can be increased, while for modules with fewer events, some space is released to balance resource allocation. This dynamic adjustment mechanism can not only cope with sudden high-load scenarios, but also avoids the problem of loss of event records of other modules due to frequent event uploads by a single module, thereby improving the flexibility and reliability of the entire system.
[0036] When the frequency of multi-module events is abnormal, the system will intelligently discard them according to the remaining space in the queue to ensure the recording of key events. First, the system will detect and discard repetitive events to reduce the storage of redundant data. If the abnormal situation persists and the remaining space in the queue is close to the safety threshold, the system will delete all timed low-priority events and selectively discard some timed medium-priority events. Timed but high-priority events will be transferred to the priority queue for protection. When the situation deteriorates further and the remaining space in the queue is lower than the safety threshold, the system will gradually discard events according to event priority to maximize the retention of key data. This intelligent discard strategy realizes dynamic optimization of resources through comprehensive judgment of priority and queue status, which not only improves the stability of the system, but also ensures the integrity of key events.
[0037] A dynamic adjustment method for event sequence recording designed by the present invention optimizes the efficiency and reliability of event recording through a series of designs such as initialization queue, priority setting, dynamic adjustment and intelligent discarding. First, the setting of priorities and the allocation of modular queues make resource allocation more reasonable and meet the high-frequency recording requirements of key modules. Secondly, through real-time monitoring and circle counting mechanisms, it is ensured that the system can operate efficiently under normal and abnormal conditions. Not only that, the dynamic adjustment algorithm and intelligent discarding strategy enable the system to flexibly respond to sudden high-load scenarios, avoiding the risk of global failure caused by event avalanche or overload in traditional methods. These designs not only greatly improve the utilization of system resources, but also enhance the reliability and stability of the system.
[0038] In one embodiment, in the system initialization stage, the SOE event record queue is first initialized, including a storage queue, a write pointer, and a turn count; and according to the number and type of modules in the system, an event record queue is allocated to each module. In this embodiment, the size of the SOE event record queue is N, and there are three modules a, b, and c in the system. According to the module type and priority, the module event record queues A, B, and C are respectively allocated to the three modules. Assuming that module a is an IO module, a large number of events need to be recorded and the priority is high, the size of queue A is set to be larger than the size of queues B and C, and the total size of the three module event record queues is equal to N. When the SOE event record queue is not full and the module event record queue has not reached the maximum value stage, the event is recorded in the order of occurrence of the system event and the module event record array is maintained. When there is an SOE event record sent up, the event is recorded in the order of sending up and the write pointer is maintained, and the address of the event in the SOE event record queue is stored in the corresponding module event record queue.
[0039] When the SOE event record queue is full or the IO event record array reaches the maximum value, a new event occurs, and the corresponding IO event record array is searched. The nearest node in the SOE event record queue that has been assigned to the current IO is first selected, the event record is overwritten, and the circle count is increased by 1. At this time, the system detects that the frequency of events in module A has increased significantly, and adjusts the event queue space to allocate the event record space of module B with the address [x+6] and module C with the address [x+7] of the event record to module A. At this time, module A has jittered and sent 4 SOE events. If the 4 events are recorded in sequence, the unread event record of module B with the address 1 will be lost.
[0040] According to the event queue design proposed by the present invention, module A jitters and sends 4 SOE events. At this time, according to the module A event record queue, the 4 most recent SOE event record nodes assigned to module A are found, and the SOE event is recorded. The circle count is +1, and then the event record space is dynamically adjusted. The system detects that the module event frequency is abnormal and discards the repeated event records. The system monitors the frequency of events in each module in real time and finds that the frequency of events in module A is abnormally increased. The repeated event discarding strategy is activated, and the event queue space is adjusted to allocate the event record space of module B with the address [x+6] and module C with the address [x+7] of the read event record to module A. At the same time, the relationship between the new event record and the unread event record of module A in the event record is monitored in real time. If the new event record is the same as the unread event record, the repeated event record is discarded.
[0041] Obviously, the event queue design proposed by the present invention can avoid the massive loss of event records of other modules. In the case of an avalanche, especially when the event records generated by the avalanche far exceed the capacity of the SOE event record queue, the advantages are more prominent. After the avalanche event occurs, the traditional design causes all unread event records of modules B and C to be overwritten; the event queue design proposed by the present invention solves this problem and retains the key event records of the system operation as much as possible, which is convenient for the backup alarm. When the event record queue is full, the overwriting strategy is adopted to concentrate the events caused by system abnormalities, avalanches or jitters on the event record queue of the first module, which can realize the accurate recording of the time, frequency and related modules of the event occurrence, and provide clear data support for the tracing of system abnormalities. The implementation of the overwriting strategy ensures the integrity of the system's event records and data availability under emergencies, thereby providing a basic data basis for system fault analysis, abnormality location and maintenance processing.
[0042] After entering the software reading event record stage, if the turn count has not increased, the SOE event records are read in sequence. The software only reads the SOE event records from address 1 to address 4. If the turn count increases, all SOE event records are read and the read event records are removed according to the timestamp. When four event records are sent to module A, if the turn count is not increased, the software will only read the SOE events from address 1 to address 4, omitting the unread SOE events from address 5 to address x+5. After the turn count is increased, the software reads the entire queue once. In order to distinguish between read events and unread events, the software records the last event record read. The structure of the SOE event record contains the timestamp of the event occurrence. When the software reads all event records, the timestamp TickLast of the last event record read is compared with the timestamp TickNow of the event record currently being read. If TickLast>TickNow, it means that this event record has been read and can be removed.
[0043] like Figure 2 In one embodiment shown, Figure 2 The present invention is a specific flow chart of S3-S5 of a dynamic adjustment method for recording an event sequence. In an event sequence recording method designed by the present invention, in order to cope with the complex situation that the frequency of occurrence of a single module event is significantly increased or the frequency of occurrence of multiple module events is abnormal, an optimization strategy based on dynamic adjustment and intelligent discarding is proposed. First, when it is detected that the frequency of occurrence of a single module event is significantly increased, the system will evaluate the current resource allocation status by calculating the queue pressure of each module. On this basis, the queue pressure and priority of each module are comprehensively considered, and the adjustment priority weight of each module is calculated to determine the module that needs to increase the queue space and the module that needs to reduce the queue space. Next, the system calculates the specific additional requirements of each module that needs to add a queue based on the adjustment priority, and clarifies the modules that need to release the queue space and the amount of release. In order to ensure the integrity of the data, the system will further detect whether there is a risk of event loss. If a risk is detected, the protection area of the unread event will be retained, and the calculation of the queue pressure will be restarted; if there is no risk, the allocation of the module queue will be directly updated. This dynamic adjustment mechanism effectively ensures that key modules can obtain greater resource support when resources are limited, thereby ensuring the complete recording of important events.
[0044] For the abnormal frequency of events in multiple modules, the system uses an intelligent discard strategy for optimization. When an abnormal event frequency is detected, repeated events are first screened. If it is found that the newly recorded event is the same as the unread event, the repeated event is directly discarded to save storage space and reduce resource usage. After a period of monitoring, if the abnormal situation disappears, the system returns to the step of recording events in normal order; but if the abnormality still exists, it enters a further optimization process. At this time, when the system detects that the remaining space in the queue is close to the safety threshold, it will give priority to deleting all timed low-priority events, and at the same time, for the timed medium-priority events, select the necessary part to discard, and protect the timed but high-priority events and transfer them to the priority queue to ensure that they will not be overwritten. When the remaining space in the queue further decreases and falls below the safety threshold, the system will gradually discard events according to the priority of the event, and release space in batches from low priority to high priority to avoid the complete exhaustion of system resources due to overload.
[0045] This optimized design combining dynamic adjustment and intelligent discard can effectively deal with the high-frequency upload and resource competition problems of sudden events. On the one hand, through the dynamic adjustment mechanism, the system can reasonably allocate queue space when resources are unevenly allocated, making resource allocation more flexible. On the other hand, the intelligent discard strategy ensures the priority of data storage and the integrity of key events when resources are insufficient, and at the same time, by discarding redundant or low-priority events, it leaves the necessary operating space for the system. The two complement each other, not only improving the stability and reliability of the system under abnormal conditions, but also ensuring the accuracy and importance of event records, providing reliable data support for subsequent analysis, maintenance and optimization of the system.
[0046] In one embodiment, the calculation formula for calculating the current module queue pressure is as follows: Among them, R i Refers to the number of new uploaded events of module i in the current time slice; U i refers to the number of events that module i has not been read; S i Refers to the queue size currently allocated by module i.
[0047] The calculation formula for calculating the adjustment priority weight of each module is as follows: T i =α×W i +β×P i ; Among them, α and β are weight coefficients, which are used to balance the influence of pressure value and module priority; P iRefers to the priority of the module. The higher the value, the higher the priority.
[0048] After that, adjust the priority according to the module and calculate the new queue requirement of Module A: In this embodiment, the target module is A, and the size of the newly added queue space is ΔS A The specific calculation formula is: ΔS A = k * (R A + U A - S A ); Where k is the adjustment coefficient, and the value range is 0 < k ≤ 1. The specific value can be dynamically set according to the system load condition.
[0049] Then release the queue spaces of Modules B and C: Recover the excess queue space from the low-priority modules (such as B and C). The space release amount of Module j is ΔS j The specific calculation formula is: ΔS j = min(S j – U j , ΔS A ); If S j – U j ≤ 0, it means that the current space of Module j is not enough to be released, so skip this module.
[0050] Then update the module allocation: Reallocate the recovered address to the target module A: S A ’ = S A + ∑ΔS j ; After the update, ensure that ∑ΔS j = N.
[0051] Finally, during the adjustment process, it is necessary to detect whether it will cause unread events to be discarded: If U j > S j - R j , it may overwrite unread events. At this time, the following strategies can be used to avoid it: Give priority to ensuring the unread event area: perform circular allocation on the queue of Module j, and give priority to reserving the addresses of the unread part; Increase the unread event protection area: when releasing space, reserve at least U j space for Module j.
[0052] For each module, if its event queue is full (i.e., when overwriting old events), increase the corresponding wrap-around count C i ’ = Ci +1. The relevant codes in the above embodiment are as follows:
[0053] The present invention is not limited to the above-mentioned embodiments. No matter any changes are made in the shape or material composition, any structural design provided by the present invention is a variation of the present invention and should be considered to be within the protection scope of the present invention.
Claims
1. A method for dynamically adjusting event sequence records, characterized in that: The following steps are involved: S1: Initialize the event sequence record queue and set the priority of the event; S2: Allocate an event record queue for each module according to the number and type of modules in the system; S3: Recording events according to the state of the event sequence record queue, when the queue is full or the event sequence record array reaches the maximum value stage, overwriting the event record of the first module; S4: When a significant increase in the frequency of a single module event is detected, a dynamic space adjustment algorithm is used to adjust the event sequence recording space; when an abnormal frequency of multiple module events is detected, intelligent discarding is performed dynamically based on the remaining space in the queue.
2. A method for dynamically adjusting event sequence records according to claim 1, characterized in that: In step S3, when the event sequence record queue is not full and the module event sequence record queue has not reached the maximum value stage, the events are recorded in the order in which the system events occur, and the module event record array is maintained. Specifically, the events are recorded in the order in which they are sent and the write pointer is maintained. At the same time, the address of the event in the event sequence record queue is stored in the corresponding module event record queue.
3. A method for dynamically adjusting event sequence records according to claim 1 or 2, characterized in that: In step S3, when the event sequence record queue is full or the event record array reaches the maximum value stage, the event record of the first module is overwritten, specifically including: when a new event occurs, searching the corresponding event record array, selecting the event record in the event record queue that has been assigned to the nearest node to overwrite, and adding 1 to the circle count, and after monitoring that the frequency of occurrence of single module or multi-module events has increased significantly, enter step S4.
4. A method for dynamically adjusting event sequence records according to claim 1 or 2, characterized in that: In step S4, when the frequency of occurrence of a single module event is detected to be significantly increased, a space dynamic adjustment algorithm is used to adjust the event queue space, which specifically includes the following steps: S4.11: When a significant increase in the frequency of events in a single module is detected, the queue pressure of each module is calculated; S4.12: Calculate the adjustment priority weight of each module according to the queue pressure and priority of each module, and determine the module that needs to increase or decrease the queue space; S4.13: According to the module adjustment priority, calculate the new queue requirements of the module that needs to add queues and the queue space of the module that needs to release queues; S4.14: Check whether there is a risk of data loss. If so, keep the unread event protection area and return to step S4.
11. If not, update the module allocation.
5. A method for dynamically adjusting event sequence records according to claim 4, characterized in that: In step S4, when the frequency of occurrence of multi-module events is detected to be abnormal, intelligent discarding is performed dynamically according to the remaining space of the queue, specifically including the following steps: S4.21: When it is detected that the frequency of events in each module is abnormal, the repetitive events are discarded. After a period of time, if there is no abnormality, return to step S3. If there is still an abnormality, go to step S4.22; S4.22: When it is detected that the remaining space in the queue is close to the safety threshold, all timed-out low-priority events are deleted, timed-out medium-priority events are selectively discarded, and timed-out but high-priority events are transferred to the priority queue; S4.23: When it is detected that the remaining space in the queue is lower than the safety threshold, events are gradually discarded according to priority.
6. A method for dynamically adjusting event sequence records according to claim 3, characterized in that: The step S3 also includes regularly monitoring the event occurrence frequency and queue usage rate of each module, monitoring the remaining space of the queue in real time, and recording the queue entry time of each event.
7. A method for dynamically adjusting event sequence records according to claim 4, 5 or 6, characterized in that: In step S1, it will be divided into a first module, a second module and a third module. The first module serves as an IO module to record a large number of high-priority events. The second module serves as a control module. The third module serves as a redundant module. The queue size of the first module is larger than the queue sizes of the second module and the third module.
8. A method for dynamically adjusting event sequence records according to claim 7, characterized in that: In the step S1, the initialization event record queue includes a storage queue, a write pointer and a turn count, and sets a priority for the corresponding event according to event characteristics.
9. The method for dynamically adjusting event sequence records according to claim 5, characterized in that: In step S4.21, the discarding of repetitive events specifically includes discarding the repetitive event record if the new event record is the same as the unread event record.
10. The method for dynamically adjusting event sequence records according to claim 4, characterized in that: In the step S4.11 and the step S4.12, the specific method of calculating the current module queue pressure is as follows: the module queue pressure and the queue size currently allocated to the module are equal to the number of new uploaded events of the module in the current time slice plus the number of events that have not been read by the module; The specific method of adjusting the priority weight of each module is as follows: the adjustment priority weight of each module is the product of the weight coefficient α and the current module queue pressure plus the product of the weight coefficient β and the module priority. The higher the priority value of the module, the higher the priority.
Citation Information
Patent Citations
SOE event record storage and reading method
CN117348797A
Cited By
Storage server data detection method based on cloud collaboration
CN120780557A