A multi-database processing method based on load balancing
Through load balancing and dynamically adjusting database connection pool parameters, the problem that a single database connection pool configuration is difficult to cope with business changes is solved, and the system is high-performance and stable operation is achieved.
Patent Information
- Application Number
- CN202410713724.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-04
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2044-06-04
AI Technical Summary
In the prior art, a single fixed database connection pool configuration is difficult to flexibly respond to changes in business demand, resulting in frequent system downtime and adjustments, increasing operation and maintenance costs, and affecting the smooth operation of the system.
Using a multi-database processing method based on load balancing, by deploying multiple database servers, selecting load balancing technology, adjusting load balancing policies and database connection pool parameters, monitoring performance indicators in real time, and dynamically adjusting load balancing policies and connection pool parameters.
Keep the system running in a high-performance state, improve system stability and availability, optimize data access efficiency, and ensure load balancing of database servers.
Smart Images

Figure CN118819819B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of load adjustment, and particularly to a multi-database processing method based on load balancing. Background Art
[0002] Currently, with the rapid development of business, the configuration of a single fixed database connection pool has been difficult to meet the needs of business development. Along with the change of the concurrency volume, the database connection configuration has to be adjusted. However, many systems run continuously 7*24 hours. Each time the connection pool configuration of MySQL is modified, the service must be restarted, and each shutdown will affect the stable operation of the business system to a certain extent, bringing heavy operation and maintenance costs. This mode is relatively cumbersome and difficult to flexibly follow the rhythm of the business system.
[0003] Therefore, the present invention proposes a multi-database processing method based on load balancing. Summary of the Invention
[0004] The present invention provides a multi-database processing method based on load balancing, which is used to deploy multiple database servers and select load balancing technology, adjust the load balancing strategy and database connection pool parameters to keep the system running in a high-performance state.
[0005] On the one hand, the present invention provides a multi-database processing method based on load balancing, including:
[0006] Step 1: Classify the target data according to business requirements and data access characteristics, and match a database server to each classified data according to the classified database;
[0007] Step 2: Select load balancing technology and determine the configuration rules according to the characteristics of all database servers, and set the central load balancer as the middle layer to connect all database servers according to the configuration rules;
[0008] Step 3: When the central load balancer receives a client request, route the request to different database servers connected to the central load balancer according to the distribution strategy;
[0009] Step 4: Real-time monitor the execution performance metrics of each database server, and adjust the load balancing strategy and the connection pool parameters of the database server according to the monitoring data.
[0010] On the other hand, classifying the target data according to business requirements and data access characteristics includes:
[0011] Sending a query request to the business client to obtain business requirement data matching the query request;
[0012] Performing a first classification on the target data according to the characteristics of the business requirement data;
[0013] Perform priority division on the first classified data according to the data access characteristics to obtain second-classified data, where the second-classified data is the result of classifying the target data.
[0014] On the other hand, matching each classified data with a database server includes:
[0015] Determine the initial fitness of each second-classified data with each server in the classified database;
[0016]
[0017] Among them, 1 represents the initial fitness of the corresponding second-classified data with the corresponding server, ( ) represents an adjustment function, specifically The adjustment of , represents the correlation degree of the corresponding server with the i-th data in the corresponding second-classified data, which is obtained based on the server-data category correlation degree mapping table, represents the preset weight coefficient of the i-th data in the corresponding second-classified data, represents the mean function, and ln represents the logarithmic function, represents the standard correlation degree set for the corresponding server, and n represents the total number of all data in the corresponding second-classified data;
[0018] According to the priority situation of the corresponding second-classified data and in combination with each initial fitness involved, calculate the final fitness of the corresponding second-classified data with each server;
[0019]
[0020] Among them, represents the final fitness of the corresponding second-classified data with the corresponding server; represents the highest priority among all priorities; represents the priority of the corresponding second-classified data; represents The floor function of; min represents the minimum symbol; max represents the maximum symbol;
[0021] Select the server corresponding to the highest fitness from all the final fitnesses under each second-classified data as the database server for the corresponding second-classified data.
[0022] On the other hand, in the process of selecting a load balancing technology and determining the configuration rules according to the characteristics of all database servers, it includes:
[0023] Based on the characteristics of the database servers and preset standards, obtain the load information of each database server from the load information collection pool, and through a pre-configured dynamic load balancing algorithm, obtain the first weight coefficients of all metrics under each database server;
[0024] Among them, the specific calculation method of the first weight coefficient is as follows:
[0025]
[0026]
[0027] Among them, represents the set of metrics after standardizing all metrics under the corresponding database server the information degree of the j-th standardized metric in, ln( ) represents the logarithmic function, represents the set of standardized metrics the standard value of the j-th standardized metric in, represents the set of standardized metrics the first weight coefficient of the j-th standardized metric in, represents that the corresponding database server has m metrics, and m > 2; represents all the maximum value in; represents based on all the average value of.
[0028] On the other hand, according to the characteristics of all database servers, select a load balancing technology and determine the configuration rules, including:
[0029] Based on all metrics and the first weight coefficients of the database servers, combine the evaluation function to evaluate the load situation of the database servers, and obtain the load parameters of the database servers;
[0030] Match the load balancing technology of the database servers according to the load parameter - load balancing technology mapping table, and customize the configuration rules of the central load balancer according to the load balancing technology;
[0031] Combine the configuration rules and the load parameters, dynamically adjust the first weight coefficients of the database server metrics, and obtain the second weight coefficients;
[0032] Based on the second weight coefficients and the load balancing technology, determine the configuration rules, and set the central load balancer as the intermediate layer to connect all database servers.
[0033] On the other hand, the distribution strategy is jointly determined by the first strategy and the second strategy;
[0034] The first strategy includes: the IP address of the database server obtained by the central load balancer;
[0035] The second strategy includes: the central load balancer obtaining the carrying situation of the database server.
[0036] On the other hand, in the process of real-time monitoring of the execution performance metrics of each database server, it includes:
[0037] Configuring a database performance monitoring tool into each database server, and in accordance with the metric preset standards of the database server, real-time monitoring the log information generated under the execution performance metrics of the database server;
[0038] If there is information in the analysis result of the log information that does not conform to the metric preset standards, lock the inconsistent information and give an early warning based on the alarm rules.
[0039] On the other hand, adjusting the load balancing strategy and the connection pool parameters of the database server according to the monitoring data, including:
[0040] When an early warning reminder is issued, locate the database server with anomalies and obtain the anomaly monitoring data in the log information of the located server;
[0041] According to the anomaly monitoring data, obtain the current anomaly state of the located server, and in combination with the load balancing technology, adjust the load balancing strategy of the located server;
[0042] At the same time, analyze the occupancy situation of the connection pool resources of the located server in the current anomaly state to obtain the first load ratio;
[0043] Monitor the current occupancy situation of the corresponding connection pool resources to obtain the second load ratio;
[0044] When the second load ratio is greater than the first load ratio, adjust the corresponding connection pool parameters;
[0045] After the load balancing strategy and the connection pool parameters are adjusted, continuously monitor the running situation of the database server.
[0046] The present invention provides a multi-database processing method based on load balancing, which is used to deploy multiple database servers and select load balancing technology, adjust the load balancing strategy and the database connection pool parameters to keep the system running in a high-performance state. Description of the Drawings
[0047] To more clearly illustrate the technical solutions in the present invention 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 some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0048] Figure 1 It is a schematic flowchart of a multi-database processing method based on load balancing provided by an embodiment of the present invention. Specific implementation manners
[0049] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts belong to the scope of protection of the present invention.
[0050] Embodiment 1:
[0051] As Figure 1 shown, a multi-database processing method based on load balancing provided by an embodiment of the present invention includes:
[0052] Step 1: Classify the target data according to business requirements and data access characteristics, and match database servers to each classified data according to the classified databases;
[0053] Step 2: Select a load balancing technology and determine configuration rules according to the characteristics of all database servers, and set the central load balancer as the middle layer to connect all database servers according to the configuration rules;
[0054] Step 3: When the central load balancer receives a client request, route the request to different database servers connected to the central load balancer according to the distribution strategy;
[0055] Step 4: Real-time monitor the execution performance metrics of each database server, and adjust the load balancing strategy and the connection pool parameters of the database servers according to the monitored data.
[0056] In this embodiment, the business requirements refer to the specific requirements and demands in aspects such as functions, performance, and security that the system needs to meet, such as data access efficiency, load balancing and disaster tolerance, performance monitoring and tuning, business scalability, etc.
[0057] In this embodiment, the characteristics of data access refer to the characteristics in aspects such as the way, frequency, and demand pattern of the target data being accessed and utilized in the system, including: access frequency, access pattern, data correlation, data volume size, etc.
[0058] In this embodiment, the classification database contains multiple servers, and the matching of servers and data is obtained based on classification data.
[0059] In this embodiment, a database server refers to a server dedicated to storing and managing data, and its main components include: database management system, storage system, engine, query processor, connection pool, and it mainly performs operations such as querying, updating, and deleting the database.
[0060] In this embodiment, load balancing technology is a technology used to distribute the workload among multiple servers to ensure that these servers can effectively process requests together, mainly including: DNS-based load balancing, hardware load balancer, software load balancer, layer 4 load balancing, layer 7 load balancing, etc.
[0061] In this embodiment, configuration rules are the rules and parameters that need to be set after determining the load balancing technology, including: load balancing algorithms, health check mechanisms, session persistence methods, traffic limiting strategies, etc.
[0062] In this embodiment, the central load balancer is a key component responsible for coordinating and managing the entire database server cluster.
[0063] In this embodiment, the middle layer refers to a layer of system components used to connect the client and the backend database server, mainly including: application server, cache server, message queue, security layer, etc.
[0064] In this embodiment, a client request is a request sent by an application program to the system, requesting the system to perform certain operations or obtain specific data, including: request types such as insert, query, update, store new data, etc.
[0065] In this embodiment, the distribution strategy is the way the central load balancer routes client requests to different connected database servers, including: round-robin, least connections, random, distribution based on performance metrics, IP address hashing, etc.
[0066] In this embodiment, routing refers to the process of determining the path and method of data transmission in the network.
[0067] In this embodiment, the execution performance metrics are various data metrics obtained from the real-time monitoring and evaluation of the performance of the database server, including: response time, throughput, load condition, connection pool utilization rate, concurrent connection number, etc.
[0068] In this embodiment, the monitoring data is the data obtained after monitoring the execution performance indicators, mainly to obtain the data generated by different indicators during operation, which is convenient for adjusting the load balancing strategy based on the data situation subsequently.
[0069] In this embodiment, the connection pool parameters refer to the various parameters used to configure and manage the database connection pool, including: the maximum number of connections, the minimum number of idle connections, the connection timeout, the maximum waiting time, the connection validity detection and other parameters.
[0070] The working principle and beneficial effects of the above technical solution are: by data classification, load balancing technology, request routing and real-time monitoring, the system stability, availability and performance are improved, the data access efficiency is optimized, the load balancing of the database server is ensured, the system runs in a high-performance state, and the system stability is improved.
[0071] Embodiment 2:
[0072] Based on the above Embodiment 1, the target data is classified according to business requirements and data access characteristics, including:
[0073] Send a query request to the business client to obtain the business requirement data matching the query request;
[0074] Perform a first classification on the target data according to the characteristics of the business requirement data;
[0075] Perform a priority division on the data after the first classification according to the data access characteristics, and obtain the second classified data, where the second classified data is the result of classifying the target data.
[0076] In this embodiment, the business client is a specific business system or application program.
[0077] In this embodiment, the business requirement data is the relevant data collected, sorted or extracted according to specific business requirements, and may be: customer data, Party A data, financial statements, etc.
[0078] In this embodiment, the first classification is to perform a preliminary classification on the target data according to the characteristics of the business requirement data, for example, classify according to data type, access frequency, data volume size and other characteristics.
[0079] In this embodiment, the priority division refers to further sorting and dividing the data after the first classification according to the data access characteristics and importance.
[0080] In this embodiment, the second classification is the result of performing a priority division on the target data according to the data access characteristics and importance after the first classification. The classification result includes the sorting of the priority levels and the classification of the priority levels, which are divided into three levels: low, medium and high.
[0081] The working principle and beneficial effects of the above technical solution are as follows: By classifying and setting priorities, the query response speed of the system is increased, data management is optimized, the system is kept running in a high-performance state, and the system stability is improved.
[0082] Embodiment 3:
[0083] Based on the above Embodiment 1, matching a database server to each classified data, including:
[0084] Determine the initial adaptability of each second-classified data to each server in the classified database;
[0085]
[0086] Among them, 1 represents the initial adaptability of the corresponding second-classified data to the corresponding server, ( ) represents an adjustment function, specifically For the adjustment of represents the correlation degree between the corresponding server and the i-th data in the corresponding second-classified data, which is obtained based on the server-data category correlation degree mapping table, represents the preset weight coefficient of the i-th data in the corresponding second-classified data, represents the mean function, and ln represents the logarithmic function, represents the standard correlation degree set for the corresponding server, and n represents the total number of all data in the corresponding second-classified data;
[0087] According to the priority situation of the corresponding second-classified data and in combination with each initial adaptability involved, calculate the final adaptability of the corresponding second-classified data to each server;
[0088]
[0089] Among them, represents the final adaptability of the corresponding second-classified data to the corresponding server; represents the highest priority among all priorities; represents the priority of the corresponding second-classified data; represents the floor function of ; min represents the minimum symbol; max represents the maximum symbol;
[0090] Select the server corresponding to the highest adaptability from all the final adaptabilities under each second-classified data as the database server for the corresponding second-classified data.
[0091] In this embodiment, the initial fitness represents the initial matching degree between each piece of second-classification data and each server in the classification database.
[0092] In this embodiment, the adjustment function is a function used to adjust the initial fitness according to the specific attributes of the data and the degree of association with the server.
[0093] In this embodiment, the degree of association represents the degree of association between the server and specific data in the second-classification data.
[0094] In this embodiment, the server-data category association degree mapping table is a mapping table used to represent the degree of association between the server and different data categories.
[0095] In this embodiment, the preset weight coefficient refers to a pre-set weight coefficient corresponding to the data in the second-classification data.
[0096] In this embodiment, the final fitness refers to the fitness value calculated for the corresponding second-classification data and each server under the priority situation.
[0097] The working principle and beneficial effects of the above technical solution are as follows: By calculating the initial fitness between each classification data and the server, and combining the priority, the final fitness is calculated to keep the system running in a high-performance state and improve the system stability.
[0098] Embodiment 4:
[0099] Based on the above Embodiment 1, in the process of selecting the load balancing technology and determining the configuration rules according to the characteristics of all database servers, it includes:
[0100] Based on the characteristics of the database server and the preset standard, obtain the load information of each database server from the load information collection pool, and through the pre-configured dynamic load balancing algorithm, obtain the first weight coefficient of all metrics under each database server;
[0101] Among them, the specific calculation method of the first weight coefficient is as follows:
[0102]
[0103]
[0104] Among them, represents the set of metrics after standardizing all metrics under the corresponding database server the information degree of the j-th standardized metric in, ln( ) represents the logarithmic function, represents the set of standardized metrics the standard value of the j-th standardized metric in, represents the set of standardized metrics The first weight coefficient of the j-th standardized index in It indicates that the corresponding database server has m indicators in total, and m > 2; It represents all The maximum value in; It represents based on all The average value of.
[0105] In this embodiment, the preset standard refers to a set of standards predetermined when designing the system, including: the indicators considered by the load balancing algorithm and their weight distribution, the standard value range or threshold of each indicator, etc.
[0106] In this embodiment, the characteristics of the database server include: data processing ability, reliability and stability, scalability, high performance, etc.
[0107] In this embodiment, the load information collection pool is a software module used to collect, monitor, and store the load information of each node in the system in real time, periodically, or on demand.
[0108] In this embodiment, the load information refers to the load situation of the database server, including various indicators such as CPU usage rate, memory occupancy, disk I / O operations, and network traffic.
[0109] In this embodiment, the dynamic load balancing algorithm is an algorithm used to adjust the system resource allocation in a real-time environment to achieve load balancing. Among them: the obtained load information is standardized, and each indicator is mapped to the same dimension, and the load distribution to each server is dynamically adjusted according to the preset indicator weight coefficient.
[0110] In this embodiment, the first weight coefficient is a coefficient calculated for the dynamic load balancing algorithm after standardizing all indicators under each database server.
[0111] In this embodiment, the index information degree represents the information uncertainty difference of all indicators for all indicators under the database server.
[0112] The working principle and beneficial effects of the above technical solution are: through the standardized index set and calculating the first weight coefficient, the dynamic load balancing algorithm effectively schedules the load of the database server, keeps the system running in a high-performance state, and improves the system stability.
[0113] Embodiment 5:
[0114] Based on the above Embodiment 4, according to the characteristics of all database servers, select the load balancing technology and determine the configuration rules, including:
[0115] Based on all the metrics of the database server and the first weight coefficients, and in combination with the evaluation function, evaluate the load condition of the database server to obtain the load parameters of the database server;
[0116] Match the load balancing technology of the database server according to the load parameter - load balancing technology mapping table, and customize the configuration rules of the central load balancer according to the load balancing technology;
[0117] Combine the configuration rules and the load parameters to dynamically adjust the first weight coefficients of the database server metrics to obtain the second weight coefficients;
[0118] Based on the second weight coefficients and the load balancing technology, determine the configuration rules, and set the central load balancer as the intermediate layer to connect all database servers.
[0119] In this embodiment, the evaluation function is a parameter for evaluating the load condition;
[0120]
[0121] Among them, represents the evaluation result, represents that the database server has q metrics in total, represents the parameter value of the kth metric, represents the first weight coefficient of the kth metric.
[0122] In this embodiment, the load parameters are various metrics used to evaluate the load condition of the database server. It includes: CPU usage rate, memory utilization rate, disk read and write speed, network bandwidth utilization rate, request response time, etc.
[0123] In this embodiment, the load condition is the current workload and pressure status of the database server, including: the number of requests being processed currently, resource utilization rate, response time, etc.
[0124] In this embodiment, the load parameter - load balancing technology mapping table is a mapping table representing the corresponding situation between load parameters and load balancing technologies.
[0125] In this embodiment, the configuration rules refer to a series of operation rules determined according to information such as load parameters, load balancing technologies, and weight coefficients, including: load balancing algorithm selection, server health check setting, load scheduling strategy, weight coefficient adjustment rules, etc.
[0126] In this embodiment, the determination method of the second weight coefficient is as follows:
[0127]
[0128] Among them, represents the second weight coefficient, represents the first weight coefficient, represents that there are h configuration rules in total, represents the load parameter, represents the set parameter of the f-th configuration rule, represents the parameter weight of the f-th configuration rule, represents the standard parameter, represents obtaining from all the set parameter of the configuration rule corresponding to the maximum weight; 1. represents the conversion coefficient, which is convenient for unified calculation of numerical values.
[0129] The working principle and beneficial effects of the above technical solution are: By dynamically adjusting the weight coefficient, selecting an appropriate load balancing technology, and customizing the configuration rule, the load balancing optimization of the database server is realized, and the system is kept running in a high-performance state, improving the system stability.
[0130] Embodiment 6:
[0131] Based on the above Embodiment 1, the distribution strategy is jointly determined by the first strategy and the second strategy;
[0132] The first strategy includes: the IP address of the database server obtained by the central load balancer;
[0133] The second strategy includes: the carrying situation of the database server obtained by the central load balancer.
[0134] In this embodiment, the carrying situation refers to the current workload status of the database server, including: resource utilization rate, network load, service availability, etc.
[0135] The working principle and beneficial effects of the above technical solution are: By the central load balancer obtaining the IP address and carrying situation of the database server, intelligent load balancing scheduling is realized, and the system is kept running in a high-performance state, improving the system stability.
[0136] Embodiment 7:
[0137] Based on the above Embodiment 1, in the process of real-time monitoring of the execution performance indicators of each database server, it includes:
[0138] Configuring the database performance monitoring tool into each database server, and in accordance with the index preset standard of the database server, real-time monitoring the log information generated under the execution performance indicators of the database server;
[0139] If there is information in the analysis result of the log information that does not conform to the preset standard of the indicator, lock the inconsistent information and give an early warning based on the alarm rule.
[0140] In this embodiment, the database performance monitoring tool is a software specifically used to monitor, analyze, and manage the execution performance of a database system. Commonly included are tools such as SQL Profiler, MySQL Enterprise Monitor, and PGAdmin.
[0141] In this embodiment, the preset standard of the indicator is the standard of the execution performance indicators of the database server defined in advance.
[0142] In this embodiment, the log information refers to the records that record the running status and execution performance indicators of the database server, including: performance statistics, query execution situation, abnormal events, user activities, etc.
[0143] In this embodiment, the alarm rule is a set of conditions and actions preset in the database performance monitoring tool, used to generate real-time alarm notifications according to the monitoring data analysis results. It includes: trigger conditions, duration, alarm level, alarm actions, notification objects, etc.
[0144] The working principle and beneficial effects of the above technical solution are: The database performance monitoring tool monitors the execution performance of the server in real time, analyzes the log information and compares it with the preset standard. Abnormal situations trigger alarm notifications, keeping the system running in a high-performance state and improving system stability.
[0145] Embodiment 8:
[0146] Based on the above Embodiment 7, adjust the load balancing strategy and the connection pool parameters of the database server according to the monitoring data, including:
[0147] When an early warning reminder is issued, locate the database server with anomalies and obtain the abnormal monitoring data in the log information of the located server;
[0148] Obtain the current abnormal state of the located server according to the abnormal monitoring data, and combine the load balancing technology to adjust the load balancing strategy of the located server;
[0149] At the same time, analyze the occupancy of the connection pool resources of the located server in the current abnormal state to obtain the first load ratio;
[0150] Monitor the current occupancy of the corresponding connection pool resources to obtain the second load ratio;
[0151] When the second load ratio is greater than the first load ratio, adjust the corresponding connection pool parameters;
[0152] After the load balancing strategy and connection pool parameters are adjusted, continuously monitor the running status of the database server.
[0153] In this embodiment, the abnormal monitoring data refers to the information and metric data generated when abnormal situations occur during the operation of the database server, including: abnormal events, abnormal performance metrics, connection pool resource occupancy, comparison of metrics before and after load balancing strategy adjustment, and other data.
[0154] In this embodiment, the current abnormal status means that the database server has abnormal situations such as low performance, overloading, and response delay at a certain moment or within a certain time period.
[0155] In this embodiment, the connection pool resources refer to the buffer area in the database server for managing and allocating database connections, including: connection number limit, idle connections, active connections, waiting time, and other contents.
[0156] In this embodiment, the occupancy refers to the degree to which connection pool resources or other system resources are used within a specific time period, including: connection pool resource occupancy, CPU occupancy, memory occupancy, network bandwidth occupancy, etc.
[0157] In this embodiment, the first load ratio refers to analyzing the occupancy of the connection pool resources of the database server located under the abnormal status.
[0158] In this embodiment, the second load ratio refers to monitoring and analyzing the real-time occupancy of the connection pool resources of the database server after the server load balancing strategy is adjusted.
[0159] In this embodiment, the adjustment includes: operations such as request routing adjustment, weight adjustment, failover, and connection pool management.
[0160] The working principle and beneficial effects of the above technical solution are: By monitoring the abnormal status, adjusting the load balancing and connection pool parameters, the system is maintained to run in a high-performance state, improving the system stability.
[0161] Finally, it should be noted that: The above embodiments are only used to illustrate the technical solutions of the present invention, rather than limiting them; Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: They can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; And these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A multi-database processing method based on load balancing, characterized in that, Including: Step 1: Classify the target data according to business requirements and data access characteristics, and match a database server to each classified data according to the classification database; Step 2: Select a load balancing technology and determine configuration rules according to the characteristics of all database servers, and set a central load balancer as the middle layer to connect all database servers according to the configuration rules; Step 3: When the central load balancer receives a client request, route the request to different database servers connected by the central load balancer according to the distribution strategy; Step 4: Monitor the execution performance metrics of each database server in real time, and adjust the load balancing strategy and the connection pool parameters of the database server according to the monitoring data; Among them, in the process of selecting a load balancing technology and determining configuration rules according to the characteristics of all database servers, it includes: Based on the characteristics of the database server and preset criteria, obtain the load information of each database server from the load information collection pool, and obtain the first weight coefficient of all metrics under each database server through a pre-configured dynamic load balancing algorithm; Among them, the specific calculation method of the first weight coefficient is as follows: ; among them, represents the set of metrics after standardizing all metrics under the corresponding database server is the information degree of the j-th standardized metric in , ln( ) represents the logarithmic function, represents the set of standardized metrics is the standard value of the j-th standardized metric in , represents the set of standardized metrics is the first weight coefficient of the j-th standardized metric in , represents that there are m metrics in the corresponding database server, and m > 2; represents all the maximum value in ; represents the average value based on all in .
2. The multi-database processing method based on load balancing according to claim 1, characterized in that, Classify the target data according to business requirements and data access characteristics, including: Send a query request to the business client to obtain business requirement data matching the query request; Perform a first classification on the target data according to the characteristics of the business requirement data; Divide the data after the first classification according to the data access characteristics to obtain the second classified data. Among them, the second classified data is the result of classifying the target data.
3. A multi-database processing method based on load balancing according to claim 1, characterized in that, Match a database server to each classified data, including: Determine the initial adaptability of each second classified data to each server in the classification database; ; wherein, 1 represents the initial fitness of the corresponding second classification data to the corresponding server, ( ) represents an adjustment function, specifically the adjustment of , represents the correlation degree of the corresponding server with the i-th data in the corresponding second classification data, which is obtained based on the server-data category correlation degree mapping table, represents the preset weight coefficient of the i-th data in the corresponding second classification data, represents the mean function, and ln represents the logarithmic function, represents the standard correlation degree set for the corresponding server, and n represents the total number of all data in the corresponding second classification data; According to the priority of the corresponding second classified data and combined with each initial adaptability involved, calculate the final adaptability of the corresponding second classified data to each server; ; wherein, represents the final adaptability of the corresponding second classification data to the corresponding server; represents the highest priority among all priorities; represents the priority of the corresponding second classification data; represents the floor function; min represents the minimum symbol; max represents the maximum symbol; Select the server corresponding to the highest adaptability from all the final adaptabilities under each second classified data as the database server of the corresponding second classified data.
4. A multi-database processing method based on load balancing according to claim 1, characterized in that, Select a load balancing technology and determine configuration rules according to the characteristics of all database servers, including: Based on all metrics of the database server and the first weight coefficient, combine an evaluation function to evaluate the load situation of the database server to obtain the load parameters of the database server; Match the load balancing technology of the database server according to the load parameter - load balancing technology mapping table, and customize the configuration rules of the central load balancer according to the load balancing technology; Combine the configuration rules and the load parameters to dynamically adjust the first weight coefficient of the database server metrics to obtain the second weight coefficient; Based on the second weight coefficient and the load balancing technology, determine the configuration rules, and set a central load balancer as the middle layer to connect all database servers.
5. A multi-database processing method based on load balancing according to claim 1, characterized in that The distribution strategy is jointly determined by the first strategy and the second strategy; The first strategy includes: the IP address of the database server obtained by the central load balancer; The second strategy includes: the carrying situation of the database server obtained by the central load balancer.
6. A multi-database processing method based on load balancing according to claim 1, characterized in that During the process of real-time monitoring of the execution performance metrics of each database server, it includes: Configuring a database performance monitoring tool into each database server, and real-time monitoring the log information generated under the execution performance metrics of the database server according to the preset standard of the metrics of the database server; If there is information in the analysis result of the log information that does not conform to the preset standard of the metrics, lock the inconsistent information and give an early warning based on the alarm rule.
7. A multi-database processing method based on load balancing according to claim 6, characterized in that, Adjusting the load balancing strategy and the connection pool parameters of the database server according to the monitoring data, including: When an early warning reminder is issued, locate the database server with anomalies and obtain the anomaly monitoring data in the log information of the located server; Obtain the current anomaly status of the located server according to the anomaly monitoring data, and combine with the load balancing technology to adjust the load balancing strategy of the located server; At the same time, analyze the occupancy of the connection pool resources of the located server in the current anomaly status to obtain the first load ratio; Monitor the current occupancy of the corresponding connection pool resources to obtain the second load ratio; When the second load ratio is greater than the first load ratio, adjust the corresponding connection pool parameters; After the load balancing strategy and the connection pool parameters are adjusted, continuously monitor the running status of the database server.
Citation Information
Patent Citations
Web application cluster buffer utilization method and system
CN106326012A