Multi-thread data processing method and device, equipment and storage medium

Through multi-threaded concurrent processing strategy, the data is sliced ​​and executed in parallel, and the number of threads and resource usage are dynamically adjusted, which solves the inefficiency problem of traditional single-threaded data processing in massive data processing, and achieves fast and efficient data processing and system Improved responsiveness.

CN118747112APending Publication Date: 2024-10-08SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202410987846.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

When faced with massive amounts of data, traditional single-threaded data processing methods cannot fully utilize the parallel computing capabilities of multi-core processors, resulting in low system resource utilization, long processing cycles, and slow response speeds, especially in big data analysis and cloud computing scenarios. bottleneck.

Method used

Using a multi-threaded concurrent processing strategy, the data to be processed is fragmented and assigned to multiple processing threads for parallel execution. By dynamically adjusting the number of threads and monitoring resource usage, the efficiency and reliability of data processing are ensured.

Benefits of technology

It significantly shortens the data processing time, improves the system response speed and resource utilization, ensures the integrity and reliability of data processing, and provides technical support for big data application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747112A_ABST
    Figure CN118747112A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-thread data processing method and device, equipment and a storage medium, and relates to the field of data processing.The method comprises the steps that to-be-processed batch data is fragmented to obtain corresponding data fragments, and at least one processing thread is distributed to each data fragment; determining a corresponding logic operator based on the processing logic of the data in each data fragment, and executing the logic operator corresponding to the data fragment in parallel in each processing thread so as to complete the data processing of each data fragment; and in the process of carrying out data processing on each data fragment, carrying out real-time monitoring on each processing thread so as to carry out corresponding adjustment on the processing thread or the data fragment based on a corresponding monitoring result. Visibly, by adopting a multi-thread concurrent processing strategy, a plurality of data fragments can be processed at the same time, the data processing time is remarkably shortened, the response speed of the system is improved, and rapid and efficient processing of a large amount of data is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing, and in particular to a multi-threaded data processing method, device, equipment and storage medium. Background Art

[0002] With the rapid development of information technology and the popularization of Internet applications, big data has become an important resource in modern society. Its efficient processing plays a vital role in improving user experience and optimizing business decisions. However, when faced with massive amounts of data, traditional single-threaded data processing methods often lead to problems such as low system resource utilization, long processing cycles, and slow response speeds because they cannot fully utilize the parallel computing capabilities of modern multi-core processors. Especially in scenarios such as big data analysis and cloud computing, these problems are particularly prominent and have become a bottleneck restricting the improvement of data processing efficiency.

[0003] In order to overcome the shortcomings of traditional single-threaded data processing methods, multi-threading technology has gradually been introduced into the field of data processing in recent years. By adopting a concurrent processing strategy, multi-threading technology can divide data processing tasks into multiple subtasks and assign them to different threads for parallel execution, thereby significantly improving the data processing speed and system responsiveness. However, there are still some problems and challenges in the existing multi-threaded data processing methods. For example, how to reasonably divide large data sets into multiple data slices and assign them to different threads for processing to achieve load balancing and efficient use of resources; how to ensure data consistency and synchronization between multiple threads to avoid data conflicts and errors; how to design effective error recovery and fault tolerance mechanisms to ensure the integrity and reliability of data processing, etc. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a thread data processing method, device, equipment and storage medium, which can significantly improve the data processing speed and response capability: by adopting a multi-thread concurrent processing strategy, multiple data fragments can be processed simultaneously, and a large amount of data can be processed quickly and efficiently, which significantly shortens the data processing time and improves the response speed of the system. The specific scheme is as follows:

[0005] In a first aspect, the present application discloses a thread data processing method, comprising:

[0006] Slice the batch data to be processed to obtain corresponding data slices, and assign at least one processing thread to each of the data slices;

[0007] Determine corresponding logic operators based on the processing logic of the data in each of the data shards, and execute the logic operators corresponding to the data shards in parallel in each of the processing threads to complete data processing on each of the data shards;

[0008] During the process of processing the data on each of the data slices, each of the processing threads is monitored in real time, so as to make corresponding adjustments to the processing threads or the data slices based on corresponding monitoring results.

[0009] Optionally, slicing the batch data to be processed to obtain corresponding data slicing includes:

[0010] The batch data to be processed is segmented based on the data volume and processing complexity of the batch data to be processed to obtain corresponding data segments.

[0011] Optionally, the method further includes:

[0012] Dynamically adjust the number of processing threads according to the current system resource usage;

[0013] If the current system resources meet the preset conditions, then increase the number of the processing threads;

[0014] If the current system resources do not meet the preset conditions, the number of the processing threads is reduced.

[0015] Optionally, the logical operator includes any one or a combination of data cleaning, data conversion, data aggregation and data analysis operations.

[0016] Optionally, the real-time monitoring of each processing thread so as to adjust the processing thread or the data slice accordingly based on the corresponding monitoring result includes:

[0017] Real-time monitoring of the processing progress of each processing thread and the occupation of system resources; the system resources include central processing unit resources, memory resources and disk input and output resources;

[0018] Adjust the data allocation strategy and thread execution plan based on the corresponding monitoring results.

[0019] Optionally, the method further includes:

[0020] If the target processing thread fails in data processing, an automatic recovery operation or a retry operation of the target processing thread is performed;

[0021] If the automatic recovery operation or the retry operation fails, the corresponding data is rolled back;

[0022] If the automatic recovery operation or the retry operation is successful, the data processing operation of the target processing thread continues.

[0023] Optionally, the method further includes:

[0024] Acquire and record abnormal conditions in the data processing process of each processing thread so that the staff can analyze and summarize the data processing operation based on the abnormal conditions; the abnormal conditions include any one or a combination of data errors, calculation errors and system errors.

[0025] In a second aspect, the present application discloses a thread data processing device, comprising:

[0026] A processing thread allocation module, used for slicing the batch data to be processed to obtain corresponding data slices, and respectively allocating at least one processing thread to each of the data slices;

[0027] A data processing module, used to determine a corresponding logical operator based on the processing logic of the data in each of the data shards, and execute the logical operator corresponding to the data shard in parallel in each of the processing threads to complete data processing on each of the data shards;

[0028] The processing thread monitoring module is used to monitor each processing thread in real time during the process of processing each data slice, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results.

[0029] In a third aspect, the present application discloses an electronic device, comprising:

[0030] Memory, used to store computer programs;

[0031] The processor is used to execute the computer program to implement the multi-threaded data processing method as described above.

[0032] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program, wherein the computer program, when executed by a processor, implements the multi-threaded data processing method as described above.

[0033] When processing multi-threaded data, the present application first slices the batch data to be processed to obtain the corresponding data slices, and allocates at least one processing thread to each data slice; then determines the corresponding logical operator based on the processing logic of the data in each data slice, and executes the logical operator corresponding to the data slice in parallel in each processing thread to complete the data processing of each data slice; finally, in the process of data processing for each data slice, monitors each processing thread in real time, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results. It can be seen that the present application effectively shortens the data processing time and improves the overall performance of the system by dynamically allocating multiple threads of data processing tasks to execute data processing logic in parallel; significantly improves the data processing speed and the responsiveness of the system through concurrent processing strategies, so as to overcome the problems of low system resource utilization and long processing cycle in the traditional single-threaded data processing method when facing massive data; further compresses the data processing time through the parallel execution of data logic operators; and through the intelligent management and optimization of system resources, ensures the efficiency and stability of the processing process, and provides strong technical support for various big data application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0034] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0035] Figure 1 A flow chart of a multi-threaded data processing method disclosed in this application;

[0036] Figure 2 A flowchart of a specific multi-threaded data processing method disclosed in this application;

[0037] Figure 3 A schematic diagram of the structure of a multi-threaded data processing device disclosed in this application;

[0038] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0039] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. 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.

[0040] There are still some problems and challenges in the existing multi-threaded data processing methods. For example, how to reasonably divide a large data set into multiple data fragments and assign them to different threads for processing to achieve load balancing and efficient use of resources; how to ensure data consistency and synchronization between multiple threads to avoid data conflicts and errors; how to design effective error recovery and fault tolerance mechanisms to ensure the integrity and reliability of data processing, etc. In order to solve the above technical problems, the present application discloses a multi-threaded data processing method that can significantly improve data processing speed and responsiveness: by adopting a multi-threaded concurrent processing strategy, it can process multiple data fragments at the same time, realize fast and efficient processing of large amounts of data, significantly shorten data processing time, and improve the response speed of the system.

[0041] See also Figure 1 As shown, an embodiment of the present invention discloses a multi-threaded data processing method, including:

[0042] Step S11, slicing the batch data to be processed to obtain corresponding data slices, and assigning at least one processing thread to each of the data slices.

[0043] In this embodiment, in the data processing logic of the prior art, multi-threaded processing of data sharding and processing of logical operators to build thread pools are respectively adopted. For each solution, only one multi-threaded processing logic is performed. In other words, only sharding is performed on the data, which increases the number of active data items processed simultaneously. However, for each piece of data, the five data logical operators are still executed sequentially, and there is a problem that part of the time will be consumed by the time the logical operators wait for the data to be processed. For another solution, the logical operators are processed by building a connection pool, which reduces the processing time for each piece of data. However, for the overall data volume, each piece of data is still executed sequentially, and most of the time will be consumed in the time the data waits for processing. Therefore, this application combines the existing solutions to further improve the performance on the basis of optimization.

[0044] First, the system will reasonably shard the large batch data to be processed according to the preset strategy (such as data volume, processing complexity, etc.). The sharding strategy can be customized according to the actual application scenario and requirements to ensure the efficiency and balance of data processing. That is, the batch data to be processed is sharded based on the data volume and processing complexity of the batch data to be processed to obtain the corresponding data shards. Then one or more independent processing threads are assigned to each data shard. In this way, parallel processing of data can be achieved, which significantly improves the data processing speed. At the same time, using the thread management mechanism, the system can dynamically adjust the number of threads according to the current system resource usage. When the system resources are sufficient, the number of threads can be increased to increase the processing speed; when the system resources are tight, the number of threads can be reduced to avoid excessive resource consumption. In a specific embodiment, 1000 data are reasonably sharded, the number of shards is n, and each shard processes 1000 / n data. The number of shards is set according to the specific business situation. Then threads are allocated to each shard, so that the data active at the same time (for logical operators) changes from 1 to n. As mentioned above, the ideal processing time is 1000*5 / n seconds (0 <n<1000)。

[0045] Step S12: determine the corresponding logical operator based on the processing logic of the data in each of the data shards, and execute the logical operator corresponding to the data shard in parallel in each of the processing threads to complete the data processing of each of the data shards.

[0046] In this embodiment, a series of logical operators are defined for the data processing logic within each data shard. These logical operators can be operations such as data cleaning, conversion, aggregation, and analysis. Then execute in parallel: by building a logical operator thread pool, multiple processing steps of the data within a single thread can be executed simultaneously. In this way, each data shard can be processed in parallel on multiple logical operator threads, further compressing the data processing time. Among them, the logical operator means that each piece of data needs to be processed in one or more ways before it can finally generate the result data required by the business, and each way of processing data in the process is called a logical operator. For example, if you want to obtain the basic information of a person, enter the ID number, and the system will call multiple interfaces such as education and marriage to obtain the corresponding information of the person. Each of these interfaces is each logical operator.

[0047] In a specific embodiment, five logical operators are constructed into five thread pools, and each thread processes one logical operator. In this way, multiple processing steps for each piece of data in a single thread can be executed simultaneously. On the basis that the data has been sharded, the data processing time is further compressed, thereby further improving the performance. Take the above scenario as an example: 1,000 pieces of data are first sharded, the number of shards is 5, and each shard processes 200 pieces of data. Ideally, the processing time required is 1000*5 / 5 seconds. Then, for the processing of each piece of data (i.e., the processing of logical operators), each logical operator is constructed as a thread pool. Then, when processing a single piece of data, five logical operators are executed in parallel. Ideally, it takes 1 second to process one piece of data, which further improves the performance of data processing, so that the total time to process 1,000 pieces of data is (1000*5 / 5) / 5. In this way, the thread pool management mechanism is used to dynamically adjust the number of threads according to the real-time situation of system resources to ensure that resources are efficiently utilized and avoid resource waste. At the same time, the solution of data sharding and logical operators creating connection pools can meet business scenarios with large data volumes, many logical operators and certain requirements for data processing speed.

[0048] Step S13: During the process of processing the data slices, each processing thread is monitored in real time, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results.

[0049] In this embodiment, in the process of data processing for each data slice, an intelligent algorithm is introduced to automatically monitor the processing progress of each thread and the occupancy of system resources. This includes real-time monitoring of resources such as CPU (Central Processing Unit), memory, and disk I / O (Input / Output). That is, it is necessary to monitor the processing progress of each processing thread and the occupancy of system resources in real time; system resources include central processing unit resources, memory resources, and disk input and output resources. Then, according to the monitoring results, the system can dynamically adjust the data allocation strategy and thread execution plan. For example, when the amount of data processed by a thread is too large or the processing speed is too slow, the system can transfer part of the data to other idle threads for processing to ensure system load balancing and avoid resource bottlenecks. In this way, by real-time monitoring of the processing progress of each thread and the occupancy of system resources through intelligent algorithms, the data allocation strategy and thread execution plan can be dynamically adjusted to ensure efficient use of system resources and avoid resource waste.

[0050] In addition, during the data processing process, the system will capture and record various abnormal situations, such as data errors, calculation errors, system errors, etc. If the target processing thread fails to process data, the target processing thread will be automatically recovered or retried; if the automatic recovery operation or retry operation fails, the corresponding data will be rolled back; if the automatic recovery operation or retry operation succeeds, the data processing operation of the target processing thread will continue. In summary, when a thread fails to process, the system will not immediately interrupt the entire processing flow, but will try to automatically recover or retry the processing of the thread. If the recovery or retry fails, the system can also roll back the data to the previous state to ensure the integrity and reliability of data processing. Therefore, the error recovery and fault tolerance mechanism can ensure that even if a thread fails to process during the data processing process, it will not affect the normal execution of other threads. At the same time, the option of automatic retry or data rollback is provided to ensure the integrity and reliability of data processing.

[0051] In summary, when processing multi-threaded data, the present application first slices the batch data to be processed to obtain the corresponding data slices, and allocates at least one processing thread to each data slice; then determines the corresponding logical operator based on the processing logic of the data in each data slice, and executes the logical operator corresponding to the data slice in parallel in each processing thread to complete the data processing of each data slice; finally, in the process of data processing for each data slice, monitors each processing thread in real time, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results. It can be seen that the present application effectively shortens the data processing time and improves the overall performance of the system by dynamically allocating multiple threads of data processing tasks to execute data processing logic in parallel; significantly improves the data processing speed and the responsiveness of the system through concurrent processing strategies, so as to overcome the problems of low system resource utilization and long processing cycle in the traditional single-threaded data processing method when facing massive data; further compresses the data processing time through the parallel execution of data logic operators; and through the intelligent management and optimization of system resources, ensures the efficiency and stability of the processing process, and provides strong technical support for various big data application scenarios.

[0052] See also Figure 2 As shown, the embodiment of the present invention discloses a specific multi-threaded data processing method, including:

[0053] First, the system reasonably shards the large batch of data to be processed according to the preset strategy (such as data volume, processing complexity, etc.). The sharding strategy can be customized according to the actual application scenario and requirements to ensure the efficiency and balance of data processing. Then one or more independent processing threads are assigned to each data shard. This achieves parallel processing of data and significantly improves the data processing speed. In the process of thread allocation, using the thread management mechanism, the system can dynamically adjust the number of threads according to the current system resource usage. When the system resources are sufficient, the number of threads can be increased to increase the processing speed; when the system resources are tight, the number of threads can be reduced to avoid excessive resource consumption.

[0054] Then, a series of logical operators are defined for the data processing logic within each data shard. These logical operators can be operations such as data cleaning, conversion, aggregation, and analysis. By building a logical operator thread pool here, multiple processing steps of data in a single thread can be executed simultaneously. In this way, each data shard can be processed in parallel on multiple logical operator threads, further compressing the data processing time.

[0055] The above process can realize multi-threaded processing of data, but in this process, the present application introduces an intelligent load balancing strategy to monitor the processing progress of each thread and the occupancy of system resources, and dynamically adjusts the data allocation strategy and thread execution plan based on this information; and integrates an error recovery mechanism to capture exceptions during data processing, and when any thread processing fails, ensure that it does not affect the normal execution of other threads, and can automatically retry or roll back the data processing status. Specifically, the present application introduces an intelligent algorithm to automatically monitor the processing progress of each thread and the occupancy of system resources. This includes real-time monitoring of resources such as CPU, memory, and disk I / O. Then, based on the monitoring results, the system can dynamically adjust the data allocation strategy and thread execution plan. For example, when the amount of data processed by a thread is too large or the processing speed is too slow, the system can transfer part of the data to other idle threads for processing to ensure system load balancing and avoid resource bottlenecks. During the data processing process, the system will capture and record various abnormal situations, such as data errors, calculation errors, system errors, etc. At the same time, it should be noted that when a thread fails to process, the system will not immediately interrupt the entire processing flow, but will try to automatically recover or retry the processing of the thread. If recovery or retry fails, the system can also roll back the data to its previous state to ensure the integrity and reliability of data processing.

[0056] It can be seen that this application aims to achieve efficient and stable processing of large data sets and improve the overall performance of the system by dynamically allocating data processing tasks to multiple threads, executing data processing logic in parallel, and combining intelligent load balancing, error recovery and other mechanisms. And through concurrent processing strategies, the data processing speed and system responsiveness are significantly improved, which can overcome the problems of low system resource utilization and long processing cycle in the traditional single-threaded data processing method when facing massive data. This application is suitable for big data analysis and data processing tasks in cloud computing environments. By dynamically allocating data processing tasks to multiple threads and executing data processing logic in parallel, it effectively shortens data processing time and improves the overall performance of the system. Through intelligent management and optimization of system resources, it ensures efficient and stable processing, and provides strong technical support for various big data application scenarios.

[0057] See also Figure 3 As shown, an embodiment of the present invention discloses a multi-threaded data processing device, including:

[0058] A processing thread allocation module 11 is used to slice the batch data to be processed to obtain corresponding data slices, and allocate at least one processing thread to each of the data slices;

[0059] A data processing module 12 is used to determine a corresponding logical operator based on the processing logic of the data in each of the data slices, and execute the logical operator corresponding to the data slice in parallel in each of the processing threads to complete data processing on each of the data slices;

[0060] The processing thread monitoring module 13 is used to monitor each processing thread in real time during the process of processing each data slice, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results.

[0061] When processing multi-threaded data, the present application first slices the batch data to be processed to obtain the corresponding data slices, and allocates at least one processing thread to each data slice; then determines the corresponding logical operator based on the processing logic of the data in each data slice, and executes the logical operator corresponding to the data slice in parallel in each processing thread to complete the data processing of each data slice; finally, in the process of data processing for each data slice, monitors each processing thread in real time, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results. It can be seen that the present application effectively shortens the data processing time and improves the overall performance of the system by dynamically allocating multiple threads of data processing tasks to execute data processing logic in parallel; significantly improves the data processing speed and the responsiveness of the system through concurrent processing strategies, so as to overcome the problems of low system resource utilization and long processing cycle in the traditional single-threaded data processing method when facing massive data; further compresses the data processing time through the parallel execution of data logic operators; and through the intelligent management and optimization of system resources, ensures the efficiency and stability of the processing process, and provides strong technical support for various big data application scenarios.

[0062] In some specific embodiments, the processing thread allocation module 11 may specifically include:

[0063] The data shard acquisition unit is used to slice the batch data to be processed based on the data volume and processing complexity of the batch data to be processed to obtain corresponding data shards.

[0064] In some specific embodiments, the device may further include:

[0065] A quantity adjustment module is used to dynamically adjust the number of processing threads according to the current usage of system resources;

[0066] A quantity increasing module, used for increasing the quantity of the processing threads if the current system resources meet the preset conditions;

[0067] The number reduction module is used to reduce the number of the processing threads if the current system resources do not meet the preset conditions.

[0068] In some specific embodiments, the logical operator includes any one or a combination of data cleaning, data conversion, data aggregation and data analysis operations.

[0069] In some specific embodiments, the processing thread monitoring module 13 may specifically include:

[0070] A real-time monitoring unit, used to monitor the processing progress of each processing thread and the occupation of system resources in real time; the system resources include central processing unit resources, memory resources and disk input and output resources;

[0071] The strategy and plan adjustment unit is used to adjust the data allocation strategy and thread execution plan based on the corresponding monitoring results.

[0072] In some specific embodiments, the device may further include:

[0073] A data processing failure operation module, used for performing an automatic recovery operation or a retry operation of the target processing thread if the target processing thread fails in data processing;

[0074] A first judgment result execution module, configured to roll back corresponding data if the automatic recovery operation or the retry operation fails;

[0075] The second judgment result execution module is used to continue the data processing operation of the target processing thread if the automatic recovery operation or the retry operation is successful.

[0076] In some specific embodiments, the device may further include:

[0077] The abnormal situation acquisition module is used to acquire and record the abnormal situation in the data processing process of each processing thread, so that the staff can analyze and summarize the data processing operation based on the abnormal situation; the abnormal situation includes any one or a combination of data errors, calculation errors and system errors.

[0078] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.

[0079] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the multi-threaded data processing method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be an electronic computer.

[0080] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0081] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.

[0082] The operating system 221 is used to manage and control the hardware devices on the electronic device 20 and the computer program 222, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the multi-threaded data processing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0083] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the multi-threaded data processing method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.

[0084] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0085] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0086] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0087] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0088] The technical solution provided by the present application is introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for general technicians in this field, according to the idea of ​​the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A multi-threaded data processing method, characterized in that: include: Slice the batch data to be processed to obtain corresponding data slices, and assign at least one processing thread to each of the data slices; Determine corresponding logic operators based on the processing logic of the data in each of the data shards, and execute the logic operators corresponding to the data shards in parallel in each of the processing threads to complete data processing on each of the data shards; During the process of processing the data on each of the data slices, each of the processing threads is monitored in real time, so as to make corresponding adjustments to the processing threads or the data slices based on corresponding monitoring results.

2. The multi-threaded data processing method according to claim 1, characterized in that: The step of slicing the batch data to be processed to obtain corresponding data slicing includes: The batch data to be processed is segmented based on the data volume and processing complexity of the batch data to be processed to obtain corresponding data segments.

3. The multi-threaded data processing method according to claim 1, characterized in that: Also includes: Dynamically adjust the number of processing threads according to the current system resource usage; If the current system resources meet the preset conditions, then increase the number of the processing threads; If the current system resources do not meet the preset conditions, the number of the processing threads is reduced.

4. The multi-threaded data processing method according to claim 1, characterized in that: The logical operators include any one or a combination of data cleaning, data conversion, data aggregation and data analysis operations.

5. The multi-threaded data processing method according to claim 1, characterized in that: The real-time monitoring of each processing thread so as to adjust the processing thread or the data slice accordingly based on the corresponding monitoring result includes: Real-time monitoring of the processing progress of each processing thread and the occupation of system resources; the system resources include central processing unit resources, memory resources and disk input and output resources; Adjust the data allocation strategy and thread execution plan based on the corresponding monitoring results.

6. The multi-threaded data processing method according to claim 1, characterized in that: Also includes: If the target processing thread fails in data processing, an automatic recovery operation or a retry operation of the target processing thread is performed; If the automatic recovery operation or the retry operation fails, the corresponding data is rolled back; If the automatic recovery operation or the retry operation is successful, the data processing operation of the target processing thread continues.

7. The multi-threaded data processing method according to any one of claims 1 to 6, characterized in that: Also includes: Acquire and record abnormal conditions in the data processing process of each processing thread so that the staff can analyze and summarize the data processing operation based on the abnormal conditions; the abnormal conditions include any one or a combination of data errors, calculation errors and system errors.

8. A multi-threaded data processing device, characterized in that: include: A processing thread allocation module, used for slicing the batch data to be processed to obtain corresponding data slices, and respectively allocating at least one processing thread to each of the data slices; A data processing module, used to determine a corresponding logical operator based on the processing logic of the data in each of the data shards, and execute the logical operator corresponding to the data shard in parallel in each of the processing threads to complete data processing on each of the data shards; The processing thread monitoring module is used to monitor each processing thread in real time during the process of processing each data slice, so as to make corresponding adjustments to the processing thread or the data slice based on the corresponding monitoring results.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the multi-threaded data processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store a computer program, which, when executed by a processor, implements the multi-threaded data processing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Method and system for processing multi-thread data in sequence in frequency regulation control

    CN119025284A

  • A method and system for sequentially processing multi-threaded data in frequency regulation control

    CN119025284B