Database performance adjusting and optimizing method and device, electronic equipment and storage medium

By acquiring and processing the dynamic characteristics and internal metrics of the database, combined with the online training and update mechanism of the agent, the problem of poor performance tuning of the database under dynamic workloads is solved, and more efficient database performance tuning is achieved.

CN120104594APending Publication Date: 2025-06-06ZHENGZHOU UNIV
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510178173.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-06-06

AI Technical Summary

Technical Problem

The existing database performance tuning methods are poor in overall performance tuning and are difficult to adapt to workload changes when facing dynamic workloads.

Method used

By obtaining the dynamic characteristics of the current workload and the internal metrics of the target database, splicing them into the current state characteristics, using the agent to output the current configuration parameters based on these characteristics, and performing online updates. The method includes multi-sampling to process dynamic features and searching for simulated data sets of similar dynamic features from the data repository for retraining of the agent when the workload drifts.

Benefits of technology

It is implemented in a dynamic workload environment, the agent can recommend better configuration parameters based on the current database status and workload, thereby improving the overall performance of the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120104594A_ABST
    Figure CN120104594A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of databases, and discloses a database performance adjusting and optimizing method and device, electronic equipment and a storage medium, and the method comprises the steps of obtaining a current working load in response to an online adjusting and optimizing request; when the target database executes the current working load, obtaining a current dynamic characteristic of the current working load and a current internal measurement index of the target database; splicing the current dynamic feature and the current internal measurement index into a current state feature; the intelligent agent outputs a current configuration parameter based on the current state feature; wherein learning training is performed according to training data in the experience pool to generate an intelligent agent; and updating the parameters of the target database on line according to the current configuration parameters. The database performance can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of database technology, and in particular to a database performance tuning method, device, electronic device and storage medium. Background Art

[0002] There are a large number of parameters in the database and their settings directly affect the performance of the database. Reasonable parameter settings are crucial to improving the throughput, latency, resource utilization, system stability, etc. of the database system. Database parameter automatic tuning technology automatically adjusts the parameters of the current database through algorithms to optimize the database performance under the current load; the current parameter automatic tuning method refers to the use of machine learning technology to achieve automatic configuration of database parameters, including automatic tuning based on traditional machine learning, automatic tuning based on deep learning, and automatic tuning based on reinforcement learning.

[0003] Although traditional machine learning-based methods can recommend better parameters in a short period of time, they are often prone to falling into local optimality. Deep learning-based methods require a large number of high-quality samples to train the model, but in the real world, obtaining a large number of high-quality samples requires expensive time costs. Deep reinforcement learning-based methods learn by interacting with the environment, do not require prior knowledge, and can often find ideal parameter configurations. However, tuning algorithms that only consider static workloads are difficult to adapt when the workload changes, resulting in the inability to recommend better parameter configurations, which in turn affects the overall performance of the database. Summary of the invention

[0004] In view of this, the embodiments of the present application provide a database performance tuning method, device, electronic device and storage medium, which can effectively solve the problem of poor overall database performance tuning effect when facing dynamic workloads.

[0005] In a first aspect, an embodiment of the present application provides a database performance tuning method, comprising:

[0006] Respond to online tuning requests and obtain and generate current workload;

[0007] When the target database executes the current workload, obtaining current dynamic characteristics of the current workload and current internal metrics of the target database;

[0008] Splicing the current dynamic feature and the current internal metric into a current state feature;

[0009] The intelligent agent outputs current configuration parameters based on the current state characteristics; wherein the intelligent agent is generated by learning and training according to the training data in the experience pool;

[0010] The parameters of the target database are updated online according to the current configuration parameters.

[0011] In some embodiments, obtaining the current dynamic characteristics of the current workload includes:

[0012] Dividing the current workload into a plurality of current time intervals, and processing a portion of the workload corresponding to each current time interval to obtain current vector information;

[0013] According to the time series, the vector information corresponding to all the time intervals is spliced ​​to obtain the current dynamic feature.

[0014] In some embodiments, the processing of the portion of the workload corresponding to each current time interval to obtain the current vector information includes:

[0015] Abstracting query statements in the portion of the workload corresponding to the current time interval into multiple templates;

[0016] The current vector information corresponding to each current time interval is determined according to the arrival rates of all the templates.

[0017] In some embodiments, determining the current vector information corresponding to each current time interval according to the arrival rates of all the templates includes:

[0018] According to the similarity of the template arrival rates, a preset clustering algorithm is used to cluster all the templates to obtain a plurality of clusters;

[0019] Determine the average arrival rate of each cluster based on the arrival rates of all templates in each cluster;

[0020] The current vector information is determined according to the average arrival rate of all clusters.

[0021] In some embodiments, obtaining training data of the agent includes:

[0022] In response to multiple simulated parameter adjustment task requests, the load generator generates a simulated workload corresponding to each of the simulated parameter adjustment task requests;

[0023] Obtaining dynamic characteristics corresponding to each of the simulated workloads and internal metrics of the target database;

[0024] Determining current simulation state characteristics and next simulation state characteristics of the environment according to the dynamic characteristics corresponding to the simulated workload and the internal metric indicators of the target database;

[0025] The agent outputs corresponding simulation configuration parameters based on the current simulation state characteristics;

[0026] After configuring the simulation configuration parameters to the target database, using the simulation workload to perform a stress test on the target database, and calculating a reward based on the test results;

[0027] Determine the simulation data group corresponding to each simulation parameter adjustment task request according to the current simulation state characteristics, the next simulation state characteristics, the reward and the simulation configuration parameters, and store all the simulation data groups in the experience pool;

[0028] A plurality of the simulated data groups are randomly selected from the experience pool as the training data.

[0029] In some embodiments, obtaining training data of the agent further includes:

[0030] storing each of the simulation data groups and the corresponding dynamic features in a data repository;

[0031] During the agent's cyclic training and updating process, if the current simulation workload drifts, a simulation data group that meets the preset requirements will be searched from the data repository and sent to the experience pool.

[0032] In some embodiments, the method further comprises:

[0033] When the parameters of the target database are updated online, if the current workload drifts, a simulated data group that meets the preset requirements is searched in the data repository and put into the experience pool, and a plurality of the simulated data groups are randomly selected from the experience pool to retrain the agent.

[0034] In a second aspect, an embodiment of the present application provides a database performance tuning device, including a response module, an acquisition module, a processing module, an agent module, and an update module;

[0035] The response module is used to respond to the online optimization request and obtain the current workload;

[0036] The acquisition module is used to acquire the current dynamic characteristics and current internal measurement indicators of the current workload when the target database executes the current workload;

[0037] The processing module is used to splice the current dynamic feature and the current internal metric into a current state feature;

[0038] The intelligent agent module is used to enable the intelligent agent to output current configuration parameters based on the current state characteristics; wherein the intelligent agent is generated by learning and training according to the training data in the experience pool;

[0039] The updating module is used to update the parameters of the target database online according to the current configuration parameters.

[0040] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the above-mentioned database performance tuning method.

[0041] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which implements the above-mentioned database performance tuning method when executed on a processor.

[0042] The embodiments of the present application have the following beneficial effects:

[0043] The database performance tuning method of the present application, in response to an online tuning request, the load generator generates the current workload; when the target database executes the current workload, the current dynamic features of the current workload and the current internal metrics of the target database are obtained; the current dynamic features and the current internal metrics are spliced ​​into current state features; the intelligent agent outputs the current configuration parameters based on the current state features; and the parameters of the target database are updated online according to the current configuration parameters. Among them, the dynamic features enable the intelligent agent to learn the relationship between the current workload, the current state features of the target database, and the current configuration parameters, so that the intelligent agent can recommend better current configuration parameters based on the current state features of the current database and the current workload in a dynamic environment where the workload is constantly changing, and the target database configured according to the current configuration parameters has better performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0045] Figure 1 A schematic diagram of a framework for database performance tuning in the prior art is shown;

[0046] Figure 2 A schematic diagram of a framework for database performance tuning in an embodiment of the present application is shown;

[0047] Figure 3 A flow chart of a database performance tuning method in an embodiment of the present application is shown;

[0048] Figure 4A flowchart of a method for optimizing database performance in an embodiment of the present application is shown;

[0049] Figure 5 A flow chart for obtaining current dynamic features in an embodiment of the present application is shown;

[0050] Figure 6 A first flow chart of obtaining current vector information in an embodiment of the present application is shown;

[0051] Figure 7 A second flow chart for obtaining current vector information in an embodiment of the present application is shown;

[0052] Figure 8 A flow chart showing how to obtain training data for an agent in an embodiment of the present application is provided;

[0053] Fig. 9 A schematic diagram of the structure of a database performance tuning device according to an embodiment of the present application is shown.

[0054] Description of main component symbols:

[0055] 10-response module; 20-acquisition module; 30-processing module; 40-agent module; 50-update module. DETAILED DESCRIPTION

[0056] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.

[0057] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0058] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.

[0059] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present application belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present application.

[0060] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0061] Currently, the tuning based on deep reinforcement learning, such as Figure 1 As shown in the figure: First, the user sends a tuning request. After receiving the user's request, the controller performs online tuning in combination with the current workload. The indicator collector collects external and internal metrics of the target database environment while the target database executes these current workloads. External metrics refer to information that directly reflects database performance, such as throughput and latency. Internal metrics refer to information that reflects the current state of the database, such as buffer pool read pages (buffer_pages_read), buffer pool reads (buffer_pool_reads), etc. The controller configures the appropriate parameters recommended by the agent based on the internal metrics into the database. The appropriate parameters recommended by the agent and the metrics collected by the indicator collector together constitute the training data and are stored in the experience pool for updating the agent.

[0062] like Figure 1 The deep reinforcement learning-based tuning shown only considers static workloads, which makes it difficult to adapt to workload changes. Therefore, this application proposes a deep reinforcement learning method that considers dynamic workloads to recommend better configuration parameters, thereby improving the overall performance of the database, such as Figure 2 The framework diagram of database performance tuning based on deep reinforcement learning is shown in the figure. In the data processing, the extraction of dynamic features is newly added, and the state characteristics of the database environment are determined according to the current dynamic features and the internal metrics of the target database, so that the intelligent agent can perform cyclic training according to the state characteristics. In addition, a new data repository is added to store simulated data groups and their corresponding dynamic features. When the workload changes significantly, simulated data with similar dynamic features can be found in the data repository, and the model can be retrained to adapt to the current workload more quickly.

[0063] The database performance tuning method is described below in conjunction with some specific embodiments.

[0064] Figure 3A flow chart of a database performance tuning method in an embodiment of the present application is shown. Figure 4 A process framework diagram of a database performance tuning method in an embodiment of the present application is shown. Exemplarily, the database performance tuning method includes the following steps:

[0065] S100, respond to the online tuning request and obtain the current workload.

[0066] In this embodiment, a performance testing tool is used to generate a workload with a constantly changing read-write ratio. For example, the performance testing tool uses Sysbench, which is a modular, cross-platform, multi-threaded benchmark tool that is mainly used to evaluate the database load under various system parameters.

[0067] S200, when the target database executes the current workload, obtain the current dynamic characteristics of the current workload and the current internal measurement indicators of the target database.

[0068] In the embodiment, the process of obtaining the internal measurement index and the specific index of the internal measurement index are prior art and will not be described in detail. The current workload is processed based on the multiple sampling method to obtain the current dynamic features; the multiple sampling method is to first divide the workload into multiple time intervals, and then sample in each time interval, so as to quickly extract the dynamic features.

[0069] In some embodiments, Figure 5 As shown, the process of obtaining the current dynamic characteristics of the current workload based on the multi-sampling method includes:

[0070] S210, dividing the current workload into a plurality of current time intervals, and processing a portion of the workload corresponding to each current time interval to obtain current vector information.

[0071] In some embodiments, Figure 6 As shown, the process of processing a portion of the workload corresponding to each current time interval to obtain current vector information includes:

[0072] S211, abstracting the query statements in a part of the workload corresponding to the current time interval into multiple templates.

[0073] Exemplarily, the query statements in the workload, ie, Query statements, are abstracted into k templates.

[0074] template 1 ,template 2 ,…,template k =GT(sql 1 ,sql 2,…,sql n )

[0075] Among them, GT(·) represents the overall process of abstracting the original SQL into a template, which mainly includes: extracting constants from the SQL string and replacing them with value placeholders. The extracted constants include: values ​​in the where clause, set fields in the update statement, and value fields in the insert statement; sql represents the query statement in the workload; template represents the template.

[0076] S212: Determine current vector information corresponding to each current time interval according to the arrival rates of all templates.

[0077] In some implementations, first, all templates are clustered into multiple clusters using a preset clustering algorithm according to the arrival rate of the templates; then, vector information of a certain length is formed according to the multiple clusters, such as Figure 7 As shown, including:

[0078] S2121, clustering all templates using a preset clustering algorithm according to the similarity of template arrival rates to obtain multiple clusters.

[0079] For example, the arrival rate of each template is first determined, and then the preset clustering algorithm DBSCAN is used to cluster all k templates into l clusters according to the similarity between the template arrival rates.

[0080] cluster 1 ,cluster 2 ,…,cluster l =CA(template 1 ,template 2 ,…,template k )

[0081] Among them, cluster represents the cluster obtained by clustering; CA represents clustering processing.

[0082] S2122: Determine an average arrival rate of each cluster according to the arrival rates of all templates in each cluster.

[0083] Exemplarily, the workload is first divided into m time intervals, and the arrival status of each cluster is calculated in each time interval.

[0084]

[0085] Among them, arh cluster It indicates the average arrival rate of all templates in the cluster, that is, the arrival status of the cluster. Count indicates the number of templates in each cluster. is the arrival rate of template i.

[0086] S2123, determine current vector information according to the average arrival rate of all clusters.

[0087] For example, the vector information result of the i-th time interval i .

[0088] Result i =(arh cluster1 ,arh cluster2 ,…,arh clusterl ).

[0089] S220, according to the time series, concatenate the vector information corresponding to all time intervals to obtain the current dynamic features.

[0090] Exemplarily, the vector information corresponding to the obtained m time intervals is concatenated together to form the current dynamic feature C of the workload W .

[0091] C W =(result 1 ,result 2 ,…,result m )

[0092] This embodiment uses the idea of ​​multiple sampling to extract dynamic features from the workload, that is, by dividing the workload into multiple time intervals, sampling in each time interval to obtain the arrival of clusters, and finally splicing the sampled information in each time interval to form the dynamic features of the workload. The dynamic features enable the agent to learn the relationship between the workload, the state features of the target database, and the configuration parameters, so that the agent can recommend better configuration parameters based on the state features of the current database and the workload in a dynamic environment where the workload is constantly changing.

[0093] S300, concatenate the current dynamic features and the current internal measurement indicators into the current state features.

[0094] In this embodiment, the current dynamic characteristics of the current workload and the current internal metrics of the target database are concatenated as the next state characteristics of the environment.

[0095] S400, the intelligent agent outputs current configuration parameters based on current state characteristics; wherein the intelligent agent is generated through learning training according to the training data in the experience pool.

[0096] In this embodiment, the intelligent agent includes a first neural network model and a second neural network model; wherein the first neural network model is an Actor network, which is used to output configuration parameters; and the second neural network model is a Critic network, which is used to evaluate the configuration parameters.

[0097] In some embodiments, the two neural network models of the agent are determined by pre-training offline. Figure 8 As shown, the process of obtaining the training data for offline training includes:

[0098] S410, respond to multiple simulation parameter adjustment task requests and generate a simulation workload corresponding to each simulation parameter adjustment task request.

[0099] Exemplarily, during offline training, the load generator responds to simulated parameter adjustment task requests and generates a simulated workload corresponding to each simulated parameter adjustment task request.

[0100] S420, obtaining dynamic characteristics corresponding to each simulated workload and internal measurement indicators of the target database.

[0101] Exemplarily, the process of obtaining the dynamic characteristics of the simulated workload is the same as the process of obtaining the current dynamic characteristics of the current workload in the above-mentioned online tuning process, and will not be repeated here.

[0102] S430, determining current simulation state characteristics and next simulation state characteristics of the environment according to the dynamic characteristics corresponding to the simulation workload and the internal metric indicators of the target database.

[0103] Exemplarily, the dynamic characteristics and internal metrics of the simulated workload at time t are spliced ​​into the current simulation state characteristics S at time t; the dynamic characteristics and internal metrics of the simulated workload at time t+1 are spliced ​​into the next simulation state characteristics Sˋ at time t+1. This can be understood as determining the simulation configuration parameters according to each current simulation state characteristic, and performing a stress test after each simulation configuration parameter is configured to the target database. After the stress test, the dynamic characteristics corresponding to the next simulation workload and the internal metrics of the target database are re-obtained; then, the next simulation state characteristics Sˋ are spliced ​​according to the dynamic characteristics of the next simulation workload and the internal metrics of the target database.

[0104] S440, the intelligent agent outputs corresponding simulation configuration parameters based on the current simulation state characteristics.

[0105] Exemplarily, the agent outputs the corresponding simulation configuration parameter a according to the current simulation state feature S, and outputs the corresponding simulation configuration parameter aˋ according to the next simulation state feature Sˋ.

[0106] S450, after configuring the simulation configuration parameters to the target database, use the simulation workload to perform a stress test on the target database, and calculate the reward based on the test result.

[0107] Demonstratively, first, the simulation configuration parameter a is configured into the target database; then, the target data is stress tested using a simulated workload, mainly testing the number of queries per second (QPS), the number of transactions per second (TPS), and the latency (Latency) indicators; among which, the number of queries per second and the number of transactions per second indicators are maximization indicators, and the latency is a minimization indicator, so the test results include the maximization indicator and the minimization indicator; finally, the reward r is calculated based on the test results.

[0108] The reward r is calculated as:

[0109]

[0110] Among them, Δ t→0 and Δ t→t-1 Represent the performance change between time t and the initial performance and the previous time, Δ t→t-1 The calculation method is as follows:

[0111]

[0112] Among them, T t Represents the value of the indicator at the current time t, T τ Represents the value of the indicator at time τ.

[0113] S460, determine the simulation data group corresponding to each simulation parameter adjustment task request according to the current simulation state characteristics, the next simulation state characteristics, the reward and the simulation configuration parameters, and store all simulation data groups into the experience pool.

[0114] In some embodiments, each simulated data set (s, a, r, s′) is directly stored in the experience pool, and each simulated data set (s, a, r, s′) and its corresponding dynamic feature C are stored in the experience pool. W The data is stored in the data repository so that when the workload drifts during the online tuning process, a simulation data group that meets the requirements can be selected from the data repository.

[0115] S470, randomly selecting multiple simulation data groups from the experience pool as training data.

[0116] In some embodiments, multiple simulated data sets are randomly used as training data to cyclically update the agent until the maximum number of iterations is reached. The agent is updated as follows:

[0117] First, use the target critic network Q′ C Calculate the target Q value y:

[0118]

[0119] Among them, r is the reward, γ represents the discount rate, s' is the next state feature, π' A is the target Actor network, Represents the target Actor network parameters, are the network parameters of the target Critic network.

[0120] The loss function is defined by the mean square error between the target Q value and the current Q value, and the Critic network L is updated by minimizing the loss function. C :

[0121]

[0122] Among them, Q C is the current Critic network, s is the current state feature, θ is the current network parameter, π A is the current Actor network, The network parameters of the current Actor network.

[0123] Then, calculate the policy gradient and update the current Actor network:

[0124]

[0125] in, Represents the gradient symbol.

[0126] Finally, the target network is updated using soft update:

[0127]

[0128] Where ∈ represents the soft update coefficient.

[0129] In this embodiment, during the agent's cyclic training and updating process, if the current simulated workload drifts, a simulated data group that meets the preset requirements will be searched from the data repository and sent to the experience pool, so that the agent randomly selects multiple simulated data groups from the experience pool to retrain the agent. Among them, if the Euclidean distance between the dynamic characteristics of the current simulated workload and the dynamic characteristics of the previous simulated workload exceeds the first preset value, it is judged that the current workload has drifted; at this time, a simulated data group that is the same or similar to the current simulated workload is searched from the data repository and sent to the experience pool. The Euclidean distance between the dynamic characteristics corresponding to the simulated data group searched and the current dynamic characteristics is less than the second preset value, that is, the similarity is measured by the Euclidean distance; the second preset value is less than the first preset value.

[0130] S500: Update the parameters of the target database online according to the current configuration parameters.

[0131] Exemplarily, the current configuration parameters are configured into the target database, so that the target database is configured with the current configuration parameters, thereby realizing online updating of the parameters of the target database.

[0132] S600, when the parameters of the target database are updated online, if the current workload drifts, a simulated data group that meets the preset requirements is searched in the data repository and put into the experience pool, and multiple simulated data groups are randomly selected from the experience pool to re-learn the intelligent agent.

[0133] In this embodiment, when the parameters of the target database are updated online, if the current workload of the target database drifts, a simulated data group that meets the preset requirements is searched in the data repository and put into the experience pool, and multiple simulated data groups are randomly selected from the experience pool to re-learn the intelligent agent; in other words, when the parameters of the target database are updated online, if the Euclidean distance between the dynamic characteristics of the current workload and the dynamic characteristics of the previous workload exceeds a first preset value, it is determined that the current workload has drifted; at this time, the similarity is measured by the Euclidean distance, that is, the Euclidean distance between the dynamic characteristics corresponding to the simulated data group in the data repository and the current dynamic characteristics is less than a second preset value, and a simulated data group that is the same or similar to the current workload is searched from the data repository and sent to the experience pool, so that the intelligent agent randomly selects multiple simulated data groups from the experience pool for re-learning, which enables the intelligent agent to perform online training updates.

[0134] This embodiment uses a data repository to save simulated data groups and their corresponding dynamic features. When the workload drifts, it is possible to find simulated data groups with similar dynamic features from the data repository and quickly retrain the network model within the intelligent body so that the network model of the intelligent body can adapt to the current workload more quickly.

[0135] Fig. 9 A schematic diagram of the structure of the database performance tuning device of the embodiment of the present application is shown. Exemplarily, the database performance tuning device includes a response module 10, an acquisition module 20, a processing module 30, an intelligent agent module 40 and an update module 50; the response module is used to respond to online optimization requests and acquire and generate the current workload; the acquisition module is used to acquire the current dynamic characteristics of the current workload and the current internal metrics of the target database when the target database executes the current workload; the processing module is used to splice the current dynamic characteristics and the current internal metrics into the current state characteristics; the intelligent agent module is used to enable the intelligent agent to output the current configuration parameters based on the current state characteristics; wherein, the intelligent agent is generated by learning and training according to the training data in the experience pool; the update module is used to update the parameters of the target database online according to the current configuration parameters.

[0136] It can be understood that the device of this embodiment corresponds to the database performance tuning method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.

[0137] The present application also provides an electronic device. Exemplarily, the electronic device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the electronic device to execute the functions of each module in the above-mentioned database performance tuning method or the above-mentioned database performance tuning device.

[0138] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.

[0139] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.

[0140] The present application also provides a computer-readable storage medium for storing the computer program used in the above electronic device. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0141] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0142] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0143] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application.

[0144] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.

Claims

1. A database performance tuning method, characterized in that: include: Respond to online tuning requests and obtain current workload; When the target database executes the current workload, obtaining current dynamic characteristics of the current workload and current internal metrics of the target database; Splicing the current dynamic feature and the current internal metric into a current state feature; The intelligent agent outputs current configuration parameters based on the current state characteristics; wherein the intelligent agent is generated by learning and training according to the training data in the experience pool; The parameters of the target database are updated online according to the current configuration parameters.

2. The database performance tuning method according to claim 1, characterized in that: The obtaining of the current dynamic characteristics of the current workload includes: Dividing the current workload into a plurality of current time intervals, and processing a portion of the workload corresponding to each current time interval to obtain current vector information; According to the time series, the vector information corresponding to all the time intervals is spliced ​​to obtain the current dynamic feature.

3. The database performance tuning method according to claim 2, characterized in that: The processing of the portion of the workload corresponding to each current time interval to obtain current vector information includes: Abstracting query statements in the portion of the workload corresponding to the current time interval into multiple templates; The current vector information corresponding to each current time interval is determined according to the arrival rates of all the templates.

4. The database performance tuning method according to claim 3, characterized in that: The determining, according to the arrival rates of all the templates, the current vector information corresponding to each current time interval includes: According to the similarity of the template arrival rates, a preset clustering algorithm is used to cluster all the templates to obtain a plurality of clusters; Determine the average arrival rate of each cluster based on the arrival rates of all templates in each cluster; The current vector information is determined according to the average arrival rate of all clusters.

5. The database performance tuning method according to claim 1, characterized in that: Obtaining training data for the agent, including: In response to multiple simulated parameter adjustment task requests, the load generator generates a simulated workload corresponding to each of the simulated parameter adjustment task requests; Obtaining dynamic characteristics corresponding to each of the simulated workloads and internal metrics of the target database; Determining current simulation state characteristics and next simulation state characteristics of the environment according to the dynamic characteristics corresponding to the simulated workload and the internal metric indicators of the target database; The agent outputs corresponding simulation configuration parameters based on the current simulation state characteristics; After configuring the simulation configuration parameters to the target database, using the simulation workload to perform a stress test on the target database, and calculating a reward based on the test results; Determine the simulation data group corresponding to each simulation parameter adjustment task request according to the current simulation state characteristics, the next simulation state characteristics, the reward and the simulation configuration parameters, and store all the simulation data groups in the experience pool; A plurality of the simulated data groups are randomly selected from the experience pool as the training data.

6. The database performance tuning method according to claim 5, characterized in that: Obtaining training data for the agent also includes: storing each of the simulation data groups and the corresponding dynamic features in a data repository; During the agent's cyclic training and updating process, if the current simulation workload drifts, a simulation data group that meets the preset requirements will be searched from the data repository and sent to the experience pool.

7. The database performance tuning method according to claim 1, characterized in that: The method further comprises: When the parameters of the target database are updated online, if the current workload drifts, a simulated data group that meets the preset requirements is searched in the data repository and put into the experience pool, and a plurality of the simulated data groups are randomly selected from the experience pool to retrain the agent.

8. A database performance tuning device, characterized in that: It includes a response module, an acquisition module, a processing module, an agent module and an update module; The response module is used to respond to the online optimization request and obtain and generate the current workload; The acquisition module is used to acquire the current dynamic characteristics of the current workload and the current internal measurement indicators of the target database when the target database executes the current workload; The processing module is used to splice the current dynamic feature and the current internal metric into a current state feature; The intelligent agent module is used to enable the intelligent agent to output current configuration parameters based on the current state characteristics; wherein the intelligent agent is generated by learning and training according to the training data in the experience pool; The updating module is used to update the parameters of the target database online according to the current configuration parameters.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory stores a computer program, and the processor is configured to execute the computer program to implement the database performance tuning method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer program is stored therein, and when the computer program is executed on a processor, the database performance tuning method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • AI agent data communication management method and device, medium and electronic device

    CN121486119A