Database adaptive parameter tuning method, device, equipment, medium and product
Patent Information
- Application Number
- CN202611114001.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-27
- Publication Date
- 2026-08-28
AI Technical Summary
[0003]相关技术中,通常在保持数据库状态不变的情况下,调整数据库参数,但针对真实的业务场景而言,用户的业务时刻发生变化,用户的数据库实例同样时刻也在进行高速的读写,导致调参的准确性不足
[0034] As will be described in detail below, a database adaptive parameter tuning method, apparatus, device, medium, and product according to embodiments of this disclosure are disclosed. In embodiments of this disclosure, firstly, a known database instance that has been adjusted is used as a standard instance based on the user's business status. Then, instance information about the database instance to be tuned and the user's business information are obtained, and the instance information of the standard instance, the instance information of the database instance to be tuned, and the business information are vectorized to obtain a target vector matrix. Next, it is determined whether each column vector in the target vector matrix originates from a source domain or a target domain, resulting in a determination result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be tuned. Finally, adaptive parameter tuning of the database to be tuned is performed based on the determination result. Through the above processing method, this disclosure uses a standard instance as a benchmark adjusted by domain experts. This introduces expert knowledge through the standard instance, providing a high-quality reference benchmark for the parameter tuning algorithm to ensure the correctness of the tuning direction. Then, the target vector matrix obtained after processing represents the intrinsic relationship between the database parameter configuration and the business scenario, so that the parameter tuning results are deeply aligned with the user's actual business needs. Furthermore, through the domain judgment process, it is ensured that the parameter tuning can specifically move the instance to be tuned toward the standard instance. Finally, by continuously optimizing the judgment results, the parameter configuration of the database instance to be tuned continues to approach the standard instance, thereby gradually improving the accuracy of parameter tuning and achieving high-quality adaptive database parameter tuning to improve the accuracy of the parameter tuning process.
Smart Images

Figure CN122654101A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the technical field of intelligent parameter tuning, and more specifically, to a database adaptive parameter tuning method, apparatus, device, medium, and product. Background Technology
[0002] Among the many research directions in Database Management Systems (DBMS), building an intelligent database parameter tuning system has become an essential requirement in the industry. Therefore, cloud service providers urgently need to break through the traditional manual database parameter tuning model and achieve Intelligent Knobs Tuning (IKT) for database system parameters.
[0003] In related technologies, database parameters are usually adjusted while keeping the database state unchanged. However, in real business scenarios, users' business needs change constantly, and users' database instances are also constantly performing high-speed read and write operations, resulting in insufficient accuracy of parameter tuning. Summary of the Invention
[0004] This disclosure is made in view of the above-mentioned problems. This disclosure provides a method, apparatus, device, medium, and product for adaptive parameter tuning of a database.
[0005] In a first aspect, embodiments of this disclosure provide a database adaptive parameter tuning method, comprising: Based on the user's business status, the adjusted known database instance will be used as the standard instance.
[0006] Obtain the user's instance information about the database instance to be adjusted and the user's business information.
[0007] The instance information of the standard instance, the instance information of the database instance to be called, and the business information are vectorized to obtain the target vector matrix.
[0008] The system determines whether each column vector in the target vector matrix originates from the source domain or the target domain, thus obtaining the determination result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted.
[0009] Adaptive parameter tuning is performed on the database to be tuned based on the judgment results.
[0010] In one embodiment of the first aspect, the instance information of the standard instance, the instance information of the database instance to be called, and the business information are vectorized to obtain a target vector matrix, including: The instance information and business information of the standard instance are vectorized by the multi-head attention mechanism in the encoder to obtain the first vector matrix.
[0011] The instance information and business information of the database instance to be debugged are vectorized using a multi-head attention mechanism to obtain a second vector matrix.
[0012] The first and second vector matrices are concatenated sequentially to obtain the target vector matrix. The target vector matrix contains the following information: the correlation between the instance information of the standard instance and the instance information of the database instance to be adjusted; the correlation between the instance information of the standard instance and the business information; and the correlation between the instance information of the database instance to be adjusted and the business information.
[0013] In one embodiment of the first aspect, adaptive parameter tuning of the database to be tuned is performed based on the judgment result, including: The domain label is determined based on the source of each column vector in the target vector matrix.
[0014] The classification loss value is calculated based on the difference between the judgment result and the domain label.
[0015] The consistency loss value is calculated based on business information and the consistency loss function.
[0016] By alternately optimizing the classification loss value and the consistency loss value, adversarial training is performed on the domain classifier and encoder, and adaptive parameter tuning is performed on the target database based on the results of the adversarial training.
[0017] In one embodiment of the first aspect, calculating a consistency loss value based on business information and a consistency loss function includes: Obtain the parameter configuration information of the standard instance and the parameter configuration information of the database instance to be called.
[0018] Calculate the average value of all parameter configuration information in the database instance to be adjusted.
[0019] The parameter configuration information of the standard instance, the parameter configuration information of the database instance to be adjusted, and the business information are merged to obtain the fusion result.
[0020] The difference between the average value and the fusion result is calculated based on the consistency loss function and used as the consistency loss value.
[0021] In one embodiment of the first aspect, adaptive parameter tuning of the database to be tuned is performed based on the results of adversarial training, including: If the pre-constructed offset formula holds true based on the results of adversarial training, the domain offset between the source and target domains is zero, thus completing the adaptive parameter tuning of the database to be tuned. The pre-constructed offset formula is derived based on the three-event Bayesian formula and is used to characterize the conditional independence relationship between parameter configuration information and domain labels when business information remains unchanged.
[0022] In one embodiment of the first aspect, the method further includes: The performance metrics of the database under test are subjected to layer-level normalization to obtain the normalized results. These performance metrics include minimized latency and CPU utilization, as well as maximized throughput and queries per second.
[0023] The normalization result and the consistency loss function are weighted and summed to construct the training loss target.
[0024] By minimizing the training loss objective, the parameter configuration information of the database instance to be tuned is adjusted so that the domain offset between the source domain and the target domain is zero, thereby completing the adaptive parameter tuning of the database to be tuned.
[0025] In one embodiment of the first aspect, determining whether each column vector in the target vector matrix originates from the source domain or the target domain, and obtaining a determination result, includes: The target vector matrix is input into a domain classifier, which outputs a judgment result indicating whether each column vector originates from the source domain or the target domain. The domain classifier is a binary classifier; it determines that vectors in the first vector matrix originate from the source domain and vectors in the second vector matrix originate from the target domain.
[0026] In a second aspect, embodiments of this disclosure provide a database adaptive parameter tuning apparatus, comprising: The instance building unit is used to select a modified known database instance as a standard instance based on the user's business status.
[0027] The information acquisition unit is used to acquire instance information about the database instance to be adjusted and the user's business information.
[0028] The information processing unit is used to vectorize the instance information of the standard instance, the instance information of the database instance to be called, and the business information, and obtain the target vector matrix after processing.
[0029] The vector judgment unit is used to determine whether each column vector in the target vector matrix originates from the source domain or the target domain, and obtain the judgment result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted.
[0030] The adaptive parameter tuning unit is used to adaptively tune the database to be tuned based on the judgment results.
[0031] In a third aspect, embodiments of this disclosure provide an electronic device, including: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and when the machine-readable instructions are executed by the processor, the steps in the above-described database adaptive parameter tuning method are performed.
[0032] In a fourth aspect, embodiments of this disclosure provide a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the database adaptive parameter tuning method described above.
[0033] In a fifth aspect, embodiments of this disclosure provide a computer program product stored in a storage medium, the program product being executed by at least one processor to implement the steps in the database adaptive parameter tuning method described above.
[0034] As will be described in detail below, a database adaptive parameter tuning method, apparatus, device, medium, and product according to embodiments of this disclosure are disclosed. In embodiments of this disclosure, firstly, a known database instance that has been adjusted is used as a standard instance based on the user's business status. Then, instance information about the database instance to be tuned and the user's business information are obtained, and the instance information of the standard instance, the instance information of the database instance to be tuned, and the business information are vectorized to obtain a target vector matrix. Next, it is determined whether each column vector in the target vector matrix originates from a source domain or a target domain, resulting in a determination result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be tuned. Finally, adaptive parameter tuning of the database to be tuned is performed based on the determination result. Through the above processing method, this disclosure uses a standard instance as a benchmark adjusted by domain experts. This introduces expert knowledge through the standard instance, providing a high-quality reference benchmark for the parameter tuning algorithm to ensure the correctness of the tuning direction. Then, the target vector matrix obtained after processing represents the intrinsic relationship between the database parameter configuration and the business scenario, so that the parameter tuning results are deeply aligned with the user's actual business needs. Furthermore, through the domain judgment process, it is ensured that the parameter tuning can specifically move the instance to be tuned toward the standard instance. Finally, by continuously optimizing the judgment results, the parameter configuration of the database instance to be tuned continues to approach the standard instance, thereby gradually improving the accuracy of parameter tuning and achieving high-quality adaptive database parameter tuning to improve the accuracy of the parameter tuning process.
[0035] It should be understood that both the foregoing general description and the following detailed description are exemplary and intended to provide further illustration of the claimed technology. Attached Figure Description
[0036] The above and other objects, features, and advantages of this disclosure will become more apparent from the more detailed description of the embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to offer a further understanding of the embodiments of this disclosure and form part of the specification. They are used together with the embodiments of this disclosure to explain the disclosure and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same components or steps.
[0037] Figure 1 This is a flowchart of a database adaptive parameter tuning method according to an embodiment of the present disclosure.
[0038] Figure 2 This is an overall flowchart of a database adaptive parameter tuning process according to an embodiment of the present disclosure.
[0039] Figure 3 This is a schematic diagram of a database adaptive parameter tuning device according to an embodiment of the present disclosure.
[0040] Figure 4 This is a schematic diagram of an electronic device according to an embodiment of the present disclosure.
[0041] Figure 5 This is a schematic diagram of a computer program product according to an embodiment of the present disclosure. Detailed Implementation
[0042] To make the objectives, technical solutions, and advantages of this disclosure more apparent, exemplary embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments of this disclosure. It should be understood that this disclosure is not limited to the exemplary embodiments described herein.
[0043] To facilitate understanding of this embodiment, a database adaptive parameter tuning method disclosed in this disclosure will first be described in detail. (See also...) Figure 1 The diagram shows a flowchart of a database adaptive parameter tuning method provided in this embodiment of the present disclosure. This method can be applied to a database management system and includes steps S101-S105, wherein: Step S101: Based on the user's business status, use the adjusted known database instance as the standard instance.
[0044] In this embodiment of the disclosure, a domain expert with experience in adjusting database parameters is first asked to adjust the configurable parameters of the database instance to the state that best meets the user's needs based on the current business status of the user.
[0045] The business status includes, but is not limited to, the user's business type, data access mode, concurrency characteristics, and table structure information.
[0046] Domain experts can combine their own experience to adjust parameters such as database cache size, number of connections, and parallelism to adapt it to the current business scenario.
[0047] In subsequent algorithm steps, the instance adjusted by domain experts will be used as a benchmark instance. The parameter configuration of this benchmark instance is considered to be the optimal configuration under the current business state, and its data distribution constitutes the source domain in the subsequent domain adaptation algorithm, thereby guiding the parameter configuration of the database instance to be adjusted to align with this benchmark instance.
[0048] Step S102: Obtain the user's instance information about the database instance to be called and the user's business information.
[0049] Here, instance information includes the number of database instances for the current user, availability zone distribution, and instance parameter information; business information consists of table structure information (e.g., primary and foreign keys) generated using a data definition language. The table structure used for the user's business typically remains unchanged.
[0050] Instance information reflects the current running status and parameter configuration of the database instance to be tuned, while business information reflects the user's business logic and data structure. Since table structure information usually does not change, business information remains relatively stable during adaptive parameter tuning.
[0051] In this embodiment of the disclosure, standard languages for operating databases (e.g., SQL statements) can be used to obtain instance information and business information of the user regarding the database instance to be regulated, so as to mine the correlation between the instance and the business by using the instance information and business information together as input data.
[0052] Step S103: Vectorize the instance information of the standard instance, the instance information of the database instance to be called, and the business information to obtain the target vector matrix.
[0053] In this embodiment of the disclosure, the vectorization process is implemented through the Encoder module, which is a small feedforward neural network whose main component is a multi-head attention mechanism.
[0054] To address this, the instance information of the standard instance, the instance information of the database instance to be tuned, and the business information can be input into the encoder for processing through the multi-head attention mechanism in the encoder. After processing, the target vector matrix is obtained. The vectors in the target vector matrix not only retain the original parameter configuration information but also integrate the correlation between instance information and business information, enabling the subsequent domain classifier to make judgments based on richer features.
[0055] Step S104: Determine whether each column vector in the target vector matrix originates from the source domain or the target domain, and obtain the determination result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted.
[0056] Step S105: Based on the judgment result, perform adaptive parameter tuning on the database to be tuned.
[0057] In this embodiment of the disclosure, the target vector matrix is input to the domain classifier. The domain classifier classifies the vectors according to their positions in the matrix, which facilitates the construction of a classification loss based on the difference between the judgment result and the domain label. The classification loss drives the domain classifier and the encoder to perform adversarial training, enabling the instance to be tuned to learn the expert knowledge in the standard instance. Ultimately, the parameter configuration of the database instance to be tuned tends to be consistent with the parameter configuration of the standard instance, thereby achieving adaptive parameter tuning.
[0058] In the above embodiments, this disclosure uses a standard instance as a benchmark adjusted by a domain expert. This introduces expert knowledge through the standard instance, providing a high-quality reference benchmark for the parameter tuning algorithm to ensure the correctness of the tuning direction. Then, the target vector matrix obtained after processing represents the intrinsic relationship between the database parameter configuration and the business scenario, so that the parameter tuning result is deeply aligned with the user's actual business needs. Furthermore, through the domain judgment process, it is ensured that the parameter tuning can specifically move the instance to be tuned toward the standard instance. Finally, by continuously optimizing the judgment results, the parameter configuration of the database instance to be tuned continuously approaches the standard instance, thereby gradually improving the accuracy of parameter tuning and achieving high-quality adaptive database parameter tuning to improve the accuracy of the parameter tuning process.
[0059] In an optional implementation, the above steps vectorize the instance information of the standard instance, the instance information of the database instance to be called, and the business information to obtain the target vector matrix. Specifically, the steps include: The instance information and business information of the standard instance are vectorized by the multi-head attention mechanism in the encoder to obtain the first vector matrix.
[0060] The instance information and business information of the database instance to be debugged are vectorized using a multi-head attention mechanism to obtain a second vector matrix.
[0061] The first and second vector matrices are concatenated sequentially to obtain the target vector matrix. The target vector matrix contains the following information: the correlation between the instance information of the standard instance and the instance information of the database instance to be adjusted; the correlation between the instance information of the standard instance and the business information; and the correlation between the instance information of the database instance to be adjusted and the business information.
[0062] As mentioned earlier, since the main part of the encoder is a multi-head attention mechanism, the encoder not only transforms natural language processing into a vectorized form, but also calculates the correlation between each sub-item, including the correlation between instance information, between instance information and business information, and between business information itself. That is, the correlation between the instance information of the standard instance and the instance information of the database instance to be called, the correlation between the instance information of the standard instance and the business information, and the correlation between the instance information of the database instance to be called and the business information.
[0063] The formula for the multi-head attention mechanism is shown below: QKV is a preliminary vectorization of the instance information of the database instance to be called, the instance information of the standard instance, and the business information. This preliminary vectorization can be achieved using simple term frequency operations. Let Q be the length of vector K. After multiplying Q and K, we multiply them by V to calculate the correlation between each sub-item through a double-order process.
[0064] In this embodiment, the instance information and business information of the standard instance are first input into the encoder module, and vectorized using a multi-head attention mechanism to obtain a first vector matrix. Then, the instance information and business information of the database instance to be adjusted are input into the encoder module, and vectorized using the same mechanism to obtain a second vector matrix. Finally, the first and second vector matrices of the database instance to be adjusted are concatenated in sequence to form the target vector matrix. During concatenation, the first vector matrix is placed in the first column, and the second vector matrix is placed in the second column, forming the target vector matrix.
[0065] In the above implementation, each vector in the target vector matrix is no longer an isolated parameter representation, but a feature representation that integrates the correlation between instance information and between instances and business, providing rich feature information for the subsequent domain classifier to determine the data source.
[0066] In an optional implementation, the above steps adaptively tune the database to be tuned based on the judgment result, specifically including the following steps: The domain label is determined based on the source of each column vector in the target vector matrix.
[0067] The classification loss value is calculated based on the difference between the judgment result and the domain label.
[0068] The consistency loss value is calculated based on business information and the consistency loss function.
[0069] By alternately optimizing the classification loss value and the consistency loss value, adversarial training is performed on the domain classifier and encoder, and adaptive parameter tuning is performed on the target database based on the results of the adversarial training.
[0070] This disclosure allows for the determination of domain labels based on the actual source of each column vector in the target vector matrix. Since the target vector matrix is formed by concatenating a first vector matrix and a second vector matrix in a sequential order, it can be predetermined that the domain labels corresponding to the vectors in the first vector matrix are the source domains, and the domain labels corresponding to the vectors in the second vector matrix are the target domains.
[0071] In this context, the domain label can be understood as the standard answer in supervised learning, which is used for the subsequent calculation of the loss function.
[0072] Furthermore, this disclosure compares the judgment result output by the domain classifier with the aforementioned domain label. The judgment result is the domain classifier's prediction of the vector's origin, while the domain label represents the vector's true origin.
[0073] The classification loss value is obtained by calculating the difference between the judgment result and the domain label. This classification loss value quantifies the degree of judgment error of the domain classifier and is used to train the domain classifier so that it can more accurately distinguish between the source domain and the target domain.
[0074] Based on this, this disclosure calculates a consistency loss value based on business information and a consistency loss function. The consistency loss value is used to train the encoder so that the feature vector generated by the encoder can confuse the domain classifier.
[0075] Finally, adversarial training is performed on the domain classifier and encoder by alternately optimizing the classification loss and consistency loss. Specifically, the encoder parameters are first fixed, and the domain classifier parameters are updated based on the classification loss, enabling the domain classifier to more accurately distinguish between the source and target domains. Then, the domain classifier parameters are fixed, and the encoder parameters are updated based on the consistency loss, allowing the feature vectors generated by the encoder to deceive the domain classifier, making it difficult for the domain classifier to distinguish whether the vectors originate from the source or target domain.
[0076] This disclosure achieves continuous enhancement of the discriminative ability of the domain classifier and continuous enhancement of the obfuscation ability of the encoder through the alternating execution of the above two steps.
[0077] When the adversarial training results indicate that the adversarial training has reached a balance (e.g., the accuracy of the domain classifier approaches the accuracy threshold of 50%), meaning that the domain classifier cannot effectively distinguish whether a vector comes from the source domain or the target domain, it indicates that the data distribution of the source domain and the target domain in the feature space has been basically aligned, thus completing the adaptive parameter tuning.
[0078] In the above implementation, the adversarial training mechanism eliminates the need to explicitly define the distance metric between the source and target domains. Instead, the domain offset is implicitly measured by the judgment accuracy of the domain classifier, thereby avoiding the difficulty of manually designing the distance metric and ensuring the accuracy of the adaptive parameter tuning process.
[0079] In an optional implementation, the above steps calculate the consistency loss value based on business information and a consistency loss function, specifically including the following steps: Obtain the parameter configuration information of the standard instance and the parameter configuration information of the database instance to be called.
[0080] Calculate the average value of all parameter configuration information in the database instance to be adjusted.
[0081] The parameter configuration information of the standard instance, the parameter configuration information of the database instance to be adjusted, and the business information are merged to obtain the fusion result.
[0082] The difference between the average value and the fusion result is calculated based on the consistency loss function and used as the consistency loss value.
[0083] As mentioned above, this disclosure first obtains the parameter configuration information of the standard instance and the parameter configuration information of the database instance to be optimized. The parameter configuration information includes cache size, number of connections, and parallelism. The parameter configuration information of the standard instance is used as a reference benchmark, and the parameter configuration information of the database instance to be optimized is used as the object to be optimized.
[0084] The consistency loss function is as follows: ,in, For the i-th database instance or standard instance to be called, For the j-th business information, This refers to the value of the u-th configuration parameter in the parameter configuration information corresponding to the i-th database instance or standard instance to be debugged. This represents the total number of parameters that need to be adjusted. The fusion result is obtained by integrating the parameter configuration information of the standard instance, the parameter configuration information of the database instance to be regulated, and the business information.
[0085] To address this, the average value of all parameter configuration information in the database instance to be adjusted can be calculated to reflect the overall level of parameter configuration in the database instance to be adjusted. Then, the parameter configuration information of the standard instance, the parameter configuration information of the database instance to be adjusted, and the business information are fused to obtain the fusion result. The fusion method can be to concatenate the three into a joint vector, or to combine them through weighted summation or other methods; this disclosure does not require this.
[0086] The fusion result integrates source domain knowledge, the current state of the target domain (parameters of the instance to be adjusted), and business context.
[0087] Finally, the difference between the mean and the fusion result is calculated based on the consistency loss function, and this difference is used as the consistency loss value. Specifically, the consistency loss function can be Euclidean distance, Manhattan distance, or other metrics to quantify the degree of difference between the mean and the fusion result.
[0088] In the above embodiments, the obtained consistency loss value describes the overall level of the current parameter configuration of the database instance to be tuned, and the gap between it and the reference target after integrating expert knowledge and business context. The smaller the consistency loss value, the closer the parameter configuration of the instance to be tuned is to the ideal state. By minimizing the consistency loss function, this disclosure can gradually pull the parameter configuration of the instance to be tuned towards the ideal state, achieving adaptive parameter tuning.
[0089] In an optional implementation, the above steps involve adaptive parameter tuning of the database to be tuned based on the results of adversarial training, specifically including the following steps: If the pre-constructed offset formula holds true based on the results of adversarial training, the domain offset between the source and target domains is zero, thus completing the adaptive parameter tuning of the database to be tuned. The pre-constructed offset formula is derived based on the three-event Bayesian formula and is used to characterize the conditional independence relationship between parameter configuration information and domain labels when business information remains unchanged.
[0090] This disclosure pre-constructs an offset formula, which is derived based on the three-event conditional Bayesian formula. The offset formula is used to characterize the conditional independence relationship between parameter configuration information and domain labels, provided that the business information remains unchanged.
[0091] Specifically ,in, The domain label is used to indicate whether the current data comes from the source domain or the target domain. For parameter configuration information, This refers to the user's table structure information, i.e., business information.
[0092] It's important to note that only the parameters of the source domain, i.e., the benchmark instance, are known; the target domain, i.e., the database parameter values that need to be configured, are unknown. Therefore, this formula's ability to reduce domain offset rests on two premises: first, given a set of instance and business information, regardless of the domain the table originates from, the parameter adjustment results must be calculated on that table and should be identical. This can be expressed by the formula: Secondly, given the same set of parameters for a database instance, regardless of the domain from which the database instance originates, the configuration of the final instance should be identical.
[0093] When the formula is true, it indicates that, given the business information, there is no additional dependency between the parameter configuration information and the domain label, and the parameter configuration information does not contain domain bias beyond what the business information can explain, meaning that the data distributions of the two domains are perfectly aligned.
[0094] When the offset formula does not hold, it indicates that there is a domain offset between the source domain and the target domain, that is, there is a difference in the data distribution between the two domains.
[0095] This disclosure can continuously reduce the domain offset between the source and target domains through the adversarial training described above. When the adversarial training reaches an equilibrium state, that is, when the domain classifier can no longer effectively distinguish whether the feature vector comes from the source or target domain, it can be determined that the pre-constructed offset formula holds true.
[0096] Furthermore, if the offset formula holds true, it indicates that the domain offset between the source domain and the target domain is zero. At this point, the parameter configuration information of the database instance to be tuned is indistinguishable from that of the standard instance in the feature space, meaning that the parameter configuration of the instance to be tuned has converged towards that of the standard instance, and adaptive parameter tuning is complete.
[0097] In the above embodiments, by introducing a offset formula derived from Bayes' theorem, clear theoretical guidance is provided for adversarial training. The offset formula disclosed herein has a solid mathematical theoretical foundation and can more accurately determine whether the domain offset has been reduced to zero, thereby more reliably determining the timing of adaptive parameter tuning.
[0098] In an optional implementation, the above steps further include the following steps: The performance metrics of the database under test are subjected to layer-level normalization to obtain the normalized results. These performance metrics include minimized latency and CPU utilization, as well as maximized throughput and queries per second.
[0099] The normalization result and the consistency loss function are weighted and summed to construct the training loss target.
[0100] By minimizing the training loss objective, the parameter configuration information of the database instance to be tuned is adjusted so that the domain offset between the source domain and the target domain is zero, thereby completing the adaptive parameter tuning of the database to be tuned.
[0101] After successfully training the encoder module, the parameters of the database can be adjusted, and the performance metrics of the database can be added as a regularization term to the overall training loss function of the network.
[0102] The performance metrics of the database instance to be tuned include those to be minimized: latency and CPU utilization, and those to be maximized: throughput and queries per second. No further examples are provided in this disclosure.
[0103] Because different performance indicators have different dimensions and numerical ranges, they cannot be directly compared or weighted summed. Therefore, this disclosure performs layer-level normalization on the above performance indicators and transforms each indicator to a uniform numerical range to obtain the normalized result.
[0104] This disclosure can further perform weighted summation on the normalization result and the consistency loss function, and then construct the training loss target.
[0105] The expression for the training loss objective is as follows: .in, For consistency loss function, For layer normalization processing, To delay time, For central processing unit utilization, For throughput, Queries per second is a weighting coefficient used to balance the relative importance of consistency loss and performance metrics.
[0106] Following this, this disclosure uses optimization algorithms such as gradient descent to minimize the aforementioned training loss objective. In the minimization process, it simultaneously drives two objectives: reducing the consistency loss value, bringing the parameter configuration of the instance to be tuned closer to that of the standard instance; and optimizing performance metrics, improving the actual runtime performance of the database instance to be tuned. Ultimately, the parameter configuration information of the database instance to be tuned is made consistent with that of the standard instance, while the performance metrics are also optimized.
[0107] In the above implementation, it is ensured that the parameters of the instance to be adjusted not only approach those of the standard instance, but also that the database instance after parameter adjustment has excellent actual operating performance. Thus, it is possible to achieve joint optimization of parameters and performance while flexibly adapting to different business needs.
[0108] In an optional implementation, the above steps determine whether each column vector in the target vector matrix originates from the source domain or the target domain, and obtain the determination result. Specifically, the steps include the following: The target vector matrix is input into a domain classifier, which outputs a judgment result indicating whether each column vector originates from the source domain or the target domain. The domain classifier is a binary classifier; it determines that vectors in the first vector matrix originate from the source domain and vectors in the second vector matrix originate from the target domain.
[0109] The domain classifier disclosed herein is a binary classifier that determines whether an input vector originates from the source domain or the target domain. The domain classifier can be implemented using convolutional neural networks, fully connected networks, or other classification models. Its output layer typically uses the sigmoid activation function, outputting a probability value between 0 and 1, representing the probability that the input vector belongs to the source domain. It can be constructed using a convolutional head and used for classification.
[0110] The convolution class function is shown below: Where i is the column index and L is the total number of columns in the source domain data.
[0111] Since the target vector matrix is formed by concatenating the first vector matrix and the second vector matrix in a specific order, with the first vector matrix first and the second vector matrix last, the domain classifier can make a judgment based on the position of the vector in the matrix.
[0112] Specifically, for vectors in the first column that are less than or equal to L (i.e., vectors in the first vector matrix), the domain classifier classifies them as originating from the source domain; for vectors in the later columns that are greater than L (i.e., vectors in the second vector matrix), the domain classifier classifies them as originating from the target domain. The domain classifier can output the judgment result for each column of vectors, which indicates whether the current vector is predicted to be from the source domain or the target domain.
[0113] By using the above-mentioned domain judgment method, the judgment result can be compared with the true domain label to calculate the classification loss value, which is used to train the domain classifier and encoder, driving the adversarial training process, thus eliminating the need for additional label information and reducing the complexity of training.
[0114] The following is combined with Figure 2 The above-mentioned adaptive parameter tuning process for the database is described in detail below: S201: Based on the user's business status, the adjusted known database instance will be used as the standard instance.
[0115] S202: Obtain the user's instance information about the database instance to be called and the user's business information.
[0116] S203: Vectorize the instance information of the standard instance, the instance information of the database instance to be called, and the business information to obtain the target vector matrix.
[0117] Here, the vector fusion in the target vector matrix contains the following information: the correlation between the instance information of the standard instance and the instance information of the database instance to be regulated, the correlation between the instance information of the standard instance and the business information, and the correlation between the instance information of the database instance to be regulated and the business information.
[0118] S204: Determine whether each column vector in the target vector matrix originates from the source domain or the target domain, and obtain the determination result.
[0119] Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted.
[0120] S205: Determine the domain label based on the source of each column vector in the target vector matrix.
[0121] S206: Calculate the classification loss value based on the difference between the judgment result and the domain label.
[0122] S207: Calculate the consistency loss value based on business information and the consistency loss function.
[0123] S208: Adversarial training of the domain classifier and encoder is performed by alternately optimizing the classification loss value and the consistency loss value.
[0124] S209: Adaptively tune the target database based on the results of adversarial training.
[0125] As can be seen from the above description, the technical solution disclosed herein has the following advantages: (1) This disclosure proposes that a domain expert intervene to adjust an instance based on the user's current state and set it as a benchmark instance. The algorithm will use this instance to learn potential database parameter tuning knowledge.
[0126] (2) It is proposed to use an encoder model to vectorize the instance parameters and business information (table structure) that the user is currently allowed to perform intelligent parameter tuning. After vectorization, the parameters can be tuned using optimization algorithms. In addition, the encoder module can also calculate the correlation between instances and businesses, and the calculation of correlation will help to explore the potential knowledge between instances and businesses.
[0127] (3) A domain-adaptive database approach is proposed. Domain-adaptive (DA) is a machine learning method that narrows the gap between two different data distributions from the perspective of data distribution. The source domain (SD) is an existing data distribution, such as the benchmark instance parameters adjusted by a domain expert DBA based on the user's business status; the target domain (TGD) is the database instance that the user is currently running and needs to be adjusted according to the changed business status. The domain-adaptive approach aims to quickly align the data distribution with the target domain by learning from the source domain, that is, to transfer and apply knowledge from the source domain to the target domain.
[0128] Based on the same inventive concept, this disclosure also provides a database adaptive parameter tuning device corresponding to the database adaptive parameter tuning method. Since the principle of the device in this disclosure for solving the problem is similar to the database adaptive parameter tuning method described above in this disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0129] Reference Figure 3 The diagram shown is a schematic of a database adaptive parameter tuning device provided in an embodiment of this disclosure. The device includes: an instance construction unit 30, an information acquisition unit 31, an information processing unit 32, a vector judgment unit 33, and an adaptive parameter tuning unit 34; wherein: The instance building unit is used to select a modified known database instance as a standard instance based on the user's business status.
[0130] The information acquisition unit is used to acquire instance information about the database instance to be adjusted and the user's business information.
[0131] The information processing unit is used to vectorize the instance information of the standard instance, the instance information of the database instance to be called, and the business information, and obtain the target vector matrix after processing.
[0132] The vector judgment unit is used to determine whether each column vector in the target vector matrix originates from the source domain or the target domain, and obtain the judgment result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted.
[0133] The adaptive parameter tuning unit is used to adaptively tune the database to be tuned based on the judgment results.
[0134] In one possible implementation, the device is also used for: The instance information and business information of the standard instance are vectorized by the multi-head attention mechanism in the encoder to obtain the first vector matrix.
[0135] The instance information and business information of the database instance to be debugged are vectorized using a multi-head attention mechanism to obtain a second vector matrix.
[0136] The first and second vector matrices are concatenated sequentially to obtain the target vector matrix. The target vector matrix contains the following information: the correlation between the instance information of the standard instance and the instance information of the database instance to be adjusted; the correlation between the instance information of the standard instance and the business information; and the correlation between the instance information of the database instance to be adjusted and the business information.
[0137] In one possible implementation, the device is also used for: The domain label is determined based on the source of each column vector in the target vector matrix.
[0138] The classification loss value is calculated based on the difference between the judgment result and the domain label.
[0139] The consistency loss value is calculated based on business information and the consistency loss function.
[0140] By alternately optimizing the classification loss value and the consistency loss value, adversarial training is performed on the domain classifier and encoder, and adaptive parameter tuning is performed on the target database based on the results of the adversarial training.
[0141] In one possible implementation, the device is also used for: Obtain the parameter configuration information of the standard instance and the parameter configuration information of the database instance to be called.
[0142] Calculate the average value of all parameter configuration information in the database instance to be adjusted.
[0143] The parameter configuration information of the standard instance, the parameter configuration information of the database instance to be adjusted, and the business information are merged to obtain the fusion result.
[0144] The difference between the average value and the fusion result is calculated based on the consistency loss function and used as the consistency loss value.
[0145] In one possible implementation, the device is also used for: If the pre-constructed offset formula holds true based on the results of adversarial training, the domain offset between the source and target domains is zero, thus completing the adaptive parameter tuning of the database to be tuned. The pre-constructed offset formula is derived based on the three-event Bayesian formula and is used to characterize the conditional independence relationship between parameter configuration information and domain labels when business information remains unchanged.
[0146] In one possible implementation, the device is also used for: The performance metrics of the database under test are subjected to layer-level normalization to obtain the normalized results. These performance metrics include minimized latency and CPU utilization, as well as maximized throughput and queries per second.
[0147] The normalization result and the consistency loss function are weighted and summed to construct the training loss target.
[0148] By minimizing the training loss objective, the parameter configuration information of the database instance to be tuned is adjusted so that the domain offset between the source domain and the target domain is zero, thereby completing the adaptive parameter tuning of the database to be tuned.
[0149] In one possible implementation, the device is also used for: The target vector matrix is input into a domain classifier, which outputs a judgment result indicating whether each column vector originates from the source domain or the target domain. The domain classifier is a binary classifier; it determines that vectors in the first vector matrix originate from the source domain and vectors in the second vector matrix originate from the target domain.
[0150] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.
[0151] Corresponding to Figure 1 In addition to the database adaptive parameter tuning method, this disclosure also provides an electronic device 40, such as... Figure 4 The diagram shown is a schematic representation of an electronic device 40 provided in an embodiment of this disclosure, including: The system includes a processor 41, a memory 42, and a bus 43. The memory 42 stores execution instructions and includes main memory 421 and external memory 422. The main memory 421, also called internal memory, temporarily stores the computational data in the processor 41, as well as data exchanged with external memory such as a hard disk. The processor 41 exchanges data with the external memory 422 through the main memory 421. When the electronic device 40 is running, the processor 41 communicates with the memory 42 through the bus 43, causing the processor 41 to execute the following instructions: Based on the user's business status, the adjusted known database instance will be used as the standard instance.
[0152] Obtain the user's instance information about the database instance to be adjusted and the user's business information.
[0153] The instance information of the standard instance, the instance information of the database instance to be called, and the business information are vectorized to obtain the target vector matrix.
[0154] The system determines whether each column vector in the target vector matrix originates from the source domain or the target domain, thus obtaining the determination result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted.
[0155] Adaptive parameter tuning is performed on the database to be tuned based on the judgment results.
[0156] This disclosure also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the database adaptive parameter tuning method described in the above-described method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.
[0157] This disclosure also provides a computer program product 50, such as... Figure 5The diagram shown is a schematic diagram of the structure of a computer program product 50 provided in an embodiment of this disclosure. The computer program product 50 carries a computer program 51. The program included in the computer program 51 can be used to execute the steps of the database adaptive parameter tuning method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.
[0158] The above description, with reference to the accompanying drawings, outlines a database adaptive parameter tuning method, apparatus, device, medium, and product according to embodiments of this disclosure. In these embodiments, firstly, based on the user's business status, an adjusted known database instance is used as a standard instance. Then, instance information about the database instance to be tuned and the user's business information are obtained. The instance information of the standard instance, the instance information of the database instance to be tuned, and the business information are vectorized to obtain a target vector matrix. Next, it is determined whether each column vector in the target vector matrix originates from a source domain or a target domain, resulting in a determination result. Here, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be tuned. Finally, adaptive parameter tuning is performed on the database to be tuned based on the determination result. Through the above processing method, this disclosure uses a standard instance as a benchmark adjusted by domain experts. This introduces expert knowledge through the standard instance, providing a high-quality reference benchmark for the parameter tuning algorithm to ensure the correctness of the tuning direction. Then, the target vector matrix obtained after processing represents the intrinsic relationship between the database parameter configuration and the business scenario, so that the parameter tuning results are deeply aligned with the user's actual business needs. Furthermore, through the domain judgment process, it is ensured that the parameter tuning can specifically move the instance to be tuned toward the standard instance. Finally, by continuously optimizing the judgment results, the parameter configuration of the database instance to be tuned continues to approach the standard instance, thereby gradually improving the accuracy of parameter tuning and achieving high-quality adaptive database parameter tuning to improve the accuracy of the parameter tuning process.
[0159] The basic principles of this disclosure have been described above with reference to specific embodiments. However, it should be noted that the advantages, benefits, and effects mentioned in this disclosure are merely examples and not limitations, and should not be considered as essential features of each embodiment of this disclosure. Furthermore, the specific details disclosed above are for illustrative and facilitative purposes only, and are not limitations. These details do not limit the scope of this disclosure to the necessity of employing the aforementioned specific details for implementation.
[0160] The block diagrams of devices, apparatuses, devices, and systems disclosed herein are merely illustrative examples and are not intended to require or imply that they must be connected, arranged, or configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, apparatuses, devices, and systems can be connected, arranged, and configured in any manner. Words such as “comprising,” “including,” “having,” etc., are open-ended terms meaning “including but not limited to,” and are used interchangeably with them. The terms “or” and “and” as used herein refer to the terms “and / or,” and are used interchangeably with them unless the context clearly indicates otherwise. The term “such as” as used herein refers to the phrase “such as but not limited to,” and is used interchangeably with it.
[0161] Additionally, as used herein, the "or" used in a list of items beginning with "at least one" indicates a separate list, such that a list of, for example, "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not imply that the described example is preferred or better than other examples.
[0162] It should also be noted that in the systems and methods of this disclosure, the components or steps can be decomposed and / or recombined. These decompositions and / or recombinations should be considered as equivalent solutions to this disclosure.
[0163] Various changes, substitutions, and modifications can be made to the technology described herein without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of this disclosure is not limited to the specific aspects of the processes, machines, manufactures, events, means, methods, and actions described above. Currently existing or later-developed processes, machines, manufactures, events, means, methods, or actions that perform substantially the same function or achieve substantially the same result as the corresponding aspects described herein can be utilized. Therefore, the appended claims include such processes, machines, manufactures, events, means, methods, or actions within their scope.
[0164] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use this disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of this disclosure. Therefore, this disclosure is not intended to be limited to the aspects shown herein, but rather to be carried out within the widest scope consistent with the principles and novel features disclosed herein.
[0165] The above description has been given for purposes of illustration and description. Furthermore, this description is not intended to limit the embodiments of this disclosure to the forms disclosed herein. Although numerous exemplary aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and sub-combinations therein.
Claims
1. A database adaptive parameter tuning method, characterized in that, include: Based on the user's business status, the adjusted known database instance will be used as the standard instance; Obtain the user's instance information about the database instance to be adjusted and the user's business information; The instance information of the standard instance, the instance information of the database instance to be called, and the business information are vectorized to obtain the target vector matrix. Determine whether each column vector in the target vector matrix originates from the source domain or the target domain to obtain a determination result; wherein, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted; Based on the judgment result, adaptive parameter tuning is performed on the database to be tuned.
2. The method according to claim 1, characterized in that, The instance information of the standard instance, the instance information of the database instance to be adjusted, and the business information are vectorized to obtain a target vector matrix, including: The instance information and business information of the standard instance are vectorized using the multi-head attention mechanism in the encoder to obtain the first vector matrix; The instance information and business information of the database instance to be adjusted are vectorized using the multi-head attention mechanism to obtain a second vector matrix; The first vector matrix and the second vector matrix are concatenated sequentially to obtain the target vector matrix; wherein the vectors in the target vector matrix contain the following information: the correlation between the instance information of the standard instance and the instance information of the database instance to be adjusted, the correlation between the instance information of the standard instance and the business information, and the correlation between the instance information of the database instance to be adjusted and the business information.
3. The method according to claim 1, characterized in that, The adaptive parameter tuning of the database to be tuned based on the judgment result includes: The domain label is determined based on the source of each column vector in the target vector matrix; Calculate the classification loss value based on the difference between the judgment result and the domain label; Based on the aforementioned business information and the consistency loss function, the consistency loss value is calculated; By alternately optimizing the classification loss value and the consistency loss value, adversarial training is performed on the domain classifier and encoder, and adaptive parameter tuning is performed on the target database based on the results of the adversarial training.
4. The method according to claim 3, characterized in that, The step of calculating the consistency loss value based on the business information and the consistency loss function includes: Obtain the parameter configuration information of the standard instance and the parameter configuration information of the database instance to be adjusted; Calculate the average value of all parameter configuration information in the database instance to be adjusted; The parameter configuration information of the standard instance, the parameter configuration information of the database instance to be adjusted, and the business information are combined to obtain the fusion result; The difference between the average value and the fusion result is calculated based on the consistency loss function and used as the consistency loss value.
5. The method according to claim 3, characterized in that, The adaptive parameter tuning of the database to be tuned based on the results of adversarial training includes: If the pre-constructed offset formula is determined to be valid based on the results of the adversarial training, the domain offset between the source domain and the target domain is zero, thereby completing the adaptive parameter tuning of the database to be tuned; wherein, the pre-constructed offset formula is derived based on the three-event Bayesian formula, and the pre-constructed offset formula is used to characterize that the parameter configuration information and the domain label satisfy a conditional independence relationship when the business information remains unchanged.
6. The method according to claim 3, characterized in that, The method further includes: The performance metrics of the database to be adjusted are subjected to layer normalization to obtain the normalization result; wherein, the performance metrics include the minimized latency and CPU utilization, and the maximized throughput and queries per second. The normalization result and the consistency loss function are weighted and summed to construct the training loss target. By minimizing the training loss objective, the parameter configuration information of the database instance to be tuned is adjusted so that the domain offset between the source domain and the target domain is zero, thereby completing the adaptive parameter tuning of the database to be tuned.
7. The method according to claim 1, characterized in that, The determination of whether each column vector in the target vector matrix originates from the source domain or the target domain, and the resulting determination, includes: The target vector matrix is input to a domain classifier, which outputs a judgment result indicating whether each column vector originates from the source domain or the target domain. The domain classifier is a binary classifier that determines that the vectors in the first vector matrix originate from the source domain and the vectors in the second vector matrix originate from the target domain.
8. A database adaptive parameter tuning device, characterized in that, include: The instance building unit is used to select a modified known database instance as a standard instance based on the user's business status. The information acquisition unit is used to acquire instance information of the user regarding the database instance to be adjusted and the user's business information; The information processing unit is used to perform vectorization processing on the instance information of the standard instance, the instance information of the database instance to be called, and the business information, and obtain a target vector matrix after processing. The vector judgment unit is used to determine whether each column vector in the target vector matrix originates from the source domain or the target domain, and to obtain a judgment result; wherein, the source domain is the data distribution corresponding to the standard instance, and the target domain is the data distribution corresponding to the database instance to be adjusted; An adaptive parameter tuning unit is used to adaptively tune the database to be tuned based on the judgment result.
9. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the database adaptive parameter tuning method as described in any one of claims 1 to 7 are performed.
10. A computer program product, characterized in that, The computer program product is stored in a storage medium and is executed by at least one processor to implement the database adaptive parameter tuning method as described in any one of claims 1 to 7.