Data transmission method, device, equipment and storage medium
By grouping and allocating data to multiple service nodes for isolated consumption, it solves the problem of memory exhaustion and data congestion caused by data import and export in large-scale service scenarios, and improves system stability and efficiency.
Patent Information
- Application Number
- CN202311624648.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-11-29
AI Technical Summary
In large-scale service scenarios, unrestricted data import and export may lead to memory exhaustion and data congestion in the business system, affecting system stability.
By obtaining the number of rows of data to be transmitted, grouping and allocating matching consumption channels, the data is evenly distributed to multiple service nodes for isolated consumption, monitoring service node abnormalities and performing failover, and performing security monitoring and desensitization processing.
It effectively avoids memory exhaustion and data congestion caused by unlimited and disordered data import and export, and improves system stability and efficiency.
Smart Images

Figure CN117608877B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to data transmission technology, and in particular to a data transmission method, device, equipment and storage medium. Background Art
[0002] In the development process of various application systems, in order to meet users' demands for batch processing and rapid extraction of data, the function of importing and exporting table data has become a high-frequency product requirement and often appears in the development list.
[0003] In large-scale service scenarios, as business complexity increases, similar scenarios will become more and more common in order to improve the efficiency of importing and exporting data. However, if centralized import and export are performed without restrictions or order, it will cause fatal memory exhaustion problems in the business system. Summary of the invention
[0004] The present invention provides a data transmission method, device, equipment and storage medium to achieve reasonable planning of consumption capacity, avoid unlimited and disordered centralized import and export that will bring fatal memory exhaustion problems to the business system, avoid data congestion caused by abnormalities of a single service node, and improve system stability.
[0005] In a first aspect, the present invention provides a data transmission method, comprising:
[0006] Acquire target data to be transmitted, and parse the target data to obtain the number of data rows to be transmitted;
[0007] Take the preset number of rows as a group and calculate the data volume of each group of data;
[0008] Allocate a consumption channel that matches the data volume of each group of data to each group of data;
[0009] Each group of data is evenly distributed to multiple service nodes under the corresponding consumption channel for isolated consumption.
[0010] Optionally, before obtaining the target data to be transmitted, the following steps are further included:
[0011] Get the registration request of the service node;
[0012] Generating a hash code uniquely corresponding to the service node in a local cache based on the registration request;
[0013] Submit the hash code, the name of the service node and the domain name of the service node to the registration center to complete the registration.
[0014] Optionally, the data transmission method further includes:
[0015] Sending a heartbeat signal to the service node to monitor whether the service node has any abnormality;
[0016] If yes, the failover strategy is executed.
[0017] Optionally, the data transmission method further includes:
[0018] When the target data to be transmitted is data to be imported, performing security monitoring on the target data;
[0019] When the security monitoring is passed, executing the step of parsing the number of data rows to be transmitted from the target data;
[0020] When the security monitoring fails, a business abnormality reminder is issued;
[0021] When the target data to be transmitted is data to be exported, the target data is desensitized to remove sensitive information.
[0022] Optionally, the target data is desensitized to remove sensitive information, including:
[0023] Find sensitive fields from the target data;
[0024] The information stored in the sensitive field is desensitized.
[0025] Optionally, a consumption channel matching the data volume of each group of data is allocated, including:
[0026] Determine whether the amount of each set of data is greater than a preset value;
[0027] If yes, the group of data is assigned to the first consumption channel;
[0028] If not, the group of data is allocated to a second consumption channel, wherein the processing flow of the first consumption channel is greater than the processing flow of the second consumption channel.
[0029] Optionally, each group of data is evenly distributed to multiple service nodes under the corresponding consumption channel for isolated consumption, including:
[0030] For each of the service nodes, read the number of workers from the data allocated to the service node;
[0031] Start a number of task threads equal to the number of workers.
[0032] In a second aspect, the present invention further provides a data transmission device, comprising:
[0033] A data acquisition module, used to acquire target data to be transmitted, and parse the number of data rows to be transmitted from the target data;
[0034] A data volume calculation module, used to calculate the data volume of each group of data by taking a preset number of rows as a group;
[0035] A channel allocation module is used to allocate a consumption channel matching the data volume of each group of data;
[0036] The isolated consumption module is used to evenly distribute each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption.
[0037] In a third aspect, the present invention further provides an electronic device, comprising:
[0038] one or more processors;
[0039] A storage device for storing one or more programs;
[0040] When the one or more programs are executed by the one or more processors, the one or more processors implement the data transmission method provided in the first aspect of the present invention.
[0041] In a fourth aspect, the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the data transmission method provided in the first aspect of the present invention.
[0042] The data transmission method provided by the embodiment of the present invention includes: obtaining target data to be transmitted, parsing the number of data rows to be transmitted from the target data, taking the preset number of rows as a group, calculating the data volume of each group of data, allocating a consumption channel matching the data volume of the group of data to each group of data, and evenly distributing each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption, so as to achieve reasonable planning of consumption capacity, avoid the fatal memory exhaustion problem caused by unlimited and disordered centralized import and export to the business system, avoid data congestion caused by abnormality of a single service node, and improve system stability.
[0043] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0045] Figure 1A flowchart of a data transmission method provided by an embodiment of the present invention;
[0046] Figure 2 A schematic diagram of the structure of a data transmission device provided by an embodiment of the present invention;
[0047] Figure 3 A schematic structural diagram of an electronic device provided by an embodiment of the present invention.
[0048] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0049] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present invention.
[0050] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0051] Figure 1 This is a flow chart of a data transmission method provided by an embodiment of the present invention. This embodiment is applicable to the case of large-volume data import and export. The method can be executed by a data transmission device provided by an embodiment of the present invention. The device can be implemented by software and / or hardware and is usually configured in an electronic device, such as Figure 1 As shown, the data transmission method specifically includes the following steps:
[0052] S101, obtaining target data to be transmitted, and parsing the number of data rows to be transmitted from the target data.
[0053] In an embodiment of the present invention, the target data to be transmitted may be data to be imported into a business system, or data to be exported from a business system, which is not limited in the embodiment of the present invention. After acquiring the target data to be transmitted, the target data is parsed to parse out the number of rows of data to be transmitted. In an embodiment of the present invention, the import and export of data is performed in the form of rows or columns. For example, when importing data, the table data is imported into the business system in the form of rows or columns, and when exporting data, the data is exported to the table in the form of rows or columns.
[0054] For example, taking data import as an example, in response to a data import request sent by a user at the business end, the address of the data to be imported is obtained from the data import request. The target data to be imported is obtained according to the address of the data to be imported, and the number of data rows to be transmitted is parsed from the target data.
[0055] Exemplarily, taking data export as an example, in response to a data export request sent by a user at the business end, the address of the data to be exported is obtained from the data export request. The target data to be exported is obtained according to the address of the data to be exported, and the number of data rows to be transmitted is parsed from the target data.
[0056] S102, taking a preset number of rows as a group, and calculating the data volume of each group of data.
[0057] In the embodiment of the present invention, the data is divided into multiple groups with a preset number of rows as one group, and the data volume of each group of data is calculated. Exemplarily, in the embodiment of the present invention, one row of data is taken as one group, or multiple rows of data are taken as one group, which is not limited in the embodiment of the present invention.
[0058] S103: Allocate a consumption channel that matches the data volume of each group of data.
[0059] In an embodiment of the present invention, the system presets multiple consumption channels, each of which may have different data processing capabilities (i.e., processing traffic). After calculating the data volume of each group of data, a consumption channel matching the data volume of the group of data is allocated to each group of data.
[0060] Exemplarily, in some embodiments of the present invention, the business system presets two groups of consumption channels, namely the first consumption channel and the second consumption channel, and the processing flow of the first consumption channel is greater than the processing flow of the second consumption channel. After calculating the data volume of each group of data, it is determined whether the data volume of each group of data is greater than the preset value. If so, the group of data is allocated to the first consumption channel; if not, the group of data is allocated to the second consumption channel.
[0061] Exemplarily, four task tables are set for each group of consumption channels, for a total of eight task tables. The number of task tables can be set accordingly according to the processing flow of the consumption channels, and expansion is supported, which is not limited in the embodiment of the present invention.
[0062] S104: Evenly distribute each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption.
[0063] In an embodiment of the present invention, multiple service nodes are set under each consumption channel. After each group of data is assigned a consumption channel that matches the data volume of the group of data, each group of data is evenly distributed to the multiple service nodes under the corresponding consumption channel for isolated consumption, thereby realizing reasonable planning of consumption capacity, avoiding unlimited and disordered centralized import and export that will bring fatal memory exhaustion problems to the business system, avoiding data congestion caused by abnormalities of a single service node, and improving system stability.
[0064] Exemplarily, in an embodiment of the present invention, for each service node, the number of workers is read from the data allocated to the service node, and task threads equal to the number of workers are started. The data allocated to the service node is evenly distributed to the task group under the service node, so as to achieve the isolation of data consumption between processes and threads. A worker is an independently running process or thread that can work in parallel with the main program to execute some tasks that are time-consuming or require a large amount of computing resources. Concurrent processing is achieved by assigning these tasks to different workers, thereby improving the efficiency of program operation. Workers usually communicate with the main program through message queues or event triggering mechanisms. The main program can send tasks to workers and obtain their execution results. Workers can achieve concurrent processing through multi-threading. Each worker has its own independent memory space and execution environment, so problems caused by competition conditions and data sharing can be avoided. By reasonably assigning tasks to different workers and taking advantage of the performance of multi-core CPUs, system resources can be fully utilized.
[0065] This asynchronous method can effectively avoid blocking the main program, making the system more stable and reliable.
[0066] The data transmission method provided by the embodiment of the present invention includes: obtaining target data to be transmitted, parsing the number of data rows to be transmitted from the target data, taking the preset number of rows as a group, calculating the data volume of each group of data, allocating a consumption channel matching the data volume of the group of data to each group of data, and evenly distributing each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption, so as to achieve reasonable planning of consumption capacity, avoid the fatal memory exhaustion problem caused by unlimited and disordered centralized import and export to the business system, avoid data congestion caused by abnormality of a single service node, and improve system stability.
[0067] Exemplarily, in some embodiments of the present invention, the service node may be pre-registered. Exemplarily, a registration request of the service node is obtained, a hash code uniquely corresponding to the service node is generated in a local cache based on the registration request, and the hash code, the name of the service node, and the domain name of the service node are submitted to a registration center to complete the registration. Exemplarily, the registration center dynamically files a unique code for task data isolation and allocation.
[0068] Exemplarily, in some embodiments of the present invention, after the service node completes registration, the service node can be tested to detect whether the service node is abnormal. Exemplarily, a heartbeat signal is sent to the service node to monitor whether the service node is abnormal. If so, a failover strategy is executed. The heartbeat signal is a method of sending a very small data packet to the other party of the interconnection at regular intervals, and judging whether the communication link between the two parties of the interconnection has been disconnected by the other party's reply. Exemplarily, if the service node is offline, it will automatically stop and initiate an invalidation application. If it monitors for long-term 500 system anomalies or user-defined anomalies that reach the upper limit, it will automatically stop and mark the anomaly to form an operation report, a graded alarm, etc. The embodiments of the present invention are not limited here.
[0069] In some embodiments of the present invention, when the target data to be transmitted is the data to be imported, that is, when the data is imported, security monitoring is performed on the target data, for example, file type detection, access to a third-party security service to detect file viruses, etc. When the security monitoring passes, the step of parsing the number of data rows to be transmitted from the target data is executed. When the security monitoring fails, a business abnormality reminder is issued to remind the user to upload again.
[0070] Exemplarily, in some embodiments of the present invention, when data is imported, the target data to be substituted may also be subject to security process approval. After the security process approval is completed, the step of parsing the number of data rows to be transmitted from the target data is executed.
[0071] In some embodiments of the present invention, when the target data to be transmitted is the data to be exported, that is, when the data is exported, the target data is desensitized to remove sensitive information. Among them, sensitive information includes the user's real name, ID number, telephone number, address information, etc. Exemplarily, sensitive fields are searched from the target data, and the information stored in the sensitive fields is desensitized. Desensitization refers to a technical measure that processes sensitive fields in the original data without affecting the accuracy of the data analysis results, thereby reducing data sensitivity and reducing personal privacy risks. Desensitization includes de-identification and anonymization in terms of effect. De-identification refers to the technical processing of personal information so that the subject of personal information cannot be identified without the help of additional information. Anonymization refers to the process of technical processing of personal information so that the subject of personal information cannot be identified or associated, and the processed information cannot be restored.
[0072] The embodiment of the present invention further provides a data transmission device, Figure 2 A schematic diagram of a data transmission device according to an embodiment of the present invention is shown in FIG. Figure 2 As shown, the data transmission device includes:
[0073] The data acquisition module 201 is used to acquire the target data to be transmitted, and parse the number of data rows to be transmitted from the target data;
[0074] A data volume calculation module 202, used to calculate the data volume of each group of data by taking a preset number of rows as a group;
[0075] A channel allocation module 203 is used to allocate a consumption channel matching the data volume of each group of data;
[0076] The isolated consumption module 204 is used to evenly distribute each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption.
[0077] In some embodiments of the present invention, the data transmission device further includes:
[0078] A registration request acquisition module, used to acquire a registration request of a service node before acquiring target data to be transmitted;
[0079] A hash code generation module, configured to generate a hash code uniquely corresponding to the service node in a local cache based on the registration request;
[0080] The registration submission module is used to submit the hash code, the name of the service node and the domain name of the service node to a registration center to complete the registration.
[0081] In some embodiments of the present invention, the data transmission device further includes:
[0082] A heartbeat signal sending module, used to send a heartbeat signal to the service node to monitor whether the service node has an abnormality;
[0083] The failover module is used to execute the failover strategy when an abnormality occurs in the service node.
[0084] In some embodiments of the present invention, the data transmission device further includes:
[0085] A security monitoring module, used for performing security monitoring on the target data to be transmitted when the target data to be imported is data to be imported;
[0086] An execution module, configured to execute the step of parsing the number of data rows to be transmitted from the target data when the security monitoring passes;
[0087] An abnormality reminder module is used to issue a business abnormality reminder when the security monitoring fails;
[0088] The desensitizing module is used to perform desensitizing processing on the target data to be transmitted and remove sensitive information when the target data to be transmitted is data to be exported.
[0089] In some embodiments of the present invention, the desensitization module includes:
[0090] A sensitive field search submodule, used to search for sensitive fields from the target data;
[0091] The desensitizing submodule is used to perform desensitization processing on the information stored in the sensitive field.
[0092] In some embodiments of the present invention, the channel allocation module 203 includes:
[0093] A judgment submodule is used to judge whether the amount of each set of data is greater than a preset value;
[0094] A first allocation submodule, used for allocating the group of data to the first consumption channel when the amount of data is greater than a preset value;
[0095] The first allocation submodule is used to allocate the group of data to the second consumption channel when the data volume is less than or equal to a preset value, wherein the processing flow of the first consumption channel is greater than the processing flow of the second consumption channel.
[0096] In some embodiments of the present invention, the isolated consumption module 204 includes:
[0097] A reading submodule, configured to read, for each of the service nodes, the number of workers from the data allocated to the service node;
[0098] The thread starting submodule is used to start task threads equal to the number of the workers.
[0099] The above-mentioned data transmission device can execute the data transmission method provided by the above-mentioned embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the data transmission method.
[0100] Figure 3 A schematic diagram of the structure of an electronic device provided for an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0101] like Figure 3 As shown, the electronic device includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0102] A number of components in the electronic device are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0103] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs the various methods and processes described above, such as a data transmission method.
[0104] In some embodiments, the data transmission method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the data transmission method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the data transmission method in any other appropriate manner (e.g., by means of firmware).
[0105] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0106] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0107] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0108] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0109] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0110] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0111] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the data transmission method provided in any embodiment of the present application.
[0112] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0113] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0114] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A data transmission method, characterized in that: include: Acquire target data to be transmitted, and parse the target data to obtain the number of data rows to be transmitted; Take the preset number of rows as a group and calculate the data volume of each group of data; Allocate a consumption channel that matches the data volume of each group of data to each group of data; Evenly distribute each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption; Each group of data is evenly distributed to multiple service nodes under the corresponding consumption channel for isolated consumption, including: For each of the service nodes, read the number of workers from the data allocated to the service node; Start task threads equal to the number of workers; Before obtaining the target data to be transmitted, it also includes: Get the registration request of the service node; Generating a hash code uniquely corresponding to the service node in a local cache based on the registration request; Submit the hash code, the name of the service node, and the domain name of the service node to a registration center to complete the registration; The data transmission method also includes: Sending a heartbeat signal to the service node to monitor whether the service node has any abnormality; If yes, then execute the failover strategy; Assign a consumption channel that matches the amount of data in each group of data to each group of data, including: Determine whether the amount of each set of data is greater than a preset value; If yes, the group of data is assigned to the first consumption channel; If not, the group of data is allocated to a second consumption channel, wherein the processing flow of the first consumption channel is greater than the processing flow of the second consumption channel.
2. The data transmission method according to claim 1, characterized in that: Also includes: When the target data to be transmitted is data to be imported, performing security monitoring on the target data; When the security monitoring is passed, executing the step of parsing the number of data rows to be transmitted from the target data; When the security monitoring fails, a business abnormality reminder is issued; When the target data to be transmitted is data to be exported, the target data is desensitized to remove sensitive information.
3. The data transmission method according to claim 2, characterized in that: Desensitize the target data to remove sensitive information, including: Find sensitive fields from the target data; The information stored in the sensitive field is desensitized.
4. A data transmission device, characterized in that: include: A data acquisition module, used to acquire target data to be transmitted, and parse the number of data rows to be transmitted from the target data; A data volume calculation module, used to calculate the data volume of each group of data by taking a preset number of rows as a group; A channel allocation module is used to allocate a consumption channel matching the data volume of each group of data; The isolated consumption module is used to evenly distribute each group of data to multiple service nodes under the corresponding consumption channel for isolated consumption; The isolated consumption modules include: A reading submodule, configured to read, for each of the service nodes, the number of workers from the data allocated to the service node; A thread starting submodule, used to start task threads equal to the number of the workers; The data transmission device also includes: A registration request acquisition module, used to acquire a registration request of a service node before acquiring target data to be transmitted; A hash code generation module, configured to generate a hash code uniquely corresponding to the service node in a local cache based on the registration request; A registration submission module, used to submit the hash code, the name of the service node and the domain name of the service node to a registration center to complete the registration; The data transmission device also includes: A heartbeat signal sending module, used to send a heartbeat signal to the service node to monitor whether the service node has an abnormality; A failover module, used to execute a failover strategy when an abnormality occurs in the service node; The channel allocation module includes: A judgment submodule is used to judge whether the amount of each set of data is greater than a preset value; A first allocation submodule, used for allocating the group of data to the first consumption channel when the amount of data is greater than a preset value; The first allocation submodule is used to allocate the group of data to the second consumption channel when the data volume is less than or equal to a preset value, wherein the processing flow of the first consumption channel is greater than the processing flow of the second consumption channel.
5. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the data transmission method as described in any one of claims 1-3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data transmission method according to any one of claims 1 to 3 is implemented.
