Data writing channel management method and system for tenant-level resource isolation
Through the data writing channel management method of tenant-level resource isolation, combined with load balancing cluster, Kafka and SparkStreaming, the problem of low efficiency of Hadoop data warehouse in high-frequency data writing scenarios is solved, and efficient and scalable data writing is achieved. Automatically merge with small files, improving the timeliness and user experience of data downloading.
Patent Information
- Application Number
- CN202410102498.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-24
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2044-01-24
AI Technical Summary
In high-frequency near-real-time data writing scenarios, the existing Hive data warehouse based on Hadoop is difficult to efficiently write data from different sources to corresponding storage locations, and the timeliness of data placement is uncontrollable, and its applicable scenarios are limited.
Adopting the data writing channel management method of tenant-level resource isolation, by deploying a combination of load balancing clusters, multi-tenant isolation, data caching layer Kafka and SparkStreaming programs, setting up consumer groups and consumption instances, deploying file merging services, and implementing data writing channels On-demand configuration and automatic merging of small files.
It improves the efficiency and throughput of data writing, supports tenant-level resource isolation, automatically merges small files after data is placed on the disk, and the process is user-insensitive, realizing an scalable data writing channel.
Smart Images

Figure CN118860269A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data management, and in particular to a data writing channel management method and system for tenant-level resource isolation. Background Art
[0002] With the advancement of industrial informatization and intelligent development, the amount of data generated in industrial production and the value of production data are increasing. For the existing Hadoop-based Hive data warehouse, it is a big challenge to efficiently write data from different sources to the corresponding storage location in the high-frequency near-real-time data writing scenario while avoiding the small file problem.
[0003] In the prior art, a Chinese patent with application number 202310745568.5 discloses "a method and device for writing data into a large data warehouse". Although it can realize data writing into HDFS, the timeliness of data storage is uncontrollable and the applicable scenarios are limited. Summary of the invention
[0004] In view of the defects in the prior art, the object of the present invention is to provide a data writing channel management method and system with tenant-level resource isolation.
[0005] The data writing channel management method for tenant-level resource isolation provided by the present invention includes:
[0006] Step 1: Deploy a load balancing cluster;
[0007] Step 2: Perform multi-tenant isolation;
[0008] Step 3: After the data is written through the Rest gateway, it is sent to the data cache layer Kafka, and then consumed by the Spark Streaming program and written to HDFS. The combination of the data cache layer and the Spark Streaming program is used as the data writing channel;
[0009] Step 4: Set the consumption group and consumption instance to change the data consumption speed;
[0010] Step 5: Deploy a file merging service to monitor the number and size of files. When the number or size of files reaches the preset threshold, the small file merging is automatically triggered.
[0011] Preferably, data is written using the Restful API, the Rest service is deployed in cluster mode, supports horizontal expansion, uses Nginx as a load balancing service, and provides a unified access address to the outside world.
[0012] Preferably, data files are stored on the Hadoop distributed file system HDFS. The data files stored on HDFS provide query services to the outside world through the Impala query engine. The data table is first authorized on Impala before access. Different tenants can only see the tables and data under their own tenants. When writing data, it supports configuring the write channel at the tenant granularity. The data writing of different tenants will not affect each other. Tenants adjust the resources used by the channel according to their own data writing volume and configure on demand.
[0013] Preferably, STS provides a Web management page to manage data writing channels and configure writing policies. The configuration relationship between tenants and data writing channels is one-to-one or many-to-one. After the Rest gateway receives a user's request to write data, it queries the corresponding writing policy according to the tenant to which the user belongs, and sends the data to the corresponding writing channel according to the writing policy until it is finally written to the disk. The resources between channels are isolated, and the whole process is not affected by each other.
[0014] Preferably, when data is written to the cache layer Kafka, it is stored in different topics, consumed by Spark Streaming programs and written to HDFS; a group of Spark Streaming programs is called a consumer group, each consumer group is responsible for consuming data from one or more topics, and the consumer group is configured with a corresponding number of consumer instances based on the actual amount of data consumed. Within a preset range, when the number of consumer instances increases, the consumption speed increases linearly;
[0015] A consumer group contains one or more Spark streaming instances. Each consumer group subscribes to data from one or more topics from Kafka. The Spark streaming instance periodically pulls data from the subscribed topics from Kafka and writes it to HDFS. If data is accumulated, increase the number of consumer instances on the consumer group management page to speed up data consumption.
[0016] The data writing channel management system for tenant-level resource isolation provided by the present invention includes:
[0017] Module M1: Deploy a load balancing cluster;
[0018] Module M2: performs multi-tenant isolation;
[0019] Module M3: After the data is written through the Rest gateway, it is sent to the data cache layer Kafka, and then consumed by the SparkStreaming program and written to HDFS. The combination of the data cache layer and the Spark Streaming program is used as the data writing channel;
[0020] Module M4: Set consumption groups and consumption instances to change the data consumption speed;
[0021] Module M5: Deploy the file merging service, which is responsible for monitoring the number and size of files. When the number or size of files reaches the preset threshold, it automatically triggers the merging of small files.
[0022] Preferably, data is written using the Restful API, the Rest service is deployed in cluster mode, supports horizontal expansion, uses Nginx as a load balancing service, and provides a unified access address to the outside world.
[0023] Preferably, data files are stored on the Hadoop distributed file system HDFS. The data files stored on HDFS provide query services to the outside world through the Impala query engine. The data table is first authorized on Impala before access. Different tenants can only see the tables and data under their own tenants. When writing data, it supports configuring the write channel at the tenant granularity. The data writing of different tenants will not affect each other. Tenants adjust the resources used by the channel according to their own data writing volume and configure on demand.
[0024] Preferably, STS provides a Web management page to manage data writing channels and configure writing policies. The configuration relationship between tenants and data writing channels is one-to-one or many-to-one. After the Rest gateway receives a user's request to write data, it queries the corresponding writing policy according to the tenant to which the user belongs, and sends the data to the corresponding writing channel according to the writing policy until it is finally written to the disk. The resources between channels are isolated, and the whole process is not affected by each other.
[0025] Preferably, when data is written to the cache layer Kafka, it is stored in different topics, consumed by Spark Streaming programs and written to HDFS; a group of Spark Streaming programs is called a consumer group, each consumer group is responsible for consuming data from one or more topics, and the consumer group is configured with a corresponding number of consumer instances based on the actual amount of data consumed. Within a preset range, when the number of consumer instances increases, the consumption speed increases linearly;
[0026] A consumer group contains one or more Spark streaming instances. Each consumer group subscribes to data from one or more topics from Kafka. The Spark streaming instance periodically pulls data from the subscribed topics from Kafka and writes it to HDFS. If data is accumulated, increase the number of consumer instances on the consumer group management page to speed up data consumption.
[0027] Compared with the prior art, the present invention has the following beneficial effects:
[0028] The present invention provides a scalable data writing channel that can configure computing resources on demand to improve data throughput and writing efficiency; supports tenant-level resource isolation configuration; after data is stored on the disk, uses background services to monitor and automatically merge small files, and the merging process is imperceptible to users. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0030] Figure 1 Write a flowchart for data;
[0031] Figure 2 Write policy management page for xIn3Plat structured data service data. DETAILED DESCRIPTION
[0032] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.
[0033] Example 1
[0034] The present invention provides a data writing channel management method for tenant-level resource isolation, such as Figure 1 Users under different tenants write data to the STS Rest cluster of the Nginx proxy through the Rest interface. The data is sent to different topics of Kafka for cache according to the tenant to which the user belongs, and then consumed by the corresponding STS Streaming instance group and written to the Hadoop distributed file system. The small file merging service is responsible for monitoring and merging small files.
[0035] The specific implementation process includes the following steps:
[0036] 1. Load balancing cluster
[0037] Use the RESTful API to write data. The REST service is deployed in cluster mode to support horizontal expansion. Nginx is used as a load balancing service to provide a unified access address. The cluster mode can effectively improve the throughput of written data and meet the needs of high-frequency data writing.
[0038] 2. Multi-tenant isolation
[0039] Multi-tenant isolation function, data files are stored on the Hadoop Distributed File System (HDFS for short), and data files stored on HDFS provide query services to the outside world through the Impala query engine. Data tables need to be authorized on Impala before they can be accessed. Different tenants can only see the tables and data under their own tenants. When writing data, it supports configuring the write channel at the tenant granularity, and the data writing of different tenants will not affect each other. Tenants can adjust the resources used by the channel according to their own data writing volume and configure on demand.
[0040] 3. Data writing channel
[0041] After the data is written through the Rest gateway, it will be sent to the data cache layer (Kafka), and then consumed and written to HDFS through the SparkStreaming program. The combination of the data cache layer + Spark Streaming program is called the data write channel. STS provides a web management page to manage the data write channel and configure the write policy. The configuration relationship between tenants and data write channels can be one-to-one or many-to-one. After the Rest gateway receives the user's request to write data, it will query the corresponding write policy according to the tenant to which the user belongs, and send the data to the corresponding write channel according to this policy until it is finally written to the disk. The resources between the channels are isolated, and the whole process is not affected by each other.
[0042] 4. Consumer groups and consumer instances
[0043] When data is written to the cache layer (Kafka), it will be saved in different topics, and then consumed by Spark Streaming programs and written to HDFS. We call a group of Spark Streaming programs a consumer group. Each consumer group is responsible for consuming data from one or more topics. The consumer group can configure the corresponding number of consumer instances based on the actual amount of data consumed. Within a certain range, as the number of consumer instances increases, the consumption speed can be linearly increased.
[0044] A consumer group contains one or more Spark streaming instances. Each consumer group subscribes to data from one or more topics from Kafka. The Spark streaming instance periodically pulls data from the subscribed topics from Kafka and writes it to HDFS. If the amount of data written is large, the consumer group will not be able to process it in time, resulting in data backlog. A small amount of data backlog can be left unprocessed. If the data backlog is serious, you can increase the number of consumer instances on the consumer group management page to increase the data consumption speed.
[0045] 5. Document merging service
[0046] When data is written to HDFS by the consumer instance, it is basically small files. The file merging service is responsible for monitoring the number of files. When the number or size of files reaches the threshold (defined by the configuration file), it automatically triggers the merging of small files.
[0047] Example 2
[0048] Structured data services in the self-developed industrial Internet platform xIn3Plat.
[0049] Specific implementation method:
[0050] 1. In the xIn3Plat structured data service, a web management page is provided to visually configure the write strategy and manage the data write channel. Figure 2 .
[0051] 2.xIn3Plat structured data service implements the RESTful interface for writing data and provides high-performance data writing function through the REST gateway.
[0052] 3.xIn3Plat structured data service uses the Spark Streaming framework to implement the function of transferring data from the cache layer (Kafka) to the file storage system (HDFS), which can ensure that data is stored in the database securely and timely for user queries.
[0053] 4. The Merge component of the xIn3Plat structured data service can monitor file changes on the file storage system (HDFS) in real time and automatically merge small files.
[0054] Example 3
[0055] The present invention also provides a data writing channel management system for tenant-level resource isolation, which can be implemented by executing the process steps of the data writing channel management method for tenant-level resource isolation, that is, technical personnel in this field can understand the data writing channel management method for tenant-level resource isolation as a preferred implementation of the data writing channel management system for tenant-level resource isolation.
[0056] The data writing channel management system for tenant-level resource isolation provided by the present invention includes: module M1: deploying a load balancing cluster; module M2: performing multi-tenant isolation; module M3: after the data is written through the Rest gateway, it is sent to the data cache layer Kafka, and then consumed and written to HDFS through the Spark Streaming program, and the combination of the data cache layer and the Spark Streaming program is used as the data writing channel; module M4: setting consumption groups and consumption instances to change the data consumption speed; module M5: deploying a file merging service, which is responsible for monitoring the number and size of files, and automatically triggering the small file merging when the number or size of files reaches a preset threshold.
[0057] Use the Restful API to write data. The Rest service is deployed in cluster mode to support horizontal expansion. Nginx is used as a load balancing service to provide a unified access address to the outside world.
[0058] Data files are stored on the Hadoop distributed file system HDFS. The data files stored on HDFS provide query services to the outside world through the Impala query engine. The data table is first authorized on Impala before access. Different tenants can only see the tables and data under their own tenants. When writing data, the write channel can be configured at the tenant granularity. The data writing of different tenants will not affect each other. Tenants adjust the resources used by the channel according to their own data writing volume and configure on demand.
[0059] STS provides a web management page to manage data writing channels and configure writing policies. The configuration relationship between tenants and data writing channels is one-to-one or many-to-one. After the Rest gateway receives a user's request to write data, it queries the corresponding writing policy according to the tenant to which the user belongs, and sends the data to the corresponding writing channel according to the writing policy until it is finally written to the disk. The resources between channels are isolated, and the whole process is not affected by each other.
[0060] When data is written to the cache layer Kafka, it is saved in different topics, consumed by Spark Streaming programs and written to HDFS. A group of Spark Streaming programs is called a consumer group. Each consumer group is responsible for consuming data from one or more topics. The consumer group is configured with a corresponding number of consumer instances based on the actual amount of data consumed. Within the preset range, when the number of consumer instances increases, the consumption speed increases linearly.
[0061] A consumer group contains one or more Spark streaming instances. Each consumer group subscribes to data from one or more topics from Kafka. The Spark streaming instance periodically pulls data from the subscribed topics from Kafka and writes it to HDFS. If data is accumulated, increase the number of consumer instances on the consumer group management page to speed up data consumption.
[0062] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.
[0063] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.
Claims
1. A data writing channel management method for tenant-level resource isolation, characterized in that: include: Step 1: Deploy a load balancing cluster; Step 2: Perform multi-tenant isolation; Step 3: After the data is written through the Rest gateway, it is sent to the data cache layer Kafka, and then consumed by the Spark Streaming program and written to HDFS. The combination of the data cache layer and the Spark Streaming program is used as the data writing channel; Step 4: Set the consumption group and consumption instance to change the data consumption speed; Step 5: Deploy a file merging service to monitor the number and size of files. When the number or size of files reaches the preset threshold, the small file merging is automatically triggered.
2. The data writing channel management method for tenant-level resource isolation according to claim 1 is characterized in that: Use the Restful API to write data. The Rest service is deployed in cluster mode to support horizontal expansion. Nginx is used as a load balancing service to provide a unified access address to the outside world.
3. The data writing channel management method for tenant-level resource isolation according to claim 1 is characterized in that: Data files are stored on the Hadoop distributed file system HDFS. The data files stored on HDFS provide query services to the outside world through the Impala query engine. The data table is first authorized on Impala before access. Different tenants can only see the tables and data under their own tenants. When writing data, the write channel can be configured at the tenant granularity. The data writing of different tenants will not affect each other. Tenants adjust the resources used by the channel according to their own data writing volume and configure on demand.
4. The data writing channel management method for tenant-level resource isolation according to claim 1 is characterized in that: STS provides a web management page to manage data writing channels and configure writing policies. The configuration relationship between tenants and data writing channels is one-to-one or many-to-one. After the Rest gateway receives a user's request to write data, it queries the corresponding writing policy according to the tenant to which the user belongs, and sends the data to the corresponding writing channel according to the writing policy until it is finally written to the disk. The resources between channels are isolated, and the whole process is not affected by each other.
5. The data writing channel management method for tenant-level resource isolation according to claim 1 is characterized in that: When data is written to the cache layer Kafka, it is saved in different topics, consumed by Spark Streaming programs and written to HDFS. A group of Spark Streaming programs is called a consumer group. Each consumer group is responsible for consuming data from one or more topics. The consumer group is configured with a corresponding number of consumer instances based on the actual amount of data consumed. Within the preset range, when the number of consumer instances increases, the consumption speed increases linearly. A consumer group contains one or more Spark streaming instances. Each consumer group subscribes to data from one or more topics from Kafka. The Spark streaming instance periodically pulls data from the subscribed topics from Kafka and writes it to HDFS. If data is accumulated, increase the number of consumer instances on the consumer group management page to speed up data consumption.
6. A data writing channel management system for tenant-level resource isolation, characterized in that: include: Module M1: Deploy a load balancing cluster; Module M2: performs multi-tenant isolation; Module M3: After the data is written through the Rest gateway, it is sent to the data cache layer Kafka, and then consumed by the SparkStreaming program and written to HDFS. The combination of the data cache layer and the Spark Streaming program is used as the data writing channel; Module M4: Set consumption groups and consumption instances to change the data consumption speed; Module M5: Deploy the file merging service, which is responsible for monitoring the number and size of files. When the number or size of files reaches the preset threshold, it automatically triggers the merging of small files.
7. The data writing channel management system for tenant-level resource isolation according to claim 6 is characterized in that: Use the Restful API to write data. The Rest service is deployed in cluster mode to support horizontal expansion. Nginx is used as a load balancing service to provide a unified access address to the outside world.
8. The data writing channel management system for tenant-level resource isolation according to claim 6, characterized in that: Data files are stored on the Hadoop distributed file system HDFS. The data files stored on HDFS provide query services to the outside world through the Impala query engine. The data table is first authorized on Impala before access. Different tenants can only see the tables and data under their own tenants. When writing data, the write channel can be configured at the tenant granularity. The data writing of different tenants will not affect each other. Tenants adjust the resources used by the channel according to their own data writing volume and configure on demand.
9. The data writing channel management system for tenant-level resource isolation according to claim 6, characterized in that: STS provides a web management page to manage data writing channels and configure writing policies. The configuration relationship between tenants and data writing channels is one-to-one or many-to-one. After the Rest gateway receives a user's request to write data, it queries the corresponding writing policy according to the tenant to which the user belongs, and sends the data to the corresponding writing channel according to the writing policy until it is finally written to the disk. The resources between channels are isolated, and the whole process is not affected by each other.
10. The data writing channel management system for tenant-level resource isolation according to claim 6, characterized in that: When data is written to the cache layer Kafka, it is saved in different topics, consumed by Spark Streaming programs and written to HDFS. A group of Spark Streaming programs is called a consumer group. Each consumer group is responsible for consuming data from one or more topics. The consumer group is configured with a corresponding number of consumer instances based on the actual amount of data consumed. Within the preset range, when the number of consumer instances increases, the consumption speed increases linearly. A consumer group contains one or more Spark streaming instances. Each consumer group subscribes to data from one or more topics from Kafka. The Spark streaming instance periodically pulls data from the subscribed topics from Kafka and writes it to HDFS. If data is accumulated, increase the number of consumer instances on the consumer group management page to speed up data consumption.
Citation Information
Patent Citations
Method and device for writing data into big data warehouse
CN116700622A
Method for establishing data mart for intelligent power distribution and consumption big data application system
CN108959356A
Kafka consumption concurrent processing method and device based on Spark
CN110618860A
Multi-tenant data isolation method and device, equipment and storage medium
CN115905206A
Technologies for providing service isolation, scalability, and proactive tenant migration in multi-tenant ecosystems
US20190272331A1
