Batch processing system
By designing the data source, collector and processor modules of the batch processing system, the problem of inflexible configuration processing in the existing technology is solved, lightweight batch processing adapted to a variety of downstream systems is realized, and development and data processing are improved. efficiency.
Patent Information
- Application Number
- CN202410908150.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-10-18
AI Technical Summary
Existing technology cannot flexibly handle batch processing problems in different scenarios through configuration, and data acquisition is inflexible, and the requirements for adapting to scenarios such as financial agency marketing are complex.
A batch processing system is designed, including a data source module, a collector module and a processor module. Data is obtained through the data source module. The collector module integrates the data into batches and sends them to the processor module. The processor module communicates with downstream systems. Docking processing, supporting docking and configuration processing of multiple downstream systems.
It implements a lightweight batch processing method that adapts to a variety of downstream systems, improves development and data processing efficiency, supports reading from multiple data sources and downstream docking, and simplifies the processing process through configuration.
Smart Images

Figure CN118796276A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of batch processing, and in particular to a batch processing system. Background Art
[0002] In some current scenarios, there will be multiple scenarios for connecting to multiple customers, but the connection protocols and restrictions will be different for each scenario. For example, in financial marketing scenarios, these scenarios will involve batch processing, such as database collision, data feedback, three-party data matching, and downstream batch matching. Different downstreams have different protocols and processing methods for the same scenario.
[0003] There are currently two solutions. The first is to use message queues, which can be used to collect pending messages, handle different scenarios according to different topics, aggregate messages on the consumer side, and process them uniformly. However, different scenarios require complex logical processing, aggregation, and retry on failure on the consumer side. Therefore, message queues are suitable for single message processing to eliminate peaks and decouple, but are not very friendly to batch aggregation. The second is to use Flink for processing. Flink's pipeline runtime system can execute batch and stream processing programs, which can solve the problem of batch processing. However, compared with financial marketing scenarios, it is heavier and not lightweight enough, and is more complicated to implement. At the same time, Flink has a strong batch processing abstraction capability and cannot be configured to handle different scenarios. Summary of the invention
[0004] In view of this, an object of the present invention is to provide a batch processing system to solve the problems in the prior art that different scenarios cannot be processed through configuration and data acquisition is inflexible.
[0005] According to a first aspect of an embodiment of the present invention, there is provided a batch processing system, comprising:
[0006] The data source module is used to connect with multiple data sources and obtain data from each data source;
[0007] The collector module is used to collect and integrate the data obtained by the data source module into multiple batches according to a preset batch number, and send the data of the multiple batches to the processor module;
[0008] The processor module is used to connect with the downstream system. After receiving multiple batches of data, the processor or the downstream system is used to process the data to obtain processing results.
[0009] Preferably, the collector module is also used to obtain the processing results of each batch of data from the processor module and record the location of the processed batch of data; if the processing result is failure, after receiving a reprocessing instruction, the batch of data is resent to the processor module from the recorded location.
[0010] Preferably, the collector module is further used to persist the processing results of each batch after obtaining the processing results; if a reprocessing instruction is received, the data of the batch with a failed processing result is sent to the processor module.
[0011] Preferably, the collector module is also used to set a preset number of batches as a minimum heap after obtaining the processing results. If the processing results of the batches in the minimum heap fail, the data of the batches included in the minimum heap are sent to the processor module after receiving a reprocessing instruction.
[0012] Preferably, after receiving multiple batches of data, the processor module selects a single-thread processing mode or a multi-thread processing mode according to a pre-acquired thread selection instruction.
[0013] Preferably, before using the downstream system to process the data, the processor module obtains the maximum number of batches that can be processed simultaneously by the downstream system, and limits the number of batches allocated to the downstream system for processing based on the maximum number of batches that can be processed simultaneously by the downstream system.
[0014] Preferably, when the processor module processes the data using the downstream system, it constructs request parameters according to the batch of data to be processed and sends the request parameters to the downstream system;
[0015] The processor module receives a response field returned by the downstream system, and parses the response field to obtain a processing result.
[0016] Preferably, when acquiring data from a data source, the data source module generates an end tag and sends the end tag to the collector module if an end marker in the data source is detected.
[0017] The technical solution provided by the embodiments of the present invention may have the following beneficial effects:
[0018] It is understandable that the technical solution shown in the present invention is used to connect with multiple data sources through the data source module to obtain data from each data source; through the collector module, it is used to collect and integrate the data obtained by the data source module into multiple batches according to the preset batch number, and send the multiple batches of data to the processor module; through the processor module, it is used to connect with the downstream system, and after receiving the multiple batches of data, the data is processed by the processor or the downstream system to obtain the processing results. It is understandable that the technical solution shown in the present invention can adapt to a variety of downstream systems, provide a flexible and lightweight batch processing method, can realize the reading of multiple data sources through configuration, and can flexibly configure the processor to support multiple downstream connections, effectively improving the development and data processing efficiency.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0021] Figure 1 is a schematic block diagram of a batch processing system according to an exemplary embodiment;
[0022] Figure 2 It is a flowchart of a batch processing system according to an exemplary embodiment. DETAILED DESCRIPTION
[0023] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0024] In one embodiment, Figure 1 is a schematic block diagram of a batch processing system according to an exemplary embodiment. Figure 1 , providing a batch processing system, comprising:
[0025] The data source module is used to connect to multiple data sources and obtain data from each data source.
[0026] The collector module is used to collect and integrate the data obtained by the data source module into multiple batches according to a preset batch number, and send the data of the multiple batches to the processor module;
[0027] The processor module is used to connect with the downstream system. After receiving multiple batches of data, the processor or the downstream system is used to process the data to obtain processing results.
[0028] In specific practice, Figure 2 is a flowchart of a batch processing system according to an exemplary embodiment. Figure 2 The data source module is responsible for reading data from various data sources, such as files, FTP, databases, etc., which can be flexibly expanded. After reading the data, it sends the data to the collection module.
[0029] Preferably, when acquiring data from a data source, the data source module generates an end tag and sends the end tag to the collector module if an end marker in the data source is detected.
[0030] An end marker is set in each data source. When the data source module continuously acquires data, once the end marker is read, it means that the data in the data source has been read, and an end marker can be generated and sent to the collector module.
[0031] The collector module is responsible for collecting data. Since different processors require different batches to be processed each time, the collection quantity will be based on the pre-set batch quantity. After the collection is completed, it will be pushed to the downstream processor to complete the batch collection.
[0032] It should be noted that the collector module is also used to obtain the processing results of each batch of data from the processor module and record the location of the processed batch of data; if the processing result is failure, after receiving the reprocessing instruction, the batch of data is resent to the processor module from the recorded location.
[0033] In actual practice, for each batch of data processing, the callback processing results are recorded, and the processing location is persisted after successful processing. If downstream processing fails, after the task is resubmitted, breakpoint processing can be performed from the place where the last processing was completed to prevent repeated consumption of messages, comprehensively considering the issues of temporary resources and repeated consumption.
[0034] There are two ways to handle breakpoints:
[0035] For the first breakpoint processing method, it should be noted that the collector module is also used to persist the processing results of each batch after obtaining the processing results; if a reprocessing instruction is received, the data of the batch with failed processing results is sent to the processor module.
[0036] For example, there are three batches of data, namely the first batch, the second batch and the third batch. After each batch receives the processing results, the processing results of each batch are persisted. Among them, if the first batch is successful, the second batch is failed, and the third batch is successful, then after receiving the reprocessing instruction, only the second batch of data needs to be resent to the processor module for reprocessing.
[0037] It is understandable that this processing method persists the information of each successful processing. The advantage is that it ensures no repeated consumption when data is repeatedly processed, but it occupies a large amount of memory.
[0038] The second breakpoint processing method, it should be noted that the collector module is also used to set a preset number of batches as a minimum heap after obtaining the processing results. If the processing results of the batches in the minimum heap fail, then after receiving the reprocessing instruction, the data of the batches contained in the minimum heap are sent to the processor module.
[0039] For example, there are nine batches of data, and every three batches form a minimum heap. The first minimum heap includes the first batch, the second batch, and the third batch. If the first batch is successful, the second batch fails, and the third batch is successful, then after receiving the reprocessing instruction, the data of the first batch, the second batch, and the third batch are resent to the processor module for reprocessing, wherein the data of the first batch and the data of the third batch are repeatedly processed. Preferably, when storing the minimum heap processing result, it is possible to store which batch has failed. If the first batch is successful, the second batch fails, and the third batch is successful, the data of the second batch and the batches thereafter are resent to the processor module for reprocessing, wherein the data of the third batch is repeatedly processed.
[0040] It is understandable that this processing method can maintain the minimum heap for storage. The disadvantage is that there is a risk of duplicate consumption, but it takes up less memory.
[0041] In practice, after receiving multiple batches of data, if the processor can process it by itself, there is no need to call the downstream system, and the processing results are generated after the processor processes it by itself. If the processor cannot process it by itself, it needs to call the downstream system.
[0042] It should be noted that after receiving multiple batches of data, the processor module selects a single-thread processing mode or a multi-thread processing mode according to a pre-acquired thread selection instruction.
[0043] In practice, the single-thread processing mode is a sequential processing mode, where the second batch of data is processed after the first batch of data is processed. The multi-thread processing mode is a mode where multiple threads are processed simultaneously. For example, if there are four threads, four batches of data can be processed simultaneously.
[0044] It should be noted that before using the downstream system to process the data, the processor module obtains the maximum number of batches that can be processed simultaneously by the downstream system, and limits the number of batches allocated to the downstream system for processing based on the maximum number of batches that can be processed simultaneously by the downstream system.
[0045] In actual practice, the processor module also has the function of flow limiter management, which can be responsible for batch processing flow limiting, limiting QPS according to the processing capacity of the downstream system, and preventing the downstream system from overloading.
[0046] It should be noted that when the processor module processes the data using the downstream system, it constructs request parameters according to the batch of data to be processed and sends the request parameters to the downstream system;
[0047] The processor module receives a response field returned by the downstream system, and parses the response field to obtain a processing result.
[0048] In specific practice, the connection with downstream systems is handled, including the calling method (HTTP, etc.), calling parameter construction and return parameter parsing. The calling parameters and response fields can be reused and improved through database configuration.
[0049] It is understandable that the technical solution shown in the present invention is used to connect with multiple data sources through the data source module and obtain data from each data source; the collector module is used to collect and integrate the data obtained by the data source module into multiple batches according to the preset batch number, and send the multiple batches of data to the processor module; the processor module is used to connect with the downstream system, and after receiving multiple batches of data, the processor or downstream system is used to process the data to obtain the processing results. It is understandable that the technical solution shown in the present invention can adapt to a variety of downstream systems, provide a flexible and lightweight batch processing method, can realize multiple data source reading through configuration, and can flexibly configure the processor to support multiple downstream docking. Lightweight and simple batch processing method: a lightweight and flexible batch processing method is realized through memory, heap, and thread pool, which can be directly applied to the system without occupying other redundant resources, and can be configured and flexibly applied. Efficient and flexible support for multiple downstream docking, batch reading, batch collection, and batch processing are integrated, and multiple downstream docking is supported in a configured manner, which effectively improves the development and data processing efficiency.
[0050] It can be understood that the same or similar parts of the above embodiments can be referenced to each other, and the contents not described in detail in some embodiments can refer to the same or similar contents in other embodiments.
[0051] It should be noted that, in the description of the present invention, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of the present invention, unless otherwise specified, the meaning of "plurality" refers to at least two.
[0052] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present invention includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present invention belong.
[0053] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0054] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0055] In addition, each functional unit in each embodiment of the present invention may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0056] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0057] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0058] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A batch processing system, characterized in that: include: The data source module is used to connect with multiple data sources and obtain data from each data source; The collector module is used to collect and integrate the data obtained by the data source module into multiple batches according to a preset batch number, and send the data of the multiple batches to the processor module; The processor module is used to connect with the downstream system. After receiving multiple batches of data, the processor or the downstream system is used to process the data to obtain processing results.
2. The batch processing system according to claim 1, characterized in that: The collector module is also used to obtain the processing result of each batch of data from the processor module and record the location of the processed batch of data; if the processing result is failure, after receiving a reprocessing instruction, the batch of data is resent to the processor module from the recorded location.
3. The batch processing system according to claim 2, characterized in that: The collector module is also used to persist the processing results of each batch after obtaining the processing results; if a reprocessing instruction is received, the data of the batch with a failed processing result is sent to the processor module.
4. The batch processing system according to claim 2, characterized in that: The collector module is also used to set a preset number of batches as a minimum heap after obtaining the processing results. If the processing results of the batches in the minimum heap fail, the data of the batches included in the minimum heap are sent to the processor module after receiving a reprocessing instruction.
5. The batch processing system according to claim 1, characterized in that: After receiving multiple batches of data, the processor module selects a single-thread processing mode or a multi-thread processing mode according to a pre-acquired thread selection instruction.
6. The batch processing system according to claim 1, characterized in that: Before using the downstream system to process the data, the processor module obtains the maximum number of batches that can be processed simultaneously by the downstream system, and limits the number of batches allocated to the downstream system for processing according to the maximum number of batches that can be processed simultaneously by the downstream system.
7. The batch processing system according to claim 1, characterized in that: When the processor module processes the data using the downstream system, the processor module constructs request parameters according to the batch of data to be processed and sends the request parameters to the downstream system; The processor module receives a response field returned by the downstream system, and parses the response field to obtain a processing result.
8. The batch processing system according to claim 1, characterized in that: When acquiring data from a data source, the data source module generates an end tag and sends the end tag to the collector module if an end mark in the data source is detected.
