Network data acquisition and storage system
Through double buffer mode and multi-thread processing, it solves the problems of data storage reliability and real-time under high-speed data transmission, realizes timely, complete and efficient data storage, and is suitable for high-load data collection and storage systems.
Patent Information
- Application Number
- CN202410734751.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-20
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing technology is difficult to maintain the reliability and real-time performance of the high-speed data storage process when the data transmission rate is high, resulting in system performance degradation or crash.
The data acquisition and storage system adopts double buffer mode. The data acquisition unit writes data in the first buffer and overwrites the old data after the second buffer is full. It combines different interrupt request numbers and threads for data storage to ensure Real-time and continuous data.
It achieves the timeliness, integrity and continuity of data, improves the efficiency of data storage, reduces storage delays, and ensures the real-time and accuracy of data.
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of data collection and arrangement, and specifically relates to a network data collection and storage system. Background Art
[0002] With the rapid development of the Internet, more and more data is generated and stored on the Internet. In order to obtain and utilize this massive amount of data, network data collection, classification, organization and storage systems have emerged. Such systems can capture data from the Internet, classify and organize the data, and finally store the data in a database for subsequent analysis and application.
[0003] Traditional database systems often face performance bottlenecks when processing large-scale data, resulting in slow data storage and affecting the overall efficiency of the system. In addition, as the amount of data continues to increase, traditional storage systems may not be able to meet the needs of the system, resulting in system performance degradation or even crashes. Therefore, when the data transmission rate is very high, it is difficult for existing technologies to maintain the reliability and real-time performance of the high-speed data storage process.
[0004] A patent with publication number CN115238151A discloses an information communication big data collection and storage system, which is provided with a classification module, which can classify data, and the classification module is composed of several classifiers of different levels, which can classify data in multiple levels, so that when consulting, data can be consulted only according to the project type. However, due to the use of a multi-level classification module, a lot of data needs to be processed when storing data, so when the data transmission rate is very high, the reliability and real-time performance of the high-speed data storage process cannot be maintained. Summary of the invention
[0005] The purpose of the present invention is to provide a network data collection and storage system to solve the following technical problems raised in the background technology:
[0006] When the data transmission rate is very high, it is difficult for the existing technology to maintain the reliability and real-time performance of the high-speed data storage process.
[0007] In order to solve the above technical problems, the technical solution adopted by the present invention is:
[0008] A network data collection and storage system, comprising a data collection unit and a data storage unit;
[0009] The data acquisition unit includes a data acquisition device having a first buffer and a second buffer; the data acquisition device first writes data into the first buffer, and when the data starts to be written into the second buffer, the user program takes out the data in the first buffer for processing; when the second buffer is full, the data acquisition unit returns to the beginning of the first buffer and writes the new data into the first buffer in a manner of overwriting the old data;
[0010] The data storage unit is used to store the data collected by the data acquisition unit in real time; when the data acquisition unit writes the collected data into the first buffer, the data storage thread stores the data in the second buffer into the hard disk; when the data acquisition unit writes the data into the second buffer, the data storage thread stores the data in the first buffer into the hard disk.
[0011] Furthermore, the data acquisition unit uses a high-speed digital I / O card with a maximum transmission rate of not less than 60Mbytes / sec.
[0012] Furthermore, in the network data collection and storage system, the data collection unit and the data storage unit use different interrupt request numbers.
[0013] Furthermore, in the network data collection and storage system, the data collection unit and the data storage unit use different threads.
[0014] Furthermore, the first buffer and the second buffer have the same capacity.
[0015] Furthermore, it also includes a cloud storage module, and the hard disk uploads the data to the cloud storage module after acquiring the data.
[0016] Furthermore, it also includes a distributed file management system, and the data storage unit converts the acquired data and writes it into the distributed file system.
[0017] Compared with the prior art, the present invention has the following beneficial effects:
[0018] The present invention uses a double buffer mode to use a smaller capacity to store almost unlimited data in an uninterrupted buffer. Through the design of the present invention, before the data fills up one of the buffers, the data storage thread has already stored the data in the other buffer into the SCSI hard disk. Therefore, this method can ensure the real-time, integrity and continuity of the data.
[0019] The data storage unit of the present invention can store the data collected by the data collection unit in real time, thereby ensuring the timeliness and accuracy of the data.
[0020] The data collector writes the data into the first buffer, and when the data starts to be written into the second buffer, the user program can take out the data in the first buffer for processing. This method simplifies the data processing process and enables users to obtain and process the collected data in a timely manner.
[0021] When the second buffer is full, the data acquisition unit returns to the beginning of the first buffer and writes the new data into the first buffer in a manner of overwriting the old data. This design ensures the continuity of data and can continuously acquire and store the latest data.
[0022] The data storage unit stores the data in the second buffer into the hard disk, and stores the data in the first buffer into the hard disk after the first buffer is full. This dispersed / aggregated data storage method can improve the efficiency of data storage and reduce storage delays. The data storage unit can store the collected data in real time to ensure the timeliness and accuracy of the data. DETAILED DESCRIPTION
[0023] The technical solutions in the embodiments of the present invention are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] Example:
[0025] A network data collection and storage system, comprising a data collection unit and a data storage unit;
[0026] The data acquisition unit includes a data acquisition device having a first buffer and a second buffer; the data acquisition device first writes data into the first buffer, and when the data starts to be written into the second buffer, the user program takes out the data in the first buffer for processing; when the second buffer is full, the data acquisition unit returns to the beginning of the first buffer and writes the new data into the first buffer in a manner of overwriting the old data;
[0027] In this embodiment, the data collector uses a PCI-7300A_RevB ultra-high-speed digital I / O card, the characteristics of which are as follows:
[0028] 32-bit digital I / O channels;
[0029] 32-bit PCI bus;
[0030] Control the start of data acquisition operation through trigger signal;
[0031] 100-pin SCSI type connector;
[0032] DMA in scatter / gather mode;
[0033] Maximum transfer rate 80Mbytes / sec;
[0034] The data storage unit is used to store the data collected by the data acquisition unit in real time; when the data acquisition unit writes the collected data into the first buffer, the data storage thread stores the data in the second buffer into the hard disk; when the data acquisition unit writes the data into the second buffer, the data storage thread stores the data in the first buffer into the hard disk.
[0035] It should be noted that the present invention realizes network data collection and storage based on computers.
[0036] In this embodiment, the data storage unit includes a hard disk controller and a hard disk. The hard disk is a SCSI hard disk of model ST3146707LC produced by Seagate. The hard disk controller is used to write the data of the data collector into the hard disk.
[0037] Before data and storage, you need to build a hardware platform. Although PCI-7300A_RevB uses a dispersed / gathered DMA, it has a high CPU occupancy rate. To ensure the normal operation of the entire data acquisition and storage system, a computer system with a Pentium IV of 1.7G or above is required. In addition, the Windows system allows multiple devices to share an interrupt request number IRQ. In order to ensure the real-time nature of the storage process, it is necessary to ensure that the SCSI hard disk controller and the PCI-7300A_RevB card use different IRQs. You can manually configure the IRQ of the Pnp (plug and play) / PCI device in the motherboard BIOS. Finally, Windows 2000 Service Pack 2 (SP2) and earlier versions do not support hard disks with a capacity greater than 137GB. You need to install Service Pack 3 first, and then add a REG_DWORD type parameter EnableBigLba in the registry (HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesAtapiPara meters) and set the value to 0x1. In this way, the 146GB hard disk can work properly.
[0038] After the hardware platform is built, software design is required to use the API functions in the PCIS-DASK driver package to implement continuous multi-buffer operations for high-speed data acquisition.
[0039] The double buffer mode of the first buffer and the second buffer in the data collector has the following advantages compared with the commonly used single buffer mode: the double buffer mode can use smaller capacity content to store uninterrupted buffering of almost unlimited data, of course, the premise is that the input and output ends need to work together.
[0040] Set the driver of the data collector, that is, set the driver of the PCI-7300A_RevB ultra-high-speed digital I / O card. In the continuous data input mode, the driver needs to open a buffer in the system memory as a secondary cache. The user can set the size of the buffer. The method is: open the DASK2000DeviceDriverConfiguration dialog box from the menu Start / Programs / PCI-DASK / NuDAQPCIconfigurationUtility, select the Pci7300A_RevB item from the Card Type combo box, enter the buffer capacity you want to open in the DI column, and click the OK button to complete the setting. It should be noted that there is a certain relationship between the secondary buffer set by the driver and the buffer capacity opened by the user program. After many experiments, the driver buffer capacity is about 3 times the buffer opened by the user; therefore, when the secondary buffer is too small and the buffer opened by the user is larger, an error will occur.
[0041] In order to use the API functions provided by PCIS-DASK to implement continuous multi-buffer operations, as well as the API functions to initialize the data collector and set the working mode of the data collector, VisualC++ needs to connect to the dynamic link library Pci-dask.lib provided by PCI-DASK. The specific method is: open the project, open the ProjectSetting dialog box from the menu Project / Setting…, switch to the Link tab, add Pci-dask.lib in the Object / librarymodules section, and click the OK button to complete the setting. Finally, add the header file Dask.h. to the project.
[0042] At the beginning of the work, the data collector first writes the data into the first buffer. When the data collector starts to write the data into the second buffer, the user program can take out the data in the first buffer for specific processing according to its own needs. When the second buffer is full, the data acquisition card returns to the beginning of the first buffer and writes the new data into the first buffer by overwriting the old data; at the same time, the user program takes out the data in the second buffer. The entire data acquisition process can be circulated continuously in this way. In the case of high-speed, real-time and continuous acquisition and storage, on the one hand, the system is required to perform data acquisition uninterruptedly, and at the same time, data must be stored in real time, otherwise data will be lost and incomplete data will be caused. The multitasking technology of Windows is introduced. Two working threads are created in the program to complete data acquisition and data storage respectively. The buffering method adopts the double buffer mode mentioned above. When the data acquisition thread SampleThread Proc writes the collected data into the first buffer, the data storage thread StorageThreadProc stores the data in the second buffer into the SCSI hard disk; when the data acquisition thread writes the data into the second buffer, the data storage thread stores the data in the first buffer into the SCSI hard disk; and so on. In addition, through actual experimental testing of the Adaptec 19160 Ultra 160-SCSI hard disk controller, in conjunction with the ST3146707LC SCSI hard disk produced by Seagate, the continuous write rate can reach 80Mbytes / sec. This is much higher than the acquisition rate of 45Mbytes / sec. Therefore, before the data acquisition thread fills one of the buffers, the data storage thread has already stored the data in the other buffer into the SCSI hard disk. Therefore, this method can ensure the real-time, integrity and continuity of the data.
[0043] In the present invention, a PCI-7300A_RevB ultra-high-speed digital I / O card is used, which has a 32-bit digital I / O channel and a maximum transmission rate of 80Mbytes / sec, and can realize high-speed data acquisition and transmission. At the same time, the data storage unit can store the data collected by the data acquisition unit in real time to ensure the timeliness and accuracy of the data. The data acquisition unit writes the data into the first buffer, and when the data starts to be written into the second buffer, the user program can take out the data in the first buffer for processing. This method simplifies the process of data processing, so that the user can obtain and process the collected data in time. When the second buffer is full, the data acquisition unit returns to the beginning of the first buffer and writes the new data into the first buffer in a way of overwriting the old data. This design ensures the continuity of the data and can continuously collect and store the latest data. The data storage unit stores the data in the second buffer into the hard disk, and stores the data in the first buffer into the hard disk after the first buffer is full. This dispersed / gathered data storage method can improve the efficiency of data storage and reduce storage delays. The data storage unit can store the collected data in real time to ensure the timeliness and accuracy of the data. This is very important for application scenarios such as real-time monitoring and data analysis.
[0044] In a preferred embodiment, the data acquisition unit uses a high-speed digital I / O card with a maximum transfer rate of no less than 60Mbytes / sec. That is, this embodiment uses the CI-7300A_RevB ultra-high-speed digital I / O card, which has the following characteristics: 32-bit digital I / O channel; 32-bit PCI bus; control of the start of data acquisition operation by trigger signal; 100-pin SCSI type connector; DMA in scatter / gather mode; maximum transfer rate of 80Mbytes / sec;
[0045] In a preferred embodiment, in the network data acquisition and storage system, the data acquisition unit and the data storage unit use different interrupt request numbers. In order to ensure the real-time performance of the storage process, it is necessary to ensure that the SCSI hard disk controller and the PCI-7300A_RevB card use different interrupt request signals.
[0046] In a preferred embodiment, in the network data collection and storage system, the data collection unit and the data storage unit use different threads. In the case of high-speed, real-time and continuous collection and storage, the system is required to collect data uninterruptedly and store data in real time at the same time, otherwise data will be lost and incomplete. In order to solve this problem, Windows multitasking technology is introduced. Two working threads are created in the program to complete data collection and data storage respectively.
[0047] In a preferred embodiment, the first buffer and the second buffer have the same capacity.
[0048] Using the network data acquisition and storage system of the above embodiment, the typical output data throughput of the computer 32-bit / 33MHz PCI bus bandwidth is 100Mbytes / sec, and the input data throughput is 120Mbytes / sec. Other PCI devices in the system also need to occupy a certain bandwidth, and the data acquisition and storage processes both occupy the PCI bus bandwidth; therefore, the acquisition and storage rate of 45Mbytes / sec is close to the limit of the system and hardware. That is, using the design of the above embodiment, the maximum storage and acquisition speed is 45Mbytes / sec.
[0049] In a preferred embodiment, a cloud storage module is further included, and the hard disk uploads the data to the cloud storage module after acquiring the data. The cloud storage module specifically includes a cloud data storage module, a data viewing module, a data calling module, a data modification module, a data recovery module, and a login module;
[0050] The cloud data storage module introduces a distributed storage architecture to store data on multiple nodes, improving the scalability and fault tolerance of the system. At the same time, data preprocessing functions can be added to perform preliminary processing on the written data, such as data cleaning, deduplication, format conversion, etc., to improve the quality and accuracy of the data.
[0051] For the data viewing module, data analysis and visualization tools are introduced: integrated data analysis tools such as Tableau, Power BI, etc., as well as visualization libraries such as D3.js, Plotly, etc., to help users view and analyze data more intuitively.
[0052] For the data call module, a flexible data call interface is designed to support multiple data formats and protocols, so that users can call data in different ways, such as RESTful API, GraphQL, etc. At the same time, a cache mechanism can be introduced to improve the performance and response speed of data calls.
[0053] For the data modification module, set data modification permissions for different users or roles to ensure the compliance of data modification operations. At the same time, record the logs and audit information of all data modification operations, including operation time, operator, etc., for traceability and auditing. Record the data modification history and save different versions of data, so that users can view and restore historical versions of data to avoid data loss or errors caused by accidental modifications.
[0054] For the data recovery module, data backup is performed regularly, and multiple copies of storage or off-site backup strategies are adopted to ensure data security and reliability. In the event of data loss or damage, data can be quickly restored to the latest state.
[0055] For the login module, data is backed up regularly and multiple copies or off-site backup strategies are adopted to ensure data security and reliability. In case of data loss or damage, data can be quickly restored to the latest state.
[0056] In a preferred embodiment, a distributed file management system is also included, and the data storage unit converts the acquired data and writes it into the distributed file system. The distributed file management system adopts a distributed file system architecture, including multiple storage nodes and metadata nodes, and achieves high reliability and scalability of data through distributed storage and distributed metadata management. When storing data, large files are split into multiple data blocks for storage, and each data block is subjected to data redundancy and distributed storage strategies to ensure data security and reliability. At the same time, a metadata management module is designed to record the metadata information of the file, including the file name, size, storage location, etc., and the file search, reading and writing operations are realized through metadata management.
[0057] The data conversion and writing process of the data storage unit is as follows:
[0058] A. After receiving the data uploaded by the user, the data storage unit performs data format conversion and processing, converting the data into a format suitable for storage in the distributed file system, such as sharding and compression;
[0059] B, write the converted data into the distributed file system, record the file's metadata information, including file name, size, storage location, etc., through the metadata management module, and store the data blocks on different storage nodes according to the distributed storage strategy.
[0060] C. Ensure the consistency and integrity of data by adopting distributed transaction management mechanism or data replication strategy to ensure the correctness and reliability of data in the distributed file system.
[0061] The data reading process of the distributed file management system is as follows:
[0062] When a user requests to read data through an interface or screen, the data storage unit searches for corresponding data blocks according to metadata information, reads and assembles the data blocks, and returns the data to the user.
[0063] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A network data collection and storage system, characterized in that: It includes a data acquisition unit and a data storage unit; The data acquisition unit includes a data acquisition device having a first buffer and a second buffer; the data acquisition device first writes data into the first buffer, and when the data starts to be written into the second buffer, the user program takes out the data in the first buffer for processing; when the second buffer is full, the data acquisition unit returns to the beginning of the first buffer and writes the new data into the first buffer in a manner of overwriting the old data; The data storage unit is used to store the data collected by the data collection unit in real time; When the data acquisition unit writes the collected data into the first buffer, the data storage thread stores the data in the second buffer into the hard disk; when the data acquisition unit writes the data into the second buffer, the data storage thread stores the data in the first buffer into the hard disk.
2. A network data collection and storage system according to claim 1, characterized in that: The data acquisition unit uses a high-speed digital I / O card with a maximum transmission rate of no less than 60Mbytes / sec.
3. A network data collection and storage system according to claim 1, characterized in that: In the network data collection and storage system, the data collection unit and the data storage unit use different interrupt request numbers.
4. A network data collection and storage system according to claim 1, characterized in that: In the network data collection and storage system, the data collection unit and the data storage unit use different threads.
5. A network data collection and storage system according to claim 1, characterized in that: The first buffer and the second buffer have the same capacity.
6. A network data collection and storage system according to claim 1, characterized in that: It also includes a cloud storage module, and the hard disk uploads the data to the cloud storage module after acquiring the data.
7. A network data collection and storage system according to claim 1, characterized in that: It also includes a distributed file management system, and the data storage unit converts the acquired data and writes it into the distributed file system.
Citation Information
Patent Citations
Multi-cache and multi-thread data acquisition method
CN110347369A
Underwater multichannel undistorted data acquisition and storage system under high sampling rate
CN114397007A
Data acquisition and storage system based on big data
CN114691675A
Self-adaptive acquisition and storage method for high-speed video data
CN114845075A
