A data archiving method, electronic device, and readable storage medium
By storing monitoring data as multiple objects and using threads to control read and write rates, the problem of data storage efficiency mismatch in public transportation monitoring systems is solved, achieving efficient data archiving and loss prevention.
Patent Information
- Application Number
- CN202110701029.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-23
- Publication Date
- 2026-08-04
- Estimated Expiration
- 2041-06-23
AI Technical Summary
In existing technologies, the data storage efficiency of public transportation monitoring systems is mismatched with the database configuration, resulting in low efficiency in generating monitoring data and the risk of data loss.
By storing monitoring data as multiple data objects and using a first thread to read them into a data queue and a second thread to write them into the database, concurrent reading and writing of the data objects is achieved, and the read and write rates are synchronously controlled to prevent data accumulation.
It improved the data object read/write speed of the monitoring subsystem, avoided data loss, reduced reliance on manual intervention, and ensured the reliability and efficiency of data archiving.
Smart Images

Figure CN115510020B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of database technology, and more specifically, to a data archiving method, an electronic device, and a computer-readable storage medium. Background Technology
[0002] In the field of public transportation such as subways and urban rail transit, the number of monitoring points in the integrated monitoring system is mostly in the tens or hundreds of thousands. Moreover, the stored data often involves operational safety, fault tracing, etc., so ensuring the security of data storage is very important.
[0003] The inventors discovered that most existing integrated monitoring systems use relational databases such as Oracle, MySQL, and MSSQL for data storage. These databases, selected based on parameters, have varying data storage efficiencies. In contrast, integrated monitoring systems generate data offline for each specific public transportation route, with the number of monitoring points differing between routes. Furthermore, the database server configuration and database selection parameters vary for each route. Therefore, the efficiency of data generation may not match the database storage efficiency. Summary of the Invention
[0004] One objective of this disclosure is to provide a new technical solution for online data archiving.
[0005] According to a first aspect of this disclosure, a data archiving method is provided, comprising:
[0006] Acquire monitoring data collected by at least one monitoring subsystem;
[0007] The monitoring data is stored as multiple data objects corresponding to the monitoring subsystem according to preset rules;
[0008] The first thread corresponding to the monitoring subsystem is controlled to read the data objects into the corresponding data queue in a preset order;
[0009] Each time the first thread reads a data object into the data queue, the second thread corresponding to the monitoring subsystem is controlled to write the data object in the data queue into the database.
[0010] According to a second aspect of this disclosure, an electronic device is also provided, including a memory and a processor, the memory being used to store a computer program; the processor being used to execute the computer program to implement the method according to a first aspect of this disclosure.
[0011] According to a third aspect of this disclosure, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the method according to a first aspect of this disclosure.
[0012] Through the embodiments of this disclosure, for each monitoring subsystem, the collected detection data is stored as corresponding data objects. A first thread is controlled to read the data objects of the corresponding monitoring subsystem into a data queue, and then a second thread is controlled to write the data objects from the data queue into the database. This concurrently improves the read and write rates of data objects corresponding to at least one monitoring subsystem. Furthermore, by setting up a data queue, the rate at which the first thread reads data objects can be synchronously controlled based on the rate at which the second thread writes to the database, ensuring that the write rate of the second thread is synchronized with the read rate of the first thread. In addition, it can prevent the accumulation of too many unprocessed data objects in the data queue, thus avoiding data loss.
[0013] Other features and advantages of the embodiments of this disclosure will become clear from the following detailed description of exemplary embodiments with reference to the accompanying drawings. Attached Figure Description
[0014] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments of the present disclosure and, together with their description, serve to explain the principles of the embodiments of the present disclosure.
[0015] Figure 1 It is a schematic block diagram of the hardware configuration of an electronic device that can be used to implement the embodiments of the present disclosure;
[0016] Figure 2 This is a block schematic diagram of an electronic device according to one embodiment;
[0017] Figure 3 This is a flowchart illustrating a data archiving method according to one embodiment;
[0018] Figure 4 This is a schematic diagram illustrating the processing of data objects by a database archiving service module according to one embodiment.
[0019] Figure 5 This is a flowchart illustrating an example of a data archiving method according to an embodiment of the present disclosure;
[0020] Figure 6 This is a flowchart illustrating an example of a data archiving method according to an embodiment of the present disclosure;
[0021] Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to another embodiment. Detailed Implementation
[0022] Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that, unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps set forth in these embodiments do not limit the scope of the invention.
[0023] The following description of at least one exemplary embodiment is merely illustrative and is in no way intended to limit the invention or its application or use.
[0024] Techniques, methods, and equipment known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and equipment should be considered part of the specification.
[0025] In all the examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values.
[0026] It should be noted that similar labels and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be discussed further in subsequent figures.
[0027] <Hardware Configuration>
[0028] Figure 1 This is a schematic diagram of the structure of an electronic device that can be used to implement the embodiments of this disclosure.
[0029] The electronic device 1000 can be a smartphone, laptop, desktop computer, tablet computer, server, etc., and is not limited thereto.
[0030] The electronic device 1000 may include, but is not limited to, a processor 1100, a memory 1200, an interface device 1300, a communication device 1400, a display device 1500, an input device 1600, a speaker 1700, a microphone 1800, etc. The processor 1100 may be a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MCU), etc., used to execute computer programs, which can be written using instruction sets of architectures such as x86, Arm, RISC, MIPS, SSE, etc. The memory 1200 may include, for example, ROM (Read-Only Memory), RAM (Random Access Memory), and non-volatile memory such as a hard disk. The interface device 1300 may include, for example, a USB interface, a serial interface, a parallel interface, etc. The communication device 1400 may be capable of wired communication using fiber optic cables or cables, or wireless communication, specifically including WiFi communication, Bluetooth communication, 2G / 3G / 4G / 5G communication, etc. The display device 1500 may be, for example, an LCD screen, a touch screen, etc. The input device 1600 may include, for example, a touch screen, a keyboard, motion input, etc. Speaker 1700 is used to output audio signals. Microphone 1800 is used to capture audio signals.
[0031] In the embodiments of this disclosure, the memory 1200 of the electronic device 1000 is used to store a computer program that controls the processor 1100 to operate in order to implement the method according to the embodiments of this disclosure. Those skilled in the art can design this computer program based on the scheme disclosed herein. How the computer program controls the processor to operate is well known in the art and will not be described in detail here. The electronic device 1000 may be equipped with a smart operating system (e.g., Windows, Linux, Android, iOS, etc.) and application software.
[0032] Those skilled in the art should understand that, although in Figure 1 The present invention illustrates multiple devices of an electronic device 1000; however, the electronic device 1000 of the present invention may refer to only some of the devices, for example, only the processor 1100 and the memory 1200.
[0033] Hereinafter, various embodiments and examples according to the present invention will be described with reference to the accompanying drawings.
[0034] <Method Implementation>
[0035] Figure 2 This is a block schematic diagram of an electronic device according to one embodiment. For example... Figure 2 As shown, the electronic device 2000 may include a data acquisition module 2100, a main service module 2200, a database archiving service module 2300, and a human-machine interface module 2400.
[0036] The data acquisition module 2100 acquires monitoring data collected by external monitoring subsystems and transmits the data to the main service module 2200. The main service module 2200 caches the monitoring data into data files according to time sequence and stores them on the local disk in the same order. The database archiving service module 2300 splits the data files corresponding to each monitoring subsystem into multiple data objects. Then, according to time sequence, it controls the first thread corresponding to each monitoring subsystem to read the corresponding data objects into the corresponding data queue, and then controls the second thread corresponding to each monitoring subsystem to write the data objects from the corresponding data queue into the database.
[0037] The database archiving service module 2300 can also calculate the storage load rate corresponding to each monitoring subsystem, determine whether the storage load rate of each monitoring subsystem meets the alarm conditions, and, if the storage load rate of any monitoring subsystem meets the alarm conditions, send alarm information to the main service module 2200. The main service module 2200 reports the alarm information to the human-machine interface module 2400, which displays the alarm information for users to view and allows for manual intervention in the data archiving process based on the alarm information.
[0038] Figure 3 This is a flowchart illustrating a data archiving method according to one embodiment, which can be implemented by an electronic device. For example, the electronic device may be as follows: Figure 1 The electronic device shown is 1000.
[0039] like Figure 3 As shown, the data archiving method of this embodiment may include the following steps S3100 to S3400:
[0040] Step S3100: Obtain monitoring data collected by at least one monitoring subsystem.
[0041] In this embodiment, in the field of public transportation such as subways, urban rail transit, and cloud buses, the monitoring subsystem can be a passenger service monitoring system, a station equipment monitoring system, a train operation control monitoring system, a fire alarm monitoring system, or a power supply monitoring system, etc. Each monitoring subsystem can be composed of at least one corresponding monitoring device, and each monitoring device has at least one monitoring point.
[0042] The monitoring data collected by the monitoring subsystem may include the point value information of the monitoring points under the corresponding monitoring equipment and the collection time.
[0043] Step S3200: Store the monitoring data as multiple data objects corresponding to the monitoring subsystem according to preset rules.
[0044] In one embodiment of this disclosure, storing monitoring data into multiple data objects corresponding to the monitoring subsystem according to preset rules may include the following steps S3210 to S3220:
[0045] Step S3210: According to the preset first time interval, the monitoring data is stored as a data file corresponding to the monitoring subsystem.
[0046] The first time interval in this embodiment can be preset according to the application scenario or specific needs. For example, the first time interval can be 10 minutes. Then, the monitoring data collected by one of the monitoring subsystems every 10 minutes can be stored as a data file corresponding to that monitoring subsystem. That is, the time length corresponding to each data file is equal to the first time interval. Moreover, the size of the data file can be determined by the first time interval.
[0047] In this embodiment, the monitoring data is stored as a data file corresponding to the monitoring subsystem, which can be a database file, such as a *.db file.
[0048] Furthermore, a configuration interface can be provided in advance, which includes a first input box for entering a first time interval, through which the user can set the first time interval.
[0049] Furthermore, the monitoring data obtained through step S3100 can be cached in the memory of the electronic device, or the monitoring data can be stored as a data file, or the data file can be stored on the disk of the electronic device. In the case that the electronic device is a distributed computer cluster, the data file can be stored on the disk of the computer in the distributed computer cluster that performs step S3210.
[0050] If the monitoring data obtained in step S3100 is collected by multiple monitoring subsystems, the monitoring data collected by each monitoring subsystem can be stored as a data file corresponding to each monitoring subsystem according to a first time interval.
[0051] In one embodiment of this disclosure, the configuration interface includes a second input box for setting the cache window, through which the user can configure the cache window. The cache window may represent the total number of cached data files on the disk, i.e., the maximum data cache size.
[0052] The cache window can be defined in units of time. For example, the cache window can be 7 days, then the disk can cache data files from the most recent 7 days.
[0053] In this embodiment, the cache window does not need to be adjusted based on specific public transportation routes or data creation; only a general value needs to be set. By setting a cache window, the reliance on manual data archiving can be reduced.
[0054] Step S3220: According to the preset second time interval, the data file is split into multiple data objects.
[0055] The second time interval in this embodiment can be preset according to the application scenario or specific needs, or it can be set according to the actual storage capacity of the database. This second time interval can be shorter than the first time interval. For example, the second time interval can be 1 minute. Therefore, each data file with a time length of 10 minutes can be split into 10 data objects with a time length of 1 minute.
[0056] Furthermore, each data object obtained can have at least a corresponding start time and also a corresponding end time.
[0057] In this embodiment, by splitting the data file corresponding to each monitoring subsystem, the data object corresponding to each monitoring subsystem can be obtained.
[0058] Step S3300: Control the first thread corresponding to the monitoring subsystem to read the data objects into the corresponding data queue in a preset order.
[0059] In this embodiment, a first thread and a data queue corresponding to each monitoring subsystem can be pre-set. For each monitoring subsystem, the corresponding first thread is controlled to read the corresponding data objects into the corresponding data queue in a preset order.
[0060] The preset order in this embodiment can specifically be a chronological order. Specifically, the first thread of any monitoring subsystem can read the earliest unread data object from the data object corresponding to that monitoring subsystem into the data queue corresponding to that monitoring subsystem.
[0061] In step S3400, each time the first thread reads a data object into the data queue, the second thread corresponding to the monitoring subsystem is controlled to write the data object in the data queue into the database.
[0062] In this embodiment, a second thread corresponding to each monitoring subsystem can be pre-set. For each monitoring subsystem, the second thread can be controlled to write data objects from the data queue to the database.
[0063] Specifically, the second thread can write data objects to the database in the order they are read from the data queue.
[0064] In one example, within the database archiving service module, the method by which the first thread reads data objects into the data queue and the method by which the second thread writes data objects from the data queue into the database could be, for example, as follows: Figure 4 As shown.
[0065] In one embodiment of this disclosure, for each monitoring subsystem, the corresponding data queue may include at most one data object. Therefore, the first thread can be controlled to read the next data object into the data queue after the second thread has finished writing the data object into the data queue.
[0066] In other words, once the second thread has finished writing all the data objects that the first thread read into the data queue, i.e., all of them have been written into the database, the first thread will begin the next reading step and read the next data object into the data queue.
[0067] Through the embodiments of this disclosure, for each monitoring subsystem, the collected detection data is stored as corresponding data objects. A first thread is controlled to read the data objects of the corresponding monitoring subsystem into a data queue, and then a second thread is controlled to write the data objects from the data queue into the database. This concurrently improves the read and write rates of data objects corresponding to at least one monitoring subsystem. Furthermore, by setting up a data queue, the rate at which the first thread reads data objects can be synchronously controlled based on the rate at which the second thread writes to the database, ensuring that the write rate of the second thread is synchronized with the read rate of the first thread. In addition, it can prevent the accumulation of too many unprocessed data objects in the data queue, thus avoiding data loss.
[0068] In one embodiment of this disclosure, the method may further include steps S3500 to S3700 as shown below:
[0069] Step S3500: During the process of the first thread reading the data object this time, monitor the storage load rate of the corresponding subsystem.
[0070] The storage load ratio is a parameter used to measure whether the read and write rates of data objects in this monitoring subsystem are balanced. The read rate is the rate at which the first thread reads data objects into the data queue, and the write rate is the rate at which the second thread writes data objects into the database.
[0071] In one embodiment of this disclosure, during the process of obtaining the data object read by the first thread, the storage load rate of the monitoring subsystem may include the following steps S3510 to S3530:
[0072] Step S3510: Obtain the first start time of the data object read by the first thread this time, and the second start time of the data object read by the first thread last time.
[0073] The start time refers to the time when the corresponding data object begins to be collected. This start time includes a first start time and a second start time. That is, the first start time is the time when the first thread begins collecting the data object it is currently reading, and the second start time is the time when the first thread last collected the data object it was reading.
[0074] In this embodiment, in addition to obtaining the data object, the start time of the data object can also be obtained.
[0075] Step S3520: Obtain the first system time when the first thread starts executing the operation of reading the data object this time, and the second system time when the first thread last started executing the operation of reading the data object.
[0076] In this embodiment, the system time can be the local time of the electronic device or the internet time. Specifically, the first system time can be the system time at which the first thread begins executing the operation to read the data object, and the second system time can be the system time at which the first thread last began executing the operation to read the data object.
[0077] Step S3530: Determine the storage load rate based on the first start time, the second start time, the first system time, and the second system time.
[0078] In one embodiment of this disclosure, determining the storage load rate based on the first start time, the second start time, the first system time, and the second system time may include the following steps S3531 to S3533:
[0079] Step S3531: Determine the time difference between the first start time and the second start time, and use it as the first time difference.
[0080] For example, the first start time can be represented as T_data_cur, and the second start time can be represented as T_data_pre. Then, the first time difference T1 can be obtained by the following formula.
[0081] T1 = T_data_cur - T_data_pre (Formula 1)
[0082] Step S3532: Determine the time difference between the first system time and the second system time, and use it as the second time difference.
[0083] For example, the first start time can be represented as T_oper_cur, and the second start time can be represented as T_oper_pre. Then, the second time difference T2 can be obtained by the following formula 2.
[0084] T2 = T_oper_cur - T_oper_pre (Formula 2)
[0085] Step S3533: Determine the ratio between the second time difference and the first time difference as the storage load rate.
[0086] The storage load factor P can be obtained using the following formula (Formula 3).
[0087] P = T2 / T1 (Formula 3)
[0088] In one embodiment of this disclosure, the storage load rate of the monitoring subsystem may be obtained each time the first thread reads a data object.
[0089] Step S3600: Determine whether the storage load rate corresponding to the monitoring subsystem meets the preset alarm conditions.
[0090] In one embodiment of this disclosure, determining whether the storage load rate corresponding to the monitoring subsystem meets the preset alarm conditions may include the following steps S3610 to S3630:
[0091] Step S3610: Determine whether the storage load rate of the monitoring subsystem exceeds a preset threshold during the process of the first thread reading the data object.
[0092] The preset threshold can be set in advance according to the application scenario or specific needs. For example, the threshold can be 1.
[0093] If the storage load rate does not exceed the threshold, it indicates that the efficiency of writing the data object in the data queue to the database during the first thread's reading of the data object is sufficient to meet the efficiency requirements of reading the data object into the data queue.
[0094] If the storage load rate exceeds the threshold, it indicates that during the first thread's reading of the data object, the efficiency of writing the data object in the data queue to the database cannot meet the efficiency of reading the data object into the data queue, resulting in data accumulation in the data queue.
[0095] Step S3620: If the storage load rate exceeds the threshold, determine whether the number of consecutive times the storage load rate of the monitoring subsystem exceeds the threshold exceeds a preset number threshold.
[0096] If, during the last data object read by the first thread, the storage load rate of the monitoring subsystem exceeded the threshold, and the consecutive count corresponding to the last data object read by the first thread was n, then if, during the current data object read by the first thread, the storage load rate of the monitoring subsystem exceeds the threshold, then the consecutive count corresponding to the current data object read by the first thread is n+1; if, during the current data object read by the first thread, the storage load rate of the monitoring subsystem does not exceed the threshold, then the consecutive count corresponding to the current data object read by the first thread is 0.
[0097] The number of times threshold in this embodiment can be set in advance according to the application scenario or specific needs. For example, the number of times threshold can be 3.
[0098] Step S3630: If the number of consecutive occurrences exceeds the threshold, determine that the database meets the alarm conditions.
[0099] Since the storage load rate of the monitoring subsystem exceeds the threshold during a single data object read by the first thread, this only indicates a transient state of the database storage load. It's possible that the data objects read into the data queue are relatively dense, and the rate at which data objects are read into the queue may be slowed down in subsequent reads. Therefore, the storage load rate of the monitoring subsystem exceeding the threshold during a single read does not necessarily indicate an imbalance in database throughput.
[0100] This embodiment determines that the database meets the alarm conditions based on the number of consecutive times the storage load rate of the monitoring subsystem exceeds the threshold, which can avoid the problem of false alarms.
[0101] Step S3700: If the monitoring submodule meets the alarm conditions, an alarm is issued.
[0102] In one embodiment of this disclosure, when the database meets the alarm conditions, an alarm can be issued by generating alarm information and displaying the alarm information through an interface.
[0103] In one embodiment of this disclosure, the alarm information may include: the storage load rate of the monitoring subsystem as determined last time; and / or, the names of the top N monitoring points in terms of storage volume in the last data object read from the monitoring subsystem, and the storage ratio of these monitoring points in the monitoring subsystem.
[0104] The information contained in this alarm message can guide data producers to adjust and allocate data in a timely manner, and to modify the configuration of specific monitoring points in a targeted manner, which has positive practical significance for the monitoring deployment of the entire public transportation line. Moreover, it is also important for the actual online operation of the public transportation line. Specifically, if abnormally frequent monitoring data collection or a decline in database storage performance occurs, this alarm message can also alert operations personnel, facilitating the timely detection of storage problems during operation.
[0105] In the embodiments of this disclosure, by calculating the database storage load rate of each monitoring subsystem, an automatic feedback mechanism is added between data acquisition, data caching, and database storage. This reduces reliance on human experience and makes data archiving more convenient. Furthermore, the archiving service is not interrupted during the archiving process, thus preventing the loss of monitoring data.
[0106] In one embodiment of this disclosure, issuing an alarm when the database meets the alarm conditions may include the following steps S3710 to S3720:
[0107] Step S3710: If the database meets the alarm conditions, determine the alarm level based on the number of consecutive occurrences.
[0108] In one embodiment of this disclosure, multiple frequency ranges and corresponding alarm levels for each frequency range can be pre-defined based on the application scenario or specific requirements. For example, the multiple frequency ranges may include greater than or equal to 3 and less than 5, greater than or equal to 5 and less than or equal to 10, and greater than 10. The alarm level corresponding to the frequency range greater than or equal to 3 and less than 5 can be a low level, the alarm level corresponding to the frequency range greater than or equal to 5 and less than or equal to 10 can be a medium level, and the alarm level corresponding to the frequency range greater than 10 can be a high level.
[0109] In this embodiment, determining the alarm level based on the number of consecutive occurrences can be done by determining the alarm level corresponding to the range of occurrences to which the consecutive occurrences belong.
[0110] For example, if the number of consecutive occurrences is 4, this number falls within the range of 3 or more but less than 5, and the corresponding alarm level is low.
[0111] For example, if the consecutive count is 8, this consecutive count falls within the range of 5 to 10, and the corresponding alarm level is medium.
[0112] Step S3720: Issue the corresponding alarm according to the alarm level.
[0113] In one embodiment of this disclosure, the method of issuing a corresponding alarm based on the alarm level may be to display alarm information by displaying an alarm message with a color corresponding to the alarm level.
[0114] The color corresponding to each alarm level can be preset according to the application scenario or specific needs. For example, the color corresponding to the low level can be yellow, the color corresponding to the medium level can be orange, and the color corresponding to the high level can be red.
[0115] Specifically, the alarm message text can be displayed in a color corresponding to the alarm level, or the alarm message box can be highlighted in a color corresponding to the alarm level.
[0116] In another embodiment of this disclosure, the method of issuing a corresponding alarm based on the alarm level can also be to add the alarm level to the alarm information for display.
[0117] <Example 1>
[0118] Figure 5 This is a flowchart illustrating an example of a data archiving method according to an embodiment of the present disclosure.
[0119] like Figure 5 As shown, the method may include steps S5001 to S5006 as follows:
[0120] Step S5001: Obtain monitoring data collected by at least one monitoring subsystem.
[0121] Step S5002: According to the preset first time interval, the monitoring data is stored as a data file corresponding to each monitoring subsystem.
[0122] Step S5003: According to the preset second time interval, each data file is split into multiple data objects.
[0123] Step S5004: Control the first thread corresponding to the monitoring subsystem to read the i-th data object into the corresponding data queue.
[0124] Where i is a positive integer.
[0125] Step S5005: When the first thread reads the i-th data object into the data queue, control the second thread corresponding to the monitoring subsystem to write the i-th data object in the data queue into the database.
[0126] Step S5006: After the second thread has finished writing the i-th data object, increment i by one.
[0127] After completing step S5006, proceed to step S5004.
[0128] <Example 2>
[0129] Based on Example 1 above, this embodiment takes the archiving of monitoring data collected by the target monitoring subsystem as an example to illustrate the data archiving method of this disclosure.
[0130] This data archiving method may also include, for example: Figure 6 Steps S6001 to S6009 shown:
[0131] Step S6001: Control the first thread to read the data object into the data queue for the i-th time. Where i is a positive integer.
[0132] Step S6002: Determine if i is greater than 1. If yes, proceed to step S6003; otherwise, proceed to step S6009.
[0133] Step S6003: Obtain the first start time of the data object read by the first thread for the i-th time and the second start time of the data object read by the first thread for the (i-1)-th time.
[0134] Step S6004: Obtain the first system time of the first thread performing the operation of reading the data object for the i-th time, and the second system time of the first thread performing the operation of reading the data object for the (i-1)-th time.
[0135] Step S6005: Determine the storage load rate corresponding to the target monitoring subsystem based on the first start time, the second start time, the first system time, and the second system time.
[0136] Step S6006: Determine whether the storage load rate corresponding to the target monitoring subsystem exceeds a preset threshold. If yes, proceed to step S6007; otherwise, proceed to step S6009.
[0137] Step S6007: Determine whether the number of consecutive times the storage load rate of the monitoring subsystem exceeds the threshold exceeds the preset threshold. If yes, proceed to step S6008; otherwise, proceed to step S6009.
[0138] Step S6008: Generate alarm information and display the alarm information through the interface.
[0139] Step S6009: Increment i by one.
[0140] <Equipment Example>
[0141] Figure 7 This is a schematic diagram of the hardware structure of an electronic device according to another embodiment.
[0142] like Figure 7As shown, the electronic device 7000 includes a processor 7100 and a memory 7200, the memory 7200 for storing an executable computer program, and the processor 7100 for executing methods as described in any of the above method embodiments under the control of the computer program.
[0143] The electronic device 7000 can be a smartphone, laptop, desktop computer, tablet computer, server, distributed computer cluster, or other electronic product.
[0144] Each module of the above electronic device 7000 can be implemented by the processor 7100 executing the computer program stored in the memory 7200 in this embodiment, or it can be implemented by other circuit structures, which are not limited here.
[0145] <Example of Computer-Readable Storage Medium>
[0146] This embodiment provides a computer-readable storage medium storing executable commands that, when executed by a processor, perform the methods described in any of the method embodiments of this specification.
[0147] This invention can be a system, method, and / or computer program product. A computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the invention.
[0148] Computer-readable storage media can be tangible devices capable of holding and storing instructions for use by an instruction execution device. Computer-readable storage media can be, for example—but not limited to—electrical storage devices, magnetic storage devices, optical storage devices, electromagnetic storage devices, semiconductor storage devices, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), static random access memory (SRAM), portable compact disc read-only memory (CD-ROM), digital multifunction disc (DVD), memory sticks, floppy disks, mechanical encoding devices, such as punch cards or recessed protrusions storing instructions thereon, and any suitable combination thereof. The computer-readable storage media used herein are not to be construed as transient signals themselves, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (e.g., light pulses through fiber optic cables), or electrical signals transmitted through wires.
[0149] The computer-readable program instructions described herein can be downloaded from computer-readable storage media to various computing / processing devices, or downloaded via a network, such as the Internet, local area network, wide area network, and / or wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards them to the computer-readable storage media in the respective computing / processing device.
[0150] The computer program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the computer-readable program instructions. This electronic circuitry can execute the computer-readable program instructions to implement various aspects of the invention.
[0151] Various aspects of the present invention are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer-readable program instructions.
[0152] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that, when executed by the processor of the computer or other programmable data processing apparatus, they create means for implementing the functions / actions specified in one or more blocks of the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium that causes a computer, programmable data processing apparatus, and / or other device to operate in a particular manner; thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.
[0153] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to perform the functions / actions specified in one or more boxes of a flowchart and / or block diagram.
[0154] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of an instruction containing one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions. It will be known to those skilled in the art that implementation in hardware, implementation in software, and implementation using a combination of software and hardware are equivalent.
[0155] The various embodiments of the present invention have been described above. These descriptions are exemplary and not exhaustive, and are not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen to best explain the principles, practical application, or technical improvements to the embodiments in the market, or to enable others skilled in the art to understand the embodiments disclosed herein. The scope of the invention is defined by the appended claims.
Claims
1. A data archiving method, comprising: Acquire monitoring data collected by at least one monitoring subsystem; The monitoring data is stored as multiple data objects corresponding to the monitoring subsystem according to preset rules; The first thread corresponding to the monitoring subsystem is controlled to read the data objects into the corresponding data queue in a preset order; Each time the first thread reads a data object into the data queue, the second thread corresponding to the monitoring subsystem is controlled to write the data object in the data queue into the database. The method further includes: After the second thread finishes writing the data object to the data queue, the first thread is controlled to read the next data object into the data queue; the method further includes: During the process of obtaining the data object read by the first thread, the storage load rate of the monitoring subsystem is as follows: the storage load rate is a parameter that measures whether the read rate and write rate of the data object of the monitoring subsystem are balanced. Determine whether the storage load rate meets the preset alarm conditions; An alarm is issued when the storage load rate meets the alarm conditions.
2. The method according to claim 1, wherein during the process of obtaining the data object read by the first thread, the storage load rate corresponding to the monitoring subsystem includes: Obtain the first start time of the data object read by the first thread this time, and the second start time of the data object read by the first thread last time; wherein, the start time is the start time of the corresponding data object; Obtain the first system time when the first thread starts executing the operation of reading the data object, and the second system time when the first thread last started executing the operation of reading the data object; The storage load rate is determined based on the first start time, the second start time, the first system time, and the second system time.
3. The method according to claim 2, wherein determining the storage load rate based on the first start time, the second start time, the first system time, and the second system time comprises: The time difference between the first start time and the second start time is determined as the first time difference; The time difference between the first system time and the second system time is determined as the second time difference; The ratio between the second time difference and the first time difference is determined as the storage load rate.
4. The method according to claim 1, wherein determining whether the storage load rate meets the preset alarm conditions includes: Determine the number of consecutive times the storage load rate of the monitoring subsystem exceeds a preset threshold; If the number of consecutive occurrences exceeds a preset threshold, the storage load rate is determined to meet the alarm conditions.
5. The method according to claim 4, wherein issuing an alarm when the storage load rate meets the alarm conditions comprises: Under the condition that the storage load rate meets the alarm conditions, the alarm level is determined based on the number of consecutive occurrences. An alarm will be issued according to the alarm level.
6. The method according to claim 1, wherein storing the monitoring data into multiple data objects corresponding to the monitoring subsystem according to a preset rule comprises: The monitoring data is stored as a data file corresponding to the monitoring subsystem according to a preset first time interval; The data file is split into multiple data objects according to a preset second time interval.
7. An electronic device, comprising: It includes a memory and a processor, the memory being used to store a computer program, and the processor being used, under the control of the computer program, to execute the method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, the computer program implementing the method as described in any one of claims 1 to 6 when executed by a processor.