Real-time processing method and data processing system for large data streams
By using one main control process and multiple auxiliary computing processes in the data processing system, the high-speed industrial data flow is divided and processed in the shared memory, which solves the real-time and stability problems of the data processing system and reduces hardware costs and resources. loss.
Patent Information
- Application Number
- CN202310580226.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-22
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2043-05-22
AI Technical Summary
When the existing technology is processing high-speed industrial data collection, real-time data analysis leads to unpredictable anomalies in the system, and the parallel processing method of multiple sets of computers leads to large data transmission time and resource loss, increases hardware costs, and affects the real-time nature of data processing.
Using the method of one main control process and multiple auxiliary computing processes, the very large data stream collected in real time is divided into data blocks of preset sizes, written into the shared memory, and sent to the idle auxiliary computing process through Remote mode for analysis and calculation. The result is returned to the main control process.
It realizes real-time processing of very large data streams, reduces costs and data transmission losses, solves the problem of system instability caused by a single process occupying memory and CPU resources for a long time, and simplifies the data analysis and processing process.
Smart Images

Figure CN116737409B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a real-time processing method and a data processing system for ultra-large data streams. Background Art
[0002] With the development of science and technology, high-speed industrial data acquisition equipment has reached a data acquisition speed of G, that is, several G of data acquisition is completed in 1 second. Such data acquisition is carried out continuously for a long time, and real-time data analysis is also required for these data. In a process or in multiple threads, long-term operation of huge memory space can easily cause unpredictable abnormalities in the system, which is a huge challenge for the ordinary computers or servers we currently use. Currently, there is a solution to big data analysis by using multiple groups of computers for parallel processing. However, the parallel processing of multiple groups of computers will inevitably require the transfer of huge amounts of data over G to different computers for processing. The transmission of ultra-large data between computers will bring extremely serious time and huge loss of resources, and will also greatly increase the cost of hardware, which will greatly affect the real-time performance of data processing. Summary of the invention
[0003] In view of the above-mentioned shortcomings of the prior art, an object of the present invention is to provide a real-time processing method and a data processing system for ultra-large data streams, so as to solve the above-mentioned problems of the prior art.
[0004] To achieve the above-mentioned purpose and other related purposes, the present invention provides a real-time processing method for a very large data stream, which is applied to a data processing system, including: a main control process and multiple auxiliary computing processes, the method comprising: writing multiple data blocks of a preset data size obtained by segmenting a very large data stream collected in real time into a shared memory through the main control process, and sending the data information of each data block to an idle auxiliary computing process respectively; the auxiliary computing process that receives the data information of the data block reads the corresponding data block written in the shared memory according to the corresponding data information, and sends the calculation result obtained after analyzing and calculating the data of the data block to the main control process.
[0005] In one embodiment of the present invention, the main control process includes: a data acquisition thread and a data transmission thread.
[0006] In one embodiment of the present invention, the process of writing each data block of a preset size collected in real time into a shared memory through a main control process, and sending the data information of each data block to a corresponding auxiliary computing process includes: collecting a very large data stream in real time through the data collection thread, and dividing it into multiple data blocks of a preset data size; writing each data block into an idle shared memory space in the shared memory through the data transfer thread, and transmitting the shared memory handle and data block parameters of the corresponding data block to an idle auxiliary computing process through Remote mode.
[0007] In one embodiment of the present invention, the auxiliary computing process that receives the data information of the data block reads the corresponding data block written in the shared memory according to the corresponding data information, and sends the calculation result obtained after analyzing and calculating the data block data to the main control process, including: reading the corresponding data block from the corresponding shared memory space in the shared memory according to the shared memory handle and data block parameters of the received data block through the corresponding auxiliary computing process, analyzing and calculating the data block data, and sending the calculation result obtained after the analysis and calculation is completed to the main control process through the Remote mode.
[0008] In one embodiment of the present invention, the preset data size is 256M.
[0009] In one embodiment of the present invention, each auxiliary computing process is respectively configured with an independent communication Port.
[0010] In one embodiment of the present invention, each data block divided into a preset size is written into a temporary data list by the data acquisition thread.
[0011] In one embodiment of the present invention, each data block is written into a free shared memory space in the shared memory through the data transfer thread, and the shared memory handle and data block parameters of the corresponding data block are transmitted to an idle auxiliary computing process through the Remote mode, including: when it is monitored that the data of a data block in the temporary data list has been written, the corresponding data block is taken out from the temporary data list and stored in a free shared memory space, and the shared memory handle and data block parameters of the data block are packaged and transmitted to the communication port of an idle auxiliary computing process through the Remote mode.
[0012] In one embodiment of the present invention, the method further includes: receiving and storing the calculation results sent from the corresponding auxiliary computing process through the main control process, and marking the shared memory space storing the corresponding data block and the corresponding auxiliary computing process as idle.
[0013] To achieve the above-mentioned purpose and other related purposes, the present invention provides a data processing system, which includes: a main control process and multiple auxiliary computing processes; wherein the main control process is used to write multiple data blocks of a preset data size obtained by segmenting a super-large data stream collected in real time into a shared memory, and send the data information of each data block to an idle auxiliary computing process respectively; the auxiliary computing process is used to read the corresponding data block written in the shared memory according to the data information of the data block received from the main control process, and send the calculation result obtained after analyzing and calculating the data of the data block to the main control process.
[0014] As described above, the present invention is a real-time processing method and data processing system for a super large data stream, which has the following beneficial effects: the present invention writes multiple data blocks of a preset data size obtained by segmenting a super large data stream collected in real time into a shared memory through a main control process, and sends the data information of each data block to an idle auxiliary computing process respectively, and then the auxiliary computing process reads the corresponding data block written in the shared memory according to the data information of the received data block, and sends the calculation result obtained after analyzing and calculating the data of the data block to the main control process. The present invention realizes the real-time processing of super large data streams by setting a main control process and multiple auxiliary computing processes, making the real-time analysis and processing of super large data streams simple and easy to operate; and compared with other methods, the cost is significantly reduced, and the various losses caused by the transmission of super large data are significantly reduced; it also solves the problem of system instability caused by a single process occupying super large memory blocks and CPU resources for a long time. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a schematic flow chart of a method for real-time processing of a very large data stream in one embodiment of the present invention.
[0016] Figure 2 It is a schematic diagram showing the working implementation of a data acquisition thread and a data transmission thread in one embodiment of the present invention.
[0017] Figure 3 It is a schematic diagram showing the implementation steps of a method for real-time processing of a very large data stream in one embodiment of the present invention.
[0018] Figure 4 Shown is a structural schematic diagram of a data processing system in one embodiment of the present invention. DETAILED DESCRIPTION
[0019] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0020] It should be noted that in the following description, reference is made to the accompanying drawings, which describe several embodiments of the present invention. It should be understood that other embodiments may also be used, and that mechanical composition, structural, electrical and operational changes may be made without departing from the spirit and scope of the present invention. The following detailed description should not be considered restrictive, and the scope of the embodiments of the present invention is limited only by the claims of the published patents. The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. Spatially related terms, such as "upper", "lower", "left", "right", "below", "below", "lower", "above", "upper", etc., may be used in the text to facilitate the description of the relationship between an element or feature shown in the figure and another element or feature.
[0021] Throughout the specification, when a part is said to be "connected" to another part, this includes not only the case of "direct connection" but also the case of "indirect connection" by placing other elements therebetween. In addition, when a part is said to "include" a certain constituent element, unless otherwise stated, it does not exclude other constituent elements, but means that other constituent elements may be included.
[0022] The terms first, second and third mentioned herein are used to describe various parts, components, regions, layers and / or segments, but are not limited thereto. These terms are only used to distinguish a certain part, component, region, layer or segment from other parts, components, regions, layers or segments. Therefore, the first part, component, region, layer or segment described below may refer to the second part, component, region, layer or segment within the scope of the present invention.
[0023] Furthermore, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless there is an indication to the contrary in the context. It should be further understood that the terms "comprise", "include" indicate the presence of the described features, operations, elements, components, items, kinds, and / or groups, but do not exclude the presence, occurrence or addition of one or more other features, operations, elements, components, items, kinds, and / or groups. The terms "or" and "and / or" used herein are interpreted as inclusive, or mean any one or any combination. Therefore, "A, B or C" or "A, B and / or C" means "any of the following: A; B; C; A and B; A and C; B and C; A, B and C". Exceptions to this definition will only occur when the combination of elements, functions or operations is inherently mutually exclusive in some way.
[0024] The present invention provides a real-time processing method for a super-large data stream. The main control process writes multiple data blocks of a preset data size obtained by segmenting the super-large data stream collected in real time into a shared memory, and sends the data information of each data block to an idle auxiliary computing process respectively. The auxiliary computing process then reads the corresponding data block written in the shared memory according to the data information of the received data block, and sends the calculation result obtained after analyzing and calculating the data of the data block to the main control process. The present invention realizes the real-time processing of super-large data streams by setting a main control process and multiple auxiliary computing processes, making the real-time analysis and processing of super-large data streams simple and easy to operate; and compared with other methods, the cost is significantly reduced, and various losses caused by the transmission of super-large data are significantly reduced; it also solves the problem of system instability caused by a single process occupying super-large memory blocks and CPU resources for a long time.
[0025] The following is a detailed description of the embodiments of the present invention with reference to the accompanying drawings so that those skilled in the art can easily implement the present invention. The present invention can be embodied in many different forms and is not limited to the embodiments described herein.
[0026] like Figure 1 A schematic flow chart showing a method for real-time processing of a very large data stream in an embodiment of the present invention.
[0027] Applied to data processing systems, including: a main control process and multiple auxiliary computing processes.
[0028] The method comprises:
[0029] Step S1: write multiple data blocks of preset data size obtained by segmenting the super large data stream collected in real time into the shared memory through the main control process, and send the data information of each data block to the idle auxiliary computing process respectively.
[0030] In detail, the main control process is started, and the main control process collects ultra-large data streams in real time, and divides them into multiple data blocks of preset data sizes, writes each divided data block into a shared memory, and then sends the data information of each data block to the idle auxiliary computing process respectively.
[0031] In one embodiment, the main control process includes: a data acquisition thread and a data transmission thread.
[0032] The data collection thread is responsible for data collection and data block segmentation;
[0033] The data transfer thread is responsible for writing the segmented data blocks into the shared memory, and transferring the data information corresponding to the data blocks to the idle auxiliary computing processes.
[0034] In a specific embodiment, step S1 includes:
[0035] The data collection thread collects a very large data stream in real time and divides it into a plurality of data blocks of a preset data size; for example, the very large data stream collected in real time is 1.8G / s.
[0036] Each data block is written into the free shared memory space in the shared memory through the data transfer thread, and the shared memory handle and data block parameters of the corresponding data block are transmitted to an idle auxiliary computing process through the Remote mode.
[0037] Among them, Remote mode uses Remote technology, which means remote call or remote control. It is a remote control server software. This software is a computer application software suitable for any individual, company and family for remote maintenance, remote assistance and remote management. Users shall not use this software for illegal purposes, such as: stealing, destroying the computer data of the controlled end, stealing the privacy of others and other illegal acts. Any illegal acts will be punished by law.
[0038] It should be noted that there are multiple shared memory spaces in the shared memory, and each shared memory space is marked with an idle or non-idle state. Preferably, if the shared memory space in the shared memory is less than the preset number, a new shared memory is added for storage; for example, if there are already 48 shared memory spaces, the currently idle shared memory is found, and if there are less than 48 shared memory spaces, a new shared memory is applied for.
[0039] Preferably, the preset data size is 256M, that is, the collected super-large data will be divided into multiple data blocks of 256M in size by the data collection thread.
[0040] For example, if Figure 2As shown, the data acquisition thread collects ultra-large data streams in real time and divides them into multiple data blocks of 256M; the data transfer thread writes each data block into the free shared memory space in the shared memory, and the shared memory handle of the corresponding data block and additional information data of the data block such as data block parameters are transmitted to an idle auxiliary computing process through the Remote mode.
[0041] In one embodiment, each auxiliary computing process is respectively configured with an independent communication Port.
[0042] In one embodiment, the data acquisition thread writes each data block divided into a preset size into a temporary data list. Specifically, the data acquisition thread collects a large data stream in real time, divides it into multiple data blocks of a preset data size, and writes the data blocks into a temporary data list.
[0043] In one embodiment, writing each data block into an idle shared memory space in the shared memory through the data transfer thread, and transmitting the shared memory handle and data block parameters of the corresponding data block to an idle auxiliary computing process through the Remote mode includes:
[0044] When it is monitored that the data of a data block in the temporary data list has been written, the corresponding data block is taken out from the temporary data list and stored in an idle shared memory space, and the shared memory handle of the data block and the data block parameters are packaged and transmitted to the communication port of an idle auxiliary computing process through the Remote mode. Specifically, the temporary data list is monitored through the shared memory management thread. If there is data in the temporary data list that has been written, the data is taken out from the temporary data list, the currently idle shared memory is found, and the data taken out from the temporary data list is stored in the shared memory through the corresponding Port using the Remote technology.
[0045] Step S2: The auxiliary computing process that receives the data information of the data block reads the corresponding data block written in the shared memory according to the corresponding data information, and sends the calculation result obtained after analyzing and calculating the data of the data block to the main control process.
[0046] In one embodiment, step S2 includes:
[0047] The corresponding auxiliary computing process reads the corresponding data block from the corresponding shared memory space in the shared memory according to the shared memory handle of the received data block and the data block parameters, and analyzes and calculates the data block data, and sends the calculation results obtained after the analysis and calculation are completed to the main control process through the Remote mode.
[0048] In one embodiment, the method further includes: receiving and storing the calculation results sent from the corresponding auxiliary computing process through the main control process, and marking the shared memory space storing the corresponding data block and the corresponding auxiliary computing process as idle.
[0049] In order to better illustrate the real-time processing method of the above-mentioned ultra-large data stream, the present invention provides the following specific embodiments.
[0050] Embodiment 1: A method for real-time processing of very large data streams.
[0051] Applied to data processing system, the computer used in the system is configured with 64 CPU cores and 128G memory. The system includes a main control process and 48 auxiliary computing processes, such as Figure 3 As shown, the steps for implementing the real-time processing method of super large data stream are as follows:
[0052] Step 1: Start the master control process;
[0053] Step 2: Allocate independent communication ports to each of the 48 computing processes and start the computing processes;
[0054] Step 3: The main control process continuously collects data through the data collection thread, and the size of each collected data is 256M (the amount of data collected per second is 1800M);
[0055] Step 4: The collected data is stored in the temporary data list A;
[0056] Step 5: The shared memory management thread monitors the data list A. If data in the data list A has been written, the data is taken out from the list A. If there are already 48 blocks of shared memory, the currently free shared memory is found. If there are less than 48 blocks of shared memory, a new shared memory is applied. After the appropriate shared memory is prepared, the data taken out from the list A is stored in the shared memory.
[0057] Step 6: Pack the shared memory handle of the current operation, the size of the stored data, and some other parameters;
[0058] Step 7: Find the currently idle process n among the 48 computing processes (a process that has not established a connection with the main control process or has established a connection and completed the computing work and returned the computing results).
[0059] Step 8: Use Remote technology to send the data prepared in step 6 to the idle computing process n through the corresponding Port port;
[0060] Step 9: After receiving the data, the idle process n takes out the data block from the corresponding shared memory according to the shared memory handle in the data packet and starts data analysis and calculation;
[0061] Step 10: After the idle process n completes the calculation, it sends the calculation result to the main control process again through the Remote technology;
[0062] Step 11: After the master process collects the result data sent back by the idle process n, it saves the result and marks the computing process n and the corresponding shared memory block as idle.
[0063] Similar to the principle of the above embodiment, the present invention provides a data processing system.
[0064] The following provides specific embodiments in conjunction with the accompanying drawings:
[0065] like Figure 4 A schematic structural diagram of a data processing system in an embodiment of the present invention is shown.
[0066] The system can be implemented by a processor, such as a processor with a certain memory and a processing core. The processor may include but is not limited to a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0067] The system comprises:
[0068] A main control process 1 and multiple auxiliary computing processes 2;
[0069] The main control process 1 is used to write multiple data blocks of a preset data size obtained by segmenting a super large data stream collected in real time into a shared memory, and send data information of each data block to an idle auxiliary computing process 2 respectively;
[0070] The auxiliary computing process 2 is used to read the corresponding data block written in the shared memory according to the data information of the data block received from the main control process 1, and send the calculation result obtained after analyzing and calculating the data of the data block to the main control process 1.
[0071] In one embodiment, the main control process 1 includes: a data collection thread 11 and a data transmission thread 12.
[0072] In one embodiment, the data acquisition thread 11 is used to collect ultra-large data streams in real time and divide them into multiple data blocks of preset data sizes; the data transfer thread 12 is used to write each data block into the free shared memory space in the shared memory, and transmit the shared memory handle and data block parameters of the corresponding data block to an idle auxiliary computing process through the Remote mode.
[0073] In one embodiment, the auxiliary computing process 2 is used to read the corresponding data block in the shared memory space corresponding to the shared memory according to the shared memory handle of the received data block and the data block parameters, and analyze and calculate the data block data, and send the calculation results obtained after the analysis and calculation are completed to the main control process 1 through the Remote mode.
[0074] In one embodiment, the preset data size is 256M.
[0075] In one embodiment, each auxiliary computing process 2 is respectively configured with an independent communication Port.
[0076] In one embodiment, the data collection thread 21 is further configured to write each data block divided into a preset size into a temporary data list.
[0077] In one embodiment, the data transfer thread 12 is used to take out the corresponding data block from the temporary data list and store it in a free shared memory space when it monitors that the data of a data block in the temporary data list has been written, and to package the shared memory handle and data block parameters of the data block and transmit them to the communication port of an idle auxiliary computing process 2 through Remote mode.
[0078] In one embodiment, the main control process 1 is also used to receive and store the calculation results sent from the corresponding auxiliary computing process 2, and mark the shared memory space storing the corresponding data block and the corresponding auxiliary computing process 2 as idle.
[0079] In summary, the real-time processing method and data processing system of the present invention for super large data streams write multiple data blocks of preset data size obtained by segmenting the super large data stream collected in real time into a shared memory through a main control process, and send the data information of each data block to an idle auxiliary computing process respectively, and then the auxiliary computing process reads the corresponding data block written in the shared memory according to the data information of the received data block, and sends the calculation result obtained after analyzing and calculating the data of the data block to the main control process. The present invention realizes the real-time processing of super large data streams by setting a main control process and multiple auxiliary computing processes, making the real-time analysis and processing of super large data streams simple and easy to operate; and compared with other methods, the cost is significantly reduced, and the various losses caused by the transmission of super large data are significantly reduced; it also solves the problem of system instability caused by a single process occupying super large memory blocks and CPU resources for a long time. Therefore, the present invention effectively overcomes the various shortcomings in the prior art and has a high industrial utilization value.
[0080] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present invention. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed by the present invention shall still be covered by the claims of the present invention.
Claims
1. A real-time processing method for ultra-large data streams, characterized in that: Applied to a data processing system, comprising: a main control process and a plurality of auxiliary computing processes, the method comprises: The main control process writes multiple data blocks of a preset data size obtained by segmenting a super large data stream collected in real time into a shared memory, and sends data information of each data block to an idle auxiliary computing process respectively; the main control process includes: a data acquisition thread and a data transmission thread; the super large data stream is collected in real time by the data acquisition thread, and is segmented into multiple data blocks of a preset data size; each data block is written into an idle shared memory space in the shared memory by the data transmission thread, and the shared memory handle and data block parameters of the corresponding data block are transmitted to an idle auxiliary computing process through the Remote mode; The auxiliary computing process that receives the data information of the data block reads the corresponding data block written in the shared memory according to the corresponding data information, and sends the calculation result obtained after analyzing and calculating the data block data to the main control process; the corresponding auxiliary computing process reads the corresponding data block from the corresponding shared memory space in the shared memory according to the shared memory handle of the received data block and the data block parameters, analyzes and calculates the data block data, and sends the calculation result obtained after the analysis and calculation is completed to the main control process through the Remote mode.
2. The real-time processing method of the super large data stream according to claim 1, characterized in that: The default data size is 256M.
3. The real-time processing method of the super large data stream according to claim 1, characterized in that: Each auxiliary computing process is configured with an independent communication port.
4. The real-time processing method of the super large data stream according to claim 2, characterized in that: Each data block divided into a preset size is written into a temporary data list by the data acquisition thread.
5. The real-time processing method of the super large data stream according to claim 3 is characterized in that: Writing each data block into an idle shared memory space in the shared memory through the data transfer thread, and transmitting the shared memory handle and data block parameters of the corresponding data block to an idle auxiliary computing process through the Remote mode includes: When it is monitored that the data of a data block in the temporary data list has been written, the corresponding data block is taken out from the temporary data list and stored in an idle shared memory space, and the shared memory handle and data block parameters of the data block are packaged and transmitted to the communication port of an idle auxiliary computing process through Remote mode.
6. The real-time processing method of the super large data stream according to claim 1, characterized in that: The method further comprises: The main control process receives and stores the calculation results sent from the corresponding auxiliary calculation process, and marks the shared memory space storing the corresponding data block and the corresponding auxiliary calculation process as idle.
7. A data processing system, characterized in that: The system comprises: A master control process and multiple auxiliary computing processes; The main control process is used to write multiple data blocks of a preset data size obtained by segmenting a super large data stream collected in real time into a shared memory, and send the data information of each data block to an idle auxiliary computing process respectively; the main control process includes: a data acquisition thread and a data transmission thread; the super large data stream is collected in real time by the data acquisition thread, and is segmented into multiple data blocks of a preset data size; each data block is written into an idle shared memory space in the shared memory by the data transmission thread, and the shared memory handle and data block parameters of the corresponding data block are transmitted to an idle auxiliary computing process through the Remote mode; The auxiliary computing process is used to read the corresponding data block written in the shared memory according to the data information of the data block received from the main control process, and send the calculation result obtained after analyzing and calculating the data block data to the main control process; read the corresponding data block from the corresponding shared memory space in the shared memory according to the shared memory handle and data block parameters of the received data block through the corresponding auxiliary computing process, analyze and calculate the data block data, and send the calculation result obtained after the analysis and calculation is completed to the main control process through the Remote mode.
