Data storage method, device and equipment
Patent Information
- Application Number
- CN202411275659.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2044-09-12
Smart Images

Figure CN118778913B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of data management and data storage, in particular to the field of database disk management, and more particularly to a data storage method, device and equipment. Background Art
[0002] With the continuous increase in data volume and the diversification of database application scenarios, it is particularly important to improve the access speed, concurrent processing capability and throughput of database systems to improve the performance of database systems. Many developers improve the performance of databases by designing database structures or using partitions and tables.
[0003] In the process of implementing the concept of the present invention, it is found that there are at least the following problems in the related art: after the business requirements corresponding to the business scenario change, the developer may need to redesign the database structure and the corresponding application code to keep the database performance at a good level, and the process of redesigning the database structure and the application code is very labor-intensive and time-consuming. Therefore, there is an urgent need for a method that saves manpower and time and can improve database performance. Summary of the invention
[0004] In view of the above problems, the present invention provides a data storage method, device and equipment.
[0005] According to a first aspect of the present invention, a data storage method is provided, comprising: determining a solution space of a storage scheme based on storage resource amounts of respective multiple storage spaces included in a database disk and data item sizes of multiple data items, wherein the storage scheme represents the storage manner in which the multiple data items are stored in the multiple storage spaces; randomly initializing attribute information of multiple storage schemes within the solution space, wherein the attribute information includes storage location information and location update speed, and the storage location information represents the storage location of the multiple data items in at least one of the storage spaces; iteratively adjusting the attribute information of respective multiple storage schemes based on target optimization conditions to determine storage location information of a target iteration round; and re-determining the storage location of the multiple data items included in the database disk based on the storage location information of the target iteration round.
[0006] According to an embodiment of the present invention, the above-mentioned iterative adjustment of the attribute information of each of the above-mentioned multiple storage schemes based on the target optimization condition to determine the storage location information of the target iteration round includes: determining the optimization reference value of each of the above-mentioned storage schemes in the current iteration round based on the above-mentioned target optimization condition and the storage location information of the current iteration round of each of the above-mentioned storage schemes; determining the local storage location information of each of the above-mentioned storage schemes in the current iteration round from the storage location information of each of the above-mentioned storage schemes in the current iteration round and the storage location information of the previous iteration round based on the optimization reference value of each of the above-mentioned storage schemes in the current iteration round and the storage location information of the previous iteration round; determining the global storage location information of the current iteration round from the multiple local storage location information based on the optimization reference value of each of the above-mentioned storage schemes in the current iteration round; in the case that the above-mentioned current iteration round reaches the above-mentioned target iteration round, determining the global storage location information of the above-mentioned current iteration round as the storage location information of the above-mentioned target iteration round.
[0007] According to an embodiment of the present invention, based on the optimization reference value of each of the above-mentioned storage schemes in the above-mentioned current iteration round and the optimization reference value of the previous iteration round, the local storage location information of each of the above-mentioned storage schemes in the current iteration round and the storage location information of the previous iteration round are determined, including: for each of the above-mentioned storage schemes, based on the optimization reference value of the previous iteration round and the optimization reference value of the current iteration round, the cost value of the above-mentioned storage scheme is determined; the above-mentioned cost value represents that the storage location information of the above-mentioned previous iteration round is better than the storage location information of the above-mentioned current iteration round. In the case of the annealing probability of each of the storage schemes, the annealing probability is determined based on the cost value corresponding to each of the storage schemes and the annealing temperature of the current iteration round, wherein the annealing temperature of the current iteration round is iteratively obtained by a preset initial annealing temperature based on a preset cooling function, and the cooling function includes a logarithmic cooling function; when the annealing probability is greater than or equal to the probability threshold of the current iteration round, the storage location information of the previous iteration round is determined as the local storage location information; when the annealing probability is less than the probability threshold of the current iteration round, the storage location information of the current iteration round is determined as the local storage location information.
[0008] According to an embodiment of the present invention, the above method also includes: for each of the above storage schemes, based on the global storage location information of the above current iteration round, and the location update speed of the current iteration round and the local storage location information, determining the location update speed of the next iteration round; based on the storage location information of the above current iteration round and the location update speed of the above next iteration round, determining the storage location information of the next iteration round.
[0009] According to an embodiment of the present invention, the above-mentioned determination of the optimization reference value of each storage scheme in the current iteration round based on the above-mentioned target optimization conditions and the storage location information of the current iteration round of each storage scheme includes: in the case where the above-mentioned multiple data items included in the above-mentioned database disk are respectively stored in their respective target storage locations, determining the disk utilization of the above-mentioned database disk based on the utilization rate of each storage space, wherein the target storage location of each of the above-mentioned multiple data items is determined based on the storage location information of each storage scheme; determining the input and output delay of the above-mentioned database disk based on the time cost generated by the above-mentioned database disk during the data input and output process; determining the data locality of the above-mentioned database disk based on the distance cost of the target data item, wherein the above-mentioned target data item represents a data item that is frequently accessed; determining the optimization reference value of each storage scheme in the current iteration round based on the above-mentioned input and output delay, the above-mentioned disk utilization and the above-mentioned data locality.
[0010] According to an embodiment of the present invention, the above method also includes: based on the performance change information of the above database disk, adjusting the parameters corresponding to the above input and output delays, the above disk utilization and the above data locality in the above target optimization conditions to obtain new target optimization conditions.
[0011] According to an embodiment of the present invention, the above method also includes: randomly perturbing the storage location information of each of the above storage schemes in the above current iteration round to obtain the perturbed storage location information of each of the above storage schemes in the current iteration round; wherein, the above method of determining the optimization reference value of each storage scheme in the current iteration round based on the above target optimization condition and the storage location information of each storage scheme in the current iteration round includes: determining the optimization reference value of each of the above storage schemes in the current iteration round based on the above target optimization condition and the perturbed storage location information of each of the above storage schemes in the current iteration round.
[0012] According to an embodiment of the present invention, the above method also includes: when the storage location information of the above storage scheme in the above current iteration round is outside the above solution space, re-determining the storage location information of the above storage scheme in the current iteration round based on the storage location information of other storage schemes in the above previous iteration round.
[0013] The third aspect of the present invention provides a data storage device, characterized in that the above-mentioned device includes: a space determination module, which is used to determine the solution space of the storage scheme according to the storage resource amount of each of the multiple storage spaces included in the database disk, and the data item size of multiple data items, wherein the above-mentioned storage scheme represents the storage method of the above-mentioned multiple data items in the above-mentioned multiple storage spaces; an initialization module, which is used to randomly initialize the attribute information of multiple storage schemes in the above-mentioned solution space, wherein the above-mentioned attribute information includes storage location information and location update speed, and the above-mentioned storage location information represents the storage location of the above-mentioned multiple data items in at least one of the above-mentioned storage spaces; an information determination module, which is used to iteratively adjust the attribute information of each of the above-mentioned multiple storage schemes based on the target optimization condition, and determine the storage location information of the target iteration round; a location determination module, which is used to re-determine the storage location of the multiple data items included in the above-mentioned database disk based on the storage location information of the above-mentioned target iteration round.
[0014] A third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the above method.
[0015] According to an embodiment of the present invention, in a determined solution space, the storage location information and location update speed of each of the multiple storage schemes are iteratively adjusted based on the target optimization condition to determine the storage location information of the target iteration round. Since multiple storage schemes are initialized and the changes of the multiple storage schemes are independent, the search rate is improved. In addition, the database disk is divided into multiple storage spaces, and the data stored in the database disk is re-determined in units of data items on the database disk to improve the performance of the database in terms of the target optimization condition. Since adjusting the storage location of the data item on the disk is an optimization of the physical storage structure of the data item, there is no need to re-modify the database structure or application code due to changes in the business environment. Therefore, while improving the database performance, it saves manpower and improves the reusability of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above contents and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings.
[0017] Figure 1 An application scenario diagram of the data storage method, apparatus, and device according to an embodiment of the present invention is shown.
[0018] Figure 2 A flow chart of a data storage method according to an embodiment of the present invention is shown.
[0019] Figure 3 A flowchart of an attribute information iteration process according to an embodiment of the present invention is shown.
[0020] Figure 4 A flowchart of a local storage location determination process according to an embodiment of the present invention is shown.
[0021] Figure 5 A structural block diagram of a data storage device according to an embodiment of the present invention is shown.
[0022] Figure 6 A block diagram of an electronic device suitable for implementing a data storage method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0023] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.
[0024] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "include", "comprises", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0025] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0026] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0027] With the continuous increase in data volume and the diversification of database application scenarios, it is particularly important to improve the access speed, concurrent processing capability and throughput of database systems to improve the performance of database systems. Many developers improve the performance of databases by designing database structures or using partitions and tables.
[0028] For example, by properly designing table structures, table indexes, and table relationships, the efficiency of data queries in the database can be improved. Specifically, developers may reduce duplicate data and use appropriate data types and field sizes to reduce storage space while improving query efficiency, thereby improving the overall performance of the database.
[0029] For example, according to current business needs, the data table in the database is divided into independent data blocks according to certain rules (such as range, list, hash, etc.), and each data block is called a partition, so that each partition is managed and operated independently. When querying the data in the database, only the specific partition needs to be searched, which reduces the amount of data that needs to be scanned and speeds up the query.
[0030] For another example, based on business needs, the data table in the database is split into multiple sub-tables according to certain rules (such as user ID, time range, etc.). Each sub-table stores a part of the data, so that the data can be evenly distributed to different physical storage locations, avoiding performance bottlenecks caused by excessive data in a single table.
[0031] However, in the above method, if the business requirements corresponding to the business scenario change, the developer may need to redesign the database structure and the corresponding application code to keep the database performance at a good level. In actual operation, the process of redesigning the database structure and application code requires a lot of manpower and time. Therefore, there is an urgent need for a method that saves manpower and time and can improve database performance.
[0032] An embodiment of the present invention provides a data storage method, which considers improving the performance of a database by changing the storage location of a data item on a physical storage. Specifically, the method includes: determining a solution space of a storage scheme according to the storage resource amount of each of the multiple storage spaces included in the database disk and the data item size of the multiple data items, wherein the storage scheme represents the storage method of the multiple data items stored in the database disk; randomly initializing the attribute information of multiple storage schemes in the solution space, wherein the attribute information includes storage location information and location update speed, and the storage location information represents the storage location of the multiple data items in at least one storage space; iteratively adjusting the attribute information of each of the multiple storage schemes based on the target optimization condition to determine the storage location information of the target iteration round; and re-determining the storage location of the multiple data items included in the database disk based on the storage location information of the target iteration round.
[0033] Figure 1 An application scenario diagram of the data storage method, apparatus, and device according to an embodiment of the present invention is shown.
[0034] like Figure 1 As shown, the application scenario 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0035] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).
[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0037] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0038] It should be noted that the data storage method provided in the embodiment of the present invention can generally be executed by the server 105. Accordingly, the disk data storage device provided in the embodiment of the present invention can generally be set in the server 105. The data storage method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the disk data storage device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105.
[0039] It should be understood that Figure 1The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0040] The following will be based on Figure 1 The scene described by Figure 2~Figure 4 The data storage method according to the embodiment of the present invention is described in detail.
[0041] Figure 2 A flow chart of a data storage method according to an embodiment of the present invention is shown.
[0042] like Figure 2 As shown, the data storage method of this embodiment includes operations S210 to S240.
[0043] In operation S210, a solution space of a storage scheme is determined according to storage resource amounts of each of a plurality of storage spaces included in the database disk and data item sizes of a plurality of data items, wherein the storage scheme represents a storage manner in which the plurality of data items are stored in the database disk.
[0044] In operation S220, attribute information of a plurality of storage schemes is randomly initialized in the solution space, wherein the attribute information includes storage location information and a location update speed, and the storage location information represents storage locations of a plurality of data items in at least one storage space.
[0045] In operation S230, attribute information of each of the plurality of storage solutions is iteratively adjusted based on the target optimization condition to determine storage location information of the target iteration round.
[0046] In operation S240, storage locations of the plurality of data items included in the database disk are re-determined based on the storage location information of the target iteration round.
[0047] According to an embodiment of the present invention, the storage space may be a sector or track of a database disk. The storage resource amount represents the maximum amount of resources that the storage space can accommodate. The size of a data item represents the resource usage of the data item, and the data item sizes of different data items may be different. The storage scheme of multiple data items on a database disk represents the storage locations of multiple data items on at least one storage space. The solution space of the storage scheme represents all possible solutions for storing multiple data items on multiple storage spaces. The solution space of the storage scheme is determined based on the size of each data item and the constraints of the storage resource amounts of each of the multiple storage spaces, wherein one data item can be stored in different storage spaces.
[0048] According to an embodiment of the present invention, based on the idea of the particle swarm optimization algorithm, a storage scheme can be corresponded to a particle in the particle swarm optimization algorithm. In the solution space of the storage scheme, the attribute information of multiple storage schemes is randomly initialized. The storage positions of multiple data items in multiple storage spaces are represented by the particle positions of the particles, wherein each data item needs to be in one or more storage spaces, and not all storage spaces need to store the data item.
[0049] According to an embodiment of the present invention, the target optimization condition represents a preset optimization condition, and the target optimization condition can be set as a fitness function of a particle swarm optimization algorithm. The target optimization condition may include optimization conditions for multiple database performance indicators such as response time, throughput, and resource utilization. The storage location information and the location update speed are iteratively adjusted based on the target optimization condition. The target iteration round represents the iteration round that satisfies the iteration stop condition. By presetting the iteration stop condition, the storage location information of the target iteration round is determined. The iteration stop condition may be that the maximum iteration round is satisfied, or that the change in the function value corresponding to the target optimization condition in multiple consecutive iterations is less than a preset threshold.
[0050] According to an embodiment of the present invention, by decoding the storage location information of the target iteration round, the storage location of each data item on at least one storage space is obtained. Specifically, the parameters of the data item storage operation are determined by the storage location information. The data item storage operation is an operation of storing the data item on the database disk, thereby re-determining the storage locations of multiple data items on the database disk.
[0051] According to an embodiment of the present invention, in a determined solution space, the storage location information and location update speed of each of the multiple storage schemes are iteratively adjusted based on the target optimization condition to determine the storage location information of the target iteration round. Since multiple storage schemes are initialized and the changes of the multiple storage schemes are independent, the search rate is improved. In addition, the database disk is divided into multiple storage spaces, and the data stored in the database disk is re-determined in units of data items on the database disk to improve the performance of the database in terms of the target optimization condition. Since adjusting the storage location of the data item on the disk is an optimization of the physical storage structure of the data item, there is no need to re-modify the database structure or application code due to changes in the business environment. Therefore, while improving the database performance, it saves manpower and improves the reusability of the method.
[0052] According to an embodiment of the present invention, attribute information of each of a plurality of storage schemes is iteratively adjusted based on a target optimization condition to determine storage location information of a target iteration round, including: determining an optimization reference value of each storage scheme in a current iteration round based on the target optimization condition and the storage location information of the current iteration round of each storage scheme; determining local storage location information of each of the storage schemes in a current iteration round from the storage location information of each storage scheme in a current iteration round and the storage location information of a previous iteration round based on the optimization reference value of each storage scheme in the current iteration round and the optimization reference value of the previous iteration round; determining global storage location information of a current iteration round from a plurality of local storage location information based on the optimization reference value of each storage scheme in the current iteration round; and determining the global storage location information of a current iteration round as storage location information of a target iteration round when the current iteration round reaches the target iteration round.
[0053] According to an embodiment of the present invention, the function value of the target optimization condition corresponding to each storage scheme applied to the database disk is determined based on the storage location information of the current iteration round of the storage scheme. The optimization reference value is the function value of the target optimization condition. The optimization reference value corresponding to each storage scheme can be determined by presetting a database model to simulate the data generated by the implementation of the storage scheme on the database disk. The optimization reference value is used to quantify the performance of the database corresponding to different storage schemes.
[0054] According to an embodiment of the present invention, the local storage location information of the storage scheme in the current iteration round represents the storage location information of the storage scheme up to the current iteration round, where the optimization reference value is shown. In each iteration process, by comparing the optimization reference value corresponding to the storage location information of the storage scheme in the previous iteration round with the optimization reference value corresponding to the storage location information of the storage scheme in the current iteration round, the storage location information corresponding to the smaller optimization reference value or the larger optimization reference value from the storage location information of the two iteration rounds is determined as the local storage location information of the storage scheme in the current iteration round.
[0055] According to an embodiment of the present invention, the specific selection of the storage location information corresponding to the smaller optimization reference value or the storage location information corresponding to the larger optimization reference value needs to be determined according to the specific meaning represented by the optimization reference value. For example, in the case where the optimization reference value represents the response rate of the database, the storage location information corresponding to the smaller optimization reference value should be determined as the local storage location information. For example, in the case where the optimization reference value represents the disk utilization rate of the database, the storage location information corresponding to the larger optimization reference value should be determined as the local storage location information.
[0056] According to an embodiment of the present invention, the global storage location information is the local storage location information corresponding to the maximum optimization reference value, or the local storage location information corresponding to the minimum optimization reference value, among the multiple local storage location information corresponding to the multiple storage schemes in the current iteration round. The local storage location information corresponding to the maximum or minimum optimization reference value is determined here, which is related to the specific meaning represented by the optimization reference value, and the above description can be referred to. By comparing the optimization reference value of each storage scheme in the current iteration round, the global storage location information of the current iteration round is determined from the multiple local storage location information. When the iteration is completed, that is, when the target iteration round is reached, the global location information obtained by the final iteration is determined as the storage location information of the target iteration round.
[0057] According to an embodiment of the present invention, in each iteration round, based on the optimization reference value corresponding to each storage scheme, the local storage location information corresponding to each storage scheme is determined, so that each storage scheme can iterate in the solution space in parallel, thereby improving the data processing efficiency. By controlling the update mechanism of the global storage location information and the local storage location information, the diversity of the search storage scheme can be increased, which helps to explore the search solution space more comprehensively.
[0058] According to an embodiment of the present invention, the data storage method also includes: for each of the storage schemes, based on the global storage location information of the current iteration round, and the location update speed of the current iteration round and the local storage location information, determining the location update speed of the next iteration round; based on the storage location information of the current iteration round and the location update speed of the next iteration round, determining the storage location information of the next iteration round.
[0059] According to an embodiment of the present invention, the update formula of the particle speed in the particle swarm optimization algorithm is used as a basis, the global storage position information of the current iteration round, the position update speed of each storage scheme in the current iteration round, and the local storage position information are input into the update formula to obtain the position update speed of each storage scheme in the next iteration round, wherein the weight coefficient in the update formula is pre-set by professionals, the position update speed corresponds to the particle speed in the update formula, the storage position information corresponds to the particle position in the update formula, the local storage position information corresponds to the individual best position (pbest) in the update formula, and the global storage position information corresponds to the global best position (gbest) in the update formula.
[0060] According to an embodiment of the present invention, the update formula of the particle speed in the particle swarm optimization algorithm is used as a basis, the storage position information of the current iteration round and the position update speed of each storage scheme in the next iteration round are input into the update formula, and the storage position information of each storage scheme in the next iteration round is obtained, wherein the storage position information corresponds to the particle position in the update formula.
[0061] According to an embodiment of the present invention, for each storage scheme, the storage location information corresponding to the optimization reference value that satisfies the optimization direction in multiple iterations is recorded through local storage location information. The storage location information corresponding to the optimization reference value that satisfies the optimization direction in multiple iterations is recorded through global storage location information. The location update speed of each storage scheme in the next iteration round is updated through the global storage location information, thereby realizing information sharing among multiple storage schemes, so as to guide multiple storage schemes to iterate in the direction of better optimization reference value.
[0062] Figure 3 A flowchart of an attribute information iteration process according to an embodiment of the present invention is shown.
[0063] like Figure 3 As shown, the data storage method of this embodiment includes operations S310 to S380.
[0064] In operation S310, based on the target optimization condition and the storage location information of each storage solution in the Qth iteration round, an optimization reference value of each storage solution in the Qth iteration round is determined.
[0065] Wherein, Q is a positive integer greater than 1.
[0066] In operation S320, based on the optimization reference value of each storage scheme in the Qth iteration round and the optimization reference value of the (Q-1)th iteration round, local storage location information of multiple storage schemes in the Qth iteration round is determined from the storage location information of each storage scheme in the current iteration round and the storage location information of the (Q-1)th iteration round.
[0067] In operation S330 , global storage location information of the Qth iteration round is determined from a plurality of local storage location information based on the optimization reference value of each storage scheme at the Qth iteration round.
[0068] In operation S340, it is determined whether the Qth iteration round reaches the target iteration round.
[0069] If the Qth generation round reaches the target iteration round, operation S350 is performed. Otherwise, operation S360 is performed.
[0070] In operation S350, the global storage location information of the Qth iteration round is determined as the storage location information of the target iteration round.
[0071] In operation S360, based on the global storage location information of the Qth iteration round, the location update speed of each storage solution of the Qth iteration round, and the local storage location information, the location update speed of each storage solution of the (Q+1)th iteration round is determined.
[0072] In operation S370 , storage location information of each storage solution in the (Q+1)th iteration round is determined based on the storage location information of each storage solution in the Qth iteration round and the location update speed of each storage solution in the Qth iteration round.
[0073] In operation S380, the value of Q is increased by 1 and then reassigned to the variable Q.
[0074] According to an embodiment of the present invention, based on the optimization reference value of each storage scheme in the current iteration round and the optimization reference value of the previous iteration round, the local storage location information of multiple storage schemes in the current iteration round is determined from the storage location information of each storage scheme in the current iteration round and the storage location information of the previous iteration round, including: for each storage scheme, based on the optimization reference value of the previous iteration round and the optimization reference value of the current iteration round, determining the cost value of the storage scheme; the storage location information of the previous iteration round represented by the cost value is better than the storage location information of the current iteration round In this case, the annealing probability of each storage scheme is determined based on the cost value corresponding to each storage scheme and the annealing temperature of the current iteration round, wherein the annealing temperature of the current iteration round is iteratively obtained by using a preset initial annealing temperature based on a preset cooling function, and the cooling function includes a logarithmic cooling function; when the annealing probability is greater than or equal to a probability threshold of the current iteration round, the storage location information of the previous iteration round is determined as the local storage location information; when the annealing probability is less than the probability threshold of the current iteration round, the storage location information of the current iteration round is determined as the local storage location information.
[0075] According to an embodiment of the present invention, the cost value of the storage scheme is used to characterize the relationship between the storage location information of the previous iteration round and the storage location information of the current iteration round. The cost value of the storage scheme can be the difference between the optimization reference value of the storage scheme in the previous iteration round and the optimization reference value of the current iteration round. The cost value of the storage scheme can also be the difference between the value obtained by multiplying the optimization reference value of the previous iteration round by a preset weight and the value obtained by multiplying the optimization reference value of the current iteration round by a preset weight.
[0076] According to an embodiment of the present invention, the cost value can be obtained by subtracting the optimization reference value of the previous iteration from the optimization reference value of the current iteration. By presetting the cost threshold, the relationship between the storage location information of the previous iteration and the storage location information of the current iteration is determined through the relationship between the preset cost threshold and the cost value, and the specific corresponding relationship is related to the meaning of the database performance indicator represented by the optimization reference value.
[0077] For example, when the optimization reference value represents the input and output delay of the database, the storage location information corresponding to the smaller optimization reference value is the preferred storage location information. Therefore, when the cost value is greater than or equal to the preset cost threshold, the storage location information of the previous iteration round is better than the storage location information of the current iteration round.
[0078] According to an embodiment of the present invention, the annealing temperature is a control parameter in the simulated annealing algorithm, which is used to control the degree of exploration of the solution space by the algorithm during the search process. The initial annealing temperature can be preset. The higher the initial annealing temperature, the easier it is for the storage scheme to explore the solution space. Based on the receiving criterion formula of the simulated annealing algorithm, the cost value corresponding to each storage scheme and the annealing temperature of the current iteration round are brought into the receiving criterion formula to obtain the annealing probability of each storage scheme. Specifically, the ratio of the cost value to the annealing temperature of the current iteration round is inverted as the exponent of e, and the value obtained after the instruction is taken as the annealing probability. The cooling function is the cooling function of the simulated annealing algorithm, and the cooling function may include an exponential cooling function.
[0079] According to an embodiment of the present invention, the probability threshold of each iteration round can be randomly generated by a computer. When the annealing probability is greater than or equal to the probability threshold of the current iteration round, the storage location information of the previous iteration round is determined as the local storage location information; when the annealing probability is less than the probability threshold of the current iteration round, the storage location information of the current iteration round is determined as the local storage location information.
[0080] According to an embodiment of the present invention, in combination with a simulated annealing algorithm, the cost value is used as the first-level criterion for determining whether to accept the storage location information of the current iteration round. When the storage location information of the current iteration round is inferior to the storage location information of the previous iteration round, the storage location information of the current iteration round is probabilistically accepted to achieve a global search of the solution space, thereby reducing the possibility of falling into a local optimal solution and improving the accuracy of the storage location of the target iteration round.
[0081] Figure 4 A flowchart of a local storage location determination process according to an embodiment of the present invention is shown.
[0082] like Figure 4As shown, the data storage method of this embodiment includes operations S401 to S407.
[0083] In operation S401 , for each storage solution, a cost value of the storage solution is determined based on an optimization reference value of a previous iteration round and an optimization reference value of each storage solution in a current iteration round.
[0084] In operation S402, it is determined whether the cost value represents the storage location information of the previous iteration round, which is better than the storage location information of the current iteration round.
[0085] If the cost value represents that the storage location information of the previous iteration round is better than the storage location information of the current iteration round, operation S403 is performed. Otherwise, operation S407 is performed.
[0086] In operation S403 , the annealing probability of each storage solution is determined based on the cost value corresponding to each storage solution and the annealing temperature of the current iteration round.
[0087] In operation S404, it is determined whether the annealing probability is less than a probability threshold of the current iteration round.
[0088] When the annealing probability is less than the probability threshold of the current iteration round, operation S405 is performed. Otherwise, operation S406 is performed.
[0089] In operation S405, the storage location information of the current iteration round is determined as the local storage location information.
[0090] In operation S406, the storage location information of the previous iteration round is determined as the local storage location information.
[0091] In operation S407, the storage location information of the current iteration round is determined as the local storage location information of the storage solution in the current iteration round.
[0092] According to an embodiment of the present invention, based on the target optimization conditions and the storage location information of the current iteration round of each storage scheme, the optimization reference value of each storage scheme in the current iteration round is determined, including: in the case where multiple data items included in the database disk are respectively stored in their respective target storage locations, the disk utilization of the database disk is determined based on the utilization of each storage space, wherein the target storage locations of the multiple data items are determined based on the storage location information of each storage scheme; based on the time cost generated by the database disk during the data input and output process, the input and output delay of the database disk is determined; based on the distance cost of the target data item, the data locality of the database disk is determined, wherein the target data item represents a data item that is frequently accessed; based on the input and output delay, disk utilization and data locality, the optimization reference value of each storage scheme in the current iteration round is determined.
[0093] According to an embodiment of the present invention, the target storage location represents the storage location corresponding to the plurality of data items in the storage location information. When the plurality of data items included in the database disk are respectively stored in the respective target storage locations, the input / output delay, disk utilization and data locality of the database disk are detected or simulated when the plurality of data items of the database disk are respectively stored in the respective target storage locations.
[0094] According to an embodiment of the present invention, when the storage space is a disk, and there are N data items and M disks, N is an integer greater than 1, and M is an integer greater than 1. The disk utilization rate can be determined by the following formula (1):
[0095]
[0096] in, Indicates disk utilization. Indicates the jth disk, the value range of j is [1, M], j is a positive integer, Indicates the total capacity of all disks.
[0097] The input and output delay can be determined by the following formula (2):
[0098]
[0099] in, Indicates input and output delay, represents the cost function of assigning data item i to disk j, where May include the seek time of the disk head moving from data item i to disk j. Represents the access frequency of data item i, the value range of i is [1, N], and i is a positive integer. Represents the total access frequency of all data items.
[0100] Data locality can be determined by the following formula (3):
[0101]
[0102] Among them, DataLocality represents data locality. Represents the cylinder distance between data items i and j on disk.
[0103] When the input / output delay, disk utilization, and data locality are obtained, the optimization reference value can be determined by the following formula (4):
[0104]
[0105] in, represents the optimized reference value, The weight parameter of the formula is used to balance input and output delays, disk utilization, and data locality, and to improve the flexibility and accuracy of the expression of the optimization reference value.
[0106] According to an embodiment of the present invention, the impact of storing multiple data items in a target storage location on the database disk performance is used as a target constraint condition to control the storage scheme to iteratively optimize in the direction of better input and output delays, disk utilization and data locality, thereby gradually reducing the number of disk seeks during data access and improving the efficiency and speed of data access.
[0107] According to an embodiment of the present invention, the data storage method also includes: based on the performance change information of the database disk, adjusting the parameters corresponding to the input and output delays, disk utilization and data locality in the target optimization conditions to obtain new target optimization conditions.
[0108] According to an embodiment of the present invention, the performance change information of the database disk may include the response speed of the database, disk utilization, input / output delay, etc. After re-determining the storage locations of multiple data items included in the database disk based on the storage location information of the target iteration round, if the performance of the database disk represents the improvement effect of the response speed of the database disk or the input / output delay, and the improvement effect is greater than that of other performances, the parameter value corresponding to the input / output delay is increased.
[0109] According to an embodiment of the present invention, when the performance of the database disk represents the effect of improving the disk utilization of the database disk, and the improvement effect is greater than that of other performances, the parameter value corresponding to the disk utilization is increased. When the performance of the database disk represents the effect of improving the data locality of the database disk, and the improvement effect is greater than that of other performances, the parameter value corresponding to the data locality is increased.
[0110] According to an embodiment of the present invention, based on the performance change after the database disk is adjusted, the parameters of each part of the target optimization condition are adjusted, thereby improving the dynamic adaptability and flexibility of the target optimization condition and improving the accuracy of the algorithm.
[0111] According to an embodiment of the present invention, the data storage method also includes: randomly perturbing the storage location information of each storage scheme in the current iteration round to obtain the perturbed storage location information of each storage scheme in the current iteration round; wherein, based on the target optimization condition and the storage location information of each storage scheme in the current iteration round, determining the optimization reference value of each storage scheme in the current iteration round, including: based on the target optimization condition and the perturbed storage location information of each storage scheme in the current iteration round, determining the optimization reference value of each storage scheme in the current iteration round.
[0112] According to an embodiment of the present invention, random perturbation can be achieved by randomly selecting two storage schemes of the current iteration round by a computer and exchanging the storage location information of the two storage schemes. In the same iteration round, multiple storage schemes can be selected for random perturbation. For each iteration round, by randomly perturbing the storage location information of the current iteration round, the probability of the storage location information or the location update speed being locally optimal is reduced.
[0113] According to an embodiment of the present invention, the data storage method also includes: when the storage location information of the storage scheme in the current iteration round is outside the solution space, re-determining the storage location information of the storage scheme in the current iteration round based on the storage location information of other storage schemes in the previous iteration round.
[0114] According to an embodiment of the present invention, after each iteration, it is checked whether the location of the storage solution is located in the solution space. If the storage location information of the storage solution in the current iteration round is outside the solution space, the storage location information of other storage solutions in the previous iteration round can be used for interpolation calculation to obtain the storage location information of the storage solution in the current iteration round. Alternatively, the storage location information of other storage solutions in the previous iteration round is determined as the storage location information of the storage solution in the current iteration round.
[0115] According to an embodiment of the present invention, by redetermining the storage location information of the storage scheme in the current iteration round based on the storage location information of other storage schemes in the previous iteration round, the situation where the storage location information of the storage scheme is outside the solution space can be effectively handled, thereby improving the accuracy of the storage location information of the target iteration round.
[0116] According to an embodiment of the present invention, the performance of the database system is collected in real time through various database disk performance detection tools or built-in performance detection mechanisms. The performance of the database system includes disk input and output performance, query response time, system load, disk usage, etc. By analyzing the collected database system performance, statistical analysis is performed on the performance changes of the database system after the storage performance information of the target iteration round is applied to the disk, and the analysis results are obtained.
[0117] According to an embodiment of the present invention, based on the results of data analysis, a detailed feedback report can be generated, including an evaluation of the optimization effect, existing problems, and possible improvement suggestions, to help database administrators understand the current system status and perform further adjustments.
[0118] According to an embodiment of the present invention, the dynamic adjustment of the optimization strategy is promoted based on the performance data of the collected database disk. Specifically, when the input and output speed of the database disk is reduced, the local search is increased: the intensity of the local search is increased, and the algorithm's search ability around the local optimal solution is improved to cope with the situation where the overall performance is affected by the input and output speed. When the disk utilization rate is improved, the number of iterations can be reduced to better converge when approaching the global optimal solution. When the disk utilization rate is reduced, the inertia weight in the function corresponding to the target optimization condition can be adjusted to balance the ratio of global search and local search. Or adjust the number of initialization storage schemes.
[0119] According to the implementation principle of the present invention, the algorithm is adjusted through the performance data of the database disk detected above, so that the database disk management system can continuously improve its performance and effectiveness, and improve the versatility of the database system to the ever-changing operating environment and business needs.
[0120] Based on the above data storage method, the present invention also provides a data storage device. Figure 5 The device is described in detail.
[0121] Figure 5 A structural block diagram of a data storage device according to an embodiment of the present invention is shown.
[0122] like Figure 5 As shown, the data storage device 500 of this embodiment includes a space determination module 510 , an initialization module 520 , an information determination module 530 and a position determination module 540 .
[0123] The space determination module 510 is used to determine the solution space of the storage scheme according to the storage resource amount of each of the multiple storage spaces included in the database disk and the data item size of the multiple data items, wherein the storage scheme represents the storage method of storing the multiple data items in the multiple storage spaces. In one embodiment, the space determination module 510 can be used to perform the operation S210 described above, which will not be repeated here.
[0124] Initialization module 520 is used to randomly initialize attribute information of multiple storage schemes in the solution space, wherein the attribute information includes storage location information and location update speed, and the storage location information represents the storage location of multiple data items in at least one storage space. In one embodiment, initialization module 520 can be used to perform operation S220 described above, which will not be repeated here.
[0125] The information determination module 530 is used to iteratively adjust the attribute information of each of the multiple storage solutions based on the target optimization condition to determine the storage location information of the target iteration round. In one embodiment, the information determination module 530 can be used to perform the operation S230 described above, which will not be repeated here.
[0126] The location determination module 540 is used to re-determine the storage locations of multiple data items included in the database disk based on the storage location information of the target iteration round. In one embodiment, the location determination module 540 is used to perform the operation S240 described above, which will not be described in detail here.
[0127] According to an embodiment of the present invention, the information determination module 530 includes: a reference determination submodule, a first position determination submodule, a second position determination submodule, and a target position determination submodule.
[0128] The reference determination submodule is used to determine the optimization reference value of each storage scheme in the current iteration round based on the target optimization condition and the storage location information of each storage scheme in the current iteration round.
[0129] The first position determination submodule is used to determine the local storage position information of multiple storage schemes in the current iteration round from the storage position information of each storage scheme in the current iteration round and the storage position information of the previous iteration round based on the optimization reference value of each storage scheme in the current iteration round and the optimization reference value of the previous iteration round.
[0130] The second position determination submodule is used to determine the global storage position information of the current iteration round from multiple local storage position information based on the optimization reference value of each storage scheme in the current iteration round.
[0131] The target position determination submodule is used to determine the global storage position information of the current iteration round as the storage position information of the target iteration round when the current iteration round reaches the target iteration round.
[0132] According to an embodiment of the present invention, the first position determination submodule includes: a cost determination unit, a probability determination unit, a first position determination unit, and a second position determination unit.
[0133] The cost determination unit is used to determine the cost value of each storage solution based on the optimization reference value of the previous iteration round and the optimization reference value of each storage solution in the current iteration round.
[0134] A probability determination unit is used to determine the annealing probability of each storage scheme based on the cost value corresponding to each storage scheme and the annealing temperature of the current iteration round when the cost value represents the storage location information of the previous iteration round, which is better than the storage location information of the current iteration round, wherein the annealing temperature of the current iteration round is obtained by iterating a preset initial annealing temperature based on a preset cooling function, and the cooling function includes a logarithmic cooling function.
[0135] The first position determining unit is used to determine the storage position information of the previous iteration round as the local storage position information when the annealing probability is greater than or equal to the probability threshold of the current iteration round.
[0136] The second position determining unit is used to determine the storage position information of the current iteration round as the local storage position information when the annealing probability is less than the probability threshold of the current iteration round.
[0137] According to an embodiment of the present invention, the data storage device 500 further includes: a speed determination module and a position determination module.
[0138] The speed determination module is used to determine the position update speed of each storage scheme in the next iteration round based on the global storage position information of the current iteration round, the position update speed of each storage scheme in the current iteration round, and the local storage position information.
[0139] The location determination module is used to determine the storage location information of each storage solution in the next iteration round based on the storage location information of each storage solution in the current iteration round and the location update speed of each storage solution in the next iteration round.
[0140] According to an embodiment of the present invention, the reference determination submodule includes: a first determination unit, a second determination unit, a third determination unit, and a fourth determination unit.
[0141] The first determination unit is used to determine the disk utilization of the database disk based on the utilization of each storage space when multiple data items included in the database disk are respectively stored in respective target storage locations, wherein the respective target storage locations of the multiple data items are determined based on the storage location information of each storage scheme.
[0142] The second determining unit is used to determine the input and output delay of the database disk based on the time cost generated during the data input and output process of the database disk.
[0143] The third determining unit is used to determine the data locality of the database disk based on the distance cost of the target data item, wherein the target data item represents a frequently accessed data item.
[0144] The fourth determining unit is used to determine the optimization reference value of each storage solution in the current iteration round based on input and output delays, disk utilization and data locality.
[0145] According to an embodiment of the present invention, the data storage device 500 further includes: a parameter adjustment module.
[0146] The parameter adjustment module is used to adjust the parameters corresponding to the input and output delays, disk utilization and data locality in the target optimization conditions based on the performance change information of the database disk to obtain new target optimization conditions.
[0147] According to an embodiment of the present invention, the information determination module 530 further includes: a disturbance submodule.
[0148] The perturbation submodule is used to randomly perturb the storage location information of each storage scheme in the current iteration round to obtain the perturbed storage location information of each storage scheme in the current iteration round.
[0149] The reference determination submodule includes: a reference determination unit, which is used to determine the optimization reference value of each storage scheme in the current iteration round based on the target optimization condition and the disturbance storage position information of each storage scheme in the current iteration round.
[0150] According to an embodiment of the present invention, the information determination module 530 further includes: a third position determination submodule.
[0151] The third position determination submodule is used to redetermine the storage position information of the storage scheme in the current iteration round based on the storage position information of other storage schemes in the previous iteration round when the storage position information of the storage scheme in the current iteration round is outside the solution space.
[0152] According to an embodiment of the present invention, any multiple modules of the space determination module 510, the initialization module 520, the information determination module 530 and the position determination module 540 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. According to an embodiment of the present invention, at least one of the space determination module 510, the initialization module 520, the information determination module 530 and the position determination module 540 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in a suitable combination of any of them. Alternatively, at least one of the space determination module 510, the initialization module 520, the information determination module 530 and the position determination module 540 may be at least partially implemented as a computer program module, which may perform a corresponding function when executed.
[0153] Figure 6 A block diagram of an electronic device suitable for implementing a data storage method according to an embodiment of the present invention is shown.
[0154] like Figure 6 As shown, the electronic device 600 according to an embodiment of the present invention includes a processor 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 to a random access memory (RAM) 603. The processor 601 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 601 may also include an onboard memory for caching purposes. The processor 601 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.
[0155] In RAM603, various programs and data required for the operation of electronic device 600 are stored. Processor 601, ROM602 and RAM603 are connected to each other via bus 604. Processor 601 performs various operations of the method flow according to an embodiment of the present invention by executing the programs in ROM602 and / or RAM603. It should be noted that the program can also be stored in one or more memories other than ROM602 and RAM603. Processor 601 can also perform various operations of the method flow according to an embodiment of the present invention by executing the programs stored in the one or more memories.
[0156] According to an embodiment of the present invention, the electronic device 600 may further include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 may further include one or more of the following components connected to the input / output (I / O) interface 605: an input portion 606 including a keyboard, a mouse, etc.; an output portion 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 608 including a hard disk, etc.; and a communication portion 609 including a network interface card such as a LAN card, a modem, etc. The communication portion 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage portion 608 as needed.
[0157] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present invention is implemented.
[0158] According to an embodiment of the present invention, the computer-readable storage medium may be a non-volatile computer-readable storage medium, for example, it may include but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device. For example, according to an embodiment of the present invention, the computer-readable storage medium may include the ROM602 and / or RAM603 described above and / or one or more memories other than ROM602 and RAM603.
[0159] The embodiment of the present invention also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method shown in the flowchart. When the computer program product is run in a computer system, the program code is used to enable the computer system to implement the data storage method provided by the embodiment of the present invention.
[0160] The computer program executes the above functions defined in the system / device of the embodiment of the present invention when it is executed by the processor 601. According to the embodiment of the present invention, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0161] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 609, and / or installed from a removable medium 611. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0162] In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the processor 601, the above functions defined in the system of the embodiment of the present invention are performed. According to the embodiment of the present invention, the system, device, means, module, unit, etc. described above can be implemented by a computer program module.
[0163] According to an embodiment of the present invention, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0164] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0165] It will be appreciated by those skilled in the art that the features described in the various embodiments of the present invention may be combined or coupled in various ways, even if such combinations or couplings are not explicitly described in the present invention. In particular, the features described in the various embodiments of the present invention may be combined and / or coupled in various ways without departing from the spirit and teachings of the present invention. All of these combinations and / or couplings fall within the scope of the present invention.
[0166] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.
Claims
1. A data storage method, characterized in that: The method comprises: Determine a solution space of a storage scheme according to the storage resource amounts of each of the plurality of storage spaces included in the database disk and the data item sizes of the plurality of data items, wherein the storage scheme represents a storage manner in which the plurality of data items are stored in the plurality of storage spaces; In the solution space, randomly initializing attribute information of a plurality of storage schemes, wherein the attribute information includes storage location information and location update speed, and the storage location information represents the storage location of the plurality of data items in at least one of the storage spaces; Iteratively adjust the attribute information of each of the multiple storage solutions based on the target optimization condition to determine the storage location information of the target iteration round; Based on the storage location information of the target iteration round, the storage locations of the multiple data items included in the database disk are re-determined.
2. The method according to claim 1, characterized in that The iteratively adjusting the attribute information of each of the plurality of storage solutions based on the target optimization condition to determine the storage location information of the target iteration round includes: Determine an optimization reference value of each storage solution in the current iteration round based on the target optimization condition and the storage location information of each storage solution in the current iteration round; Based on the optimization reference value of each storage scheme in the current iteration round and the optimization reference value of the previous iteration round, determine the local storage location information of each storage scheme in the current iteration round and the storage location information of the previous iteration round; Based on the optimization reference value of each storage scheme in the current iteration round, determine the global storage location information of the current iteration round from the plurality of local storage location information; In a case where the current iteration round reaches the target iteration round, the global storage location information of the current iteration round is determined as the storage location information of the target iteration round.
3. The method according to claim 2, characterized in that The determining, based on the optimization reference value of each storage scheme in the current iteration round and the optimization reference value of the previous iteration round, the respective local storage location information of the multiple storage schemes in the current iteration round from the storage location information of each storage scheme in the current iteration round and the storage location information of the previous iteration round, comprises: For each of the storage solutions, determining a cost value of the storage solution based on the optimization reference value of the previous iteration round and the optimization reference value of the current iteration round; In a case where the cost value represents the storage location information of the previous iteration round and is better than the storage location information of the current iteration round, determining the annealing probability of each storage scheme based on the cost value corresponding to each storage scheme and the annealing temperature of the current iteration round, wherein the annealing temperature of the current iteration round is obtained by iterating a preset initial annealing temperature based on a preset cooling function, and the cooling function includes a logarithmic cooling function; In a case where the annealing probability is greater than or equal to the probability threshold of the current iteration round, determining the storage location information of the previous iteration round as the local storage location information; When the annealing probability is less than the probability threshold of the current iteration round, the storage location information of the current iteration round is determined as the local storage location information.
4. The method according to claim 2, characterized in that: The method further comprises: For each of the storage schemes, determining a location update speed for a next iteration round based on the global storage location information of the current iteration round, the location update speed of the current iteration round, and the local storage location information; Based on the storage location information of the current iteration round and the location update speed of the next iteration round, the storage location information of the next iteration round is determined.
5. The method according to claim 2, characterized in that: The step of determining the optimization reference value of each storage scheme in the current iteration round based on the target optimization condition and the storage location information of each storage scheme in the current iteration round includes: In a case where the plurality of data items included in the database disk are respectively stored in respective target storage locations, determining the disk utilization of the database disk based on the utilization of each storage space, wherein the respective target storage locations of the plurality of data items are determined based on the storage location information of each storage scheme; Determining the input and output delay of the database disk based on the time cost generated by the database disk during the data input and output process; determining data locality of the database disk based on a distance cost of a target data item, wherein the target data item represents a frequently accessed data item; Based on the input and output delays, the disk utilization, and the data locality, an optimization reference value of each storage solution in a current iteration round is determined.
6. The method according to claim 5, characterized in that The method further comprises: Based on the performance change information of the database disk, the parameters corresponding to the input and output delay, the disk utilization and the data locality in the target optimization condition are adjusted to obtain a new target optimization condition.
7. The method according to claim 2, characterized in that The method further comprises: Randomly perturb the storage location information of each storage scheme in the current iteration round to obtain the perturbed storage location information of each storage scheme in the current iteration round; Wherein, determining the optimization reference value of each storage scheme in the current iteration round based on the target optimization condition and the storage location information of each storage scheme in the current iteration round includes: Based on the target optimization condition and the disturbance storage position information of each storage solution in the current iteration round, an optimization reference value of each storage solution in the current iteration round is determined.
8. The method according to claim 2, characterized in that: The method further comprises: When the storage location information of the storage scheme in the current iteration round is outside the solution space, the storage location information of the storage scheme in the current iteration round is re-determined based on the storage location information of other storage schemes in the previous iteration round.
9. A data storage device, characterized in that: The device comprises: A space determination module, used to determine a solution space of a storage scheme according to the storage resource amount of each of the plurality of storage spaces included in the database disk and the data item size of the plurality of data items, wherein the storage scheme represents a storage manner in which the plurality of data items are stored in the plurality of storage spaces; An initialization module, used to randomly initialize attribute information of multiple storage schemes in the solution space, wherein the attribute information includes storage location information and location update speed, and the storage location information represents the storage location of the multiple data items in at least one of the storage spaces; An information determination module, configured to iteratively adjust the attribute information of each of the plurality of storage solutions based on a target optimization condition, and determine storage location information of a target iteration round; The location determination module is used to re-determine the storage locations of the multiple data items included in the database disk based on the storage location information of the target iteration round.
10. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more computer programs, It is characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1 to 8.
