WO2023098724A1 - Database parameter tuning method, network equipment, and computer-readable storage medium - Google Patents

Database parameter tuning method, network equipment, and computer-readable storage medium Download PDF

Info

Publication number
WO2023098724A1
WO2023098724A1 PCT/CN2022/135455 CN2022135455W WO2023098724A1 WO 2023098724 A1 WO2023098724 A1 WO 2023098724A1 CN 2022135455 W CN2022135455 W CN 2022135455W WO 2023098724 A1 WO2023098724 A1 WO 2023098724A1
Authority
WO
WIPO (PCT)
Prior art keywords
database
parameter
regression model
parameters
optimization
Prior art date
Application number
PCT/CN2022/135455
Other languages
French (fr)
Chinese (zh)
Inventor
文韬
宋恺珉
史智慧
于涛
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2023098724A1 publication Critical patent/WO2023098724A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the embodiment of the present application relates to but not limited to the field of database technology, for example, relates to a database parameter tuning method, a network device, and a computer-readable storage medium.
  • Parameter tuning is an important part of database operation and maintenance; after the database system is installed, it is necessary to select the best combination of configuration items based on the actual hardware environment and software kernel version through parameter tuning to improve the performance of the database system.
  • the current process of parameter tuning in order to ensure the accuracy of parameter tuning, it often takes a lot of time to restore the background data, which will make the efficiency of parameter tuning low.
  • Embodiments of the present application provide a database parameter tuning method, a network device, and a computer-readable storage medium.
  • the embodiment of the present application provides a method for optimizing database parameters, including: obtaining initial database adjustment parameters and tuning setting parameters; Perform preheating processing according to the preheating selection conditions to obtain a preheating time set; perform disturbance processing on the initial adjustment parameters of the database to obtain a candidate parameter configuration set; according to the candidate parameter configuration set, the first regression model, and the parameter optimization regression model Group and preset optimization exploration conditions are iteratively processed to obtain optimal adjustment parameters; wherein, the first regression model is obtained by training the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained by the set of warm-up time and the pre-heating time It is obtained through the training of the judgment condition of the set tuning round.
  • the embodiment of the present application also provides a network device, including: at least one processor; at least one memory for storing at least one program; when at least one of the programs is executed by at least one of the processors, the The database parameter tuning method described above.
  • the embodiment of the present application further provides a computer-readable storage medium, storing computer-executable instructions, where the computer-executable instructions are used to execute the database parameter tuning method as described above.
  • Fig. 1 is a flowchart of a database parameter tuning method provided by an embodiment of the present application
  • FIG. 2 is a flowchart of a database parameter tuning method provided in another embodiment of the present application.
  • Fig. 3 is an example flow chart of obtaining a warm-up time set provided by an embodiment of the present application
  • FIG. 4 is a flow chart of a database parameter tuning method provided in another embodiment of the present application.
  • Fig. 5 is an example flow chart of obtaining a warm-up time set provided by another embodiment of the present application.
  • Fig. 6 is an example flowchart of the first regression model training process provided by one embodiment of the present application.
  • FIG. 7 is an example flowchart of a parameter optimization regression model group training process provided by an embodiment of the present application.
  • FIG. 8 is an example flowchart of parameter iteration processing provided by an embodiment of the present application.
  • FIG. 9 is an example flowchart of parameter iteration processing provided by another embodiment of the present application.
  • FIG. 10 is an example flowchart for obtaining optimal adjustment parameters provided by an embodiment of the present application.
  • Fig. 11 is an example flowchart of a database parameter tuning method provided by another embodiment of the present application.
  • Fig. 12 is a schematic structural diagram of a network device provided by an embodiment of the present application.
  • the application provides a database parameter tuning method, network equipment and computer-readable storage medium to obtain the database initial adjustment parameters and tuning setting parameters; according to the database initial tuning parameters, tuning setting parameters and preset preheating Select conditions for preheating to obtain a set of preheating time; perform disturbance processing on the initial adjustment parameters of the database to obtain a set of candidate parameter configurations; according to the set of candidate parameter configurations, the first regression model, parameter optimization regression model group and preset optimization exploration
  • the conditions are iteratively processed to obtain the optimal adjustment parameters; among them, the first regression model is obtained by training the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained by training the preheating time set and the preset adjustment round judgment conditions.
  • the preheating process is performed according to the initial adjustment parameters of the database, the tuning setting parameters and the preset preheating selection conditions to obtain the preheating time set, and then perturb the initial adjustment parameters of the database to obtain a candidate parameter configuration set; finally, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group, and the preset optimization exploration conditions to obtain the optimal Adjusting parameters, this method can well shorten the waiting time in the process of database parameter tuning and improve the efficiency of parameter tuning.
  • FIG. 1 is a flowchart of a database parameter tuning method provided by an embodiment of the present application.
  • the database parameter tuning method includes but not limited to step S100, step S200, step S300 and step S400:
  • Step S100 obtaining initial database adjustment parameters and tuning setting parameters
  • Step S200 performing preheating processing according to the database initial adjustment parameters, tuning setting parameters and preset preheating selection conditions to obtain a set of preheating times;
  • Step S300 performing perturbation processing on the initial adjustment parameters of the database to obtain a set of candidate parameter configurations
  • Step S400 perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and the preset optimization exploration conditions to obtain the optimal adjustment parameters;
  • the first regression model is obtained by training the initial adjustment parameters of the database
  • the parameter optimization regression model group is obtained by training the set of warm-up time and the preset judgment conditions of the adjustment round.
  • the database initial adjustment parameters and tuning setting parameters are obtained, and then the preheating process is performed according to the database initial tuning parameters, tuning setting parameters and preset preheating selection conditions to obtain the preheating time set, and then Disturb the initial adjustment parameters of the database to obtain a candidate parameter configuration set; finally, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group, and the preset optimization exploration conditions to obtain the optimal adjustment parameters.
  • the method can well shorten the waiting time in the process of database parameter tuning and improve the efficiency of parameter tuning.
  • the traditional database parameter tuning method includes the following steps: initialize the configuration vector of the database to be adjusted and write it into the database configuration file; restart the database instance so that the modified configuration vector takes effect; re-import the data to ensure that each stress test The background data is consistent; the warm-up program is executed, mainly to query the target table of the performance test; during this process, the database kernel will import the data of the target table into the cache. The warm-up program can reduce the impact of memory thrashing and ensure the stability of subsequent stress test results.
  • Traditional database parameter tuning often requires multiple rounds.
  • Each round includes modifying the configuration vector to be adjusted, restarting the instance to ensure that the configuration vector to be adjusted takes effect, re-importing data, performing warm-up to reduce memory thrashing, performing a stress test and returning performance Metrics and training regression models.
  • the background data needs to be restored to a consistent state before each parameter adjustment.
  • the recovery operation is to delete the original database first, then rebuild the database, and finally import the data. Background data recovery takes a large proportion of time in the process of database tuning; secondly, in order to ensure the stability of the performance test, it needs to be warmed up before each test starts.
  • the database parameter tuning method of the embodiment of the present application is proposed to shorten the time for database parameter tuning and improve the efficiency of parameter tuning.
  • the initial adjustment parameters of the database can be ⁇ BufferSize, IOThreads>, BufferSize represents the memory buffer size of the database, IOThreads represents the read and write thread scale of the database, these two parameters can be modified after the configuration file is restarted to take effect, and can be passed Specific modification configuration commands take effect.
  • the training process of the first regression model and the parameter optimization regression model group can be set after the warm-up time set is obtained, and the disturbance processing of the initial adjustment parameters of the database needs to be based on the first regression model.
  • the first regression model may be a three-layer feedforward neural network with 128 hidden layer nodes; and the parameter optimization regression model group may be several three-layer feedforward neural networks with 32 hidden layer nodes.
  • step S110 may also be included before step S200 but not limited to.
  • Step S110 copying the original database file, the original database file includes background data.
  • the original database file is copied, where the original database file includes background data; when the original database file needs to be restored by copying the original database file, only the original database file needs to be overwritten, which can reduce waiting for background data recovery time.
  • the tuning setting parameters include a flashback training flag, a flashback operation flag, and a parameter tuning value
  • the preheating selection condition includes a first selection condition
  • the first selection condition is the flashback training flag bit is true and the parameter adjustment count is an odd number not greater than the preset number of parameter adjustments or the flashback training flag is false and the flashback operation flag is false
  • the warm-up time set includes the first warm-up time set, as shown in Figure 3
  • the above step S200 may include but not limited to step S210, step S220, step S230 and step S240.
  • Step S210 when the first selection condition is satisfied, the database original file is overwritten with the previous database original file to form a first database test state;
  • Step S220 according to the first database test status, write the database initial adjustment parameters into the database configuration file
  • Step S230 restarting the database instance to make the database initial adjustment parameters in the database configuration file take effect
  • step S240 the database is preheated according to the initial adjustment parameters of the database to obtain a first warm-up time set.
  • the database original file is overwritten on the previous database original file to form the first database test state; then, according to the first database test state, the database initial adjustment parameters are written into The database configuration file; then restart the database instance to make the database initial adjustment parameters in the database configuration file take effect; finally, according to the database initial adjustment parameters, preheat the database to obtain the first warm-up time set.
  • preheating is to execute specific SQL statements and load the data files stored on the storage medium into the memory in page format in proportion to ensure that subsequent performance tests can truly simulate the pressure of business peaks.
  • the first warm-up time set includes the initial database adjustment parameters and the warm-up waiting time corresponding to the initial database adjustment parameters, and the first warm-up time set can be used for training the parameter optimization regression model group.
  • the original data file containing the complete background data is cold copied (to ensure data consistency) when the database is stopped; in the relevant rounds of the parameter adjustment process, the database instance is closed and the database is deleted Log file, overwrite the original data file with the database data file, write the initial adjustment parameters of the database into the database configuration file, restart the database instance, and execute the warm-up procedure.
  • step S120 may also be included after step S200 but not limited to.
  • Step S120 record the early time nodes of the performance test.
  • the preheating selection condition includes a second selection condition
  • the second selection condition is that the flashback training flag bit is true and the parameter adjustment count value is an even number not greater than the preset number of parameter adjustment times or the flashback training flag bit is false and the flashback operation flag bit is true
  • the warm-up time set includes the second warm-up time set, as shown in FIG. 5
  • the above step S200 may include but not limited to step S250, step S260 and step S270.
  • Step S250 when the second selection condition is met, perform a rollback operation on the database according to the previous time node of the performance test to form a second database test state;
  • Step S260 based on the test status of the second database and related configuration commands, make the initial adjustment parameters of the database take effect;
  • step S270 a second warm-up time set is obtained based on the initial adjustment parameters of the database.
  • the database is rolled back according to the early stage of the performance test to form the second database test state; then based on the second database test state and related configuration commands, the initial adjustment of the database The parameters take effect; finally, based on the initial adjustment parameters of the database, the second warm-up time set is obtained.
  • configuration commands can be used to validate the modified initial adjustment parameters of the database, perform a rollback operation, roll back the database to the moment state of the previous time node of the performance test, and restore the background data to the state of the previous round to ensure The correctness of the training data for the regression model.
  • the second warm-up time set includes the initial database adjustment parameters and the warm-up waiting time corresponding to the initial database adjustment parameters, and the second warm-up time set can be used for training the parameter optimization regression model group.
  • the training process of the first regression model includes but not limited to step S310 and step S320 .
  • Step S310 performing a performance test on the database according to the initial adjustment parameters of the database to obtain performance index parameters
  • step S320 the first regression model is trained according to the performance index parameters; and the adjusted parameter value is updated.
  • the performance index parameter includes a performance parameter and an adjustment parameter corresponding to the performance parameter.
  • the performance test is performed on the database to obtain the performance index parameters; then the first regression model is trained according to the performance index parameters; and the value of the adjustment parameters is updated; among them, the performance index parameters It includes performance parameters and adjustment parameters corresponding to the performance parameters.
  • performing a performance test on the database means performing a TPCC performance test on the database; and performance parameters may include average throughput and delay.
  • the adjustment parameters corresponding to the performance parameters are corresponding initial adjustment parameters of the database.
  • the first regression model may be a three-layer feed-forward neural network with 128 hidden layer nodes; the updating process of the parameter adjustment value may be that after one round of parameter adjustment, the parameter adjustment value is automatically increased by 1.
  • the parameter optimization regression model group includes the second regression model and the third regression model, and the judgment condition of the parameter adjustment round is that the parameter adjustment value is equal to the preset number of parameter adjustment rounds and the flashback training flag is true , as shown in FIG. 7 , the training process of parameter optimization regression model group includes but not limited to step S330.
  • Step S330 when the judgment condition of the parameter adjustment round is satisfied, the second regression model is trained according to the first warm-up time set; and the third regression model is trained according to the second warm-up time set; and the flashback training mark bit is set to false.
  • the second regression model is trained according to the first warm-up time set and the third regression model is trained according to the second warm-up time set;
  • the training flag bit is set to false.
  • step S330 is set after step S320, and the updated parameter tuning counter value can be compared with the preset number of parameter tuning rounds.
  • both the second regression model and the third regression model may be a three-layer feed-forward neural network including 32 hidden layer nodes.
  • the optimization exploration condition includes a first optimization condition
  • the first optimization condition includes that the flashback training flag bit is true
  • the step S400 may include but not limited to the step 410 and step S420.
  • Step 410 when the first optimization condition is met, predict the candidate parameter configuration set according to the first regression model to obtain the candidate parameter expected performance set;
  • Step S420 selecting the first optimal configuration item from the expected performance set of candidate parameters, and determining the first optimal configuration item as a new database initial adjustment parameter, so as to use the database initial adjustment parameter to perform iteration processing again.
  • the candidate parameter configuration set is predicted according to the first regression model to obtain the candidate parameter expected performance set, and then the first optimal configuration item is selected from the candidate parameter expected performance set, and the first most The optimal configuration item is determined as the new database initial adjustment parameter, so as to use the new database initial adjustment parameter to replace and update the database initial adjustment parameter in the previous round, and then re-execute the above-mentioned database parameter optimization method until the optimal adjustment is obtained parameter.
  • the early parameter adjustment process can be considered as collecting the preheating conditions of the relevant preheating schemes, and then training and processing the relevant regression model based on the preheating conditions, so that the later parameter tuning process can be based on the preheating conditions collected in the previous period. And automatically and quickly select the optimal adjustment parameters.
  • the optimization exploration condition includes a second optimization condition
  • the second optimization condition includes that the flashback training flag bit is false and the optimal performance parameter among the performance index parameters changes for a preset number of times, as shown in Figure 9
  • step S400 may include but not limited to step 430 and step S440.
  • Step 430 when the second optimization condition is satisfied, according to the candidate parameter configuration set and the preset adjustment algorithm, the candidate parameter expected value set is obtained;
  • Step S440 select the second optimal configuration item from the expected value set of candidate parameters, and determine the second optimal configuration item as the new database initial adjustment parameter, and update the flashback operation flag bit according to the adjustment algorithm, so as to utilize
  • the new database initial adjustment parameters and the new flashback operation flag are iteratively processed.
  • the candidate parameter expected value set will be obtained according to the candidate parameter configuration set and the preset adjustment algorithm; then the second optimal configuration item is selected from the candidate parameter expected value set, and Determine the second optimal configuration item as the new database initial adjustment parameter and update the flashback operation flag bit according to the adjustment algorithm, so as to use the new database initial adjustment parameter to replace and update the database initial adjustment parameter in the previous round , and replace and update the flashback operation flag of the previous round with the new flashback operation flag, and then re-execute the above-mentioned database parameter tuning method until the optimal adjustment parameters are obtained.
  • the adjustment algorithm is obtained based on the parameter optimization regression model group.
  • the adjustment algorithm can be expressed as follows:
  • FlashBackOps is the flashback operation flag
  • PredX is the second optimal configuration item
  • DX is the candidate parameter configuration set
  • xi is the candidate configuration item in the candidate parameter configuration set
  • PredValue(xi) is the candidate parameter expected value set
  • f (xi) is the predicted target performance of the candidate configuration item
  • ⁇ (xi) is the standard deviation of the predicted target performance of the candidate configuration item
  • g1(xi) and g2(xi) are the preheating scheme and the coverage background data of the candidate configuration item respectively.
  • the estimated time-consuming of the rollback operation plan, allTime is the total time that can be applied for this parameter adjustment, and duringTime is the total time that this parameter adjustment has already consumed.
  • the optimization exploration condition includes a third optimization condition
  • the third optimization condition includes that the flashback training flag bit is false and the optimal performance parameter among the performance index parameters does not change for a preset number of times, as shown in FIG. 10, step S400 may include but not limited to step 450.
  • Step 450 when the third optimization condition is satisfied, the adjustment parameter corresponding to the optimal performance parameter is determined as the optimal adjustment parameter.
  • the adjustment parameter corresponding to the optimal performance parameter will be determined as the optimal adjustment parameter;
  • the preset number of times can be 3.
  • the corresponding optimal performance parameter can be The adjustment parameters are determined as optimal adjustment parameters.
  • parameter configuration X to be adjusted is the initial adjustment parameter of the database
  • the parameter configuration X of the database to be adjusted is ⁇ BufferSize, IOThreads>, the former represents the memory buffer size of the database, and the latter represents the read and write thread size of the database. It is assumed that these two parameters can be modified after the configuration file is restarted To take effect, and to take effect by modifying specific configuration commands.
  • the target target for database tuning is the average throughput during the performance test phase.
  • the warm-up command of the database is to perform a full table scan command on the test table. After the command is executed, the memory buffer will be filled to reduce the fluctuation of the performance test.
  • the performance test of the database is to execute the TPCC performance test widely used in the industry.
  • Model f is a 3-layer feedforward neural network with 128 hidden layer nodes. Both models g1 and g2 are 3-layer feed-forward neural networks with 32 hidden layer nodes.
  • the tLimit parameter is set to 10 and the k parameter is set to 3.
  • step S210 Execute the above step S210, step S220, step S230 and step S240; record ⁇ X, Time1> and save it in the data set DS1.
  • X is the configuration value of the database parameter at this time
  • Time1 is the total time from the shutdown of the database to the completion of the warm-up program execution;
  • step S250 step S260 and step S270; record ⁇ X, Time2> and save it to the data set DS2.
  • X is the configuration value of the database parameter at this time
  • Time2 is the time period for the database to perform the rollback operation
  • Time2 g2(X)
  • Time2 the mapping relationship from parameter configuration information X to Time2 (the duration of the database execution rollback operation) as far as possible;
  • Perturbation is performed around the current configuration vector X (for example, the value of some configuration items of X is randomly increased or decreased by percentage), and the parameter configuration set DX after the disturbance is obtained.
  • an embodiment of the present application also provides a network device 600 , the network device 600 includes: a memory 620 , a processor 610 , and an Computer program.
  • the processor 610 and the memory 620 may be connected through a bus or in other ways.
  • network device 600 in this embodiment and the database parameter tuning method in the above embodiments belong to the same inventive concept, so these embodiments have the same implementation principle and technical effect, and will not be described in detail here.
  • the non-transitory software programs and instructions required to realize the database parameter tuning method of the above-mentioned embodiment are stored in the memory 620, and when executed by the processor 610, the database parameter tuning method in the above-mentioned embodiment is executed, for example, the above Described method steps S100 to S400 in Fig. 1, method steps S110 in Fig. 2, method steps S210 to S240 in Fig. 3, method steps S120 in Fig. 4, method steps S250 to S270 in Fig. 5, Fig. 6
  • an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor 610, for example, by the above-mentioned network device 600 is executed by a processor 610 in the embodiment, which can cause the above-mentioned processor 610 to execute the database parameter tuning method in the above-mentioned embodiment, for example, execute the method steps S100 to S400 in FIG. 1 described above, and the method in FIG. 2 Step S110, method steps S210 to S240 in FIG. 3, method steps S120 in FIG. 4, method steps S250 to S270 in FIG. 5, method steps S310 to S320 in FIG. 6, method steps S330 in FIG. 7, FIG. The method steps S410 to S420 in 8, the method steps S430 to S440 in FIG. 9 , and the method step S450 in FIG. 10 .
  • the embodiment of the present application includes: obtaining the database initial adjustment parameters and tuning setting parameters; performing preheating processing according to the database initial adjustment parameters, tuning setting parameters and preset preheating selection conditions to obtain a preheating time set; The initial adjustment parameters are disturbed to obtain the candidate parameter configuration set; according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and the preset optimization exploration conditions, iterative processing is performed to obtain the optimal adjustment parameters; among them, the first The regression model is trained by the initial adjustment parameters of the database, and the parameter optimization regression model group is trained by the set of warm-up time and the preset judgment conditions of the adjustment round.
  • the preheating process is performed according to the initial adjustment parameters of the database, the tuning setting parameters and the preset preheating selection conditions to obtain the preheating time set, and then perturb the initial adjustment parameters of the database to obtain a candidate parameter configuration set; finally, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group, and the preset optimization exploration conditions to obtain the optimal Adjusting parameters, this method can well shorten the waiting time in the process of database parameter tuning and improve the efficiency of parameter tuning.
  • Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tape, magnetic disk storage or other magnetic storage devices, or can Any other medium used to store desired information and which can be accessed by a computer.
  • communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The present application provides a database parameter tuning method, network equipment, and a computer-readable storage medium. The database parameter tuning method comprises: obtaining initial adjustment parameters of a database and tuning setting parameters (S100); performing preheating according to the initial adjustment parameters of the database, the tuning setting parameters, and a preset preheating selection condition, to obtain a preheating time set (S200); performing perturbation on the initial adjustment parameters of the database, to obtain a candidate parameter configuration set (S300); performing iteration according to the candidate parameter configuration set, a first regression model, a parameter optimization regression model group, and a preset optimization exploration condition, to obtain an optimal adjustment parameter, wherein the first regression model is obtained through training by using the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained through training by using the preheating time set and a preset parameter adjustment round determination condition (S400).

Description

数据库参数调优方法、网络设备及计算机可读存储介质Database parameter tuning method, network device and computer-readable storage medium
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202111456061.5、申请日为2021年12月01日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on a Chinese patent application with application number 202111456061.5 and a filing date of December 01, 2021, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated by reference into this application.
技术领域technical field
本申请实施例涉及但不限于数据库技术领域,例如涉及一种数据库参数调优方法、网络设备及计算机可读存储介质。The embodiment of the present application relates to but not limited to the field of database technology, for example, relates to a database parameter tuning method, a network device, and a computer-readable storage medium.
背景技术Background technique
参数调优是数据库运维的重要组成部分;在数据库系统完成安装后,需要通过参数调优来选取出基于实际硬件环境和软件内核版本的最佳配置项组合,以提升数据库系统的性能。然而,目前在进行参数调优的过程中,为了保证参数调优的准确性,往往需要耗费大量时间进行背景数据恢复,这样就会使得参数调优的效率较低。Parameter tuning is an important part of database operation and maintenance; after the database system is installed, it is necessary to select the best combination of configuration items based on the actual hardware environment and software kernel version through parameter tuning to improve the performance of the database system. However, in the current process of parameter tuning, in order to ensure the accuracy of parameter tuning, it often takes a lot of time to restore the background data, which will make the efficiency of parameter tuning low.
发明内容Contents of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics described in detail in this article. This summary is not intended to limit the scope of the claims.
本申请实施例提供了一种数据库参数调优方法、网络设备及计算机可读存储介质。Embodiments of the present application provide a database parameter tuning method, a network device, and a computer-readable storage medium.
第一方面,本申请实施例提供了一种数据库参数调优方法,包括:获取数据库初始调节参数和调优设定参数;根据所述数据库初始调节参数、所述调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合;对所述数据库初始调节参数进行扰动处理,得到候选参数配置集合;根据所述候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数;其中,所述第一回归模型由数据库初始调节参数训练得到,所述参数优化回归模型组由所述预热时间集合和预设的调参回合判断条件训练得到。In the first aspect, the embodiment of the present application provides a method for optimizing database parameters, including: obtaining initial database adjustment parameters and tuning setting parameters; Perform preheating processing according to the preheating selection conditions to obtain a preheating time set; perform disturbance processing on the initial adjustment parameters of the database to obtain a candidate parameter configuration set; according to the candidate parameter configuration set, the first regression model, and the parameter optimization regression model Group and preset optimization exploration conditions are iteratively processed to obtain optimal adjustment parameters; wherein, the first regression model is obtained by training the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained by the set of warm-up time and the pre-heating time It is obtained through the training of the judgment condition of the set tuning round.
第二方面,本申请实施例还提供了一种网络设备,包括:至少一个处理器;至少一个存储器,用于存储至少一个程序;当至少一个所述程序被至少一个所述处理器执行时实现如上所述的数据库参数调优方法。In the second aspect, the embodiment of the present application also provides a network device, including: at least one processor; at least one memory for storing at least one program; when at least one of the programs is executed by at least one of the processors, the The database parameter tuning method described above.
第三方面,本申请实施例还提供了一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令用于执行如上所述的数据库参数调优方法。In a third aspect, the embodiment of the present application further provides a computer-readable storage medium, storing computer-executable instructions, where the computer-executable instructions are used to execute the database parameter tuning method as described above.
本申请的其它特征和优点将在随后的说明书中阐述,并且,部分地从说明书中变得显而易见,或者通过实施本申请而了解。本申请的目的和其他优点可通过在说明书、权利要求书以及附图中所特别指出的结构来实现和获得。Additional features and advantages of the application will be set forth in the description which follows, and, in part, will be obvious from the description, or may be learned by practice of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
附图说明Description of drawings
附图用来提供对本申请技术方案的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请的技术方案,并不构成对本申请技术方案的限制。The accompanying drawings are used to provide a further understanding of the technical solution of the present application, and constitute a part of the specification, and are used together with the embodiments of the present application to explain the technical solution of the present application, and do not constitute a limitation to the technical solution of the present application.
图1是本申请一个实施例提供的数据库参数调优方法的流程图;Fig. 1 is a flowchart of a database parameter tuning method provided by an embodiment of the present application;
图2是本申请另一个实施例提供的数据库参数调优方法的流程图;FIG. 2 is a flowchart of a database parameter tuning method provided in another embodiment of the present application;
图3是本申请一个实施例提供的获取预热时间集合的示例流程图;Fig. 3 is an example flow chart of obtaining a warm-up time set provided by an embodiment of the present application;
图4是本申请另一个实施例提供的数据库参数调优方法的流程图;FIG. 4 is a flow chart of a database parameter tuning method provided in another embodiment of the present application;
图5是本申请另一个实施例提供的获取预热时间集合的示例流程图;Fig. 5 is an example flow chart of obtaining a warm-up time set provided by another embodiment of the present application;
图6是本申请一个实施例提供的第一回归模型训练过程的示例流程图;Fig. 6 is an example flowchart of the first regression model training process provided by one embodiment of the present application;
图7是本申请一个实施例提供的参数优化回归模型组训练过程的示例流程图;FIG. 7 is an example flowchart of a parameter optimization regression model group training process provided by an embodiment of the present application;
图8是本申请一个实施例提供的参数迭代处理的示例流程图;FIG. 8 is an example flowchart of parameter iteration processing provided by an embodiment of the present application;
图9是本申请另一个实施例提供的参数迭代处理的示例流程图;FIG. 9 is an example flowchart of parameter iteration processing provided by another embodiment of the present application;
图10是本申请一个实施例提供的得到最优调节参数的示例流程图;FIG. 10 is an example flowchart for obtaining optimal adjustment parameters provided by an embodiment of the present application;
图11是本申请另一个实施例提供的数据库参数调优方法的示例流程图;Fig. 11 is an example flowchart of a database parameter tuning method provided by another embodiment of the present application;
图12是本申请一个实施例提供的网络设备的构造示意图。Fig. 12 is a schematic structural diagram of a network device provided by an embodiment of the present application.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, not to limit the present application.
需要说明的是,虽然在装置示意图中进行了功能模块划分,在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于装置中的模块划分,或流程图中的顺序执行所示出或描述的步骤。说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that although the functional modules are divided in the schematic diagram of the device, and the logical sequence is shown in the flowchart, in some cases, it can be executed in a different order than the module division in the device or the flowchart in the flowchart. steps shown or described. The terms "first", "second" and the like in the specification and claims and the above drawings are used to distinguish similar objects, and not necessarily used to describe a specific sequence or sequence.
本申请提供了一种数据库参数调优方法、网络设备及计算机可读存储介质,获取数据库初始调节参数和调优设定参数;根据数据库初始调节参数、调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合;对数据库初始调节参数进行扰动处理,得到候选参数配置集合;根据候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数;其中,第一回归模型由数据库初始调节参数训练得到,参数优化回归模型组由预热时间集合和预设的调参回合判断条件训练得到。根据本申请实施例提供的方案,首先获取数据库初始调节参数和调优设定参数,然后根据数据库初始调节参数、调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合,接着对数据库初始调节参数进行扰动处理,得到候选参数配置集合;最后根据候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数,该方法能够很好地缩短数据库参数调优过程中的等待时间,提升参数调优的效率。The application provides a database parameter tuning method, network equipment and computer-readable storage medium to obtain the database initial adjustment parameters and tuning setting parameters; according to the database initial tuning parameters, tuning setting parameters and preset preheating Select conditions for preheating to obtain a set of preheating time; perform disturbance processing on the initial adjustment parameters of the database to obtain a set of candidate parameter configurations; according to the set of candidate parameter configurations, the first regression model, parameter optimization regression model group and preset optimization exploration The conditions are iteratively processed to obtain the optimal adjustment parameters; among them, the first regression model is obtained by training the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained by training the preheating time set and the preset adjustment round judgment conditions. According to the solution provided in the embodiment of the present application, firstly, the initial adjustment parameters and tuning setting parameters of the database are obtained, and then the preheating process is performed according to the initial adjustment parameters of the database, the tuning setting parameters and the preset preheating selection conditions to obtain the preheating time set, and then perturb the initial adjustment parameters of the database to obtain a candidate parameter configuration set; finally, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group, and the preset optimization exploration conditions to obtain the optimal Adjusting parameters, this method can well shorten the waiting time in the process of database parameter tuning and improve the efficiency of parameter tuning.
下面结合附图,对本申请实施例作进一步阐述。The embodiments of the present application will be further described below in conjunction with the accompanying drawings.
如图1所示,图1是本申请一个实施例提供的数据库参数调优方法的流程图。该数据库参数调优方法包括但不限于有步骤S100、步骤S200、步骤S300和步骤S400:As shown in FIG. 1 , FIG. 1 is a flowchart of a database parameter tuning method provided by an embodiment of the present application. The database parameter tuning method includes but not limited to step S100, step S200, step S300 and step S400:
步骤S100,获取数据库初始调节参数和调优设定参数;Step S100, obtaining initial database adjustment parameters and tuning setting parameters;
步骤S200,根据数据库初始调节参数、调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合;Step S200, performing preheating processing according to the database initial adjustment parameters, tuning setting parameters and preset preheating selection conditions to obtain a set of preheating times;
步骤S300,对数据库初始调节参数进行扰动处理,得到候选参数配置集合;Step S300, performing perturbation processing on the initial adjustment parameters of the database to obtain a set of candidate parameter configurations;
步骤S400,根据候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数;Step S400, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and the preset optimization exploration conditions to obtain the optimal adjustment parameters;
其中,第一回归模型由数据库初始调节参数训练得到,参数优化回归模型组由预热时间集合和预设的调参回合判断条件训练得到。Among them, the first regression model is obtained by training the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained by training the set of warm-up time and the preset judgment conditions of the adjustment round.
需要说明的是,首先获取数据库初始调节参数和调优设定参数,然后根据数据库初始调节参数、调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合,接着对数据库初始调节参数进行扰动处理,得到候选参数配置集合;最后根据候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数,该方法能够很好地缩短数据库参数调优过程中的等待时间,提升参数调优的效率。It should be noted that firstly, the database initial adjustment parameters and tuning setting parameters are obtained, and then the preheating process is performed according to the database initial tuning parameters, tuning setting parameters and preset preheating selection conditions to obtain the preheating time set, and then Disturb the initial adjustment parameters of the database to obtain a candidate parameter configuration set; finally, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group, and the preset optimization exploration conditions to obtain the optimal adjustment parameters. The method can well shorten the waiting time in the process of database parameter tuning and improve the efficiency of parameter tuning.
需要说明的是,传统的数据库参数调优方法包括以下步骤:初始化数据库的待调节配置向量、写入数据库配置文件;重启数据库实例、以便修改的配置向量生效;重新导入数据,保证每次压力测试的背景数据一致;执行预热程序,主要是针对性能测试的目标表进行查询;在此过程中,数据库内核会将目标表的数据导入缓存。预热程序能够降低内存颠簸影响,保证后续压力测试结果稳定。而传统的数据库调参往往也需要经历多个回合,每个回合包括修改待调节配置向量、重启实例保证待调节配置向量生效、重新导入数据、执行预热降低内存颠簸、执行压力测试并返回性能指标和训练回归模型。为了保证回归模型f的训练数据正确性,每次调参前需要将背景数据恢复到一致性状态。目前智能调参基本流程中,这个恢复操作是先删除原始数据库、再重新建库、最后导入数据。背景数据恢复在数据库调参过程中的耗时比例很大;其次,为了保证性能测试的稳定性,在每次测试开始前需要进行预热。即执行特定SQL语句、将保存在存储介质上的数据文件以页面格式按比例加载到内存中,以保证性能测试能够真实模拟业务高峰的压力,这个过程往往也需要3-4分钟以上。因此,基于传统的数据库参数调优方法的耗时较长,因此提出本申请实施例的数据库参数调优方法,以缩短数据库参数调优的时间,提升参数调优的效率。It should be noted that the traditional database parameter tuning method includes the following steps: initialize the configuration vector of the database to be adjusted and write it into the database configuration file; restart the database instance so that the modified configuration vector takes effect; re-import the data to ensure that each stress test The background data is consistent; the warm-up program is executed, mainly to query the target table of the performance test; during this process, the database kernel will import the data of the target table into the cache. The warm-up program can reduce the impact of memory thrashing and ensure the stability of subsequent stress test results. Traditional database parameter tuning often requires multiple rounds. Each round includes modifying the configuration vector to be adjusted, restarting the instance to ensure that the configuration vector to be adjusted takes effect, re-importing data, performing warm-up to reduce memory thrashing, performing a stress test and returning performance Metrics and training regression models. In order to ensure the correctness of the training data of the regression model f, the background data needs to be restored to a consistent state before each parameter adjustment. In the current basic process of intelligent parameter adjustment, the recovery operation is to delete the original database first, then rebuild the database, and finally import the data. Background data recovery takes a large proportion of time in the process of database tuning; secondly, in order to ensure the stability of the performance test, it needs to be warmed up before each test starts. That is to execute specific SQL statements and load the data files stored on the storage medium into the memory in proportion to the page format to ensure that the performance test can truly simulate the pressure of business peaks. This process often takes more than 3-4 minutes. Therefore, based on the time-consuming traditional database parameter tuning method, the database parameter tuning method of the embodiment of the present application is proposed to shorten the time for database parameter tuning and improve the efficiency of parameter tuning.
值得注意的是,在数据库参数调优的过程中为了保证参数调优的准确性,往往需要经过多次的调参回合,直至符合优化探索条件才会输出最优调节参数。It is worth noting that in the process of database parameter tuning, in order to ensure the accuracy of parameter tuning, it is often necessary to go through multiple tuning rounds, and the optimal tuning parameters will not be output until the optimization exploration conditions are met.
示例性地,数据库初始调节参数可以为<BufferSize,IOThreads>,BufferSize代表数据库的内存缓冲区大小,IOThreads代表数据库的读写线程规模,这两个参数既可以修改配置文件后重启生效,又可以通过特定修改配置命令生效。Exemplarily, the initial adjustment parameters of the database can be <BufferSize, IOThreads>, BufferSize represents the memory buffer size of the database, IOThreads represents the read and write thread scale of the database, these two parameters can be modified after the configuration file is restarted to take effect, and can be passed Specific modification configuration commands take effect.
需要说明的是,第一回归模型和参数优化回归模型组的训练过程可以设定在得到预热时间集合之后,而对数据库初始调节参数进行扰动处理需要根据第一回归模型。It should be noted that the training process of the first regression model and the parameter optimization regression model group can be set after the warm-up time set is obtained, and the disturbance processing of the initial adjustment parameters of the database needs to be based on the first regression model.
示例性地,第一回归模型可以是一个含有128个隐藏层节点的三层前馈神经网络;而参数优化回归模型组可以是若干个含有32个隐藏层节点的三层前馈神经网络。Exemplarily, the first regression model may be a three-layer feedforward neural network with 128 hidden layer nodes; and the parameter optimization regression model group may be several three-layer feedforward neural networks with 32 hidden layer nodes.
另外,在一实施例中,如图2所示,在步骤S200之前还可以包括但不限于步骤S110。In addition, in an embodiment, as shown in FIG. 2 , step S110 may also be included before step S200 but not limited to.
步骤S110,拷贝数据库原始文件,数据库原始文件包括背景数据。Step S110, copying the original database file, the original database file includes background data.
需要说明的是,拷贝数据库原始文件,其中数据库原始文件包括背景数据;拷贝数据库原始文件以使得需要恢复背景数据的情况下,只需要将数据库原始文件进行覆盖处理,这样就可以减少等待背景数据恢复的时间。It should be noted that the original database file is copied, where the original database file includes background data; when the original database file needs to be restored by copying the original database file, only the original database file needs to be overwritten, which can reduce waiting for background data recovery time.
另外,在一实施例中,调优设定参数包括闪回训练标记位、闪回操作标记位和调参计数值,预热选择条件包括第一选择条件,第一选择条件为闪回训练标记位为真且调参计数值为不大于预设调参次数的奇数或者闪回训练标记位为假且闪回操作标记位为假,预热时间集合包括第一预热时间集,如图3所示,上述步骤S200可以包括但不限于步骤S210、步骤S220、步骤S230和步骤S240。In addition, in an embodiment, the tuning setting parameters include a flashback training flag, a flashback operation flag, and a parameter tuning value, and the preheating selection condition includes a first selection condition, and the first selection condition is the flashback training flag bit is true and the parameter adjustment count is an odd number not greater than the preset number of parameter adjustments or the flashback training flag is false and the flashback operation flag is false, the warm-up time set includes the first warm-up time set, as shown in Figure 3 As shown, the above step S200 may include but not limited to step S210, step S220, step S230 and step S240.
步骤S210,当满足第一选择条件,将数据库原始文件对前一次的数据库原始文件进行覆盖处理,以形成第一数据库测试状态;Step S210, when the first selection condition is satisfied, the database original file is overwritten with the previous database original file to form a first database test state;
步骤S220,根据第一数据库测试状态,将数据库初始调节参数写入数据库配置文件;Step S220, according to the first database test status, write the database initial adjustment parameters into the database configuration file;
步骤S230,重启数据库实例以使得数据库配置文件中的数据库初始调节参数生效;Step S230, restarting the database instance to make the database initial adjustment parameters in the database configuration file take effect;
步骤S240,根据数据库初始调节参数,对数据库进行预热处理,得到第一预热时间集。In step S240, the database is preheated according to the initial adjustment parameters of the database to obtain a first warm-up time set.
需要说明的是,当满足第一选择条件,将数据库原始文件对前一次的数据库原始文件进行覆盖处理,以形成第一数据库测试状态;接着根据第一数据库测试状态,将数据库初始调节参数写入数据库配置文件;接着重启数据库实例以使得数据库配置文件中的数据库初始调节参数生效;最后根据数据库初始调节参数,对数据库进行预热处理,得到第一预热时间集。It should be noted that, when the first selection condition is satisfied, the database original file is overwritten on the previous database original file to form the first database test state; then, according to the first database test state, the database initial adjustment parameters are written into The database configuration file; then restart the database instance to make the database initial adjustment parameters in the database configuration file take effect; finally, according to the database initial adjustment parameters, preheat the database to obtain the first warm-up time set.
值得注意的是,将数据库原始文件对前一次的数据库原始文件进行覆盖处理,使得背景数据恢复的时间得到了降低;对背景数据进行恢复处理,保证回归模型的训练数据的正确性。It is worth noting that the original database file is overwritten on the previous database original file, so that the background data recovery time is reduced; the background data is restored to ensure the correctness of the training data of the regression model.
可以理解的是,预热处理即执行特定SQL语句、将保存在存储介质上的数据文件以页面格式按比例加载到内存中,以保证后续性能测试能够真实模拟业务高峰的压力。It is understandable that preheating is to execute specific SQL statements and load the data files stored on the storage medium into the memory in page format in proportion to ensure that subsequent performance tests can truly simulate the pressure of business peaks.
需要说明的是,第一预热时间集包括数据库初始调节参数以及与数据库初始调节参数对应的预热等待时间,第一预热时间集可以用于对参数优化回归模型组进行训练处理。It should be noted that the first warm-up time set includes the initial database adjustment parameters and the warm-up waiting time corresponding to the initial database adjustment parameters, and the first warm-up time set can be used for training the parameter optimization regression model group.
可以理解的是,在调参未开始时,在数据库停止的状态下,冷拷贝包含完整背景数据的原始数据文件(保证数据一致性);在调参过程的相关回合,关闭数据库实例,删除数据库日志文件,将原始数据文件覆盖数据库数据文件,将数据库初始调节参数写入数据库配置文件中,重启数据库实例,执行预热程序。It is understandable that when the parameter adjustment has not started, the original data file containing the complete background data is cold copied (to ensure data consistency) when the database is stopped; in the relevant rounds of the parameter adjustment process, the database instance is closed and the database is deleted Log file, overwrite the original data file with the database data file, write the initial adjustment parameters of the database into the database configuration file, restart the database instance, and execute the warm-up procedure.
另外,在一实施例中,如图4所示,在步骤S200之后还可以包括但不限于步骤S120。In addition, in an embodiment, as shown in FIG. 4 , step S120 may also be included after step S200 but not limited to.
步骤S120,记录性能测试前期时间节点。Step S120, record the early time nodes of the performance test.
需要说明的是,在预热完毕之后,还需要记录性能测试前期时间节点,为了后续的回滚操作提供时间节点的依据,以使得背景数据能够快速恢复。It should be noted that after the warm-up is complete, it is also necessary to record the time node in the early stage of the performance test, so as to provide the basis for the time node for the subsequent rollback operation, so that the background data can be quickly restored.
另外,在一实施例中,预热选择条件包括第二选择条件,第二选择条件为闪回训练标记位为真且调参计数值为不大于预设调参次数的偶数或者闪回训练标记位为假且闪回操作标记位为真,预热时间集合包括第二预热时间集,如图5所示,上述步骤S200可以包括但不限于步骤S250、步骤S260和步骤S270。In addition, in one embodiment, the preheating selection condition includes a second selection condition, the second selection condition is that the flashback training flag bit is true and the parameter adjustment count value is an even number not greater than the preset number of parameter adjustment times or the flashback training flag bit is false and the flashback operation flag bit is true, the warm-up time set includes the second warm-up time set, as shown in FIG. 5 , the above step S200 may include but not limited to step S250, step S260 and step S270.
步骤S250,当满足第二选择条件,根据性能测试前期时间节点对数据库进行回滚操作,以形成第二数据库测试状态;Step S250, when the second selection condition is met, perform a rollback operation on the database according to the previous time node of the performance test to form a second database test state;
步骤S260,基于第二数据库测试状态和相关的配置命令,使得数据库初始调节参数生效;Step S260, based on the test status of the second database and related configuration commands, make the initial adjustment parameters of the database take effect;
步骤S270,基于数据库初始调节参数,得到第二预热时间集。In step S270, a second warm-up time set is obtained based on the initial adjustment parameters of the database.
需要说明的是,当满足第二选择条件,根据性能测试前期时间节点对数据库进行回滚操作,以形成第二数据库测试状态;接着基于第二数据库测试状态和相关的配置命令,使得数据库初始调节参数生效;最后基于数据库初始调节参数,得到第二预热时间集。It should be noted that, when the second selection condition is satisfied, the database is rolled back according to the early stage of the performance test to form the second database test state; then based on the second database test state and related configuration commands, the initial adjustment of the database The parameters take effect; finally, based on the initial adjustment parameters of the database, the second warm-up time set is obtained.
可以理解的是,可以利用配置命令将修改的数据库初始调节参数生效,执行回滚操作,将数据库回滚到性能测试前期时间节点的时刻状态,将背景数据恢复到前一回合的状态,以保证回归模型的训练数据的正确性。It is understandable that configuration commands can be used to validate the modified initial adjustment parameters of the database, perform a rollback operation, roll back the database to the moment state of the previous time node of the performance test, and restore the background data to the state of the previous round to ensure The correctness of the training data for the regression model.
需要说明的是,第二预热时间集包括数据库初始调节参数以及与数据库初始调节参数对应的预热等待时间,第二预热时间集可以用于对参数优化回归模型组进行训练处理。It should be noted that the second warm-up time set includes the initial database adjustment parameters and the warm-up waiting time corresponding to the initial database adjustment parameters, and the second warm-up time set can be used for training the parameter optimization regression model group.
另外,在一实施例中,如图6所示,第一回归模型的训练过程包括但不限于步骤S310和步骤S320。In addition, in one embodiment, as shown in FIG. 6 , the training process of the first regression model includes but not limited to step S310 and step S320 .
步骤S310,根据数据库初始调节参数,对数据库进行性能测试得到性能指标参数;Step S310, performing a performance test on the database according to the initial adjustment parameters of the database to obtain performance index parameters;
步骤S320,根据性能指标参数对第一回归模型进行训练处理;以及对调参计数值进行更新处理。In step S320, the first regression model is trained according to the performance index parameters; and the adjusted parameter value is updated.
其中,性能指标参数包括性能参数和与性能参数对应的调整参数。Wherein, the performance index parameter includes a performance parameter and an adjustment parameter corresponding to the performance parameter.
需要说明的是,首先根据数据库初始调节参数,对数据库进行性能测试得到性能指标参数;然后根据性能指标参数对第一回归模型进行训练处理;以及对调参计数值进行更新处理;其中,性能指标参数包括性能参数和与性能参数对应的调整参数。It should be noted that, firstly, according to the initial adjustment parameters of the database, the performance test is performed on the database to obtain the performance index parameters; then the first regression model is trained according to the performance index parameters; and the value of the adjustment parameters is updated; among them, the performance index parameters It includes performance parameters and adjustment parameters corresponding to the performance parameters.
值得注意的是,对数据库进行性能测试即对数据库进行TPCC性能测试;而性能参数可以包括平均吞吐量和时延等。性能参数对应的调整参数即为相应的数据库初始调节参数。It is worth noting that performing a performance test on the database means performing a TPCC performance test on the database; and performance parameters may include average throughput and delay. The adjustment parameters corresponding to the performance parameters are corresponding initial adjustment parameters of the database.
示例性地,第一回归模型可以为一个含有128个隐藏层节点的三层前馈神经网络;对调参计数值进行更新处理可以为经过一个调参回合,调参计数值自动加1。Exemplarily, the first regression model may be a three-layer feed-forward neural network with 128 hidden layer nodes; the updating process of the parameter adjustment value may be that after one round of parameter adjustment, the parameter adjustment value is automatically increased by 1.
另外,在一实施例中,参数优化回归模型组包括第二回归模型和第三回归模型,调参回合判断条件为调参计数值等于预设的调参回合数且闪回训练标记位为真,如图7所示,参数优化回归模型组的训练过程包括但不限于步骤S330。In addition, in an embodiment, the parameter optimization regression model group includes the second regression model and the third regression model, and the judgment condition of the parameter adjustment round is that the parameter adjustment value is equal to the preset number of parameter adjustment rounds and the flashback training flag is true , as shown in FIG. 7 , the training process of parameter optimization regression model group includes but not limited to step S330.
步骤S330,当满足调参回合判断条件,根据第一预热时间集对第二回归模型进行训练处理;以及根据第二预热时间集对第三回归模型进行训练处理;以及将闪回训练标记位设定为假。Step S330, when the judgment condition of the parameter adjustment round is satisfied, the second regression model is trained according to the first warm-up time set; and the third regression model is trained according to the second warm-up time set; and the flashback training mark bit is set to false.
需要说明的是,当满足调参回合判断条件,先根据第一预热时间集对第二回归模型进行训练处理以及根据第二预热时间集对第三回归模型进行训练处理;再将闪回训练标记位设定为假。It should be noted that, when the judgment conditions of the tuning round are met, the second regression model is trained according to the first warm-up time set and the third regression model is trained according to the second warm-up time set; The training flag bit is set to false.
值得注意的是,步骤S330设定在步骤S320之后,进而可以将经过更新处理的调参计数值与预设的调参回合数进行比较。It should be noted that step S330 is set after step S320, and the updated parameter tuning counter value can be compared with the preset number of parameter tuning rounds.
示例性地,第二回归模型和第三回归模型均可以为含有32个隐藏层节点的三层前馈神经网络。Exemplarily, both the second regression model and the third regression model may be a three-layer feed-forward neural network including 32 hidden layer nodes.
另外,在一实施例中,优化探索条件包括第一优化条件,所述第一优化条件包括所述闪回训练标记位为真,如图8所示,在步骤S400中可以包括但不限于步骤410和步骤S420。In addition, in an embodiment, the optimization exploration condition includes a first optimization condition, and the first optimization condition includes that the flashback training flag bit is true, as shown in FIG. 8 , the step S400 may include but not limited to the step 410 and step S420.
步骤410,当满足第一优化条件,根据第一回归模型预测候选参数配置集合得到候选参数预期性能集合;Step 410, when the first optimization condition is met, predict the candidate parameter configuration set according to the first regression model to obtain the candidate parameter expected performance set;
步骤S420,从候选参数预期性能集合中选取第一最优配置项,且将第一最优配置项确定为新的数据库初始调节参数,以利用数据库初始调节参数重新进行迭代处理。Step S420, selecting the first optimal configuration item from the expected performance set of candidate parameters, and determining the first optimal configuration item as a new database initial adjustment parameter, so as to use the database initial adjustment parameter to perform iteration processing again.
需要说明的是,当满足第一优化条件,根据第一回归模型预测候选参数配置集合得到候选参数预期性能集合,接着从候选参数预期性能集合中选取第一最优配置项,且将第一最优配置项确定为新的数据库初始调节参数,以利用新的数据库初始调节参数对上一回合的数据库初始调节参数进行替换更新处理,然后重新执行上述的数据库参数调优方法,直至得到最优调节参数。It should be noted that when the first optimization condition is met, the candidate parameter configuration set is predicted according to the first regression model to obtain the candidate parameter expected performance set, and then the first optimal configuration item is selected from the candidate parameter expected performance set, and the first most The optimal configuration item is determined as the new database initial adjustment parameter, so as to use the new database initial adjustment parameter to replace and update the database initial adjustment parameter in the previous round, and then re-execute the above-mentioned database parameter optimization method until the optimal adjustment is obtained parameter.
可以理解的是,在数据库参数调优的过程中为了保证参数调优的准确性,往往需要经过多次的调参回合,直至符合优化探索条件才会输出最优调节参数。而前期的调参过程可以认定为对相关预热方案的预热情况进行收集,然后基于预热情况对相关的回归模型进行训练处理,使得后期的调参过程就可以根据前期采集的预热情况而自动快速地选取出最优调节参数。It is understandable that, in order to ensure the accuracy of parameter tuning in the process of database parameter tuning, it is often necessary to go through multiple rounds of parameter tuning, and the optimal tuning parameters will not be output until the optimization exploration conditions are met. The early parameter adjustment process can be considered as collecting the preheating conditions of the relevant preheating schemes, and then training and processing the relevant regression model based on the preheating conditions, so that the later parameter tuning process can be based on the preheating conditions collected in the previous period. And automatically and quickly select the optimal adjustment parameters.
另外,在一实施例中,优化探索条件包括第二优化条件,第二优化条件包括闪回训练标记位为假且性能指标参数中的最优性能参数在预设的次数存在变化,如图9所示,在步骤S400中可以包括但不限于步骤430和步骤S440。In addition, in an embodiment, the optimization exploration condition includes a second optimization condition, and the second optimization condition includes that the flashback training flag bit is false and the optimal performance parameter among the performance index parameters changes for a preset number of times, as shown in Figure 9 As shown, step S400 may include but not limited to step 430 and step S440.
步骤430,当满足第二优化条件,根据候选参数配置集合和预设的调整算法,得到候选参数预期价值集合;Step 430, when the second optimization condition is satisfied, according to the candidate parameter configuration set and the preset adjustment algorithm, the candidate parameter expected value set is obtained;
步骤S440,从候选参数预期价值集合中选取第二最优配置项,且将第二最优配置项确定为新的数据库初始调节参数且根据调整算法对闪回操作标记位进行更新处理,以利用新的数据库初始调节参数和新的闪回操作标记位进行迭代处理。Step S440, select the second optimal configuration item from the expected value set of candidate parameters, and determine the second optimal configuration item as the new database initial adjustment parameter, and update the flashback operation flag bit according to the adjustment algorithm, so as to utilize The new database initial adjustment parameters and the new flashback operation flag are iteratively processed.
需要说明的是,当满足第二优化条件,就会根据候选参数配置集合和预设的调整算法,得到候选参数预期价值集合;接着从候选参数预期价值集合中选取第二最优配置项,且将第二最优配置项确定为新的数据库初始调节参数且根据调整算法对闪回操作标记位进行更新处理,以利用新的数据库初始调节参数对上一回合的数据库初始调节参数进行替换更新处理,并且将新的闪回操作标记位对上一回合的闪回操作标记位进行替换更新处理,然后重新执行上述的数据库参数调优方法,直至得到最优调节参数。It should be noted that when the second optimization condition is satisfied, the candidate parameter expected value set will be obtained according to the candidate parameter configuration set and the preset adjustment algorithm; then the second optimal configuration item is selected from the candidate parameter expected value set, and Determine the second optimal configuration item as the new database initial adjustment parameter and update the flashback operation flag bit according to the adjustment algorithm, so as to use the new database initial adjustment parameter to replace and update the database initial adjustment parameter in the previous round , and replace and update the flashback operation flag of the previous round with the new flashback operation flag, and then re-execute the above-mentioned database parameter tuning method until the optimal adjustment parameters are obtained.
需要说明的是,调整算法基于参数优化回归模型组得到。示例性地,调整算法可以表示如下:It should be noted that the adjustment algorithm is obtained based on the parameter optimization regression model group. Exemplarily, the adjustment algorithm can be expressed as follows:
FlashBackOps=ifelse(g1(PredX)>g2(PredX),True,Flase)FlashBackOps=ifelse(g1(PredX)>g2(PredX),True,Flase)
PredX=argmax xi∈DXPredValue(xi) PredX=argmax xi∈DX PredValue(xi)
Figure PCTCN2022135455-appb-000001
Figure PCTCN2022135455-appb-000001
sigmoid(T)=1/1+exp(-T)sigmoid(T)=1/1+exp(-T)
其中,FlashBackOps为闪回操作标记位,PredX为第二最优配置项,DX为候选参数配置集合,xi为候选参数配置集合中的候选配置项,PredValue(xi)为候选参数预期价值集合,f(xi)为候选配置项的预测目标性能,σ(xi)为候选配置项的预测目标性能的标准差,g1(xi)和g2(xi)分别是候选配置项采用覆盖背景数据预热方案和回滚操作方案的预计耗时,allTime为本次调参能够申请的总时间,duringTime为本次调参已经消耗的总时间。Among them, FlashBackOps is the flashback operation flag, PredX is the second optimal configuration item, DX is the candidate parameter configuration set, xi is the candidate configuration item in the candidate parameter configuration set, PredValue(xi) is the candidate parameter expected value set, f (xi) is the predicted target performance of the candidate configuration item, σ(xi) is the standard deviation of the predicted target performance of the candidate configuration item, g1(xi) and g2(xi) are the preheating scheme and the coverage background data of the candidate configuration item respectively. The estimated time-consuming of the rollback operation plan, allTime is the total time that can be applied for this parameter adjustment, and duringTime is the total time that this parameter adjustment has already consumed.
另外,在一实施例中,优化探索条件包括第三优化条件,第三优化条件包括闪回训练标记位为假且性能指标参数中的最优性能参数在预设的次数不存在变化,如图10所示,在步骤S400中可以包括但不限于步骤450。In addition, in an embodiment, the optimization exploration condition includes a third optimization condition, and the third optimization condition includes that the flashback training flag bit is false and the optimal performance parameter among the performance index parameters does not change for a preset number of times, as shown in FIG. 10, step S400 may include but not limited to step 450.
步骤450,当满足第三优化条件,将最优性能参数对应的调整参数确定为最优调节参数。Step 450, when the third optimization condition is satisfied, the adjustment parameter corresponding to the optimal performance parameter is determined as the optimal adjustment parameter.
需要说明的是,当闪回训练标记位为假且性能指标参数中的最优性能参数在预设的次数不存在变化,就会将最优性能参数对应的调整参数确定为最优调节参数;示例性地,预设的次数可以为3,当闪回训练标记位为假且性能指标参数中的最优性能参数在三个参数调节回合都没有发生变化,就可以将最优性能参数对应的调整参数确定为最优调节参数。It should be noted that when the flashback training flag bit is false and the optimal performance parameter in the performance index parameters does not change for the preset number of times, the adjustment parameter corresponding to the optimal performance parameter will be determined as the optimal adjustment parameter; Exemplarily, the preset number of times can be 3. When the flashback training flag bit is false and the optimal performance parameter among the performance index parameters has not changed in the three parameter adjustment rounds, the corresponding optimal performance parameter can be The adjustment parameters are determined as optimal adjustment parameters.
为了更加清楚地说明本申请实施例提供的数据库参数调优方法的流程,如图11所示,下面以具体的示例进行说明。In order to more clearly illustrate the flow of the database parameter tuning method provided by the embodiment of the present application, as shown in FIG. 11 , a specific example is used below for description.
需要说明的是,待调节参数配置X即为数据库初始调节参数;It should be noted that the parameter configuration X to be adjusted is the initial adjustment parameter of the database;
本实施例中,数据库的待调节参数配置X是<BufferSize,IOThreads>,前者代表数据库的内存缓冲区大小、后者代表数据库的读写线程规模,假设这2个参数既可以修改配置文件后重启生效、又可以通过特定修改配置命令生效。数据库调参的目标Target是性能测试阶段的平均吞吐量。数据库的预热命令是对测试表执行全表扫描命令,命令执行完毕后内存缓冲区会被填充完毕、以减少性能测试的波动。数据库的性能测试是执行业界广泛采用的TPCC性能测试。模型f是一个含有128个隐藏层节点的3层前馈神经网络。模型g1和g2都是含有32个隐藏层节点的3层前馈神经网络。tLimit参数设置为10,k参数设置为3。In this embodiment, the parameter configuration X of the database to be adjusted is <BufferSize, IOThreads>, the former represents the memory buffer size of the database, and the latter represents the read and write thread size of the database. It is assumed that these two parameters can be modified after the configuration file is restarted To take effect, and to take effect by modifying specific configuration commands. The target target for database tuning is the average throughput during the performance test phase. The warm-up command of the database is to perform a full table scan command on the test table. After the command is executed, the memory buffer will be filled to reduce the fluctuation of the performance test. The performance test of the database is to execute the TPCC performance test widely used in the industry. Model f is a 3-layer feedforward neural network with 128 hidden layer nodes. Both models g1 and g2 are 3-layer feed-forward neural networks with 32 hidden layer nodes. The tLimit parameter is set to 10 and the k parameter is set to 3.
开始调参流程,此时记为第1回合:初始化设置数据库的待调节配置向量X(也就是BufferSize和IOThreads参数值);设置闪回训练标记位FlashBackTrainingFlag=True,闪回操作标记位FlashBackOps=False;当前调参计数器tCounter=1,gTime=NULL;Start the parameter adjustment process, which is recorded as the first round at this time: initialize and set the configuration vector X to be adjusted in the database (that is, the BufferSize and IOThreads parameter values); set the flashback training flag FlashBackTrainingFlag=True, and the flashback operation flag FlashBackOps=False ;Current parameter adjustment counter tCounter=1, gTime=NULL;
在调参的第1、3、5、7、9回合,此时FlashBackTrainingFlag==True且tCounter%2==1:In the 1st, 3rd, 5th, 7th, and 9th rounds of tuning, FlashBackTrainingFlag==True and tCounter%2==1:
执行上述步骤S210、步骤S220、步骤S230和步骤S240;记录下<X,Time1>并保存到数据集DS1。其中X为此时数据库参数配置值、Time1为从数据库关闭直到预热程序执行完成的总时长;Execute the above step S210, step S220, step S230 and step S240; record <X, Time1> and save it in the data set DS1. Among them, X is the configuration value of the database parameter at this time, and Time1 is the total time from the shutdown of the database to the completion of the warm-up program execution;
在调参的第2、4、6、8、10回合,此时FlashBackTrainingFlag==True且tCounter%2==0:In the 2nd, 4th, 6th, 8th, and 10th rounds of parameter tuning, FlashBackTrainingFlag==True and tCounter%2==0:
执行上述步骤S250、步骤S260和步骤S270;记录下<X,Time2>并保存到数据集DS2。其中X为此时数据库参数配置值、Time2为数据库执行回滚操作的时长;Execute the above step S250, step S260 and step S270; record <X, Time2> and save it to the data set DS2. Among them, X is the configuration value of the database parameter at this time, and Time2 is the time period for the database to perform the rollback operation;
在调参的第11回合以后,如果FlashBackTrainingFlag==False且FlashBackOps==False:执行上述步骤S210、步骤S220、步骤S230和步骤S240;After the 11th round of tuning, if FlashBackTrainingFlag==False and FlashBackOps==False: execute the above steps S210, S220, S230 and S240;
在调参的第11回合以后,如果FlashBackTrainingFlag==False且FlashBackOps==True:执行上述步骤S250、步骤S260和步骤S270。After the 11th round of parameter tuning, if FlashBackTrainingFlag==False and FlashBackOps==True: execute the above steps S250, S260 and S270.
在调参过程的所有回合:记录当前时间为gTime;执行TPCC性能测试,通过测试工具向数据库发起大量查询、度量其返回值的正确性和时延,执行一段时间后停止,反馈压力测试阶段的性能指标Target(时延、吞吐量等),并将<X,Target>保存到数据集TargetHistorySet。In all rounds of the parameter adjustment process: record the current time as gTime; execute TPCC performance test, initiate a large number of queries to the database through the test tool, measure the correctness and delay of the returned value, stop after a period of time, and feedback the stress test phase Performance indicator Target (delay, throughput, etc.), and save <X, Target> to the dataset TargetHistorySet.
在调参过程的所有回合:基于TargetHistorySet数据集训练回归模型f,令Target=f(X)、让f能够尽量反映X到Target的映射关系In all rounds of the parameter adjustment process: train the regression model f based on the TargetHistorySet dataset, set Target=f(X), and let f reflect the mapping relationship between X and Target as much as possible
在调参过程的所有回合:调参计数器值累加tCounter=tCounter+1In all rounds of the parameter adjustment process: the value of the parameter adjustment counter is accumulated tCounter=tCounter+1
在调参过程的第11回合,执行如下操作(其它回合不做任何操作):In the 11th round of the parameter adjustment process, perform the following operations (do nothing in other rounds):
基于DS1数据集训练回归模型g1,令Time1=g1(X)、让g1能够尽量反映参数配置信息X到Time1(从数据库关闭直到预热程序执行完成的总时长)的映射关系;Regression model g1 is trained based on the DS1 data set, so that Time1=g1(X), so that g1 can reflect the mapping relationship from the parameter configuration information X to Time1 (the total duration from the closing of the database until the completion of the warm-up program execution) as much as possible;
基于DS2数据集训练回归模型g2,令Time2=g2(X)、让g2能够尽量反映参数配置信息X到Time2(数据库执行回滚操作的时长)的映射关系;Based on the DS2 dataset training regression model g2, make Time2=g2(X), allow g2 to reflect the mapping relationship from parameter configuration information X to Time2 (the duration of the database execution rollback operation) as far as possible;
设置FlashBackTrainingFlag=False。Set FlashBackTrainingFlag=False.
在调参过程的所有回合:在当前配置向量X周边进行扰动(如对X某些配置项的取值按百分比随机增减)、得到扰动后的参数配置集合DX。In all rounds of the parameter adjustment process: Perturbation is performed around the current configuration vector X (for example, the value of some configuration items of X is randomly increased or decreased by percentage), and the parameter configuration set DX after the disturbance is obtained.
以下步骤分情况处理:The following steps are handled on a case-by-case basis:
在调参过程的第1-10回合:In rounds 1-10 of the tuning process:
利用回归模型f预测DX中各个配置项的预期性能Predy,取使得Predy达到最优的配置项PredX,令X=PredX;流程返回到预热选择,开始下一个回合;Use the regression model f to predict the expected performance Predy of each configuration item in DX, take the configuration item PredX that makes Predy reach the optimum, let X=PredX; the process returns to the preheating selection, and starts the next round;
在调参过程的第11回合以后(含第11回合),如果TargetHistorySet中的最优值TargetBest在最近连续3次中发生过变化:After the 11th round of the tuning process (including the 11th round), if the optimal value TargetBest in the TargetHistorySet has changed in the last 3 consecutive times:
根据上述调整算法计算DX中各个候选配置项(记为xi)的预期价值PredValue,取使得PredValue达到最优的配置项PredX,令X=PredX;并赋值FlashBackOps,流程转到预热选择,开始下一个回合;Calculate the expected value PredValue of each candidate configuration item (denoted as xi) in DX according to the above adjustment algorithm, take the configuration item PredX that makes PredValue reach the optimal value, let X=PredX; a round;
在调参过程的第11回合以后(含第11回合),如果TargetHistorySet中的最优值TargetBest在最近连续3次不发生变化:After the 11th round of the tuning process (including the 11th round), if the optimal value TargetBest in the TargetHistorySet has not changed for the last 3 consecutive times:
则返回TargetBest对应的配置向量XBest,推荐最佳的BufferSize和IOThreads参数值,结束整个调优过程。Return the configuration vector XBest corresponding to TargetBest, recommend the best BufferSize and IOThreads parameter values, and end the entire tuning process.
另外,如图12所示,本申请的一个实施例还提供了一种网络设备600,该网络设备600包括:存储器620、处理器610及存储在存储器620上并可在处理器610上运行的计算机程序。In addition, as shown in FIG. 12 , an embodiment of the present application also provides a network device 600 , the network device 600 includes: a memory 620 , a processor 610 , and an Computer program.
处理器610和存储器620可以通过总线或者其他方式连接。The processor 610 and the memory 620 may be connected through a bus or in other ways.
需要说明的是,本实施例中的网络设备600和上述实施例中的数据库参数调优方法属于相同的发明构思,因此这些实施例具有相同的实现原理以及技术效果,此处不再详述。It should be noted that the network device 600 in this embodiment and the database parameter tuning method in the above embodiments belong to the same inventive concept, so these embodiments have the same implementation principle and technical effect, and will not be described in detail here.
实现上述实施例的数据库参数调优方法所需的非暂态软件程序以及指令存储在存储器620中,当被处理器610执行时,执行上述实施例中的数据库参数调优方法,例如,执行以上描述的图1中的方法步骤S100至S400、图2中的方法步骤S110、图3中的方法步骤S210至S240、图4中的方法步骤S120、图5中的方法步骤S250至S270、图6中的方法步骤S310至S320、图7中的方法步骤S330、图8中的方法步骤S410至S420、图9中的方法步骤S430至S440、图10中的方法步骤S450。The non-transitory software programs and instructions required to realize the database parameter tuning method of the above-mentioned embodiment are stored in the memory 620, and when executed by the processor 610, the database parameter tuning method in the above-mentioned embodiment is executed, for example, the above Described method steps S100 to S400 in Fig. 1, method steps S110 in Fig. 2, method steps S210 to S240 in Fig. 3, method steps S120 in Fig. 4, method steps S250 to S270 in Fig. 5, Fig. 6 Method steps S310 to S320 in , method steps S330 in FIG. 7 , method steps S410 to S420 in FIG. 8 , method steps S430 to S440 in FIG. 9 , method steps S450 in FIG. 10 .
此外,本申请的一个实施例还提供了一种计算机可读存储介质,该计算机可读存储介质存储有计算机可执行指令,该计算机可执行指令被一个处理器610执行,例如,被上述网络设备600实施例中的一个处理器610执行,可使得上述处理器610执行上述实施例中的数据库参数调优方法,例如,执行以上描述的图1中的方法步骤S100至S400、图2中的方法步骤S110、图3中的方法步骤S210至S240、图4中的方法步骤S120、图5中的方法步骤S250至S270、图6中的方法步骤S310至S320、图7中的方法步骤S330、图8中的方法步骤S410 至S420、图9中的方法步骤S430至S440、图10中的方法步骤S450。In addition, an embodiment of the present application also provides a computer-readable storage medium, the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by a processor 610, for example, by the above-mentioned network device 600 is executed by a processor 610 in the embodiment, which can cause the above-mentioned processor 610 to execute the database parameter tuning method in the above-mentioned embodiment, for example, execute the method steps S100 to S400 in FIG. 1 described above, and the method in FIG. 2 Step S110, method steps S210 to S240 in FIG. 3, method steps S120 in FIG. 4, method steps S250 to S270 in FIG. 5, method steps S310 to S320 in FIG. 6, method steps S330 in FIG. 7, FIG. The method steps S410 to S420 in 8, the method steps S430 to S440 in FIG. 9 , and the method step S450 in FIG. 10 .
本申请实施例包括:获取数据库初始调节参数和调优设定参数;根据数据库初始调节参数、调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合;对数据库初始调节参数进行扰动处理,得到候选参数配置集合;根据候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数;其中,第一回归模型由数据库初始调节参数训练得到,参数优化回归模型组由预热时间集合和预设的调参回合判断条件训练得到。根据本申请实施例提供的方案,首先获取数据库初始调节参数和调优设定参数,然后根据数据库初始调节参数、调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合,接着对数据库初始调节参数进行扰动处理,得到候选参数配置集合;最后根据候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数,该方法能够很好地缩短数据库参数调优过程中的等待时间,提升参数调优的效率。The embodiment of the present application includes: obtaining the database initial adjustment parameters and tuning setting parameters; performing preheating processing according to the database initial adjustment parameters, tuning setting parameters and preset preheating selection conditions to obtain a preheating time set; The initial adjustment parameters are disturbed to obtain the candidate parameter configuration set; according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and the preset optimization exploration conditions, iterative processing is performed to obtain the optimal adjustment parameters; among them, the first The regression model is trained by the initial adjustment parameters of the database, and the parameter optimization regression model group is trained by the set of warm-up time and the preset judgment conditions of the adjustment round. According to the solution provided in the embodiment of the present application, firstly, the initial adjustment parameters and tuning setting parameters of the database are obtained, and then the preheating process is performed according to the initial adjustment parameters of the database, the tuning setting parameters and the preset preheating selection conditions to obtain the preheating time set, and then perturb the initial adjustment parameters of the database to obtain a candidate parameter configuration set; finally, perform iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group, and the preset optimization exploration conditions to obtain the optimal Adjusting parameters, this method can well shorten the waiting time in the process of database parameter tuning and improve the efficiency of parameter tuning.
本领域普通技术人员可以理解,上文中所公开方法中的全部或某些步骤、系统可以被实施为软件、固件、硬件及其适当的组合。某些物理组件或所有物理组件可以被实施为由处理器,如中央处理器、数字信号处理器或微处理器执行的软件,或者被实施为硬件,或者被实施为集成电路,如专用集成电路。这样的软件可以分布在计算机可读介质上,计算机可读介质可以包括计算机存储介质(或非暂时性介质)和通信介质(或暂时性介质)。如本领域普通技术人员公知的,术语计算机存储介质包括在用于存储信息(诸如计算机可读指令、数据结构、程序模块或其他数据)的任何方法或技术中实施的易失性和非易失性、可移除和不可移除介质。计算机存储介质包括但不限于RAM、ROM、EEPROM、闪存或其他存储器技术、CD-ROM、数字多功能盘(DVD)或其他光盘存储、磁盒、磁带、磁盘存储或其他磁存储装置、或者可以用于存储期望的信息并且可以被计算机访问的任何其他的介质。此外,本领域普通技术人员公知的是,通信介质通常包含计算机可读指令、数据结构、程序模块或者诸如载波或其他传输机制之类的调制数据信号中的其他数据,并且可包括任何信息递送介质。Those skilled in the art can understand that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware and an appropriate combination thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit . Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). As known to those of ordinary skill in the art, the term computer storage media includes both volatile and nonvolatile media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, program modules, or other data. permanent, removable and non-removable media. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cartridges, tape, magnetic disk storage or other magnetic storage devices, or can Any other medium used to store desired information and which can be accessed by a computer. In addition, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media .
以上是对本申请的若干实施进行了具体说明,但本申请并不局限于上述实施方式,熟悉本领域的技术人员在不违背本申请本质的前提下还可作出种种的等同变形或替换,这些等同的变形或替换均包含在本申请权利要求所限定的范围内。The above is a specific description of several implementations of the present application, but the present application is not limited to the above-mentioned embodiments. Those skilled in the art can also make various equivalent deformations or replacements without violating the essence of the present application. Any modification or substitution is included within the scope defined by the claims of the present application.

Claims (12)

  1. 一种数据库参数调优方法,包括:A database parameter tuning method, comprising:
    获取数据库初始调节参数和调优设定参数;Obtain the initial adjustment parameters and tuning setting parameters of the database;
    根据所述数据库初始调节参数、所述调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合;performing preheating processing according to the initial adjustment parameters of the database, the tuning setting parameters and preset preheating selection conditions to obtain a set of preheating times;
    对所述数据库初始调节参数进行扰动处理,得到候选参数配置集合;Perform disturbance processing on the initial adjustment parameters of the database to obtain a candidate parameter configuration set;
    根据所述候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数;performing iterative processing according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and preset optimization exploration conditions to obtain optimal adjustment parameters;
    其中,所述第一回归模型由数据库初始调节参数训练得到,所述参数优化回归模型组由所述预热时间集合和预设的调参回合判断条件训练得到。Wherein, the first regression model is obtained by training the initial adjustment parameters of the database, and the parameter optimization regression model group is obtained by training the set of warm-up times and the preset judgment conditions of the adjustment round.
  2. 根据权利要求1所述的数据库参数调优方法,其中,在所述根据所述数据库初始调节参数、所述调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合之前,所述方法还包括:The method for optimizing database parameters according to claim 1, wherein the preheating process is performed according to the initial adjustment parameters of the database, the tuning setting parameters and the preset preheating selection conditions to obtain the preheating time Before the collection, the method also includes:
    拷贝数据库原始文件,所述数据库原始文件包括背景数据。A database raw file is copied, the database raw file including background data.
  3. 根据权利要求2所述的数据库参数调优方法,其中,所述调优设定参数包括闪回训练标记位、闪回操作标记位和调参计数值,所述预热选择条件包括第一选择条件,所述第一选择条件为所述闪回训练标记位为真且所述调参计数值为不大于预设调参次数的奇数或者所述闪回训练标记位为假且所述闪回操作标记位为假,所述预热时间集合包括第一预热时间集,所述根据所述数据库初始调节参数、所述调优设定参数和所述预热选择条件进行预热处理,得到预热时间集合,包括:The database parameter tuning method according to claim 2, wherein the tuning setting parameters include flashback training flags, flashback operation flags, and tuning parameter values, and the warm-up selection conditions include the first selection condition, the first selection condition is that the flashback training flag is true and the parameter adjustment count value is an odd number not greater than the preset number of parameter adjustments or the flashback training flag is false and the flashback The operation flag bit is false, the set of warm-up time includes the first set of warm-up time, and the pre-heating process is performed according to the initial adjustment parameters of the database, the tuning setting parameters and the pre-heating selection conditions, and the obtained A collection of warm-up times, including:
    当满足所述第一选择条件,将所述数据库原始文件对前一次的数据库原始文件进行覆盖处理,以形成第一数据库测试状态;When the first selection condition is satisfied, the database original file is overwritten on the previous database original file to form a first database test state;
    根据所述第一数据库测试状态,将所述数据库初始调节参数写入数据库配置文件;Writing the database initial adjustment parameters into a database configuration file according to the first database test status;
    重启数据库实例以使得所述数据库配置文件中的所述数据库初始调节参数生效;Restarting the database instance to make the initial adjustment parameters of the database in the database configuration file take effect;
    根据所述数据库初始调节参数,对数据库进行预热处理,得到所述第一预热时间集。According to the initial adjustment parameters of the database, the database is preheated to obtain the first warm-up time set.
  4. 根据权利要求3所述的数据库参数调优方法,其中,在根据所述数据库初始调节参数、所述调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合之后,所述方法还包括:The database parameter tuning method according to claim 3, wherein, after the preheating process is performed according to the initial database adjustment parameters, the tuning setting parameters and the preset preheating selection conditions, and the preheating time set is obtained , the method also includes:
    记录性能测试前期时间节点。Record the time node in the early stage of the performance test.
  5. 根据权利4所述的数据库参数调优方法,其中,所述预热选择条件包括第二选择条件,所述第二选择条件为所述闪回训练标记位为真且所述调参计数值为不大于预设调参次数的偶数或者所述闪回训练标记位为假且所述闪回操作标记位为真,所述预热时间集合包括第二预热时间集,所述根据所述数据库初始调节参数、所述调优设定参数和预设的预热选择条件进行预热处理,得到预热时间集合,包括:The database parameter tuning method according to claim 4, wherein the preheating selection condition includes a second selection condition, the second selection condition is that the flashback training flag bit is true and the parameter adjustment count value is An even number not greater than the preset number of parameter adjustments or the flashback training flag bit is false and the flashback operation flag bit is true, the warm-up time set includes the second warm-up time set, and according to the database The initial adjustment parameters, the tuning setting parameters and the preset preheating selection conditions are preheated to obtain a set of preheating times, including:
    当满足所述第二选择条件,根据所述性能测试前期时间节点对数据库进行回滚操作,以形成第二数据库测试状态;When the second selection condition is satisfied, perform a rollback operation on the database according to the early stage time node of the performance test to form a second database test state;
    基于第二数据库测试状态和相关的配置命令,使得所述数据库初始调节参数生效;Making the initial adjustment parameters of the database take effect based on the test status of the second database and related configuration commands;
    基于所述数据库初始调节参数,得到所述第二预热时间集。Based on the initial adjustment parameters of the database, the second warm-up time set is obtained.
  6. 根据权利要求5所述的数据库参数调优方法,其中,所述第一回归模型的训练过程包括:The database parameter tuning method according to claim 5, wherein, the training process of the first regression model comprises:
    根据所述数据库初始调节参数,对数据库进行性能测试得到性能指标参数;performing a performance test on the database to obtain performance index parameters according to the initial adjustment parameters of the database;
    根据所述性能指标参数对所述第一回归模型进行训练处理;以及对所述调参计数值进行更新处理;performing training processing on the first regression model according to the performance index parameters; and performing updating processing on the parameter adjustment value;
    其中,所述性能指标参数包括性能参数和与所述性能参数对应的调整参数。Wherein, the performance index parameter includes a performance parameter and an adjustment parameter corresponding to the performance parameter.
  7. 根据权利6所述的数据库参数调优方法,其中,所述参数优化回归模型组包括第二回归模型和第三回归模型,所述调参回合判断条件为所述调参计数值等于预设的调参回合数且所述闪回训练标记位为真,所述参数优化回归模型组的训练过程包括:The database parameter tuning method according to claim 6, wherein the parameter optimization regression model group includes a second regression model and a third regression model, and the judgment condition of the parameter tuning round is that the parameter tuning count value is equal to a preset The number of rounds is adjusted and the flashback training flag is true, and the training process of the parameter optimization regression model group includes:
    当满足所述调参回合判断条件,根据所述第一预热时间集对所述第二回归模型进行训练处理;以及根据所述第二预热时间集对所述第三回归模型进行训练处理;以及将所述闪回训练标记位设定为假。When the judgment condition of the adjustment round is met, the second regression model is trained according to the first warm-up time set; and the third regression model is trained according to the second warm-up time set ; and setting the flashback training flag bit to false.
  8. 根据权利要求7所述的数据库参数调优方法,其中,所述优化探索条件包括第一优化条件,所述第一优化条件包括所述闪回训练标记位为真,所述根据所述候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,包括:The database parameter tuning method according to claim 7, wherein the optimization exploration condition includes a first optimization condition, and the first optimization condition includes that the flashback training flag bit is true, and the Configuration set, first regression model, parameter optimization regression model group and preset optimization exploration conditions are iteratively processed, including:
    当满足第一优化条件,根据所述第一回归模型预测所述候选参数配置集合得到候选参数预期性能集合;When the first optimization condition is satisfied, predicting the candidate parameter configuration set according to the first regression model to obtain a candidate parameter expected performance set;
    从所述候选参数预期性能集合中选取第一最优配置项,且将所述第一最优配置项确定为新的所述数据库初始调节参数,以利用所述数据库初始调节参数重新进行迭代处理。Selecting the first optimal configuration item from the expected performance set of candidate parameters, and determining the first optimal configuration item as a new initial adjustment parameter of the database, so as to use the initial adjustment parameter of the database to perform iterative processing again .
  9. 根据权利要求7所述的数据库参数调优方法,其中,所述优化探索条件包括第二优化条件,所述第二优化条件包括所述闪回训练标记位为假且所述性能指标参数中的最优性能参数在预设的次数存在变化,所述根据所述候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,包括:The database parameter tuning method according to claim 7, wherein the optimization exploration condition includes a second optimization condition, and the second optimization condition includes that the flashback training flag bit is false and that in the performance index parameter The optimal performance parameter changes at a preset number of times, and the iterative processing is performed according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and the preset optimization exploration conditions, including:
    当满足第二优化条件,根据所述候选参数配置集合和预设的调整算法,得到候选参数预期价值集合;When the second optimization condition is satisfied, according to the candidate parameter configuration set and the preset adjustment algorithm, the candidate parameter expected value set is obtained;
    从所述候选参数预期价值集合中选取第二最优配置项,且将所述第二最优配置项确定为新的所述数据库初始调节参数且根据所述调整算法对所述闪回操作标记位进行更新处理,以利用新的所述数据库初始调节参数和新的所述闪回操作标记位进行迭代处理;Selecting a second optimal configuration item from the expected value set of candidate parameters, and determining the second optimal configuration item as a new initial adjustment parameter of the database, and marking the flashback operation according to the adjustment algorithm The bit is updated, so as to use the new initial adjustment parameter of the database and the new flashback operation flag bit to perform iterative processing;
    其中,所述调整算法基于所述参数优化回归模型组得到。Wherein, the adjustment algorithm is obtained based on the parameter optimization regression model group.
  10. 根据权利要求7所述的数据库参数调优方法,其中,所述优化探索条件包括第三优化条件,所述第三优化条件包括所述闪回训练标记位为假且所述性能指标参数中的最优性能参数在预设的次数不存在变化,所述根据所述候选参数配置集合、第一回归模型、参数优化回归模型组和预设的优化探索条件进行迭代处理,得到最优调节参数,包括:The database parameter tuning method according to claim 7, wherein, the optimization exploration condition includes a third optimization condition, and the third optimization condition includes that the flashback training flag bit is false and that in the performance index parameter There is no change in the optimal performance parameter for the preset number of times, and the iterative processing is performed according to the candidate parameter configuration set, the first regression model, the parameter optimization regression model group and the preset optimization exploration conditions to obtain the optimal adjustment parameter, include:
    当满足第三优化条件,将所述最优性能参数对应的所述调整参数确定为所述最优调节参数。When the third optimization condition is satisfied, the adjustment parameter corresponding to the optimal performance parameter is determined as the optimal adjustment parameter.
  11. 一种网络设备,包括:A network device comprising:
    至少一个处理器;at least one processor;
    至少一个存储器,用于存储至少一个程序;at least one memory for storing at least one program;
    当至少一个所述程序被至少一个所述处理器执行时实现如权利要求1至10任意一项所述 的数据库参数调优方法。When at least one of the programs is executed by at least one of the processors, the database parameter tuning method according to any one of claims 1 to 10 is realized.
  12. 一种计算机可读存储介质,存储有计算机可执行指令,其中,所述计算机可执行指令用于执行权利要求1至10任意一项所述的数据库参数调优方法。A computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the database parameter tuning method according to any one of claims 1 to 10.
PCT/CN2022/135455 2021-12-01 2022-11-30 Database parameter tuning method, network equipment, and computer-readable storage medium WO2023098724A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111456061.5 2021-12-01
CN202111456061.5A CN116204503A (en) 2021-12-01 2021-12-01 Database parameter tuning method, network device and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2023098724A1 true WO2023098724A1 (en) 2023-06-08

Family

ID=86515199

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135455 WO2023098724A1 (en) 2021-12-01 2022-11-30 Database parameter tuning method, network equipment, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN116204503A (en)
WO (1) WO2023098724A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116401236B (en) * 2023-06-07 2023-08-18 瀚高基础软件股份有限公司 Method and equipment for adaptively optimizing database parameters
CN116679615B (en) * 2023-08-03 2023-10-20 中科航迈数控软件(深圳)有限公司 Optimization method and device of numerical control machining process, terminal equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005116871A1 (en) * 2004-05-28 2005-12-08 Pattern Recognition Systems As Method and apparatus for tuning database configuration parameters usnig multivariate analysis
CN112131206A (en) * 2020-09-24 2020-12-25 北京计算机技术及应用研究所 Multi-model database OrientDB parameter configuration automatic tuning method
CN113064879A (en) * 2021-03-12 2021-07-02 腾讯科技(深圳)有限公司 Database parameter adjusting method and device and computer readable storage medium
CN113590576A (en) * 2021-02-05 2021-11-02 华中科技大学 Database parameter adjusting method and device, storage medium and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005116871A1 (en) * 2004-05-28 2005-12-08 Pattern Recognition Systems As Method and apparatus for tuning database configuration parameters usnig multivariate analysis
CN112131206A (en) * 2020-09-24 2020-12-25 北京计算机技术及应用研究所 Multi-model database OrientDB parameter configuration automatic tuning method
CN113590576A (en) * 2021-02-05 2021-11-02 华中科技大学 Database parameter adjusting method and device, storage medium and electronic equipment
CN113064879A (en) * 2021-03-12 2021-07-02 腾讯科技(深圳)有限公司 Database parameter adjusting method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN116204503A (en) 2023-06-02

Similar Documents

Publication Publication Date Title
WO2023098724A1 (en) Database parameter tuning method, network equipment, and computer-readable storage medium
US10437795B2 (en) Upgrading systems with changing constraints
WO2015144004A2 (en) Efficient methods and systems for consistent read in record-based multi-version concurrency control
CN108369601B (en) Promoting attributes in relational structured data
US10417265B2 (en) High performance parallel indexing for forensics and electronic discovery
US20060224636A1 (en) Page recovery using volume snapshots and logs
US20140236911A1 (en) Low Level Object Version Tracking Using Non-Volatile Memory Write Generations
US8560500B2 (en) Method and system for removing rows from directory tables
US11487714B2 (en) Data replication in a data analysis system
CN108431807B (en) Replication of structured data records in partitioned data storage spaces
US20170169067A1 (en) Reminder processing of structured data records among partitioned data storage spaces
US11210281B2 (en) Technique for log records management in database management system
CN112364209A (en) Distributed data storage method, data query method, device and storage medium
JP2013513862A5 (en)
CN107209707B (en) Cloud-based staging system preservation
CN113434610A (en) Operation method of knowledge graph structure based on naming rule and cache mechanism
TW201721471A (en) System, method and device for optimizing database operations
US11934927B2 (en) Handling system-characteristics drift in machine learning applications
CN113760902A (en) Data splitting method, device, equipment, medium and program product
WO2016073198A1 (en) Systems, methods, and computer medium to optimize the storage of hydrocarbon reservoir simulation data
US11093348B2 (en) Method, device and computer program product for recovering metadata
CN114579559A (en) Data synchronization method and device, computer equipment and storage medium
CN114896250B (en) Key value separated key value storage engine index optimization method and device
US20190065538A1 (en) Database column refresh via replacement
CN108376104B (en) Node scheduling method and device and computer readable storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22900528

Country of ref document: EP

Kind code of ref document: A1