Multi-tenant dynamic data source-oriented management and control method and system

By introducing dynamic data source control methods and systems into the multi-tenant architecture, the problems of insufficient data isolation, limited scalability and performance optimization are solved, and high data security, isolation and high system scalability and performance are achieved.

CN120179720APending Publication Date: 2025-06-20BEIJING BAIJU YIXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510269068.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-07
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

The current multi-tenant architecture faces the problems of insufficient data isolation, limited scalability and urgent needs for performance optimization.

Method used

A dynamic data source control method and system for multi-tenants is proposed. By analyzing tenant identification information, dynamically create or configure data source instances, and implement data source routing logic to ensure data isolation. At the same time, modular design and performance monitoring and optimization technologies are adopted to improve the scalability and performance of the system.

Benefits of technology

It significantly improves data security and isolation, increases system scalability, and optimizes performance to ensure stable operation of the system in high concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120179720A_ABST
    Figure CN120179720A_ABST
Patent Text Reader

Abstract

The invention discloses a multi-tenant dynamic data source-oriented management and control method and system. The invention relates to the technical field of computers. Corresponding data source configurations are retrieved from configuration stores (configuration files, databases, and environmental variables) according to the tenant identification information. Dynamically creating or configuring a data source instance by utilizing the retrieved data source configuration information; registering the data source instance into a data source manager of the application for subsequent use; according to the method, the data isolation function is realized, so that the data of each tenant are mutually independent and do not interfere with each other, the risks of data leakage and illegal access are greatly reduced, and the security of the data is remarkably improved. According to the invention, a modular design and a dynamic data source management technology are adopted, so that the system can easily cope with the increase or decrease of the number of tenants and the continuous change of business requirements. Therefore, high expandability is provided for the user, and the system maintenance and upgrading cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, specifically to the field of dynamic data source configuration, and particularly to a control method and system for multi-tenant dynamic data sources. Background Art

[0002] With the rapid advancement of cloud computing technology, the multi-tenant architecture has become the core design pattern in many software services. This architecture allows different tenants to share system resources while maintaining the independence and security of their data, which is of great significance for improving resource utilization and reducing operating costs. At the business application level, ensuring that the data access process is strictly differentiated according to the tenant information of the user is the key to preventing data confusion between tenants and ensuring data integrity.

[0003] In a single database environment, when dealing with multi-tenant data, a common practice is to introduce a tenant coding field (such as TenantId) in each database table as an identifier to distinguish the data of different tenants. This mechanism requires that from the moment the user logs in to the system, all subsequent business queries, data updates, and other operations, the corresponding SQL statements must carry the tenant identifier of the user. This strategy not only ensures the correctness of data access, that is, each user can only access and operate the data of its own tenant, but also in the entire data processing chain, whether it is querying or updating, the specification of carrying tenant information must be strictly adhered to in order to maintain data isolation.

[0004] However, there are several significant challenges in multi-tenant data management under the current technical framework. First, similar information is centrally stored in a single two-dimensional table. Although this design separates tenant data at the logical level, it does not meet the standard of physical isolation, resulting in a significant increase in the complexity of subsequent data maintenance. Once there is a problem with the data of a certain tenant, the recovery operation of the entire database will affect all tenants, with a wide range of impacts. Second, the failure of a single database server will directly lead to the interruption of services for all tenants, seriously affecting the availability and stability of the system. In addition, the existing database connection pool management mechanism lacks flexibility and is difficult to provide customized database services for specific tenants or special applications, which is particularly prominent when dealing with data isolation between tenants and connection pool optimization problems.

[0005] More deeply, the traditional static data source configuration mode can no longer meet the high requirements of multi-tenant applications for data processing dynamics, which not only limits the performance of the system but also hinders the smooth expansion of the system. To sum up, the main technical problems faced by the current multi-tenant architecture can be summarized as follows:

[0006] (1) Insufficient data isolation: Although tenant data is separated logically, the lack of physical isolation increases the complexity and risk of data management.

[0007] (2) Limited scalability: It is difficult for the system to efficiently handle the growth of the number of tenants and the expansion of data scale.

[0008] (3) Urgent need for performance optimization: The traditional data source configuration and management methods restrict the improvement of system performance, and a more flexible and efficient solution is urgently needed.

[0009] Therefore, exploring new technical paths to strengthen data isolation, improve system scalability, and optimize performance has become an important topic in the research and practice of the current multi-tenant architecture. For this reason, the present invention proposes a control method and system for multi-tenant dynamic data sources. Summary of the Invention

[0010] In view of this, the present invention hopes to provide a control method and system for multi-tenant dynamic data sources to solve or alleviate the technical problems existing in the prior art, that is, how to provide data isolation functions, increase scalability, and optimize performance, and implement a comprehensive control technology framework for multi-tenant dynamic data sources, and at least provide a beneficial choice for this; the technical solution of the present invention is implemented as follows:

[0011] In the first aspect, a control method for multi-tenant dynamic data sources:

[0012] (1) Overview:

[0013] The present invention aims to provide a dynamic, flexible, and efficient data source control mechanism for data access problems in a multi-tenant environment. By parsing the tenant identification information in the user request, such as the tenant ID in the HTTP request header or the JWT token, the solution can accurately identify and verify the tenant identity. Subsequently, according to the tenant identification information, the corresponding data source configuration is retrieved from the configuration storage, and a data source instance is dynamically created or configured and registered in the data source manager of the application. During the request processing, the solution implements the data source routing logic, dynamically determines the data source to be used according to the tenant ID and the request context, and ensures that the data access of each tenant is isolated and secure. At the same time, the solution also focuses on performance monitoring and optimization. By monitoring indicators such as the connection pool usage and response time of the data source, the data source configuration is dynamically adjusted or the query statement is optimized to improve the system performance and stability.

[0014] (2) Technical solution:

[0015] To achieve the above technical objectives, after receiving an input activation instruction (such as starting the application service or receiving a user request), the present invention selects to perform the following operation steps.

[0016] 2.1 Step S1, Tenant identification:

[0017] Receive a user request, parse the tenant identification information in the request based on the tenant ID or JWT token in the HTTP request header; verify the validity of the tenant identification information.

[0018] 2.1.1 Step S100, receive a user request:

[0019] Receive the request sent by the user through the HTTP protocol; the request contains the operation that the user wishes to perform and related data; the HTTP request header contains tenant identification information such as the tenant ID or JWT token.

[0020] 2.1.2 Step S101, verify the validity of the tenant identification information:

[0021] Check whether the extracted tenant ID exists in the system's tenant list; if a JWT token is used, verify the signature and validity period of the token to ensure the authenticity and validity of the token;

[0022] If the tenant identification information is invalid, return the corresponding error message and reject processing the user request.

[0023] 2.2 Step S2, retrieve data source configuration:

[0024] Retrieve the corresponding data source configuration from the configuration store (configuration file, database, and environment variables) according to the tenant identification information.

[0025] Use the retrieved data source configuration information to dynamically create or configure a data source instance; register the data source instance in the application's data source manager for subsequent use.

[0026] 2.2.1 Step S200, retrieve data source configuration according to tenant identification information:

[0027] Retrieve the corresponding data source configuration from the configuration store according to the validated tenant ID; the configuration store includes configuration files, databases, or environment variables.

[0028] 2.2.2 Step S201, dynamically create or configure a data source instance:

[0029] Use the retrieved data source configuration information to dynamically create or configure a data source instance; the data source instance is a database connection pool or a Session of an ORM framework.

[0030] 2.2.3 Step S202, register the data source instance to the data source manager

[0031] Register the created or configured data source instance in the application's data source manager; the data source manager is responsible for managing and maintaining multiple data source instances and providing a unified data access interface for the business logic layer;

[0032] After registration, the business logic layer can conveniently obtain and use the corresponding data source instance through the data source manager.

[0033] 2.3 Step S3, Data Source Routing:

[0034] The data source routing logic dynamically determines the data source to be used based on the tenant ID and the request context;

[0035] Use the dynamically configured data source to process user requests; perform database query and update operations.

[0036] Configure a transaction manager for the database operations in the request processing according to the task type.

[0037] 2.3.1 Step S300, Determine the data source according to the tenant ID and the request context:

[0038] Dynamically determine the data source to be used according to the tenant ID in the currently processed request and the request context, including request parameters and user identity;

[0039] The data source routing logic lies in finding the mapping relationship between the tenant and the data source, or selecting the data source according to the preset rules of region or business type.

[0040] 2.3.2 Step S301, Process the request using the dynamically configured data source

[0041] Obtain the previously registered and configured data source instance from the data source manager; use this data source instance to process user requests and perform corresponding database query and update operations.

[0042] 2.3.3 Step S302, Configure the transaction manager:

[0043] According to the read operation, write operation or / and transactional operation in the request processing, configure the corresponding transaction manager for the request; the transaction manager is responsible for managing the start, commit and rollback of database transactions to ensure data consistency and integrity.

[0044] 2.4 Step S4, Performance Monitoring and Optimization:

[0045] During the request processing, monitor the usage of the data source connection pool and the response time; according to the monitoring results, dynamically adjust the data source configuration or optimize the query statement to improve performance.

[0046] 2.4.1 Step S400, Monitor the usage of the data source connection pool and the response time:

[0047] During the request processing, the usage of the data source connection pool is monitored in real time, including the number of connections, the number of active connections, and the number of waiting connections. At the same time, the response time of database operations is also monitored to evaluate the performance and load of the data source.

[0048] 2.4.2 Step S401, Analyze the monitoring results

[0049] Regularly analyze and process the monitoring data to identify performance bottlenecks and slow query problems;

[0050] Through analysis, understand which data sources or query statements need to be optimized;

[0051] Dynamically adjust the data source configuration according to the monitoring results and analysis. The methods include increasing the connection pool size or adjusting database parameters;

[0052] At the same time, optimize the query statements by adding indexes or / and restructuring the query logic to improve the efficiency of database operations.

[0053] 2.5 Step S5, Response return:

[0054] After processing the user request, generate a response result and return it to the user.

[0055] (III) Mechanism for solving technical problems:

[0056] 3.1 Implementation of data isolation function:

[0057] The present invention accurately identifies the tenant to which the request belongs by parsing information such as the tenant ID or JWT token in the HTTP request header. Verify the tenant identification information to ensure that only legitimate tenants can access the system. According to the tenant identification information, retrieve the corresponding data source configuration from the configuration storage (such as a database, configuration file, etc.). Dynamically create or configure a data source instance to ensure that each tenant has an independent data source.

[0058] Implement the data source routing logic to dynamically determine the data source to be used according to the tenant ID and request context. Ensure that the request is routed to the correct data source to achieve data isolation.

[0059] 3.2 Increase in scalability:

[0060] The present invention adopts a modular design, with loose coupling between modules, which is convenient for expansion and maintenance. New modules or functions can be easily added according to business requirements. Through dynamic data source management, data sources can be easily added or deleted without modifying the application code. This enables the system to easily handle the increase or decrease in the number of tenants.

[0061] 3.3 Distributed architecture:

[0062] The present invention supports a distributed architecture, which can distribute data sources across multiple nodes to improve the scalability of the system. Through load balancing technology, the reasonable allocation of requests is achieved, improving the processing capacity of the system. The database connection pool management is implemented to reuse database connections and reduce the overhead of connection creation and destruction. By monitoring the usage of the connection pool, the size of the connection pool is dynamically adjusted to improve resource utilization.

[0063] Optimize the database query statements to reduce query time and resource consumption.

[0064] In a second aspect, a control system for multi-tenant dynamic data sources:

[0065] As Figure 2 shown, this system is used to implement the control method and system for multi-tenant dynamic data sources described above, and it includes:

[0066] (1) A presentation layer responsible for receiving users and processing their requests, including:

[0067] (1.1) A request receiving module: responsible for receiving requests sent by users through the HTTP protocol, including the tenant ID or JWT token in the HTTP request header.

[0068] (1.2) A response generation module: after the request is processed, generate a response result and return it to the user.

[0069] (2) A business logic layer that executes business processing and returns to the presentation layer, including:

[0070] (2.1) A tenant identification module: parse the tenant identification information in the request and verify its validity.

[0071] (2.2) A data source configuration retrieval module: according to the tenant identification information, retrieve the corresponding data source configuration from the configuration storage and dynamically create or configure a data source instance.

[0072] (2.3) A data source routing module: dynamically determine the data source to be used according to the tenant ID and request context, and execute database operations.

[0073] (3) A data access layer for data storage and management, including:

[0074] (3.1) A data source manager: manage the dynamically created or configured data source instances and provide data access services for the business logic layer.

[0075] (3.2) A transaction manager: provide transaction management functions for database operations to ensure data consistency and integrity.

[0076] Compared with the prior art, the beneficial effects of the present invention are:

[0077] I. Significantly enhance data security: By implementing the data isolation function, the present invention ensures that the data of each tenant is independent and does not interfere with each other, greatly reducing the risks of data leakage and illegal access, and thus significantly enhancing data security. The present invention adopts modular design and dynamic data source management technology, enabling the system to easily handle the increase or decrease in the number of tenants and the continuous changes in business requirements. This provides users with high scalability and reduces the costs of system maintenance and upgrade.

[0078] II. Optimize system performance: Through the application of technologies such as caching strategy, connection pool management, query optimization, and load balancing, the present invention effectively improves the response speed and processing capacity of the system, ensuring the stable operation of the system in high-concurrency scenarios. This provides users with a smoother and more efficient usage experience. The automated configuration and management functions of the present invention greatly reduce the need for manual intervention, reducing the complexity and cost of operation and maintenance. At the same time, through the monitoring and alarm mechanism, operation and maintenance personnel can promptly discover and handle potential problems to ensure the continuous stable operation of the system.

[0079] III. Improve user experience: Measures such as data isolation and performance optimization ensure that each tenant can obtain independent and stable data access services, enhancing user satisfaction and loyalty. At the same time, the scalable design enables the system to continuously upgrade as user needs grow, maintaining a good user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0080] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0081] Figure 1 It is a schematic diagram of the method flow of the present invention;

[0082] Figure 2 It is a schematic diagram of the system composition of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0083] To make the above objects, features, and advantages of the present invention more obvious and understandable, the following will provide a detailed description of the specific embodiments of the present invention with reference to the drawings. Many specific details are set forth in the following description to fully understand the present invention. However, the present invention can be implemented in many other ways different from those described herein. Those skilled in the art can make similar improvements without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below;

[0084] It should be noted that the various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts among the embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description in the method section.

[0085] Explanation of related terms:

[0086] (1) HTTP request header: The header data containing the request information, used to transmit the settings and parameters of the client, such as the tenant ID.

[0087] (2) Tenant ID: The identity number that uniquely identifies different tenants, used to distinguish and associate tenant data.

[0088] (3) JWT token: A compact and self - contained way to transmit data such as tenant information, often used for authentication and data exchange.

[0089] (4) Tenant identification information: The data used to identify the tenant's identity, including the tenant ID, JWT token, etc.

[0090] (5) Configuration storage: The place where the data source configuration information is stored, such as configuration files, databases, or environment variables.

[0091] (6) Data source configuration: The settings containing the information required for connecting to the data source, such as URL, username, password, etc.

[0092] (7) Data source instance: The specific data source object created according to the data source configuration, used for actual data access.

[0093] (8) Data source routing logic: The logical rules that determine how to select a data source based on the tenant ID and request context.

[0094] (9) Request context (should be "request context"): All the information and status related to the current request, including the tenant ID, request parameters, etc.

[0095] (10) Configuration transaction manager: The component that provides transaction management functions for database operations, ensuring data consistency and integrity.

[0096] (11) Connection pool usage: The metric that reflects the usage and idle status of the connections in the data source connection pool.

[0097] (12) Query statement: The SQL command or statement used to retrieve or update data from the database.

[0098] Embodiment 1: As Figure 1As shown in the figure, this embodiment discloses the application of the control method for multi-tenant dynamic data sources in an online car-hailing platform. In an online car-hailing platform management application, there are multiple online car-hailing companies (tenants) sharing the same platform. Each company has its own independent data such as users, drivers, and orders. To ensure data security and isolation, while improving the scalability and performance of the system, we adopt a multi-tenant dynamic data source control technology framework. The specific solution includes the following execution process:

[0099] In this embodiment, regarding step S1, tenant identification:

[0100] Specifically, step S100, receiving a user request: A user (administrator, driver, or passenger of an online car-hailing company) sends a request to the platform via the HTTP protocol, such as querying an order or updating a driver's status. The request contains the operation the user wishes to perform, relevant data, and the HTTP request header, where the request header contains the tenant ID or JWT token.

[0101] Specifically, step S101, verifying the validity of tenant identification information: The platform extracts the tenant ID from the request header or parses the JWT token to obtain the tenant ID. Checks whether the tenant ID exists in the system's tenant list to ensure the tenant is legitimate.

[0102] If a JWT token is used, it is also necessary to verify the signature and expiration date of the token to ensure the authenticity and validity of the token. If the tenant identification information is invalid, the platform returns the corresponding error message and rejects the user request.

[0103] Through tenant identification, ensure that each request can be correctly routed to the corresponding tenant data source to achieve data isolation. Using JWT tokens can improve security and prevent tenant IDs from being tampered with or forged.

[0104] In this embodiment, regarding step S2, data source configuration retrieval:

[0105] Specifically, step S200, retrieving the data source configuration according to tenant identification information: According to the verified tenant ID, retrieve the corresponding data source configuration from the configuration storage (such as configuration files, databases, or environment variables). The data source configuration includes database connection information, ORM framework configuration, etc.

[0106] Specifically, step S201, dynamically creating or configuring a data source instance: Use the retrieved data source configuration information to dynamically create or configure a data source instance.

[0107] The data source instance is a database connection pool or a Session of an ORM framework for interacting with the database.

[0108] Specifically, in step S202, registering the data source instance to the data source manager: registering the created or configured data source instance to the data source manager of the application. The data source manager is responsible for managing and maintaining multiple data source instances and providing a unified data access interface for the business logic layer. After registration, the business logic layer can conveniently obtain and use the corresponding data source instance through the data source manager.

[0109] By dynamically creating and configuring data source instances, the scalability of the data source is achieved. The data source manager provides a unified data access interface, simplifying the interaction between the business logic layer and the data source.

[0110] In this embodiment, regarding step S3, data source routing:

[0111] Specifically, in step S300, determining the data source according to the tenant ID and request context: dynamically determining the data source to be used according to the tenant ID in the current processed request and the request context (such as request parameters, user identity, etc.).

[0112] The data source routing logic involves finding the mapping relationship between the tenant and the data source, or selecting the data source according to preset rules such as region and business type.

[0113] Specifically, in step S301, processing the request using the dynamically configured data source: obtaining the previously registered and configured data source instance from the data source manager. Using this data source instance to process the user request and perform corresponding database query and update operations.

[0114] Specifically, in step S302, configuring the transaction manager: configuring the corresponding transaction manager for the request according to the task type in the request processing (such as read operation, write operation or transactional operation). The transaction manager is responsible for managing the start, commit and rollback of database transactions to ensure data consistency and integrity.

[0115] Through data source routing, it is ensured that each request can be correctly processed to the corresponding data source, achieving correct data access and isolation. Configuring the transaction manager ensures the consistency and integrity of database operations and improves the reliability of data.

[0116] In this embodiment, regarding step S4, performance monitoring and optimization:

[0117] Specifically, in step S400, monitoring the usage of the data source connection pool and the response time: during the request processing, real-time monitoring the usage of the data source connection pool, including the number of connections, the number of active connections and the number of waiting connections. At the same time, monitoring the response time of database operations to evaluate the performance and load of the data source.

[0118] Specifically, in step S401, analyze the monitoring results: Regularly analyze and process the monitoring data to identify performance bottlenecks and slow query problems. Through analysis, understand which data sources or query statements need to be optimized. According to the monitoring results and analysis, dynamically adjust the data source configuration, such as increasing the connection pool size, adjusting database parameters, etc. At the same time, also optimize the query statements by adding indexes, reconstructing query logic, etc. to improve the efficiency of database operations.

[0119] Through performance monitoring and optimization, the efficient operation of the data source and the stability of the system are ensured. Dynamically adjusting the data source configuration and optimizing the query statements improve the performance and scalability of the system.

[0120] In this embodiment, regarding step S5, response return:

[0121] Specifically, after processing the user request, generate a response result and return it to the user. The response result includes information such as the result data of the request processing and the status code.

[0122] It can be understood that through tenant identification and data source routing, it is ensured that the data of each tenant is isolated in an independent data source, improving data security and privacy. Through dynamically creating and configuring data source instances, as well as performance monitoring and optimization, the scalability of the data source and the flexibility of the system are achieved. By real-time monitoring the data source performance and optimizing the query statements, the performance and response speed of the system are improved.

[0123] Embodiment 2: Based on Embodiment 1, this embodiment will further provide a Python execution program for the method described in Embodiment 1:

[0124]

[0125]

[0126]

[0127]

[0128] In the above program, the handle_request function obtains the X-TenantID from the HTTP request header to identify the tenant. If the X-TenantID is not provided, an error response is returned.

[0129] Use the get_data_source function to obtain the corresponding data source instance from the data_source_manager according to the tenant ID. If the corresponding data source is not found, an error response is returned.

[0130] According to the method of the HTTP request (GET or POST), we perform different database operations. Use the logging module to record the start and end times of the request, as well as the status code of the request.

[0131] The Flask application is single-threaded by default, but in a production environment, it will be configured to be multi-threaded to improve concurrency performance. For example, enable the multi-thread support of Flask through the threaded=True parameter.

[0132] All of the above embodiments only express the implementation manners of the relevant actual applications of the present invention. The descriptions are relatively specific and detailed, but they should not be construed as limitations on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present invention, several modifications and improvements can still be made, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the appended claims.

[0133] For those skilled in the art, it can be further realized that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

[0134] Meanwhile, those skilled in the art can understand that all or part of the processes in the methods of implementing the above-mentioned all embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned various methods. Among them, any reference to the memory, storage, database or other media provided in this application and used in the embodiments can include non-volatile and / or volatile memories. The non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. The volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

Claims

1. A management and control method for multi-tenant dynamic data sources, characterized in that: When receiving the input activation command, perform the following steps: S1, parses the tenant identification information in the request based on the HTTP request header; S2, retrieve the corresponding data source configuration from the configuration storage according to the tenant identification information; S3, data source routing logic dynamically determines the data source to use based on the tenant ID and request context; uses the dynamically configured data source to process user requests; and performs database query and update operations; S4, during the request processing, monitors the connection pool usage and response time of the data source; S5, after processing the user request, generates a response result and returns it to the user.

2. The control method according to claim 1, characterized in that: The execution method of S1 includes: S100, receiving a request sent by a user through the HTTP protocol; the request includes an operation that the user wants to perform and related data; the HTTP request header includes tenant identification information such as a tenant ID or a JWT token; S101, check whether the extracted tenant ID exists in the tenant list of the system; if a JWT token is used, verify the signature and validity period of the token to ensure the authenticity and validity of the token; if the tenant identification information is invalid, return a corresponding error message and refuse to process the user request.

3. The control method according to claim 1, characterized in that: In S2, the retrieved data source configuration information is used to dynamically create or configure a data source instance; and the data source instance is registered in the data source manager of the application.

4. The control method according to claim 3, characterized in that: The execution method of S2 includes: S200, according to the verified valid tenant ID, retrieve the corresponding data source configuration from the configuration storage; the configuration storage includes a configuration file, a database or an environment variable; S201, dynamically create or configure a data source instance using the retrieved data source configuration information; the data source instance is a database connection pool or a Session of an ORM framework; S202, registering the created or configured data source instance to the data source manager of the application; the data source manager is responsible for managing and maintaining multiple data source instances and providing a unified data access interface for the business logic layer.

5. The control method according to claim 1, characterized in that: In S3, a transaction manager is configured for the database operation in the request processing according to the task type.

6. The control method according to claim 5, characterized in that: The execution method of S3 includes: S300, dynamically determining the data source to be used based on the tenant ID and request context in the currently processed request, including request parameters and user identity; S301, obtaining a previously registered and configured data source instance from a data source manager; using the data source instance to process user requests and perform corresponding database query and update operations; S302, according to the read operation, write operation and / or transactional operation in the request processing, configure a corresponding transaction manager for the request; the transaction manager is responsible for managing the start, commit and rollback of the database transaction.

7. The control method according to claim 1, characterized in that: In S4, the data source configuration is dynamically adjusted or the query statement is optimized according to the monitoring result.

8. The control method according to claim 7, characterized in that: The execution method of S4 includes: S400, during the request processing, monitors the usage of the data source connection pool in real time, including the number of connections, the number of active connections, and the number of waiting connections; it also monitors the response time of database operations to evaluate the performance and load of the data source; S401, regularly analyze and process monitoring data to identify performance bottlenecks and slow query problems; Through analysis, understand which data sources or query statements need to be optimized; Dynamically adjust data source configuration based on monitoring results and analysis, including increasing connection pool size or adjusting database parameters; At the same time, query statements are optimized by adding indexes and / or reconstructing query logic to improve the efficiency of database operations.

9. A system for implementing the control method according to any one of claims 1 to 8, characterized in that: The system comprises: The presentation layer is responsible for receiving user requests and processing their requests; The business logic layer performs business processing and returns it to the presentation layer; Data access layer for data storage and management.

10. The system according to claim 9, characterized in that: The presentation layer includes: Request receiving module: responsible for receiving requests sent by users through the HTTP protocol, including the tenant ID or JWT token in the HTTP request header; Response generation module: after the request processing is completed, the response result is generated and returned to the user; The business logic layer includes: Tenant identification module: parses the tenant identification information in the request and verifies its validity; Data source configuration retrieval module: retrieves the corresponding data source configuration from the configuration storage according to the tenant identification information, and dynamically creates or configures the data source instance; Data source routing module: dynamically determines the data source to be used based on the tenant ID and request context, and performs database operations; The data access layer includes: Data source manager: manages dynamically created or configured data source instances and provides data access services for the business logic layer; Transaction Manager: Provides transaction management functions for database operations.