Database parameter adjustment method, device, storage medium and electronic device
By generating and testing multiple initial configuration combinations, the target configuration combination of database parameters is determined, which solves the problem of low database parameter tuning efficiency and achieves fast and efficient database parameter adjustment.
Patent Information
- Application Number
- CN202110164625.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-05
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2041-02-05
AI Technical Summary
In the prior art, database parameter tuning efficiency is low, especially when facing new loads, it requires long training and cannot give optimization solutions in a short time, resulting in high learning costs for database administrators and inability to meet user needs in time.
By obtaining the initial configuration information of the database to be optimized, at least two initial configuration combinations are generated, performance testing is performed, the target configuration combination is determined based on the test results, and the database parameters are updated.
On the premise of ensuring performance requirements, the feasible target configuration combination is quickly determined, which improves the efficiency of database parameter adjustment and avoids a long training process.
Smart Images

Figure CN113590576B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to fields such as artificial intelligence, cloud technology, and big data, and in particular to a database parameter adjustment method, device, storage medium, and electronic device. Background Art
[0002] As data volume grows at an ever-increasing rate and businesses become increasingly complex in the information age, databases are required to meet high throughput and low latency requirements. Good configuration parameters are crucial to ensuring database performance.
[0003] When using a database, users may need to find available database parameters as quickly as possible. Manual tuning can be used for this purpose, but as databases evolve, parameters become increasingly complex and diverse. This requires database administrators to use their understanding and experience to perform parameter tuning, placing high demands on database administrators and increasing their learning costs. Automated tuning can also be used, but most automated database parameter tuning methods require lengthy training when faced with new loads, and user demands are often urgent. This approach cannot provide an optimal solution for database parameters in a short period of time.
[0004] Therefore, how to improve the efficiency of database parameter tuning has become an urgent problem that needs to be solved. Summary of the Invention
[0005] The embodiments of the present application provide a database parameter adjustment method, device, storage medium, and electronic device, which can effectively improve the adjustment efficiency of database parameters.
[0006] In one aspect, an embodiment of the present application provides a method for adjusting database parameters, the method comprising:
[0007] Obtain parameter adjustment requests for the database to be optimized;
[0008] Obtaining initial configuration information corresponding to each database parameter of the database to be optimized according to the parameter adjustment request;
[0009] Determining at least two initial configuration combinations corresponding to each of the database parameters according to the initial configuration information corresponding to each of the database parameters;
[0010] Based on the above at least two initial configuration combinations, performance tests are performed on the above databases to be optimized respectively. Based on the performance test results corresponding to each of the above initial configuration combinations, the target configuration combinations corresponding to the above database parameters are determined, so as to update the above database parameters of the above databases to be optimized based on the above target configuration combinations.
[0011] In one aspect, an embodiment of the present application provides a database parameter adjustment device, the device comprising:
[0012] A parameter adjustment request acquisition module is used to obtain a parameter adjustment request for the database to be optimized;
[0013] An initial configuration information acquisition module is used to acquire the initial configuration information corresponding to each database parameter of the database to be optimized according to the parameter adjustment request;
[0014] a configuration combination determining module, configured to determine at least two initial configuration combinations corresponding to each of the database parameters according to the initial configuration information corresponding to each of the database parameters;
[0015] The target configuration parameter determination module is used to perform performance tests on the above-mentioned database to be optimized based on the above-mentioned at least two initial configuration combinations, and determine the target configuration combinations corresponding to the above-mentioned database parameters based on the performance test results corresponding to each of the above-mentioned initial configuration combinations, so as to update the above-mentioned database parameters of the above-mentioned database to be optimized based on the above-mentioned target configuration combinations.
[0016] In an optional embodiment, the target configuration parameter determination module is configured to:
[0017] Repeat the following operations based on the at least two initial configuration combinations until a preset end condition is met, and determine the target configuration combination based on each of the obtained preliminary configuration combinations:
[0018] Performing a performance test on each of the above initial configuration combinations to obtain a performance test result corresponding to each of the above initial configuration combinations;
[0019] Determine a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to the initial configuration combinations;
[0020] At least two new configuration combinations corresponding to the database parameters are determined according to the initial configuration information corresponding to the database parameters, and the at least two new configuration combinations are used as the at least two initial configuration combinations.
[0021] In an optional embodiment, the target configuration parameter determination module is configured to:
[0022] Based on the performance test results corresponding to each of the above initial configuration combinations and the preset performance constraints, the above initial configuration combinations are filtered to obtain the retained initial configuration combinations;
[0023] Based on the performance test results corresponding to the above-retained initial configuration combinations, a preliminary configuration combination is determined from the above-retained initial configuration combinations.
[0024] In an optional embodiment, the target configuration parameter determination module is configured to:
[0025] Obtain the optimization constraints corresponding to the database to be optimized;
[0026] Determine each initial configuration combination that satisfies the optimization constraints among the initial configuration combinations, and determine a preliminary configuration combination based on the performance test results of each initial configuration combination that satisfies the optimization constraints;
[0027] Alternatively, candidate configuration combinations are determined based on the performance test results corresponding to the initial configuration combinations, and combinations among the candidate configuration combinations that meet the optimization constraints are determined as preliminary configuration combinations.
[0028] In an optional embodiment, the preset termination condition includes at least one of the following:
[0029] The operation duration of the above operation reaches the first set duration;
[0030] The initial configuration combinations corresponding to at least two of the above operations are consistent;
[0031] The operation duration of the above operation does not exceed the second set time, and the preliminary configuration combinations corresponding to at least two of the above operations are consistent;
[0032] Received the operation end instruction.
[0033] In an optional embodiment, the target configuration parameter determination module is configured to perform at least one of the following:
[0034] Determine at least one target configuration combination based on the performance test results of each of the aforementioned preliminary configuration combinations;
[0035] Each of the above-mentioned preliminary configuration combinations is used as the target configuration combination;
[0036] Optimization constraints corresponding to the database to be optimized are obtained, and at least one target configuration combination is determined based on the performance test results of each of the preliminary configuration combinations and the optimization constraints.
[0037] In an optional embodiment, the target configuration parameter determination module is configured to:
[0038] Each of the above initial configuration combinations is applied to the database instance of the above database to be optimized, and a performance test is performed on the database instance corresponding to each of the above initial configuration combinations.
[0039] In an optional embodiment, the target configuration parameter determination module is configured to:
[0040] The performance tests for the database instances corresponding to each of the above initial configuration combinations include:
[0041] Obtain historical business data of the database to be optimized;
[0042] Generate test cases based on the above historical business data, and perform performance tests on the database instances corresponding to each of the above initial configuration combinations based on the above test cases.
[0043] In an optional embodiment, the target configuration parameter determination module is configured to:
[0044] The at least two initial configuration combinations are distributed to at least two test devices, so that the at least two test devices can perform performance tests on the database to be optimized in parallel based on the initial configuration combinations distributed to them.
[0045] In an optional embodiment, the target configuration parameter determination module is configured to:
[0046] Performing performance tests on the database to be optimized based on each of the initial configuration combinations to obtain performance test information corresponding to each of the initial configuration combinations, wherein the performance test information includes at least one of test throughput or test latency;
[0047] Obtaining performance benchmark information corresponding to the database to be optimized, wherein the performance benchmark information includes at least one of a benchmark throughput or a benchmark latency;
[0048] For each of the above initial configuration combinations, a performance test result corresponding to the above initial configuration combination is determined based on the above performance benchmark information and the performance test information corresponding to the above initial configuration combination.
[0049] In an optional embodiment, the target configuration parameter determination module is configured to:
[0050] For each initial configuration combination, determining the performance test result corresponding to the initial configuration combination based on the performance benchmark information and the performance test information corresponding to the initial configuration combination includes:
[0051] Obtain a first weight corresponding to throughput and a second weight corresponding to delay;
[0052] A performance test result corresponding to the initial configuration combination is determined based on the performance test information, the performance benchmark information, the first weight, and the second weight.
[0053] On the one hand, an embodiment of the present application provides an electronic device, which includes a processor and a memory, which are connected to each other; the memory is used to store a computer program; and the processor is configured to execute a method provided by any possible implementation of the above-mentioned database parameter adjustment method when calling the above-mentioned computer program.
[0054] On the one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the method provided by any possible implementation of the database parameter adjustment method.
[0055] In one aspect, embodiments of the present application provide a computer program product or computer program, comprising computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided by any possible implementation of the aforementioned database parameter adjustment method.
[0056] The beneficial effects of the technical solution provided by this application are:
[0057] In an embodiment of the present application, the database parameter adjustment method, device, storage medium and electronic device provided in the embodiment of the present application, after obtaining a parameter adjustment request for the database to be optimized, can obtain the initial configuration information of each database parameter of the data to be optimized based on the request. Then, at least two possible initial configuration combinations of each database parameter are generated based on the initial configuration information. Then, based on the at least two initial configuration combinations, the performance of the data to be optimized is tested to obtain the performance test results corresponding to each initial configuration combination, and then based on the performance test results, the target configuration combination corresponding to each database parameter is determined, so that the database parameters of the database to be optimized can be updated based on the target configuration combination. In this way, a feasible target configuration combination can be determined under the premise of ensuring performance requirements, avoiding the need in the related art to go through long preliminary training and then perform parameter tuning based on the trained model, greatly improving the efficiency of adjusting the database parameters of the database to be optimized. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0059] Figure 1 This is a schematic diagram of an implementation flow of a database parameter adjustment system provided by an embodiment of the present application in an application scenario;
[0060] Figure 2 This is a flow chart of a method for adjusting database parameters provided in an embodiment of the present application;
[0061] Figure 3 Schematic diagram of the overall framework of a database parameter adjustment method provided in an embodiment of the present application;
[0062] Figure 4 This is a schematic diagram of the structure of a database parameter adjustment device provided in an embodiment of the present application;
[0063] Figure 5 This is a schematic diagram of the working principle of a management terminal provided in an embodiment of the present application;
[0064] Figure 6 This is a schematic diagram of the working principle of a sub-machine performing performance testing provided in an embodiment of the present application;
[0065] Figure 7 This is a flow chart of updating and eliminating parameter groups through health monitoring provided by an embodiment of the present application;
[0066] Figure 8 This is a flow chart of a performance test using a real load, provided in an embodiment of the present application;
[0067] Figure 9 This is a schematic diagram of a process for determining a target configuration combination provided by an embodiment of the present application;
[0068] Figure 10 This is an optional structural diagram of the distributed system 100 provided in an embodiment of the present application applied to a blockchain system;
[0069] Figure 11 This is an optional schematic diagram of the block structure provided in the embodiment of the present application;
[0070] Figure 12 It is a structural diagram of another database parameter adjustment device provided in an embodiment of the present application;
[0071] Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0072] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0073] The database parameter adjustment method provided in the embodiments of the present application involves various fields such as artificial intelligence, cloud technology, such as databases, cloud computing, cloud services, etc. in cloud technology, as well as related data computing and processing fields in the big data field.
[0074] Artificial Intelligence (AI) refers to the theories, methods, techniques, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, AI is a comprehensive technology within computer science that seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. AI also involves studying the design principles and implementation methods of various intelligent machines, enabling them to possess the capabilities of perception, reasoning, and decision-making.
[0075] Cloud technology refers to a hosting technology that unifies hardware, software, network and other resources within a wide area network or local area network to achieve data computing, storage, processing and sharing. The database parameter adjustment method provided in the embodiment of the application can be implemented based on cloud computing in cloud technology.
[0076] A database, in short, can be thought of as a digital filing cabinet—a place where electronic files are stored, allowing users to add, query, update, and delete data. A database is a collection of data stored in a specific way, shared by multiple users, with minimal redundancy, and independent of applications.
[0077] A database management system (DBMS) is a computer software system designed for managing databases, typically providing basic functions such as storage, retrieval, security, and backup. DBMSs can be categorized by the database model they support, such as relational or XML (Extensible Markup Language); by the type of computer they support, such as server clusters or mobile phones; by the query language used, such as SQL (Structured Query Language) or XQuery; by performance priorities, such as maximum scale or maximum speed; or by other classification methods. Regardless of the classification method used, some DBMSs can cross categories, for example, supporting multiple query languages simultaneously.
[0078] Cloud computing refers to obtaining required resources on demand and in an easily scalable manner through the Internet. It is the product of the integration of traditional computer and network technologies such as grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing.
[0079] Artificial intelligence cloud services, also commonly referred to as AIaaS (AI as a Service), are a mainstream AI platform service model. Specifically, AIaaS platforms break down several common AI services and provide independent or packaged services in the cloud, such as processing resource conversion requests.
[0080] Big data refers to data sets that cannot be captured, managed, and processed within a certain timeframe using conventional software tools. These are massive, high-growth, and diverse information assets that require new processing models to enhance decision-making, insight discovery, and process optimization capabilities. With the advent of the cloud era, big data has attracted increasing attention. Effectively implementing the database parameter adjustment method provided in this embodiment requires specialized technologies based on big data. Technologies suitable for big data include massively parallel processing databases, data mining, distributed file systems, distributed databases, and the aforementioned cloud computing.
[0081] As an example, Figure 1FIG2 shows a schematic diagram of an implementation flow of a database parameter adjustment system applicable to an embodiment of the present application in an application scenario. It can be understood that the database parameter adjustment method provided in the embodiment of the present application can be applied to but not limited to applications such as Figure 1 In the application scenario shown.
[0082] The database parameter adjustment system in this example may include, but is not limited to, a user terminal 101, a network 102, and a server 103. The user terminal 101 (such as a user's smartphone) can communicate with the server 103 via the network 102. The user terminal 101 may include a human-computer interaction screen 1011, a processor 1012, and a memory 1013. A parameter adjustment request can be initiated on the human-computer interaction screen. For example, a user can initiate a parameter adjustment request for the data to be optimized via the user terminal 101 and send the parameter adjustment request to the server via the network. The server 103 may include a database 1031 and a processing engine 1032. The processor 1032 is used to perform corresponding processing after receiving the parameter adjustment request to obtain a target configuration combination corresponding to each database parameter of the data to be optimized. The memory 1031 is used to store the target configuration combination, etc.
[0083] like Figure 1 As shown, the specific interaction process of the database parameter adjustment system in this application may include steps S1-S4:
[0084] In step S1 , a user initiates a parameter adjustment request for a database to be optimized through a user terminal 101 , and sends the parameter adjustment request to a server 103 through a network 102 .
[0085] In step S2, the server 103 receives the parameter adjustment request, and the processing engine 1032 obtains the initial configuration information corresponding to each database parameter of the database to be optimized according to the parameter adjustment request.
[0086] In step S3, the processing engine 1032 in the server 103 determines at least two initial configuration combinations corresponding to the above-mentioned database parameters according to the initial configuration information corresponding to the above-mentioned database parameters.
[0087] In step S4, the processing engine 1032 in the server 103 performs performance tests on the above-mentioned databases to be optimized based on the above-mentioned at least two initial configuration combinations, determines the target configuration combinations corresponding to the above-mentioned database parameters based on the performance test results corresponding to each of the above-mentioned initial configuration combinations, and sends the target configuration combinations to the user terminal.
[0088] Step S5: The user terminal receives the target configuration combination and updates each database parameter of the database to be optimized based on the target configuration combination.
[0089] The database 1031 in the server 103 is used to store various data generated in steps S2-S4, such as initial configuration information, performance test results corresponding to each of the above initial configuration combinations, target configuration combinations, etc.
[0090] The database parameter adjustment method of the present application can be applied to various scenarios requiring database parameter adjustment. In actual application scenarios, different parameter adjustment requests can be initiated based on business needs. Business needs can be determined based on actual application scenarios and are not limited here. For example, the business can be a shopping application, an instant messaging application, an audio and video application, a search application, etc., without any limitation here.
[0091] The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server or server cluster that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The aforementioned network can include, but is not limited to, wired networks and wireless networks. The wired network includes a local area network, a metropolitan area network, and a wide area network, and the wireless network includes Bluetooth, Wi-Fi, and other networks that enable wireless communication. The user terminal can be a smartphone (such as an Android phone, an iOS phone, etc.), a tablet computer, a laptop computer, a digital broadcast receiver, a MID (Mobile Internet Device), a PDA (Personal Digital Assistant), a desktop computer, an in-vehicle terminal (such as an in-vehicle navigation terminal), a smart speaker, a smartwatch, etc. The user terminal and the server can be connected directly or indirectly via wired or wireless communication, but are not limited to such. The specific method can also be determined based on the actual application scenario requirements and is not limited here.
[0092] See also Figure 2 , Figure 2 This is a flow chart of a method for adjusting database parameters provided by an embodiment of the present application. This method can be executed by any electronic device, such as a server, a user terminal, or an interaction between a user terminal and a server. Optionally, it can be executed by a server, such as Figure 2 As shown, the database parameter adjustment method provided in the embodiment of the present application includes the following steps:
[0093] Step S201: obtaining a parameter adjustment request for the database to be optimized;
[0094] Step S202: acquiring initial configuration information corresponding to each database parameter of the database to be optimized according to the parameter adjustment request;
[0095] Step S203, determining at least two initial configuration combinations corresponding to each of the database parameters according to the initial configuration information corresponding to each of the database parameters;
[0096] Step S204: Based on the at least two initial configuration combinations, the performance tests are performed on the databases to be optimized respectively. Based on the performance test results corresponding to the initial configuration combinations, the target configuration combinations corresponding to the database parameters are determined, so as to update the database parameters of the database to be optimized based on the target configuration combinations.
[0097] Optionally, the database to be optimized can be determined based on actual business needs. For example, the database to be optimized can be a database used by a shopping application, an instant messaging application, an audio and video application, a search application, and so on, without limitation herein. The database type of the database to be optimized can be a cloud database (CDB) or a database (DB), without limitation herein.
[0098] The parameter adjustment request can be a user-initiated Hypertext Transfer Protocol (HTTP) request or a Remote Procedure Call (RPC) request. It is understood that the embodiments of the present application do not impose any restrictions on the specific request type of the parameter adjustment request. The parameter adjustment request can include the desired performance indicators (i.e., the performance constraints described above). In actual applications, the desired performance indicators may not be achieved due to the hardware performance of the requesting device itself.
[0099] After the parameter adjustment request is obtained, initial configuration information corresponding to each database parameter of the data to be optimized may be determined according to the parameter adjustment request.
[0100] The database parameters of the database to be optimized can be all parameters that may affect the performance of the database to be optimized. The database parameters can be determined through manual screening, such as by combining the experience of database administrators. It is understood that there is no limit to the number of database parameters to be optimized.
[0101] The initial configuration information of each database parameter can be understood as the adjustment range (also referred to as the value range) of each database parameter.
[0102] Database parameters can be divided into multiple types, such as integer type, string type, enumeration type, etc. Different types of database parameters correspond to different initial configuration information.
[0103] For integer database parameters, the adjustment range for any database parameter consists of the following information: {parameter type, minimum value, maximum value, default value}. The default value is the default parameter value of the database being optimized (i.e., the current configuration value). The minimum and maximum values can be a fuzzy range defined by the database administrator based on the machine configuration of the requesting device, business type, and business volume.
[0104] Taking the cloud database CDB as an example, the adjustment range of integer type database parameters is explained:
[0105] "thread_pool_size": ["integer", [1, 48, 48]], where "thread_pool_size" represents the adjustment range of the integer type database parameter, integer represents the integer type, the first value 1 is the minimum value of the parameter, the second value 48 is the maximum value of the parameter, and the third value 48 is the default parameter value (that is, the current configuration value) of the parameter of the database to be optimized.
[0106] For database parameters of string, enumeration, and other types, the adjustment range consists of the following information: {parameter type, all possible discrete values, and default value}. The default value is the default parameter value of the database to be optimized (that is, the current configuration value).
[0107] Taking the Cloud Database CDB as an example, the following describes the adjustment range of the default database parameters of the string type:
[0108] "binlog_checksum": ["string",["NONE","CRC32"],"CRC32"], "binlog_checksum" indicates the adjustment range of a database parameter of the string type. "string" refers to the string type. The array ["NONE","CRC32"] represents all possible discrete values of the parameter. "CRC32" represents the default parameter value (i.e., the current configuration value) of the parameter in the database to be optimized. The value of this parameter can only be changed in the discrete array.
[0109] It is understandable that the above is only an example. In actual applications, database administrators can organize all parameters that may affect database performance into a parameter list that needs to be adjusted in the above form. For different database types, the adjusted parameter list is different. For different users, some adjustments can also be made, which are not limited here.
[0110] To improve the efficiency of database parameter adjustment, an embodiment of the present application applies a heuristic algorithm to database parameter adjustment. The main idea is to obtain a feasible solution for database parameters based on a heuristic algorithm. Heuristic algorithms have different definitions: one definition is an algorithm constructed based on intuition or experience that can provide an approximate optimal solution to an instance of an optimization problem within an acceptable computational cost (computation time, space occupied, etc.). The degree of deviation of this approximate solution from the true optimal solution cannot necessarily be predicted in advance; another definition is that a heuristic algorithm is a technique that allows the search for the best solution within an acceptable computational cost, but does not necessarily guarantee a feasible solution or an optimal solution. In fact, in most cases, it is impossible to explain the degree of approximation of the obtained solution to the optimal solution. It is proposed in contrast to the optimal algorithm. The optimal algorithm for a problem refers to the optimal solution for each instance of the problem. In some cases, especially in practical problems, the computation time of the optimal algorithm is unbearable or the computation time increases exponentially with the increase in the problem size due to the difficulty of the problem. In this case, a feasible solution to the problem can only be obtained through a heuristic algorithm.
[0111] Specifically, after obtaining the initial configuration information corresponding to each database parameter, at least two possible initial configuration combinations of each database parameter can be determined based on the initial configuration information. The initial configuration combination can be understood as different combinations of possible values of each database parameter. For example, assuming that the database parameters of the database to be optimized are parameter A, parameter B, and parameter C, there are 1000 possible values for parameter A, 500 possible values for parameter B, and 800 possible values for parameter C, then at least two initial configuration combinations can be generated according to the various possible values of parameter A, parameter B, and parameter C, such as initial configuration combination 1 [A1, B1, C1], ..., initial configuration combination i [A i , B i , C i ], where A1, A i Indicates the value of parameter A, B1, B i Indicates the value of parameter B, C1, C i Indicates the value of parameter C.
[0112] Among them, the initial configuration combination may include the current configuration combination of each database parameter of the database to be optimized (which can also be called the default configuration combination of each database parameter of the database to be optimized), that is, the current configuration value of each database parameter of the database to be optimized can be tested to test whether it meets the performance requirements.
[0113] Then, based on the at least two initial configuration combinations obtained, performance tests are performed on the database to be optimized respectively to obtain the performance test results corresponding to each initial configuration combination. The initial configuration combinations are screened according to the performance test results. If a combination that meets the performance requirements can be screened out, the combination that meets the performance requirements can be used as the target configuration combination, so that the requesting device can update the database parameters of the database to be optimized based on the target configuration combination.
[0114] It should be noted that the above process is described using the example of a server and a requesting device interacting to complete the database parameter adjustment method provided in this application. In actual applications, the method can also be completed independently by the server or the requesting device. For example, the server or the requesting device can initiate a parameter adjustment request, then determine the target configuration combination according to the above method, and based on the obtained target configuration combination, update the database parameters corresponding to the data to be optimized on the server. This embodiment of the present application does not impose any limitations on this.
[0115] In practical applications, the target configuration combination can be determined through multiple iterations. For example, in the first iteration, based on the user's performance requirements, at least one feasible solution that meets the performance requirements can be selected from at least two initial configuration combinations, i.e., at least one target configuration combination. In practical applications, multiple iterations are often required to obtain more and better feasible solutions. This means that various possible feasible solutions can be obtained through the second and third iterations, and so on. Through continuous iterative optimization, the target configuration combination for each database parameter is determined.
[0116] For example, after obtaining the initial configuration information for each database parameter, at least two initial configuration combinations can be determined by calling the parameter list. For example, for integer values, a random value between the minimum and maximum values can be selected, such as 20 for thread_pool_size. For string and enumeration values, binlog_checksum can be randomly selected from the discrete parameter list, "CRC32." This method can generate at least two sets of parameter values, each set consisting of, for example, {thread_pool_size: 20, binlog_checksum: "CRC32"...}. In the first iteration, n parameter sets (i.e., initial configuration combinations) can be generated, and the user's default parameter set (i.e., current configuration combination) can be added to the n parameter sets. Performance testing is then performed on the generated n parameter sets plus the user's default parameter set, obtaining corresponding performance test results. Based on the performance test results, at least one feasible solution that meets the performance requirements is determined. Continue iterating, determining multiple feasible solutions in the same manner, and then determining the target configuration combination from among these multiple feasible solutions.
[0117] Through the embodiment of the present application, after obtaining the parameter adjustment request for the database to be optimized, the initial configuration information of each database parameter of the data to be optimized can be obtained based on the request. Then, at least two possible initial configuration combinations of each database parameter are generated based on the initial configuration information. Then, based on the at least two initial configuration combinations, the performance of the data to be optimized is tested to obtain the performance test results corresponding to each initial configuration combination, and then based on the performance test results, the target configuration combination corresponding to each database parameter is determined, so that the database parameters of the database to be optimized can be updated based on the target configuration combination. In this way, a feasible target configuration combination can be determined under the premise of ensuring performance requirements, avoiding the need in related technologies to go through long preliminary training and then perform parameter tuning based on the trained model, which greatly improves the efficiency of tuning the database parameters of the database to be optimized.
[0118] The following details the specific process of tuning database parameters through iterative optimization.
[0119] In an optional embodiment, the above-mentioned at least two initial configuration combinations are used to perform performance tests on the database to be optimized, and based on the performance test results corresponding to each of the initial configuration combinations, a target configuration combination corresponding to each of the database parameters is determined, including:
[0120] Repeat the following operations based on the at least two initial configuration combinations until a preset end condition is met, and determine the target configuration combination based on each of the obtained preliminary configuration combinations:
[0121] Performing a performance test on each of the above initial configuration combinations to obtain a performance test result corresponding to each of the above initial configuration combinations;
[0122] Determine a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to the initial configuration combinations;
[0123] At least two new configuration combinations corresponding to the database parameters are determined according to the initial configuration information corresponding to the database parameters, and the at least two new configuration combinations are used as the at least two initial configuration combinations.
[0124] Optionally, the following operations may be repeatedly performed based on at least two initial configuration combinations in an iterative optimization manner until a preset end condition is met, and a target configuration combination is determined based on each of the obtained preliminary configuration combinations. The specific process is as follows:
[0125] In the first iteration, a performance test is performed on each initial configuration combination to obtain a performance test result corresponding to each initial configuration combination. Based on the performance test result corresponding to each initial configuration combination, at least one preliminary configuration combination is determined from the initial configuration combination. The preliminary configuration combination is a feasible solution for at least one database parameter that meets the performance requirements. Then, in order to find more feasible solutions, iterative optimization can be continued. In the second iteration, at least two new configuration combinations corresponding to a new batch of database parameters are determined from the initial configuration information, and the at least two new configuration combinations are used as the at least two initial configuration combinations mentioned above. At least one preliminary configuration combination corresponding to the new initial configuration information is continued to be determined in the manner of the first iteration. No further details will be given here. It is understandable that in actual applications, there is no limit on the specific number of iterations.
[0126] Through the embodiments of the present application, the preliminary configuration combination can be continuously updated through iterative optimization, and then the target configuration combination can be determined from the preliminary configuration combination, so that the performance of the determined target configuration combination is better, ensuring the optimization of performance requirements.
[0127] In an optional embodiment, the preset termination condition includes at least one of the following:
[0128] The operation duration of the above operation reaches the first set duration;
[0129] The initial configuration combinations corresponding to at least two of the above operations are consistent;
[0130] The operation duration of the above operation does not exceed the second set time, and the preliminary configuration combinations corresponding to at least two of the above operations are consistent;
[0131] Received the operation end instruction.
[0132] Optionally, the first set duration can be understood as the user's given tuning duration, that is, the target configuration combination is determined within the tuning duration. Then, when the first set duration is reached, the target configuration combination can be determined from the various preliminary configuration combinations that have been obtained.
[0133] Alternatively, if the preliminary configuration combinations determined by at least two operations are consistent, the iterative operation can be stopped, and then the target configuration combination can be determined from the preliminary configuration combinations.
[0134] Alternatively, the second set duration can be understood as the user's given tuning duration, that is, the target configuration combination is determined within the tuning duration. If the second duration is not exceeded and the preliminary configuration combinations corresponding to at least two of the above operations are consistent, the iterative operation can be stopped, and then the target configuration combination can be determined from the preliminary configuration combinations that have been obtained.
[0135] Alternatively, upon receiving an operation end instruction, the iterative operation is stopped, and the target configuration combination is determined from the obtained preliminary configuration combinations. The operation end instruction may be initiated by the requesting device, which is not limited here.
[0136] Through the embodiments of the present application, different preset end conditions can be set according to actual needs. When the preset end conditions are met, the target configuration combination is determined from the various preliminary configuration combinations that have been obtained. The method is flexible and changeable, which improves the flexibility of determining the target configuration combination.
[0137] In an optional embodiment, determining a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to each of the initial configuration combinations includes:
[0138] Based on the performance test results corresponding to each of the above initial configuration combinations and the preset performance constraints, the above initial configuration combinations are filtered to obtain the retained initial configuration combinations;
[0139] Based on the performance test results corresponding to the above-retained initial configuration combinations, a preliminary configuration combination is determined from the above-retained initial configuration combinations.
[0140] Optionally, after determining the performance test results of each initial configuration combination, it is necessary to filter each initial configuration combination based on the performance test results and preset performance constraints. If the performance test result is the performance score of the initial configuration combination, and the performance constraint is that the performance score is not lower than a certain set threshold, then the combinations with performance scores lower than the set threshold in each initial configuration combination can be filtered out. Alternatively, the performance scores of each initial configuration combination can be sorted in descending order, and a set number of combinations ranked at the bottom can be filtered out, and so on, which are not limited here.
[0141] Then, based on the performance results corresponding to the retained initial configuration combinations, a preliminary configuration combination is determined from the retained initial configuration combinations. For example, the best combination among the retained initial configuration combinations can be determined as a preliminary configuration combination. In other words, in each iteration, a preliminary configuration combination with the best performance can be determined and recorded, and then at least one target configuration combination can be determined from each recorded preliminary configuration combination.
[0142] Through the embodiments of the present application, some configuration combinations with poor performance can be removed by filtering to meet the performance requirements of the database to be optimized, and configuration combinations with good performance can be selected. By filtering configuration combinations with poor performance, there is no need to repeatedly test the combinations with poor performance, thereby improving efficiency.
[0143] In an optional embodiment, determining a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to each of the initial configuration combinations includes:
[0144] Obtain the optimization constraints corresponding to the database to be optimized;
[0145] Determine each initial configuration combination that satisfies the optimization constraints among the initial configuration combinations, and determine a preliminary configuration combination based on the performance test results of each initial configuration combination that satisfies the optimization constraints;
[0146] Alternatively, candidate configuration combinations are determined based on the performance test results corresponding to the initial configuration combinations, and combinations among the candidate configuration combinations that meet the optimization constraints are determined as preliminary configuration combinations.
[0147] Optionally, in actual applications, when determining the preliminary configuration combination, in addition to considering performance requirements (ie, performance constraints), it is also necessary to consider the user's hard requirements (ie, optimization constraints), which are some hard requirements of the database to be optimized.
[0148] For example, the CDB database supports three logging modes: statement, row, and mixed. Statement logging logs all relevant operations as Structured Query Language (SQL) statements. However, this logging mode cannot synchronize certain special information, such as dynamically changing values like uuid and now(). Row logging logs records the value of every column in the relevant row. This results in very large log files, but ensures the determinism of dynamic values. There is also a mixed logging mode, in which MySQL (mysql_num_rows, which indicates the number of rows in the result set) determines the logging method. Statement logging offers better performance than row and mixed logging modes, but it cannot log dynamically changing values. If your business requires dynamically changing values, you should choose row or mixed logging modes, even if it sacrifices some performance. This is a hard requirement for the user, and performance cannot be blindly improved. The principle of user needs first and performance improvement second should be followed.
[0149] The above hard requirements are just one possible optimization constraint. Other hard requirements exist. For example, to ensure timely failover to the slave database in the event of a master database failure, timely master-slave synchronization must be enabled. To prevent data loss, parameters for flushing data from the cache to disk must be enabled. These constraints are designed to ensure data integrity and security while meeting user business standards. Hard limits can be set when generating database parameters to prohibit the selection of parameter values that do not meet business standards.
[0150] In actual applications, user needs may change, and hard requirements may also be updated over time.
[0151] In practical applications, hard requirements are crucial. When determining the target configuration combination, the principle of hard requirements over performance improvement must be adhered to. After obtaining the user's hard requirements (i.e., optimization constraints), different approaches can be used to determine the initial configuration combination based on these hard requirements.
[0152] Method 1: Filter according to the optimization constraints to identify initial configuration combinations that satisfy the optimization constraints. Then, filter based on the performance constraints. Specifically, based on the performance test results of the initial configuration combinations that satisfy the optimization constraints, at least one preliminary configuration combination is determined. For example, assuming there are 1000 initial configuration combinations, filtering based on the optimization constraints yields 10 initial configuration combinations that satisfy the optimization constraints. Then, filtering based on the performance constraints yields 2 preliminary configuration combinations that satisfy the performance constraints.
[0153] Method 2: Filter by performance constraints. Based on the performance test results corresponding to each initial configuration combination, at least one candidate configuration combination is identified. Then, filter by optimization constraints to determine a preliminary configuration combination from the at least one candidate configuration combination that satisfies the optimization constraints. For example, assuming there are 1000 initial configuration combinations, filtering by performance constraints yields 20 candidate configuration combinations that satisfy the performance constraints. Then, filtering by optimization constraints yields two preliminary configuration combinations that satisfy the optimization constraints.
[0154] It is understandable that the above is only an example and the embodiments of the present application do not impose any limitation thereto.
[0155] When selecting through optimization constraints, the parameters in the initial configuration combination can include user-specified parameter values. If the user does not have hard-defined parameters, the parameter values in the initial configuration combination determined through iterative operations do not need to be replaced and can be used directly. The specific operation is to match each parameter in the initial configuration combination with the hard requirement rules in turn.
[0156] Through the embodiments of the present application, in actual applications, the user's hard needs can be fully considered, and various possible configuration combinations of the database parameters of the database to be optimized can be screened, which can simultaneously meet the performance requirements and the user's hard needs, and ensure the feasibility of the screened configuration combinations in actual applications.
[0157] In an optional embodiment, determining the target configuration combination based on the obtained preliminary configuration combinations includes any one of the following:
[0158] Determine at least one target configuration combination based on the performance test results of each of the aforementioned preliminary configuration combinations;
[0159] Each of the above-mentioned preliminary configuration combinations is used as the target configuration combination;
[0160] Optimization constraints corresponding to the database to be optimized are obtained, and at least one target configuration combination is determined based on the performance test results of each of the preliminary configuration combinations and the optimization constraints.
[0161] Optionally, when determining the target configuration combination of each database parameter of the database to be optimized, there are multiple possible implementation methods, as follows:
[0162] Based on the performance test results of the preliminary configuration combinations obtained from each recorded iteration, the target configuration combination with the best performance can be selected as the final configuration combination of the database parameters of the database to be optimized. Alternatively, at least two target configuration combinations with the highest performance scores can be sent to the requesting device, and the user corresponding to the requesting device can select the final configuration combination of the database parameters of the database to be optimized. This is not limited here.
[0163] The preliminary configuration combination obtained in each iteration can be used as the target configuration combination. For example, in actual applications, if the user's database adjustment time (such as the first set duration) is relatively urgent, the database parameters of the database to be optimized can be adjusted in a simultaneous optimization method. For example, the optimal preliminary configuration combination obtained in each iteration (i.e., the optimal configuration combination that satisfies both performance constraints and optimization constraints) can be sent to the requesting device. If the adjustment time has not been reached, the iteration can be continued. If the preliminary configuration combination obtained in the current iteration is better, it is sent to the requesting device. If it is not better than the preliminary configuration combination obtained in the previous iteration, the iteration is continued until the adjustment time is reached.
[0164] At least one target configuration combination can also be determined from each of the preliminary configuration combinations based on the optimization constraints and performance constraints of the database to be optimized. For example, the performance test results of the preliminary configuration combinations obtained from each iteration can be filtered according to the performance constraints. Then, at least one target configuration combination that satisfies the optimization constraints can be filtered from the combinations that meet the performance constraints. This at least one target configuration combination can then be sent to the requesting device for screening by the user corresponding to the requesting device.
[0165] It is understandable that the above is only an example and the embodiments of the present application are not limited thereto.
[0166] Through the embodiments of the present application, the target configuration combination can be determined in a variety of flexible and diverse ways, which improves the flexibility of the method of determining the configuration combination of each database parameter of the database to be optimized.
[0167] The following is a detailed description of how to perform performance testing.
[0168] In an optional embodiment, the performance test of the database to be optimized is performed based on the at least two initial configuration combinations, including:
[0169] Each of the above initial configuration combinations is applied to the database instance of the above database to be optimized, and a performance test is performed on the database instance corresponding to each of the above initial configuration combinations.
[0170] Optionally, a database instance consists of various high-speed buffer pools and background processes. A database is an organized, shareable collection of data stored long-term in a computer. The data in a database is organized, described, and stored using a specific data model, with minimal redundancy, high data independence, and scalability, and can be shared by multiple users within a certain scope. A database instance consists of operating system background processes and allocated memory areas, representing a collection of memory and background processes. It should be noted that a database instance can be used for a single database, and multiple database instances can also be used simultaneously for a single database. The relationship between a database instance and a database is one-to-many, with the database instance responsible for maintaining and accessing the data within the database.
[0171] When performing performance testing, each initial configuration combination can be applied to a database instance of the database to be optimized, and a performance test can be performed on the database instance corresponding to each initial configuration combination to obtain a performance test result corresponding to each initial configuration combination.
[0172] In actual applications, when performing performance testing, performance test information containing multiple performance parameters (such as throughput, latency, etc.) may be obtained. However, users may only be concerned about one or more of these performance parameters. Therefore, it is necessary to filter out the performance parameters that the user is interested in. For example, regular expressions can be used for filtering. Regular expressions can use pattern matching to match data that meets the user's requirements from each data record (i.e., performance vector group), that is, to obtain data in a fixed format that meets the requirements. For example, a pattern matching syntax can be written to only obtain data that meets the requirements. In a regular expression, a single string is used to describe and match a series of strings that match a certain syntactic rule. For example, [\s] represents a string, and [\w] represents characters, numbers, and underscores. Take the regular expression [\s]*95th percentile:[\s]*(\d+\.\d+) as an example. This regular expression indicates that you want to obtain: any string + 95th percentile: string + any string + number.number. By recording the data that matches this regular expression, you can filter the data and obtain the desired data, such as throughput and latency.
[0173] Through the embodiments of the present application, performance testing can be performed by applying various initial configuration combinations to a database instance, thereby improving the efficiency of performance testing.
[0174] In a possible embodiment, the performance test of the database instance corresponding to each of the initial configuration combinations includes:
[0175] Obtain historical business data of the database to be optimized;
[0176] Generate test cases based on the above historical business data, and perform performance tests on the database instances corresponding to each of the above initial configuration combinations based on the above test cases.
[0177] Alternatively, historical business data can be interpreted as the actual load in a user's business scenario. Test cases are generated using this real load, and performance tests are performed on the database instances corresponding to each initial configuration combination based on these test cases to obtain corresponding performance test results. In actual applications, performance testing can be performed without using test cases generated from historical business data; this is not a limitation here.
[0178] For example, you can obtain a user's historical business scenario request records and analyze them. The analysis mainly includes: the amount of stored data (such as the number of databases, the number of data tables, and the amount of data in each database's data table), the request record type (such as query, insert, delete, update), the number of requests per minute or per second, and the query type (such as whether the query is simple or complex). Through analysis, you can obtain the corresponding test case, simulate the user's real business request scenario, and treat the request as a database batch request (i.e., test case). These requests are placed on the database instance for testing to obtain the performance indicators that the database can handle, such as the acceptable number of requests per second, the number of transactions processed per second, and the transaction latency. After processing, you will obtain a performance indicator vector group, which can also be called a performance vector group (i.e., the performance test information described above).
[0179] Through the embodiments of the present application, performance testing can be performed on the database instance of the database to be optimized based on test cases generated according to actual historical business data to obtain performance test results. This approach can better meet the actual business needs of users and improve practicality.
[0180] In an optional embodiment, the performance test of the database to be optimized is performed based on the at least two initial configuration combinations, including:
[0181] The at least two initial configuration combinations are distributed to at least two test devices, so that the at least two test devices can perform performance tests on the database to be optimized in parallel based on the initial configuration combinations distributed to them.
[0182] Optionally, when performing performance testing, at least two test devices can be used to perform performance testing in parallel. For example, assuming that n groups of initial configuration combinations (also called n groups of initialization parameter groups or n groups of parameter groups) are generated, the n groups of parameter groups can be assigned to m machines (i.e., test devices), and the number of parameter groups held by each machine is n / m. When each machine is healthy, each machine holds n / m parameter groups, and each machine concurrently applies the parameters it holds to multiple database instances. Performance testing is performed using the real load in the user's usual business scenarios to obtain the performance indicators of each parameter group. The performance indicators of each parameter group are collected and eliminated using a heuristic algorithm to generate a new parameter group (i.e., at least two new configuration combinations described above), and the new parameter group and the corresponding performance indicators are recorded. If a parameter group with better performance indicators is found, it is recorded as the preliminary configuration combination. Wherein, n and m are both positive integers, and n is greater than or equal to m.
[0183] Optionally, during performance testing, health monitoring of each test device is required. This is achieved by receiving heartbeat information from each test device, which verifies whether the test device is functioning properly. Based on the heartbeat information, the system determines whether each test device is functioning properly. If one or more test devices are not functioning properly, the configuration combination sent to them is retrieved and resent to other test devices that are functioning properly.
[0184] A heartbeat message is a message sent from a source (test equipment) to a receiver (such as a server) to allow the receiver to determine if and when the source has failed or terminated. Typically, heartbeat messages are sent from the time the source is started until it is shut down, during which time the source continuously sends periodic or recurring messages. If a receiver does not receive a message within a certain message receiving period, it may assume that the source has been shut down, failed, or is currently unavailable. Heartbeat messages are often used for high availability or fault tolerance.
[0185] Specifically, if a test device is processing a transaction, it will send a status message, such as "Processing a transaction," to the server at regular intervals, such as 5 seconds. If the test device does not send verification information to the server after 5 seconds, the server will send a message to the slave machine requesting status information. If it does not receive a message within 5 seconds, the server will assume that the test device is down or unable to provide normal service. Assuming that there are n initial configuration combinations and m test devices, if a test device is found to be down or unable to provide normal service, the server will evenly distribute the parameter group assigned to the test device (i.e., the initial configuration combination) to the other m-1 test devices.
[0186] The above is only an example and is not limited to the embodiments of the present application.
[0187] Through the embodiments of the present application, performance testing can be performed through parallel testing and health monitoring. On the one hand, the efficiency of performance testing is improved, and on the other hand, it can ensure that performance testing is performed using normally functioning test equipment, avoiding the inability to perform performance testing due to test equipment downtime or inability to provide normal services.
[0188] In an optional embodiment, the performance test of the database to be optimized is performed based on the at least two initial configuration combinations, including:
[0189] Performing performance tests on the database to be optimized based on each of the initial configuration combinations to obtain performance test information corresponding to each of the initial configuration combinations, wherein the performance test information includes at least one of test throughput or test latency;
[0190] Obtaining performance benchmark information corresponding to the database to be optimized, wherein the performance benchmark information includes at least one of a benchmark throughput or a benchmark latency;
[0191] For each of the above initial configuration combinations, a performance test result corresponding to the above initial configuration combination is determined based on the above performance benchmark information and the performance test information corresponding to the above initial configuration combination.
[0192] Optionally, a performance test can be performed on the database to be optimized based on each initial configuration combination, and performance test information corresponding to each initial configuration combination (i.e., the performance vector group described above) can be obtained. This performance test information can be determined based on actual needs, that is, based on the performance requirements that are actually to be met. For example, this performance test information can include at least one of test throughput or test latency. Throughput and latency can be performance parameters.
[0193] Among them, throughput refers to the amount of data that can be successfully transmitted per unit time by the requesting device corresponding to the database to be optimized (which can be measured by bits, bytes, packets, etc.).
[0194] Then, the current configuration information of each database parameter of the database to be optimized is obtained, and based on the current configuration information, a performance test is performed on the data to be optimized to obtain performance benchmark information corresponding to the database to be optimized, wherein the performance benchmark information may include at least one of a benchmark throughput or a benchmark delay.
[0195] Then, for each initial configuration combination, a performance test result corresponding to the initial configuration combination can be determined based on the performance benchmark information of the database to be optimized and the performance test information corresponding to each initial configuration combination.
[0196] For example, assuming that the performance test information includes test throughput and the performance benchmark information includes benchmark throughput, the throughput performance test result can be determined based on the test throughput and the benchmark throughput. The specific calculation method can be: taking the difference between the test throughput and the benchmark throughput as the first difference, and taking the ratio between the first difference and the benchmark throughput as the throughput performance test result. For example, for the i-th initial configuration combination, the test throughput corresponding to the initial configuration combination is T i , the benchmark throughput of the database to be optimized is T D , the throughput performance test result is s, then the throughput performance test result corresponding to the i-th initial configuration combination can be determined according to the following formula:
[0197]
[0198] Assuming that the performance test information includes a test delay and the performance benchmark information includes a benchmark delay, the delay performance test result can be determined based on the test delay and the benchmark delay. The specific calculation method can be: taking the difference between the test delay and the benchmark delay as the second difference, and taking the ratio between the second difference and the benchmark delay as the delay performance test result. For example, for the i-th initial configuration combination, the test delay corresponding to the initial configuration combination is L i , the baseline delay of the database to be optimized is L D , the delay performance test result is s, then the delay performance test result corresponding to the i-th initial configuration combination can be determined according to the following formula:
[0199]
[0200] Assuming that the performance test information includes test throughput and test delay, and the performance benchmark information includes test delay and benchmark delay, the performance test result corresponding to the i-th initial configuration combination can be determined according to the following formula:
[0201]
[0202] It is understandable that the above is only an example, and in the embodiments of the present application, no limitation is imposed on the specific formula of the performance test results.
[0203] Through the embodiments of the present application, performance test results can be determined based on actual performance requirements, so that initial configuration combinations with poor performance can be eliminated through the performance test results. By continuously eliminating configuration combinations with poor performance, the foundation is laid for finally determining a configuration combination with good performance.
[0204] In an optional embodiment, the performance test information includes test throughput and test delay, and the performance benchmark information includes benchmark throughput and benchmark delay;
[0205] For each initial configuration combination, determining the performance test result corresponding to the initial configuration combination based on the performance benchmark information and the performance test information corresponding to the initial configuration combination includes:
[0206] Obtain a first weight corresponding to throughput and a second weight corresponding to delay;
[0207] A performance test result corresponding to the initial configuration combination is determined based on the performance test information, the performance benchmark information, the first weight, and the second weight.
[0208] Optionally, when determining the performance test results, the proportion of different performance parameters (such as throughput and latency) may also be considered.
[0209] Among user needs, some users may be more concerned about throughput, while others may be more concerned about latency. The ratio of the first weight corresponding to throughput and the second weight corresponding to latency can be set according to the performance requirements of different users. That is, the ratio of the first weight and the second weight needs to be adapted to user needs.
[0210] When the performance test information includes test throughput and test latency, and the performance benchmark information includes benchmark throughput and benchmark latency, the performance test result corresponding to the i-th initial configuration combination can be determined according to the following formula:
[0211]
[0212] Among them, s is the performance test result. For the i-th initial configuration combination, T i is the test throughput corresponding to the initial configuration combination, T D is the benchmark throughput of the database to be optimized, L i is the test delay corresponding to the initial configuration combination, L D is the benchmark delay of the database to be optimized, α is the first weight, and β is the second weight.
[0213] For each initial configuration combination, the performance test result (also called score) s of each initial configuration combination can be obtained by formula calculation. S represents the quality of the i-th initial configuration combination. The parameter group with a low score (i.e., the initial configuration combination) can be eliminated by the score of each initial configuration combination. The parameter group with a high score is selected, and then some parameters are selected from the parameter groups with high scores to generate a new parameter group. For example, parameter group 1 contains parameters {k1, k2, k3}, and parameter group 2 is {m1, m2, m3}. The generated new parameter group 3 may be {k1, m2, m3} or {k1, k2, m3}. Each parameter of each parameter group has a certain probability of being randomly moved to the new parameter group to generate a new parameter group, where k i and m i Each iteration eliminates some parameter groups with low scores and generates some new parameter groups. As the number of iterations increases, if a parameter group with a higher score than the historical highest score is found each time, it can be retained and recorded.
[0214] In practical applications, in addition to determining a new parameter group based on the retained parameter groups (i.e., some parameter groups with high scores), or, alternatively, a new parameter group may be determined based on the initial configuration information, or, a new parameter group may be determined based on the retained parameter group and the initial configuration information. No limitation is imposed here.
[0215] Through the embodiments of the present application, the performance test results can be determined based on the proportions of different performance parameters. In this way, the determined performance test results can be more adapted to the user's business needs, thereby improving adaptability to business needs.
[0216] The following takes the example of a user initiating a parameter adjustment request through a client and processing the parameter adjustment request through a server to illustrate the specific implementation of the database parameter adjustment method in the embodiment of the present application. The server may include a controller (such as a server, a computer, or other electronic device) and a management terminal (Master, such as a server, a computer, or other electronic device). The specific implementation is as follows:
[0217] See also Figure 3 , Figure 3 This is a schematic diagram of the overall framework of a database parameter adjustment method provided in an embodiment of the present application. Figure 3As shown, the user initiates a parameter adjustment request on the client, the server-side control end receives and responds to the parameter adjustment request, obtains the initial configuration information of each database parameter of the database to be optimized, generates the initialization parameter group required by the heuristic algorithm (i.e., at least two initial configuration combinations) based on the initial configuration information, and submits the at least two initialization parameter groups to the management end. The management end applies the initialization parameter group to the database instance and uses the real load in the user's normal business scenario as the test load (i.e., test case) to stress test each initialization parameter group and obtain the performance vector group (including throughput and latency) corresponding to each initialization parameter group. This performance vector group is the performance test information mentioned above. Based on the performance vector group, the parameter group of this iteration is eliminated and selected to obtain a preliminary configuration combination. The new initialization parameter group corresponding to the next iteration is updated and the iteration process continues as described above. The best performance parameters obtained in each iteration are recorded as the preliminary configuration combination in a file or database, and the control end determines whether to recommend the preliminary configuration combination as the target configuration combination to the user.
[0218] in, Figure 3 The database corresponding to the database instance shown may be a DB database or a CDB database, which is not limited here.
[0219] As an optional method, the device corresponding to the database parameter adjustment method of the present application can be Figure 4 The structure shown, see Figure 4 , Figure 4 This is a schematic diagram of the structure of a database parameter adjustment device provided in an embodiment of the present application. Figure 4 As shown, the device includes a load generation module, a load playback module, an initialization parameter generation module, a heuristic algorithm training module, a property vector group acquisition module, and a parameter group recommendation module.
[0220] Among them, the load generation module is used to generate test load based on the real load in normal business scenarios.
[0221] The load replay module is used to perform stress testing on each initialization parameter group based on the obtained test load.
[0222] The initialization parameter generation module is used to respond to parameter adjustment requests, obtain initial configuration information of various database parameters of the database to be optimized, and generate an initialization parameter group based on the initial configuration information.
[0223] The heuristic algorithm training module is used to update, eliminate, and select each initialization parameter group of each iteration based on the initialization parameter group to generate a new initialization parameter group for the next iteration.
[0224] The performance vector group acquisition module is used to obtain the performance vector group corresponding to each initialization parameter group.
[0225] The parameter group recommendation module is used to determine the target configuration combination recommended to the user based on the preliminary configuration combination generated in each iteration.
[0226] The following describes in detail the specific working principles of the management end.
[0227] See also Figure 5 , Figure 5 This is a schematic diagram of the working principle of a management terminal provided in an embodiment of the present application. Figure 5 As shown, on the management side, through parallel processing, the management side Master distributes the n initialization parameter groups generated by the initialization parameter generation module and evenly distributes them to at least one sub-machine (i.e., the test equipment described above). Each sub-machine receives at least one initialization parameter group of its own, performs multi-database instance stress testing, and returns the performance vector group of each initialization parameter group (i.e., the full performance vector group shown in the figure). The Master manages the update, elimination, selection, and generation of a new generation of initialization parameter groups by the Master, as shown in the figure. The poor parameter groups are eliminated and new parameter groups are generated. Then, it is determined whether the parameter group obtained in the current iteration is better than the parameter group obtained in the previous iteration. If it is better, it is passed to the client. If not, the update and iteration continue.
[0228] Among them, when conducting performance testing, after configuring the parameters of each database instance corresponding to the database to be optimized according to each initialization parameter group, wait for the database to restart and conduct performance testing. By parsing the stress test files of different test benchmarks (that is, performance testing according to different initialization parameter groups) through regular expressions, throughput and latency information can be obtained, and the performance vector group can be obtained. The performance vector group is saved and passed to the management end. Each sub-machine will evenly distribute the parameters issued by the management end again, and use multi-process technology to perform stress testing on multiple database instances to improve testing efficiency.
[0229] Next, we will introduce how to perform performance testing on each sub-machine. Figure 6 , Figure 6 This is a schematic diagram of the working principle of a sub-machine for performance testing provided in an embodiment of the present application.
[0230] Each sub-machine can be responsible for the performance test of at least one database instance. In this case, based on the number of database instances that the sub-machine can test simultaneously, at least one initialization parameter group can be assigned to the sub-machine. Then, the sub-machine applies the at least one initialization parameter group to the at least one database instance to perform performance testing. The at least one performance vector group is obtained by parsing, and the performance vector groups corresponding to the initialization parameter groups are integrated and sent to the management end. Figure 6 This is a schematic diagram of using a sub-machine to perform performance testing on three database instances, and this embodiment of the present application does not impose any limitation on this.
[0231] During the performance test, one or more sub-machines may fail to provide services. To ensure the smooth progress of the performance test, you can perform health monitoring on the sub-machines. Figure 7 , Figure 7 This is a flow chart of updating and eliminating parameter groups by health monitoring provided by an embodiment of the present application, such as Figure 7 As shown, the Master has an independent thread that monitors the health of each sub-machine by obtaining heartbeat information from each sub-machine. If a sub-machine experiences a problem, the Master will retrieve the parameters sent to that sub-machine and send them to other healthy sub-machines, ensuring high availability and horizontal scalability. The initialization parameter group generated in each iteration is sent to each sub-machine. Through database instance stress testing, the performance vector group corresponding to each initialization parameter group is collected. After each iteration, the performance test results obtained using the performance vector group are used to eliminate and select the best parameter group in the current iteration. The control end then determines whether to recommend this parameter group. For example, the control end can determine whether the parameter group meets the user's hard requirements to determine whether to recommend it to the client.
[0232] When performing performance testing, in order to ensure better adaptation to the user's business scenario, you can also perform performance testing based on the actual load of the user's business scenario. Figure 8 , Figure 8 This is a flow chart of a performance test using a real load provided by an embodiment of the present application. Figure 8As shown, the historical data of the real load of the user's business scenario is input, and the request records under the user's real load are analyzed. The analysis content mainly includes: the amount of stored data (such as how many databases, how many data tables, and how much data is in each database's data table), the request record type (such as query, insert, delete, update), the number of requests per minute or per second, and the query type (such as whether the query is a simple query or a complex query). Simulate the user's real business request scenario, treat the request as a database batch request, and generate the corresponding user request script (i.e., test case). These user request scripts are applied to the database instance for performance testing. As shown in the figure, performance testing is performed using database instance 1 + parameter group 1, database instance 2 + parameter group 2, and database instance 3 + parameter group 3. The performance vector group corresponding to each parameter group is obtained, such as performance vector group 1 corresponding to parameter group 1, performance vector group 2 corresponding to parameter group 2, and performance vector group 3 corresponding to parameter group 3 as shown in the figure.
[0233] The following details how to select the target configuration combination from each preliminary configuration combination, see Figure 9 , Figure 9 This is a flow chart of determining a target configuration combination provided by an embodiment of the present application, such as Figure 9 As shown in the above method, the Manager can select the best parameter group (i.e., the preliminary configuration combination) in each iteration through a heuristic algorithm. The control end performs rule matching to check whether it meets the client's hard requirements (i.e., judging whether the optimization constraints are met as shown in the figure). If not, a new generation of iteration and selection begins. If it meets the requirements, it is compared with the previously recommended parameter group. If the effect is consistent with the previously recommended parameter group, it means that the best parameter group retained in the previous iteration is still the best parameter group for this iteration, and there is no need to recommend it again. If the performance of the parameter group obtained in this iteration is better, it will be recommended to the client again. If the effect is not as good as the previously recommended parameter group, there is no need to recommend the parameter group generated in this iteration.
[0234] After receiving the parameter group recommended by the control end, the client can update various database parameters of the client's database to be optimized based on the recommended parameter group.
[0235] It should be noted that the database parameter adjustment method in the embodiment of the present application can be applied to various types of databases, such as key-value databases, relational databases, etc., and it is only necessary to change the test load (i.e., the database parameters of the database to be optimized) and the new parameter search space (i.e., the initial configuration information). It is simple for any company to use the parameter adjustment method shown in the embodiment of the present application. In small companies, there is no need to recruit senior database administrators, and the technical solution of the embodiment of the present application lowers the learning threshold for database parameter adjustment, and in most cases, a better parameter group can be found to meet most parameter adjustment needs. In large companies, this solution can still provide senior database administrators with auxiliary parameter adjustment solutions when facing new load types or new database types. Senior database administrators can find better parameter groups based on their own experience and the database parameter adjustment method provided by the embodiment of the present application.
[0236] The parameter adjustment methods provided by the embodiments of this application were tested in different test environments, significantly improving throughput and reducing latency compared to the performance of the current default configuration combination for the data to be optimized. Furthermore, the time required for automated database parameter adjustment was shortened from days to hours. Under time-sensitive conditions, users were provided with optimal performance parameter sets to meet their database performance requirements, greatly improving adjustment efficiency.
[0237] The electronic devices involved in the embodiments of the present application (including but not limited to servers, user terminals, management terminals, control terminals and clients) can be nodes of the blockchain system, the servers involved (including but not limited to servers) can be blockchain servers, and the data required to be stored in the embodiments of the present application can also be stored in blockchain nodes. The database parameter adjustment system involved in the embodiments of the present application can be a distributed system formed by connecting user terminals (such as clients, user terminals) and multiple blockchain nodes (any form of computing devices connected to the network, such as servers, user terminals) through network communication.
[0238] Taking the distributed system as the blockchain system as an example, see Figure 10 , Figure 10This is an optional structural diagram of the distributed system 100 provided in an embodiment of the present application applied to a blockchain system. It is composed of multiple nodes 200 (any form of computing device in the access network, such as a server or user terminal) and a client 300. The nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In a distributed system, any machine, such as a server or terminal, can join and become a node. A node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.
[0239] See also Figure 10 The functions of each node in the blockchain system shown include:
[0240] 1) Routing: A basic function of a node, used to support communication between nodes.
[0241] In addition to the routing function, nodes can also have the following functions:
[0242] 2) Applications, deployed in the blockchain, implement specific services based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.
[0243] For example, the services implemented by the application include:
[0244] 2.1) Wallet: This provides the functionality for conducting electronic currency transactions, including initiating transactions (i.e., sending the current transaction record to other nodes in the blockchain system. Upon successful verification by other nodes, the transaction record data is stored in a temporary block of the blockchain as a response to acknowledge the transaction's validity). The wallet also supports querying the remaining electronic currency in an electronic currency address.
[0245] 2.2) Shared ledgers are used to store, query, and modify account data. Records of operations on account data are sent to other nodes in the blockchain system. After verification, other nodes acknowledge the validity of the account data by storing the recorded data in a temporary block. They can also send a confirmation to the node that initiated the operation.
[0246] 2.3) Smart contracts are computerized protocols that can enforce the terms of a contract. They are implemented through code deployed on a shared ledger that is executed when certain conditions are met. Based on actual business needs, the code is used to complete automated transactions, such as querying the logistics status of a buyer's purchased goods and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts that process received information.
[0247] 3) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.
[0248] See also Figure 11 , Figure 11 This is an optional schematic diagram of the block structure provided by the embodiment of the present application. Each block includes the hash value of the transaction record stored in this block (the hash value of this block) and the hash value of the previous block. The blocks are connected by hash values to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains relevant information used to verify the validity of its information (anti-counterfeiting) and generate the next block.
[0249] See also Figure 12 , Figure 12 Schematic diagram of another database parameter adjustment device provided in an embodiment of the present application. The database parameter adjustment device 1 provided in an embodiment of the present application includes:
[0250] A parameter adjustment request acquisition module 11 is used to acquire a parameter adjustment request for the database to be optimized;
[0251] The initial configuration information acquisition module 12 is used to obtain the initial configuration information corresponding to each database parameter of the database to be optimized according to the parameter adjustment request;
[0252] A configuration combination determining module 13 is configured to determine at least two initial configuration combinations corresponding to each of the database parameters according to the initial configuration information corresponding to each of the database parameters;
[0253] The target configuration parameter determination module 14 is used to perform performance tests on the above-mentioned database to be optimized based on the above-mentioned at least two initial configuration combinations, and determine the target configuration combinations corresponding to the above-mentioned database parameters based on the performance test results corresponding to each of the above-mentioned initial configuration combinations, so as to update the above-mentioned database parameters of the above-mentioned database to be optimized based on the above-mentioned target configuration combinations.
[0254] In an optional embodiment, the target configuration parameter determination module is configured to:
[0255] Repeat the following operations based on the at least two initial configuration combinations until a preset end condition is met, and determine the target configuration combination based on each of the obtained preliminary configuration combinations:
[0256] Performing a performance test on each of the above initial configuration combinations to obtain a performance test result corresponding to each of the above initial configuration combinations;
[0257] Determine a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to the initial configuration combinations;
[0258] At least two new configuration combinations corresponding to the database parameters are determined according to the initial configuration information corresponding to the database parameters, and the at least two new configuration combinations are used as the at least two initial configuration combinations.
[0259] In an optional embodiment, the target configuration parameter determination module is configured to:
[0260] Based on the performance test results corresponding to each of the above initial configuration combinations and the preset performance constraints, the above initial configuration combinations are filtered to obtain the retained initial configuration combinations;
[0261] Based on the performance test results corresponding to the above-retained initial configuration combinations, a preliminary configuration combination is determined from the above-retained initial configuration combinations.
[0262] In an optional embodiment, the target configuration parameter determination module is configured to:
[0263] Obtain the optimization constraints corresponding to the database to be optimized;
[0264] Determine each initial configuration combination that satisfies the optimization constraints among the initial configuration combinations, and determine a preliminary configuration combination based on the performance test results of each initial configuration combination that satisfies the optimization constraints;
[0265] Alternatively, candidate configuration combinations are determined based on the performance test results corresponding to the initial configuration combinations, and combinations among the candidate configuration combinations that meet the optimization constraints are determined as preliminary configuration combinations.
[0266] In an optional embodiment, the preset termination condition includes at least one of the following:
[0267] The operation duration of the above operation reaches the first set duration;
[0268] The initial configuration combinations corresponding to at least two of the above operations are consistent;
[0269] The operation duration of the above operation does not exceed the second set time, and the preliminary configuration combinations corresponding to at least two of the above operations are consistent;
[0270] Received the operation end instruction.
[0271] In an optional embodiment, the target configuration parameter determination module is configured to perform at least one of the following:
[0272] Determine at least one target configuration combination based on the performance test results of each of the aforementioned preliminary configuration combinations;
[0273] Each of the above-mentioned preliminary configuration combinations is used as the target configuration combination;
[0274] Optimization constraints corresponding to the database to be optimized are obtained, and at least one target configuration combination is determined based on the performance test results of each of the preliminary configuration combinations and the optimization constraints.
[0275] In an optional embodiment, the target configuration parameter determination module is configured to:
[0276] Each of the above initial configuration combinations is applied to the database instance of the above database to be optimized, and a performance test is performed on the database instance corresponding to each of the above initial configuration combinations.
[0277] In an optional embodiment, the target configuration parameter determination module is configured to:
[0278] The performance tests for the database instances corresponding to each of the above initial configuration combinations include:
[0279] Obtain historical business data of the database to be optimized;
[0280] Generate test cases based on the above historical business data, and perform performance tests on the database instances corresponding to each of the above initial configuration combinations based on the above test cases.
[0281] In an optional embodiment, the target configuration parameter determination module is configured to:
[0282] The at least two initial configuration combinations are distributed to at least two test devices, so that the at least two test devices can perform performance tests on the database to be optimized in parallel based on the initial configuration combinations distributed to them.
[0283] In an optional embodiment, the target configuration parameter determination module is configured to:
[0284] Performing performance tests on the database to be optimized based on each of the initial configuration combinations to obtain performance test information corresponding to each of the initial configuration combinations, wherein the performance test information includes at least one of test throughput or test latency;
[0285] Obtaining performance benchmark information corresponding to the database to be optimized, wherein the performance benchmark information includes at least one of a benchmark throughput or a benchmark latency;
[0286] For each of the above initial configuration combinations, a performance test result corresponding to the above initial configuration combination is determined based on the above performance benchmark information and the performance test information corresponding to the above initial configuration combination.
[0287] In an optional embodiment, the target configuration parameter determination module is configured to:
[0288] For each initial configuration combination, determining the performance test result corresponding to the initial configuration combination based on the performance benchmark information and the performance test information corresponding to the initial configuration combination includes:
[0289] Obtain a first weight corresponding to throughput and a second weight corresponding to delay;
[0290] A performance test result corresponding to the initial configuration combination is determined based on the performance test information, the performance benchmark information, the first weight, and the second weight.
[0291] In an embodiment of the present application, after obtaining a parameter adjustment request for the database to be optimized, the initial configuration information of each database parameter of the data to be optimized can be obtained based on the request. Then, at least two possible initial configuration combinations of each database parameter are generated based on the initial configuration information. Then, based on the at least two initial configuration combinations, the performance of the data to be optimized is tested to obtain the performance test results corresponding to each initial configuration combination, and then based on the performance test results, the target configuration combination corresponding to each database parameter is determined, so that the database parameters of the database to be optimized can be updated based on the target configuration combination. In this way, a feasible target configuration combination can be determined under the premise of ensuring performance requirements, avoiding the need in related technologies to go through long preliminary training and then perform parameter tuning based on the trained model, thereby greatly improving the efficiency of tuning the database parameters of the database to be optimized.
[0292] In a specific implementation, the above-mentioned database parameter adjustment device 1 can execute the above-mentioned functions through its built-in functional modules. Figure 2For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0293] The above mainly introduces that the execution subject is hardware to implement the database parameter adjustment method in this application, but the execution subject of the database parameter adjustment method in this application is not limited to hardware. The execution subject of the database parameter adjustment method in this application can also be software. The above-mentioned database parameter adjustment device can be a computer program (including program code) running in a computer device. For example, the database parameter adjustment device is an application software; the device can be used to execute the corresponding steps in the method provided in the embodiment of this application.
[0294] In some embodiments, the database parameter adjustment device provided in the embodiments of the present application can be implemented in a combination of software and hardware. As an example, the database parameter adjustment device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the database parameter adjustment method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0295] In other embodiments, the database parameter adjustment device provided in the embodiments of the present application can be implemented in software. Figure 12 The database parameter adjustment device 1 shown can be software in the form of a program and a plug-in, and includes a series of modules, including a parameter adjustment request acquisition module 11, an initial configuration information acquisition module 12, a configuration combination determination module 13 and a target configuration parameter determination module, which are used to implement the database parameter adjustment method provided in the embodiment of the present application.
[0296] See also Figure 13 , Figure 13 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 13As shown, the electronic device 1000 in this embodiment may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned electronic device 1000 may also include: a user interface 1003, and at least one communication bus 1002. The communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the user interface 1003 may optionally include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1004 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may optionally be at least one storage device located away from the aforementioned processor 1001. As Figure 13 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.
[0297] exist Figure 13 In the electronic device 1000 shown, the network interface 1004 can provide network communication functions; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the computer program stored in the memory 1005.
[0298] It should be understood that in some feasible embodiments, the processor 1001 may be a central processing unit (CPU), or may be another general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc. The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store device type information.
[0299] In a specific implementation, the electronic device 1000 can execute the above-mentioned functions through its built-in functional modules. Figure 2For the implementation methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0300] The present invention also provides a computer-readable storage medium that stores a computer program and is executed by a processor to implement Figure 2 For the methods provided in each step, please refer to the implementation methods provided in the above steps for details, which will not be repeated here.
[0301] The above-mentioned computer-readable storage medium can be the internal storage unit of the task processing device provided by any of the aforementioned embodiments, such as the hard disk or memory of the electronic device. The computer-readable storage medium can also be an external storage device of the electronic device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device. The above-mentioned computer-readable storage medium can also include a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. Further, the computer-readable storage medium can also include both the internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the electronic device. The computer-readable storage medium can also be used to temporarily store data that has been output or is to be output.
[0302] The embodiment of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the above-mentioned Figure 2 The method provided by any possible embodiment.
[0303] The terms "first," "second," and the like in the claims, specification, and drawings of this application are used to distinguish between different objects, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or device. Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in conjunction with an embodiment may be included in at least one embodiment of the present application. The presence of such a phrase in various locations in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive with other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments. The term "and / or," as used in this specification and the appended claims, refers to any and all possible combinations of one or more of the associated listed items, including, but not limited to, those listed.
[0304] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the above description generally describes the components and steps of each example according to their functions. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0305] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for adjusting database parameters, characterized in that: include: Obtain parameter adjustment requests for the database to be optimized; Obtaining, according to the parameter adjustment request, initial configuration information corresponding to each database parameter of the database to be optimized; Determining at least two initial configuration combinations corresponding to each database parameter according to the initial configuration information corresponding to each database parameter; Repeating the following operations based on the at least two initial configuration combinations until a preset end condition is satisfied, and determining a target configuration combination based on each of the obtained preliminary configuration combinations, so as to update each of the database parameters of the database to be optimized based on the target configuration combination: Performing a performance test on each of the initial configuration combinations to obtain a performance test result corresponding to each of the initial configuration combinations; Determining a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to each of the initial configuration combinations; At least two new configuration combinations corresponding to the database parameters are determined according to the initial configuration information corresponding to the database parameters, and the at least two new configuration combinations are used as the at least two initial configuration combinations.
2. The method according to claim 1, characterized in that Determining a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to each of the initial configuration combinations includes: Filtering the initial configuration combinations based on the performance test results corresponding to each of the initial configuration combinations and the preset performance constraints to obtain retained initial configuration combinations; Based on the performance test results corresponding to the retained initial configuration combinations, a preliminary configuration combination is determined from the retained initial configuration combinations.
3. The method according to claim 1 or 2, characterized in that Determining a preliminary configuration combination from each of the initial configuration combinations based on the performance test results corresponding to each of the initial configuration combinations includes: Obtaining optimization constraints corresponding to the database to be optimized; Determining each initial configuration combination that satisfies the optimization constraint condition among the initial configuration combinations, and determining a preliminary configuration combination based on performance test results of each initial configuration combination that satisfies the optimization constraint condition; Alternatively, candidate configuration combinations are determined according to the performance test results corresponding to the initial configuration combinations, and combinations among the candidate configuration combinations that meet the optimization constraint conditions are determined as preliminary configuration combinations.
4. The method according to claim 1 or 2, characterized in that The preset end condition includes at least one of the following: The operation duration of the operation reaches a first set duration; The primary configuration combinations corresponding to at least two of the operations are consistent; The operation duration of the operation does not exceed the second set duration, and the preliminary selected configuration combinations corresponding to at least two operations are consistent; Received the operation end instruction.
5. The method according to claim 1 or 2, characterized in that Determining the target configuration combination based on the obtained preliminary configuration combinations includes any of the following: Determining at least one target configuration combination based on the performance test results of each of the preliminary selected configuration combinations; Taking each of the preliminary selected configuration combinations as the target configuration combination; Optimization constraints corresponding to the database to be optimized are obtained, and at least one target configuration combination is determined based on the performance test results of each of the preliminary configuration combinations and the optimization constraints.
6. The method according to claim 1, characterized in that The performing of a performance test on each of the initial configuration combinations includes: Each of the initial configuration combinations is applied to a database instance of the database to be optimized, and a performance test is performed on the database instance corresponding to each of the initial configuration combinations.
7. The method according to claim 6, characterized in that The performing of a performance test on the database instance corresponding to each of the initial configuration combinations includes: Acquire historical business data of the database to be optimized; A test case is generated based on the historical business data, and a performance test is performed on the database instance corresponding to each initial configuration combination based on the test case.
8. The method according to claim 1, characterized in that The performing of a performance test on each of the initial configuration combinations includes: Each of the initial configuration combinations is allocated to at least two test devices, so that the performance test of the database to be optimized is performed in parallel by the at least two test devices based on the respective allocated initial configuration combinations.
9. The method according to claim 1, characterized in that The performing a performance test on each of the initial configuration combinations to obtain a performance test result corresponding to each of the initial configuration combinations includes: Performing a performance test on the database to be optimized based on each of the initial configuration combinations to obtain performance test information corresponding to each of the initial configuration combinations, wherein the performance test information includes at least one of a test throughput or a test delay; Acquire performance benchmark information corresponding to the database to be optimized, wherein the performance benchmark information includes at least one of a benchmark throughput or a benchmark latency; For each of the initial configuration combinations, a performance test result corresponding to the initial configuration combination is determined according to the performance benchmark information and the performance test information corresponding to the initial configuration combination.
10. The method according to claim 9, characterized in that The performance test information includes test throughput and test delay, and the performance benchmark information includes benchmark throughput and benchmark delay; For each initial configuration combination, determining, based on the performance benchmark information and the performance test information corresponding to the initial configuration combination, a performance test result corresponding to the initial configuration combination includes: Obtain a first weight corresponding to throughput and a second weight corresponding to delay; A performance test result corresponding to the initial configuration combination is determined according to the performance test information, the performance benchmark information, the first weight, and the second weight.
11. A database parameter adjustment device, characterized in that: include: A parameter adjustment request acquisition module is used to obtain a parameter adjustment request for the database to be optimized; An initial configuration information acquisition module, configured to acquire initial configuration information corresponding to each database parameter of the database to be optimized according to the parameter adjustment request; a configuration combination determining module, configured to determine at least two initial configuration combinations corresponding to each database parameter based on the initial configuration information corresponding to each database parameter; a target configuration parameter determination module, configured to repeatedly perform the following operations based on the at least two initial configuration combinations until a preset end condition is satisfied, and determine a target configuration combination based on each of the obtained preliminary configuration combinations, so as to update each of the database parameters of the database to be optimized based on the target configuration combination: perform a performance test on each of the initial configuration combinations to obtain a performance test result corresponding to each of the initial configuration combinations; Based on the performance test results corresponding to each of the initial configuration combinations, a preliminary configuration combination is determined from each of the initial configuration combinations; according to the initial configuration information corresponding to each of the database parameters, at least two new configuration combinations corresponding to each of the database parameters are determined, and the at least two new configuration combinations are used as the at least two initial configuration combinations.
12. An electronic device, characterized in that: comprising a processor and a memory, wherein the processor and the memory are connected to each other; The memory is used to store computer programs; The processor is configured to execute the method according to any one of claims 1 to 10 when calling the computer program.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Database optimization method and device, electronic equipment and computer readable storage medium
CN111339066A
Method and apparatus for tuning database configuration parameters usnig multivariate analysis
WO2005116871A1