WO2021174731A1 - Disk performance optimization method, apparatus and device, and computer readable storage medium - Google Patents

Disk performance optimization method, apparatus and device, and computer readable storage medium Download PDF

Info

Publication number
WO2021174731A1
WO2021174731A1 PCT/CN2020/099512 CN2020099512W WO2021174731A1 WO 2021174731 A1 WO2021174731 A1 WO 2021174731A1 CN 2020099512 W CN2020099512 W CN 2020099512W WO 2021174731 A1 WO2021174731 A1 WO 2021174731A1
Authority
WO
WIPO (PCT)
Prior art keywords
cluster
dirty
data
disk
bitmap
Prior art date
Application number
PCT/CN2020/099512
Other languages
French (fr)
Chinese (zh)
Inventor
刘仁仕
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2021174731A1 publication Critical patent/WO2021174731A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0604Improving or facilitating administration, e.g. storage management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/064Management of blocks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0652Erasing, e.g. deleting, data cleaning, moving of data to a wastebasket
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0674Disk device
    • G06F3/0676Magnetic disk device

Definitions

  • This application relates to the technical field of cache data distribution, and is applied to artificial intelligence, and in particular to a method, device, device, and computer-readable storage medium for optimizing disk performance.
  • the inventor found that as long as there is an item update in the cache item, the file will be written in a whole block during the cache.
  • the cluster size of 4M as an example, assuming that the user writes 4K randomly, when the random write 4K area needs to be allocated In the case of a new cluster, these write operations will cause the flushing of 4M secondary index table cache entries and the flushing of 4M reference counting table cache entries, and an additional 8M metadata write amplification.
  • the actual used space of the virtual disk decreases and performance decreases.
  • the main purpose of this application is to provide a method, device, device, and computer-readable storage medium for optimizing disk performance, aiming to solve the technical problem of low disk performance.
  • the present application provides a method for optimizing disk performance.
  • the method for optimizing disk performance includes the following steps:
  • the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
  • the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  • the present application also provides a disk performance optimization device, the disk performance optimization device includes the following modules:
  • An obtaining module configured to obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
  • the setting module is used to set flashing parameters in the cache item, the flashing parameters including dirty bit granularity and dirty bitmap size, wherein the dirty bitmap size is equal to the actual size of the cluster and the dirty bit granularity
  • the dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
  • a dirty bitmap allocation module configured to determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap
  • the flashing data judgment module is used to judge whether the disk has received a request for flashing data
  • the dirty data identification module is configured to, if the disk receives the request for flushing data, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
  • the present application also provides a disk performance optimization device
  • the disk performance optimization device includes a memory, a processor, and a disk performance optimization device that is stored in the memory and can run on the processor.
  • a program that, when the disk performance optimization program is executed by the processor, implements the steps of the disk performance optimization method as described below, including:
  • the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
  • the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  • the present application also provides a computer-readable storage medium having a disk performance optimization program stored on the computer-readable storage medium, and the disk performance optimization program is executed by a processor to achieve the following
  • the steps of the disk performance optimization method include:
  • the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
  • the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  • This application uses a preset marking program to mark all bits of the dirty bitmap in the cache item, and flush the dirty data in the dirty bitmap in the cache item to the file, avoiding repeated data flushing, reading and writing
  • the smallest unit of data is page page, 1page is generally 4KB, and the smallest unit of erased data is block, 1block is 64 pages, that is, 256KB, ideally, how much data is written to the main memory and how much to write to the flash memory Data, but in the actual scenario, the amount of dirty data must be written out in calculations, that is, the data consumes disk performance when writing, and it consumes disk performance when writing, thus causing write amplification and write amplification.
  • This application recognizes dirty data, only flushes dirty data, avoids flushing all data, reduces write amplification, and improves disk performance.
  • FIG. 1 is a schematic structural diagram of an operating environment of a disk performance optimization device related to a solution of an embodiment of the application;
  • FIG. 2 is a schematic flowchart of a first embodiment of a method for optimizing disk performance of this application
  • FIG. 3 is a detailed flowchart of an embodiment of step S50 in FIG. 2;
  • FIG. 4 is a schematic flowchart of a second embodiment of a method for optimizing disk performance according to this application;
  • FIG. 5 is a schematic diagram of functional modules of an embodiment of an apparatus for optimizing disk performance of the present application.
  • the disk performance optimization method involved in the embodiments of the present application is mainly applied to a disk performance optimization device, and the disk performance optimization device may be a device with display and processing functions such as a PC, a portable computer, and a mobile terminal.
  • FIG. 1 is a schematic diagram of the hardware structure of the disk performance optimization device involved in the solution of the embodiment of the application.
  • the disk performance optimization device may include a processor 1001 (for example, a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.
  • the communication bus 1002 is used to realize the connection and communication between these components;
  • the user interface 1003 may include a display (Display), an input unit such as a keyboard (Keyboard);
  • the network interface 1004 may optionally include a standard wired interface, a wireless interface (Such as WI-FI interface);
  • the memory 1005 can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a disk memory.
  • the memory 1005 can optionally be a storage device independent of the aforementioned processor 1001 .
  • FIG. 1 does not constitute a limitation on the disk performance optimization device, and may include more or less components than shown in the figure, or a combination of certain components, or different component arrangements. .
  • the memory 1005 as a computer-readable storage medium in FIG. 1 may include an operating system, a network communication module, and a disk performance optimization program, where the disk performance optimization program here implements any of the following embodiments Method of optimizing disk performance.
  • the network communication module is mainly used to connect to the server and perform data communication with the server; and the processor 1001 can call the disk performance optimization program stored in the memory 1005, and execute the disk performance optimization method provided in the embodiment of the present application.
  • the embodiment of the present application provides a method for optimizing disk performance.
  • FIG. 2 is a schematic flowchart of the first embodiment of the disk performance optimization method of the present application.
  • the disk performance optimization method includes:
  • Step S10 Obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial cluster size and the actual size of the cluster;
  • the cluster offset is the difference between the initial cluster size and the actual size of the cluster. After the cluster offset is obtained, the cache entry will be allocated according to the size of the cluster offset.
  • Step S20 Set flashing parameters in the cache item.
  • the flashing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, and the dirty bitmap size Used to indicate the total number of bits in the dirty bitmap for storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
  • the dirty bitmap size is the ratio of the cluster size to the dirty bit granularity.
  • the dirty bitmap, dirty bitmap size, and dirty bit granularity are preset in the Qcow2 virtual disk cache item.
  • the dirty bitmap represents the dirty data area bitmap of the cache item
  • the dirty bitmap size represents the dirty bitmap.
  • the total number of digits, the dirty bit granularity represents the amount of data in the cache item represented by each dirty bitmap.
  • the dirty bitmap represents the dirty data area bitmap of the cache item
  • the dirty bitmap size represents the total number of bits of the dirty bitmap
  • the dirty bit granularity represents the amount of data in the cache item represented by each dirty bitmap.
  • the dirty bit granularity parameter defaults to 4KB.
  • Step S30 Determine the target dirty bitmap according to the size of the dirty bitmap and the preset formula, and initialize the target dirty bitmap;
  • the preset formula is Data storage disks are based on clusters.
  • the reference count of the cluster needs to be updated.
  • the cluster index corresponds to the cluster, and the corresponding relationship can be established through mapping.
  • the cluster index is pre-deployed in In the cache item, when the number of cluster references in the cache item is zero, the cluster is released; otherwise, the reference count item is updated, and the corresponding bit in the dirty bitmap is updated to 1 according to the cluster index in the cache item.
  • the calculation method of several dirty bits is: index in cache item * total number of digits of reference count/8/granularity of dirty bits.
  • Step S40 it is judged whether the disk has received a request for flashing data
  • step S50 if the disk receives a request for flushing data, it identifies the corresponding dirty data through the target dirty bitmap, and flushes the dirty data.
  • the corresponding dirty_bit is calculated through the secondary index.
  • the specific calculation method of the dirty bit is the secondary index*8/dirty bit granularity.
  • qcow2 is called During the virtual disk data flushing process, for the updated cache item, the dirty data area that needs to be flushed is determined according to the starting file cluster offset of the cache item, the dirty bitmap, and the dirty bit granularity, and flushed to the back-end file .
  • step S50 includes:
  • Step S501 if the disk receives a request for flushing data, it is determined whether any reference count item in the reference count block has been updated, where the reference count block is a module used to record the reference count item in the disk, and the reference count item is used Bitmap with data in the record buffer;
  • the virtual disk currently has a request for flushing data, it is determined whether the number of initial cache item indexes is less than the number of cache items in the cache table.
  • step S502 if any reference count item in the reference count block is updated, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  • any reference count item in the reference count block is updated, it means that there is data in the dirty data state. If there is data in the dirty data state, it can be judged by the dirty bitmap in the cache item Which areas in the cache item are dirty, and flush the dirty areas to the file.
  • All bits of the dirty bitmap in the cache item are marked by the preset marking program, and the dirty data in the dirty bitmap in the cache item is flushed into the file, avoiding repeated flushing of data, reducing write amplification, and improving Disk performance.
  • FIG. 4 is a schematic flowchart of a second embodiment of a method for optimizing disk performance of the present application.
  • the method before step S10, the method further includes:
  • Step S60 It is judged whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index entry is used to index the historical secondary index table;
  • the purpose of judging whether the primary index item is directly usable is to determine whether the secondary index table can be directly loaded from the file through the cluster offset of the secondary index table indicated in the primary index item, because for the second
  • the level index table there are several situations for the level index table to consider: (1) Active primary index entry (ie, primary index table used for real-time reading and writing), where the secondary index table is directly available, that is, the secondary index table has been allocated and It is not indexed by the first-level index entries of other snapshots; (2) Allocated but also indexed by entries in the first-level index tables of other snapshots; (3) Not allocated, the first-level index entry is 0 at this time.
  • step S70 if the primary index entry is indexed into the historical secondary index table, the historical secondary index table is loaded into the cache entry.
  • each primary index item is 8 bytes, that is, 64 bits, the highest bit indicates whether the index item is directly usable, and the 0th to 55th bits, that is, the lower 56 bits, indicate the cluster offset of the secondary index table. The highest bit indicates that the index item is directly available, and the secondary index table is loaded from the file into the cache.
  • step S10 it further includes:
  • Step S90 index the target secondary index table through the primary index item
  • Step S100 Allocate clusters for the target secondary index table.
  • the secondary index mechanism is adopted, so it is necessary to index to the target secondary index table according to the preset mapping relationship between the primary index item and the target secondary index table, which is the target secondary index table
  • each secondary index item is 64 bits, and the highest bit is 1 to indicate that it is directly available.
  • the cluster needs to allocate a new cluster.
  • the qcow2 virtual disk has a parent volume, data needs to be read from the parent volume, and data needs to be copied from the original cluster when the cluster is indexed by other snapshots.
  • the offset of the secondary index table cluster indicated by the primary index entry is all 0, it means that the secondary index table has not been allocated, that is, there is no historical secondary index table. If it is not all 0, it means that there is a historical secondary Level index table; when the primary index table entry indicates that the offset of the secondary index table cluster is not all 0, the old secondary index table needs to be copied.
  • the method further includes:
  • Step S110 judging whether the cluster is directly available
  • Step S120 if the clusters are directly available, calculate the number of available clusters
  • the calculation method is:
  • the requested secondary index is the starting secondary index
  • step S110 includes:
  • Step S1101 Obtain a starting secondary index entry according to the target secondary index table, where the target secondary index table and the starting secondary index entry have a preset mapping relationship;
  • Step S1102 judging whether the highest bit of the cluster is a preset value according to the initial secondary index entry
  • step S1103 if the highest bit of the initial secondary index entry is a preset value, it is determined that the cluster is directly available.
  • each secondary index item is 64 bits. If the highest bit is 1, it means that it is directly available. At this time, there is no need to allocate a new cluster. If the highest bit is 0, it means that a new cluster needs to be allocated. There are also two situations when a new cluster needs to be allocated. One is that the cluster is not allocated, and the secondary index entries are all 0s. The other is that the cluster is indexed by other snapshots. In both cases, write copy is required. When the cluster is not allocated When the qcow2 virtual disk has a parent volume, data needs to be read from the parent volume, and data needs to be copied from the original cluster when the cluster is indexed by other snapshots.
  • step S120 includes:
  • Step S1201 calculate separately and The value of to determine the The value of the Whether the values of are equal, where P is the cluster offset, L is the preset length of the cluster, B is the actual size of the cluster, and N is the number of secondary index entries in the cluster;
  • Step S1202 if And the value of If the value of is not equal, the number of secondary index entries in the cluster is subtracted by 1 to obtain the number of directly available clusters.
  • the preset length of the cluster is preset.
  • the preset length of the cluster can be preset to 64KB. If the actual size of the cluster is 64KB, the number of clusters with a length of 64KB is 1.
  • the cluster bias of the secondary index table Shift the starting cluster offset of the allocated clusters and the number of consecutively allocated clusters, update the secondary index entries in the secondary index cache entries and record the historical secondary index entries, and update the cache entries according to the updated secondary index cache entries Dirty bit, release the cluster represented by the historical secondary index entry (ie dereference), that is, decrement the reference count of the listed cluster by one.
  • All bits of the dirty bitmap in the cache item are marked by the preset marking program, and the dirty data in the dirty bitmap in the cache item is flushed into the file, avoiding repeated flushing of data, reducing write amplification, and improving Disk performance.
  • FIG. 5 is a schematic diagram of functional modules of an embodiment of the disk performance optimization apparatus of the present application.
  • the disk performance optimization device includes:
  • the obtaining module 10 is configured to obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
  • the setting module 20 is configured to set flushing parameters in the cache item.
  • the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the actual size of the cluster and the dirty bitmap.
  • the ratio of the granularity, the size of the dirty bitmap is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the granularity of the dirty bit is used to indicate the amount of data represented by each bit;
  • the dirty bitmap allocating module 30 is configured to determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula and initialize the target dirty bitmap;
  • the data flashing judgment module 40 is used to judge whether the disk has received a request for flashing data
  • the dirty data identification module 50 is configured to, if the disk receives the request for flushing data, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
  • the dirty data identification module 30 includes:
  • the reference count item determining unit is configured to determine whether any reference count item in the reference count block has been updated if the disk receives a request for flushing data, wherein the reference count block is used to record references in the disk A module for counting items, where the reference counting item is used to record a bitmap with data buffered;
  • the target dirty bitmap identification unit is configured to, if any reference count item in the reference count block is updated, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
  • the disk performance optimization device further includes:
  • the historical secondary index table index judgment module is used to judge whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index Item is used to index the historical secondary index table;
  • the loading module is configured to load the historical secondary index table into the cache entry if the primary index entry is indexed into the historical secondary index table.
  • the disk performance optimization device further includes:
  • the target secondary index table index module is used to index the target secondary index table through the primary index item
  • the secondary index table allocating cluster module is used for allocating clusters for the target secondary index table.
  • the disk performance optimization device further includes:
  • the cluster directly usable judgment module is used to judge whether the cluster is directly usable
  • the calculation module is used to calculate the number of directly available clusters if the clusters are directly available.
  • the cluster directly usable judging module includes:
  • a starting secondary index entry acquiring unit configured to acquire a starting secondary index entry according to a target secondary index table, wherein the target secondary index table and the starting secondary index entry have a preset mapping relationship;
  • the highest bit determination unit of the cluster is configured to determine whether the highest bit of the cluster is a preset value according to the initial secondary index entry;
  • the cluster directly available determining unit is configured to determine that the cluster is directly available if the highest bit of the initial secondary index entry is a preset value.
  • the calculation module includes the following units:
  • the number of directly available clusters obtains the unit, which is used if And the value of If the value of is not equal, the number of secondary index entries in the cluster is subtracted by 1 to obtain the number of directly available clusters.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be non-volatile or volatile.
  • a disk performance optimization program is stored on the computer-readable storage medium, and the disk performance optimization program is executed by a processor to implement the steps of the disk performance optimization method described in any of the above embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The present application relates to the technical field of clouds and is applied to artificial intelligence, and discloses a disk performance optimization method comprising the following steps: acquiring a cluster offset, and allocating a cache item on the basis of the cluster offset, the cluster offset being the difference between the initial size of a cluster and the actual size of the cluster; configuring a flash parameter within the cache item, the flash parameter comprising dirty bit granularity and dirty bit map size; determining a target dirty bit map according to the dirty bit map size and a preset formula and initializing the target dirty bit map; determining whether a disk has received a request for flashing data; and if the disk has received a request for flashing data, then identifying corresponding dirty data by means of the target dirty bit map, and flashing the dirty data. Further disclosed by the present application are a disk performance optimization apparatus and device, and a computer readable storage medium. The disk performance optimization method provided by the present application improves the performance of a disk.

Description

磁盘性能优化方法、装置、设备及计算机可读存储介质Disk performance optimization method, device, equipment and computer readable storage medium
本申请要求于2020年03月05日提交中国专利局、申请号为202010146235.7、发明名称为“磁盘性能优化方法、装置、设备及计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on March 5, 2020, the application number is 202010146235.7, and the invention title is "Disk performance optimization methods, devices, equipment, and computer-readable storage media", and its entire content Incorporated in the application by reference.
技术领域Technical field
本申请涉及缓存数据分配技术领域,应用于人工智能,尤其涉及一种磁盘性能优化方法、装置、设备及计算机可读存储介质。This application relates to the technical field of cache data distribution, and is applied to artificial intelligence, and in particular to a method, device, device, and computer-readable storage medium for optimizing disk performance.
背景技术Background technique
现有技术中,由于主机端写入数据序列的差异,会产生冷热数据。冷数据被更新的频率很低,其所占用的块block被擦写的次数很少,而热数据所占用的块被擦写的次数很多。发明人意识到,如果不做特殊的磨损均衡处理,热数据占用的块被频繁使用,将提前到达其寿命。因此,需要不断地把冷数据搬移到擦写次数较多的块上,而将热数据写入到擦除次数较少的块上,达到磨损均衡的效果,这样做的结果势必会增加搬移数据的次数,从而产生写入放大现象,从而导致虚拟磁盘的性能下降。In the prior art, due to the difference in the data sequence written by the host, hot and cold data will be generated. The frequency of cold data being updated is very low, the block occupied by it is rarely erased, and the block occupied by hot data is erased many times. The inventor realizes that if special wear leveling is not done, blocks occupied by hot data are frequently used and will reach their lifespan earlier. Therefore, it is necessary to continuously move cold data to blocks with more erasing times, and write hot data to blocks with fewer erasing times to achieve the effect of wear leveling. The result of this will inevitably increase the number of data moved. The number of times, resulting in the phenomenon of write amplification, resulting in the performance of the virtual disk degraded.
同时,发明人发现,只要缓存项中存在项的更新,那么在缓存时就会整块地写入文件,以簇大小为4M为例,假设用户随机写4K,当随机写4K的区域要分配新的簇时,这些写操作会引起4M大小的二级索引表缓存项的刷写和4M大小的引用计数表缓存项的刷写,额外带来8M的元数据写入放大。从而导致虚拟磁盘的实际使用空间变少,性能下降。At the same time, the inventor found that as long as there is an item update in the cache item, the file will be written in a whole block during the cache. Taking the cluster size of 4M as an example, assuming that the user writes 4K randomly, when the random write 4K area needs to be allocated In the case of a new cluster, these write operations will cause the flushing of 4M secondary index table cache entries and the flushing of 4M reference counting table cache entries, and an additional 8M metadata write amplification. As a result, the actual used space of the virtual disk decreases and performance decreases.
发明内容Summary of the invention
本申请的主要目的在于提供一种磁盘性能优化方法、装置、设备及计算机可读存储介质,旨在解决磁盘性能低的技术问题。The main purpose of this application is to provide a method, device, device, and computer-readable storage medium for optimizing disk performance, aiming to solve the technical problem of low disk performance.
为实现上述目的,本申请提供一种磁盘性能优化方法,所述磁盘性能优化方法包括以下步骤:To achieve the above objective, the present application provides a method for optimizing disk performance. The method for optimizing disk performance includes the following steps:
获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;Acquiring a cluster offset, and allocating a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;Set flushing parameters in the cache entry, the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;Determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
判断磁盘是否接收到刷写数据的请求;Determine whether the disk has received a request for flashing data;
若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If the disk receives the request for flushing data, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
进一步地,为实现上述目的,本申请还提供一种磁盘性能优化装置,所述磁盘性能优化装置包括以下模块:Further, in order to achieve the above object, the present application also provides a disk performance optimization device, the disk performance optimization device includes the following modules:
获取模块,用于获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;An obtaining module, configured to obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
设置模块,用于在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大 小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;The setting module is used to set flashing parameters in the cache item, the flashing parameters including dirty bit granularity and dirty bitmap size, wherein the dirty bitmap size is equal to the actual size of the cluster and the dirty bit granularity The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
脏位位图分配模块,用于根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;A dirty bitmap allocation module, configured to determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
刷写数据判断模块,用于判断磁盘是否接收到刷写数据的请求;The flashing data judgment module is used to judge whether the disk has received a request for flashing data;
脏数据识别模块,用于若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。The dirty data identification module is configured to, if the disk receives the request for flushing data, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
进一步地,为实现上述目的,本申请还提供一种磁盘性能优化设备,所述磁盘性能优化设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的磁盘性能优化程序,所述磁盘性能优化程序被所述处理器执行时实现如下所述磁盘性能优化方法的步骤,包括:Further, in order to achieve the above object, the present application also provides a disk performance optimization device, the disk performance optimization device includes a memory, a processor, and a disk performance optimization device that is stored in the memory and can run on the processor. A program that, when the disk performance optimization program is executed by the processor, implements the steps of the disk performance optimization method as described below, including:
获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;Acquiring a cluster offset, and allocating a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;Set flushing parameters in the cache entry, the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;Determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
判断磁盘是否接收到刷写数据的请求;Determine whether the disk has received a request for flashing data;
若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If the disk receives the request for flushing data, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有磁盘性能优化程序,所述磁盘性能优化程序被处理器执行实现如下所述的磁盘性能优化方法的步骤,包括:Further, in order to achieve the above-mentioned object, the present application also provides a computer-readable storage medium having a disk performance optimization program stored on the computer-readable storage medium, and the disk performance optimization program is executed by a processor to achieve the following The steps of the disk performance optimization method include:
获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;Acquiring a cluster offset, and allocating a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;Set flushing parameters in the cache entry, the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;Determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
判断磁盘是否接收到刷写数据的请求;Determine whether the disk has received a request for flashing data;
若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If the disk receives the request for flushing data, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
本申请通过预置标记程序标记所述缓存项中脏位位图的所有位,以及将所述缓存项中脏位位图中的脏数据刷写入文件中,避免重复刷写数据,读写数据的最小单位是页page,1page一般为4KB,而擦除的数据的最小单位是块block,1block为64页,即256KB,理想状态下,写入主存多少数据,也要写入闪存多少数据,但是在实际场景中,还要在计算上写出脏数据的量,即数据在写入的时候要消耗磁盘性能,写出时候还要消耗磁盘性能,因此造成了写放大,写放大指的是实际写入的数据量与应当写入的数据量的比值,例如,应当写入的4KB,实际写入是8KB(写入的时候是4KB,若是脏数据,还要将4KB的脏数据擦除,因此是8KB,但是擦除的最小单位是256KB)。本申请对脏数据进行识别,仅刷写脏数据,避免将所有的数据都进行刷写,减小了写放大,提高了磁盘性能。This application uses a preset marking program to mark all bits of the dirty bitmap in the cache item, and flush the dirty data in the dirty bitmap in the cache item to the file, avoiding repeated data flushing, reading and writing The smallest unit of data is page page, 1page is generally 4KB, and the smallest unit of erased data is block, 1block is 64 pages, that is, 256KB, ideally, how much data is written to the main memory and how much to write to the flash memory Data, but in the actual scenario, the amount of dirty data must be written out in calculations, that is, the data consumes disk performance when writing, and it consumes disk performance when writing, thus causing write amplification and write amplification. Is the ratio of the amount of data actually written to the amount of data that should be written, for example, 4KB that should be written, 8KB actually written (4KB when writing, if it is dirty data, 4KB of dirty data Erase, so it is 8KB, but the smallest unit of erase is 256KB). This application recognizes dirty data, only flushes dirty data, avoids flushing all data, reduces write amplification, and improves disk performance.
附图说明Description of the drawings
图1为本申请实施例方案涉及的磁盘性能优化设备运行环境的结构示意图;FIG. 1 is a schematic structural diagram of an operating environment of a disk performance optimization device related to a solution of an embodiment of the application;
图2为本申请磁盘性能优化方法的第一实施例的流程示意图;FIG. 2 is a schematic flowchart of a first embodiment of a method for optimizing disk performance of this application;
图3为图2中步骤S50的一个实施例的细化流程示意图;FIG. 3 is a detailed flowchart of an embodiment of step S50 in FIG. 2;
图4为本申请磁盘性能优化方法的第二实施例的流程示意图;4 is a schematic flowchart of a second embodiment of a method for optimizing disk performance according to this application;
图5为本申请磁盘性能优化装置的一个实施例的功能模块示意图。FIG. 5 is a schematic diagram of functional modules of an embodiment of an apparatus for optimizing disk performance of the present application.
具体实施方式Detailed ways
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described here are only used to explain the application, and are not used to limit the application.
本申请实施例涉及的磁盘性能优化方法主要应用于磁盘性能优化设备,该磁盘性能优化设备可以是PC、便携计算机、移动终端等具有显示和处理功能的设备。The disk performance optimization method involved in the embodiments of the present application is mainly applied to a disk performance optimization device, and the disk performance optimization device may be a device with display and processing functions such as a PC, a portable computer, and a mobile terminal.
参照图1,图1为本申请实施例方案中涉及的磁盘性能优化设备的硬件结构示意图。本申请实施例中,磁盘性能优化设备可以包括处理器1001(例如CPU),通信总线1002,用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信;用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard);网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口);存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器,存储器1005可选的还可以是独立于前述处理器1001的存储装置。Referring to FIG. 1, FIG. 1 is a schematic diagram of the hardware structure of the disk performance optimization device involved in the solution of the embodiment of the application. In the embodiment of the present application, the disk performance optimization device may include a processor 1001 (for example, a CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components; the user interface 1003 may include a display (Display), an input unit such as a keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a wireless interface (Such as WI-FI interface); the memory 1005 can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a disk memory. The memory 1005 can optionally be a storage device independent of the aforementioned processor 1001 .
本领域技术人员可以理解,图1中示出的硬件结构并不构成对磁盘性能优化设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the hardware structure shown in FIG. 1 does not constitute a limitation on the disk performance optimization device, and may include more or less components than shown in the figure, or a combination of certain components, or different component arrangements. .
继续参照图1,图1中作为一种计算机可读存储介质的存储器1005可以包括操作系统、网络通信模块以及磁盘性能优化程序,其中,这里的磁盘性能优化程序实现的是下述任一个实施例的磁盘性能优化方法。Continuing to refer to FIG. 1, the memory 1005 as a computer-readable storage medium in FIG. 1 may include an operating system, a network communication module, and a disk performance optimization program, where the disk performance optimization program here implements any of the following embodiments Method of optimizing disk performance.
在图1中,网络通信模块主要用于连接服务器,与服务器进行数据通信;而处理器1001可以调用存储器1005中存储的磁盘性能优化程序,并执行本申请实施例提供的磁盘性能优化方法。In FIG. 1, the network communication module is mainly used to connect to the server and perform data communication with the server; and the processor 1001 can call the disk performance optimization program stored in the memory 1005, and execute the disk performance optimization method provided in the embodiment of the present application.
本申请实施例提供了一种磁盘性能优化方法。The embodiment of the present application provides a method for optimizing disk performance.
参照图2,图2为本申请磁盘性能优化方法的第一实施例的流程示意图。本实施例中,磁盘性能优化方法包括:Referring to FIG. 2, FIG. 2 is a schematic flowchart of the first embodiment of the disk performance optimization method of the present application. In this embodiment, the disk performance optimization method includes:
步骤S10,获取簇偏移,基于簇偏移分配缓存项,簇偏移为初始簇大小和簇的实际大小的差值;Step S10: Obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial cluster size and the actual size of the cluster;
本实施例中,簇偏移为初始簇大小和簇的实际大小的差值,在获取到簇偏移后,会根据簇偏移的大小分配缓存项。In this embodiment, the cluster offset is the difference between the initial cluster size and the actual size of the cluster. After the cluster offset is obtained, the cache entry will be allocated according to the size of the cluster offset.
步骤S20,在缓存项内设置刷写参数,刷写参数包括脏位粒度和脏位位图大小,其中,脏位位图大小等于簇的实际大小与脏位粒度的比值,脏位位图大小用于指示存储脏数据的脏位位图的总位数,脏位粒度用于指示每一个位表示的数据量;Step S20: Set flashing parameters in the cache item. The flashing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, and the dirty bitmap size Used to indicate the total number of bits in the dirty bitmap for storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
本实施例中,脏位位图大小为簇大小与脏位粒度的比值,在根据脏位位图大小和预置公式确定目标脏位位图并初始化目标脏位位图时,预置公式为:目标脏位位图=脏位位图大小/8。可以通过监控写入块内的数据的数量来作为是否需要刷写数据的依据,例如,数据量占块空间的50%时,则说明存在刷写数据的请求。In this embodiment, the dirty bitmap size is the ratio of the cluster size to the dirty bit granularity. When the target dirty bitmap is determined according to the dirty bitmap size and a preset formula and the target dirty bitmap is initialized, the preset formula is : Target dirty bitmap = dirty bitmap size/8. The amount of data written in the block can be monitored as a basis for whether data needs to be flushed. For example, when the amount of data occupies 50% of the block space, it indicates that there is a request for flushing data.
在Qcow2虚拟磁盘缓存项中预先设置脏位位图、脏位位图大小、脏位粒度,其中,脏位位图表示缓存项的脏数据区域位图,脏位位图大小表示脏位位图的总位数,脏位粒度代表每一位脏位位图表示的缓存项中数据量。其中,脏位位图表示缓存项的脏数据区域位图,脏位位图大小表示脏位位图的总位数,脏位粒度代表每一位脏位位图表示的缓存项中数据量,脏位粒度参数默认为4KB。The dirty bitmap, dirty bitmap size, and dirty bit granularity are preset in the Qcow2 virtual disk cache item. Among them, the dirty bitmap represents the dirty data area bitmap of the cache item, and the dirty bitmap size represents the dirty bitmap. The total number of digits, the dirty bit granularity represents the amount of data in the cache item represented by each dirty bitmap. Among them, the dirty bitmap represents the dirty data area bitmap of the cache item, the dirty bitmap size represents the total number of bits of the dirty bitmap, and the dirty bit granularity represents the amount of data in the cache item represented by each dirty bitmap. The dirty bit granularity parameter defaults to 4KB.
为qcow2虚拟磁盘设置新增缓存项脏位粒度参数,其中,参数默认为4KB。Set a new cache entry dirty bit granularity parameter for the qcow2 virtual disk, where the parameter defaults to 4KB.
步骤S30,根据脏位位图大小和预置公式确定目标脏位位图并初始化目标脏位位图;Step S30: Determine the target dirty bitmap according to the size of the dirty bitmap and the preset formula, and initialize the target dirty bitmap;
本实施例中,预置公式为
Figure PCTCN2020099512-appb-000001
数据存储磁盘时是以簇为单位的,在分配簇及释放簇时,需要更新簇的引用计数,根据相应簇索引,簇索引与簇相对应,可以通过映射建立对应关系,簇索引预先部署于缓存项中,当缓存项中的簇引用次数为零时,则将簇释放,否则,更新引用计数项,根据缓存项中的簇索引更新脏位位图中的相应的位为1,具体第几个脏位的计算方法为:缓存项中索引*引用计数总位数/8/脏位粒度。
In this embodiment, the preset formula is
Figure PCTCN2020099512-appb-000001
Data storage disks are based on clusters. When clusters are allocated and released, the reference count of the cluster needs to be updated. According to the corresponding cluster index, the cluster index corresponds to the cluster, and the corresponding relationship can be established through mapping. The cluster index is pre-deployed in In the cache item, when the number of cluster references in the cache item is zero, the cluster is released; otherwise, the reference count item is updated, and the corresponding bit in the dirty bitmap is updated to 1 according to the cluster index in the cache item. The calculation method of several dirty bits is: index in cache item * total number of digits of reference count/8/granularity of dirty bits.
步骤S40,判断磁盘是否接收到刷写数据的请求;Step S40, it is judged whether the disk has received a request for flashing data;
步骤S50,若磁盘接收到刷写数据的请求,则通过目标脏位位图识别对应的脏数据,并对脏数据进行刷写。In step S50, if the disk receives a request for flushing data, it identifies the corresponding dirty data through the target dirty bitmap, and flushes the dirty data.
本实施例中,对于簇写后更新二级索引表缓存项表项,通过二级索引计算相应dirty_bit,具体第几个脏位的计算方法为二级索引*8/脏位粒度,当调用qcow2虚拟磁盘数据刷写流程时,对于被更新缓存项,根据该缓存项的起始文件簇偏移,脏位位图,脏位粒度求需要刷写的脏数据区域,刷写到后端文件中。In this embodiment, for the secondary index table cache entry after the cluster is written, the corresponding dirty_bit is calculated through the secondary index. The specific calculation method of the dirty bit is the secondary index*8/dirty bit granularity. When qcow2 is called During the virtual disk data flushing process, for the updated cache item, the dirty data area that needs to be flushed is determined according to the starting file cluster offset of the cache item, the dirty bitmap, and the dirty bit granularity, and flushed to the back-end file .
通过位图标记缓存项中脏位位图的所有位,以及将缓存项中脏位位图中的脏数据刷写入文件中,避免重复刷写数据,读写数据的最小单位是页page,1page一般为4KB,而擦除的数据的最小单位是块block,1block为64页,即256KB,理想状态下,写入主存多少数据,也要写入闪存多少数据,但是在实际场景中,还要在计算上写出脏数据的量,即数据在写入的时候要消耗磁盘性能,写出时候还要消耗磁盘性能,因此造成了写放大,写放大指的是实际写入的数据量与应当写入的数据量的比值,例如,应当写入的4KB,实际写入是8KB(写入的时候是4KB,若是脏数据,还要将4KB的脏数据擦除,因此是8KB,但是擦除的最小单位是256KB)。本申请对脏数据进行识别,仅刷写脏数据,避免对所有的数据都进行刷写,减小了写放大,提高了磁盘性能。Mark all the bits of the dirty bitmap in the cache item with a bitmap, and flush the dirty data in the dirty bitmap of the cache item into the file to avoid repeated flushing of data. The smallest unit for reading and writing data is page. 1page is generally 4KB, and the smallest unit of erased data is a block, and 1block is 64 pages, that is, 256KB. In an ideal state, how much data is written to the main memory and how much data must be written to the flash memory, but in actual scenarios, The amount of dirty data must also be written out in calculations, that is, the data consumes disk performance when writing, and disk performance when writing, which causes write amplification, which refers to the amount of data actually written The ratio of the amount of data that should be written, for example, the 4KB that should be written, the actual write is 8KB (4KB when writing, if it is dirty data, the dirty data of 4KB must be erased, so it is 8KB, but The smallest unit of erasing is 256KB). This application recognizes dirty data, only flushes dirty data, avoids flushing all data, reduces write amplification, and improves disk performance.
参照图3,图3为图2中步骤S50的一个实施例的细化流程示意图。本实施例中,步骤S50包括:Referring to FIG. 3, FIG. 3 is a detailed flowchart of an embodiment of step S50 in FIG. 2. In this embodiment, step S50 includes:
步骤S501,若磁盘接收到刷写数据的请求,则判断引用计数块中的任一引用计数项是否发生更新,其中,引用计数块为磁盘中用于记录引用计数项的模块,引用计数项用于记录缓存有数据的位图;Step S501, if the disk receives a request for flushing data, it is determined whether any reference count item in the reference count block has been updated, where the reference count block is a module used to record the reference count item in the disk, and the reference count item is used Bitmap with data in the record buffer;
本实施例中,若虚拟磁盘当前存在刷写数据的请求,则判断初始缓存项索引个数是否小于缓存表中缓存项个数。In this embodiment, if the virtual disk currently has a request for flushing data, it is determined whether the number of initial cache item indexes is less than the number of cache items in the cache table.
步骤S502,若引用计数块中的任一引用计数项发生更新,则通过目标脏位位图识别对应的脏数据,并对脏数据进行刷写。In step S502, if any reference count item in the reference count block is updated, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
本实施例中,若引用计数块中的任一引用计数项发生更新,则说明有处于脏数据状态的数据,若存在处于脏数据状态的数据,则可通过缓存项中的脏位位图判断缓存项中哪些区域为脏,将脏的区域刷写到文件中。In this embodiment, if any reference count item in the reference count block is updated, it means that there is data in the dirty data state. If there is data in the dirty data state, it can be judged by the dirty bitmap in the cache item Which areas in the cache item are dirty, and flush the dirty areas to the file.
通过预置标记程序标记缓存项中脏位位图的所有位,以及将缓存项中脏位位图中的脏数据刷写入文件中,避免重复刷写数据,减小了写放大,提高了磁盘性能。All bits of the dirty bitmap in the cache item are marked by the preset marking program, and the dirty data in the dirty bitmap in the cache item is flushed into the file, avoiding repeated flushing of data, reducing write amplification, and improving Disk performance.
参照图4,图4为本申请磁盘性能优化方法的第二实施例的流程示意图。本实施例中,在步骤S10之前,还包括:Referring to FIG. 4, FIG. 4 is a schematic flowchart of a second embodiment of a method for optimizing disk performance of the present application. In this embodiment, before step S10, the method further includes:
步骤S60,判断一级索引项是否索引到历史二级索引表,一级索引项与历史二级索引表存在预置映射关系,一级索引项用于索引历史二级索引表;Step S60: It is judged whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index entry is used to index the historical secondary index table;
本实施例中,判断一级索引项是否直接可用目的是,判断是否可以通过一级索引项中 所表示的二级索引表的簇偏移,直接从文件中加载二级索引表,因为对于二级索引表有以下几种情况需要考虑:(1)活动一级索引表项(即实时读写所用一级索引表),其中,二级索引表直接可用,即该二级索引表已分配且不被其他快照一级索引表项索引到;(2)已分配但也被其他快照中一级索引表中表项索引;(3)未分配,此时一级索引项为0。In this embodiment, the purpose of judging whether the primary index item is directly usable is to determine whether the secondary index table can be directly loaded from the file through the cluster offset of the secondary index table indicated in the primary index item, because for the second There are several situations for the level index table to consider: (1) Active primary index entry (ie, primary index table used for real-time reading and writing), where the secondary index table is directly available, that is, the secondary index table has been allocated and It is not indexed by the first-level index entries of other snapshots; (2) Allocated but also indexed by entries in the first-level index tables of other snapshots; (3) Not allocated, the first-level index entry is 0 at this time.
步骤S70,若一级索引项索引到历史二级索引表,则将历史二级索引表加载至缓存项中。In step S70, if the primary index entry is indexed into the historical secondary index table, the historical secondary index table is loaded into the cache entry.
本实施例中,每个一级索引项为8字节,即64位,最高位表示该索引项是否直接可用,第0到55位即低的56位表示二级索引表簇偏移,若最高位表示该索引项直接可用,则从文件中将二级索引表加载到缓存中。In this embodiment, each primary index item is 8 bytes, that is, 64 bits, the highest bit indicates whether the index item is directly usable, and the 0th to 55th bits, that is, the lower 56 bits, indicate the cluster offset of the secondary index table. The highest bit indicates that the index item is directly available, and the secondary index table is loaded from the file into the cache.
将缓存项全部写0代表的是由二级索引表索引的簇尚未分配。因为qcow2是支持写时分配的,即写到具体位置才会分配簇。到这一步骤为止,要写的簇还未分配,只是到达分配二级索引表簇阶段,因此要先把二级索引表全部写0。预先设置通过预置标记程序标记缓存项中脏位位图的所有位,以及将缓存项中脏位位图中的脏数据刷写入文件中的规则,将缓存项中相应的脏位位图,标记为1是通过程序自动标识而实现的,因为这一方案已经将缓存项刷写流程更改为根据缓存项脏位位图进行刷写。通过预置标记程序标记缓存项中脏位位图的所有位,以及将缓存项中脏位位图中的脏数据刷写入文件中,避免重复刷写数据,减小了写放大,提高了磁盘性能。Writing all 0s to the cache entries means that the clusters indexed by the secondary index table have not been allocated. Because qcow2 supports allocation on writing, that is, clusters are allocated only when they are written to a specific location. Up to this step, the cluster to be written has not been allocated, but has reached the stage of allocating the secondary index table cluster, so the secondary index table must be written to all 0 first. Pre-set the rules for marking all the bits of the dirty bitmap in the cache item through the preset marking program, and flushing the dirty data in the dirty bitmap of the cache item into the file, and then the corresponding dirty bitmap in the cache item , Marked as 1 is achieved through automatic program identification, because this scheme has changed the cache item flushing process to flush according to the dirty bitmap of the cache item. All bits of the dirty bitmap in the cache item are marked by the preset marking program, and the dirty data in the dirty bitmap in the cache item is flushed into the file, avoiding repeated flushing of data, reducing write amplification, and improving Disk performance.
以下为本申请磁盘性能优化方法的第三个实施例。本实施例中,在步骤S10,之前,还包括:The following is the third embodiment of the method for optimizing disk performance of this application. In this embodiment, before step S10, it further includes:
步骤S90,通过一级索引项索引目标二级索引表;Step S90, index the target secondary index table through the primary index item;
步骤S100,为所述目标二级索引表分配簇。Step S100: Allocate clusters for the target secondary index table.
本实施例中,采用二级索引机制,因此需要根据预先设置好的一级索引项与目标二级索引表之间的映射关系,索引到目标二级索引表,为所述目标二级索引表分配簇,每一个二级索引项为64位,最高位为1表示直接可用,此时无须分配新的簇,否则,表示需要分配新的簇。簇需要分配新的簇也有两种情况,一种是簇未分配,此时二级索引项为全0,一种是簇被其他快照索引,这两种情况都要做写拷贝,簇未分配时在该qcow2虚拟磁盘存在母卷时需要从母卷中读取数据,簇被其他快照索引时需要从原簇中拷贝数据。In this embodiment, the secondary index mechanism is adopted, so it is necessary to index to the target secondary index table according to the preset mapping relationship between the primary index item and the target secondary index table, which is the target secondary index table To allocate clusters, each secondary index item is 64 bits, and the highest bit is 1 to indicate that it is directly available. At this time, there is no need to allocate a new cluster, otherwise, it means that a new cluster needs to be allocated. The cluster needs to allocate a new cluster. There are also two situations. One is that the cluster is not allocated, and the secondary index entries are all 0s. The other is that the cluster is indexed by other snapshots. In both cases, write copy is required, and the cluster is not allocated. When the qcow2 virtual disk has a parent volume, data needs to be read from the parent volume, and data needs to be copied from the original cluster when the cluster is indexed by other snapshots.
本实施例中,若一级索引项表示的二级索引表簇偏移全0,则表示二级索引表未分配过,即不存在历史二级索引表,若非全0,则表示存在历史二级索引表;当一级索引表项表示二级索引表簇偏移非全0时,则需要拷贝旧的二级索引表。In this embodiment, if the offset of the secondary index table cluster indicated by the primary index entry is all 0, it means that the secondary index table has not been allocated, that is, there is no historical secondary index table. If it is not all 0, it means that there is a historical secondary Level index table; when the primary index table entry indicates that the offset of the secondary index table cluster is not all 0, the old secondary index table needs to be copied.
以下为本申请磁盘性能优化方法的第四个实施例。本实施例中,在步骤S20之后,还包括:The following is the fourth embodiment of the disk performance optimization method of this application. In this embodiment, after step S20, the method further includes:
步骤S110,判断簇是否直接可用;Step S110, judging whether the cluster is directly available;
步骤S120,若簇直接可用,则计算可用簇的数量,Step S120, if the clusters are directly available, calculate the number of available clusters,
本实施例中,计算方法为:In this embodiment, the calculation method is:
(1)所求二级索引为起始二级索引;(1) The requested secondary index is the starting secondary index;
(2)求终点二级索引,若(簇偏移+长度)/(簇大小*簇内二级索引项个数)等于(簇偏移/(簇大小*簇内二级索引项个数)),表示此次要写整个区域的簇都能通过相同的二级索引表索引,终点二级索引=((簇偏移+长度)/簇大小)%(二级索引项),否则终点二级索引项为簇内二级索引项数量减1;(2) Find the end point secondary index, if (cluster offset + length)/(cluster size*number of secondary index items in cluster) is equal to (cluster offset/(cluster size*number of secondary index items in cluster) ), which means that the clusters in the entire area to be written this time can be indexed through the same secondary index table, the end secondary index = ((cluster offset + length)/cluster size)% (secondary index item), otherwise the end 2 The level index entry is the number of secondary index entries in the cluster minus one;
(3)令索引为起始二级索引加1,连续簇数量为1,至索引最大值为所求终点索引,若所求二级索引项置了直接可用标志且所表簇偏移为前一索引项所表簇偏移加簇大小,则连续簇加1,否则,可写长度为MIN((连续簇数量*簇大小–簇偏移簇内簇偏移),长 度),其中,簇偏移簇内簇偏移=簇偏移%簇大小,文件中簇偏移为起始二级索引项所表簇文件簇偏移加簇偏移簇内簇偏移。(3) Let the index be the initial secondary index plus 1, the number of consecutive clusters is 1, and the maximum value of the index is the desired end index. If the desired secondary index item is set with the directly available flag and the table cluster offset is the previous The cluster offset of an index entry plus the cluster size, then the consecutive clusters plus 1, otherwise, the writable length is MIN ((consecutive cluster number * cluster size-cluster offset within cluster offset), length), where cluster Offset cluster offset within cluster = cluster offset% cluster size, the cluster offset in the file is the cluster file cluster offset in the starting secondary index entry plus the cluster offset cluster offset within the cluster.
以下为本申请磁盘性能优化方法的第五个实施例。本实施例中,步骤S110包括:The following is the fifth embodiment of the method for optimizing disk performance of this application. In this embodiment, step S110 includes:
步骤S1101,根据目标二级索引表获取起始二级索引项,其中,所述目标二级索引表与起始二级索引项存在预置映射关系;Step S1101: Obtain a starting secondary index entry according to the target secondary index table, where the target secondary index table and the starting secondary index entry have a preset mapping relationship;
步骤S1102,根据所述起始二级索引项判断所述簇的最高位是否为预设值;Step S1102, judging whether the highest bit of the cluster is a preset value according to the initial secondary index entry;
步骤S1103,若所述起始二级索引项的最高位为预设值,则判定所述簇直接可用。In step S1103, if the highest bit of the initial secondary index entry is a preset value, it is determined that the cluster is directly available.
本实施例中,每一个二级索引项为64位,若是最高位为1,则表示直接可用,此时无须分配新的簇,若最高位为0,则表示需要分配新的簇。需要分配新的簇也有两种情况,一种是簇未分配,此时二级索引项为全0,一种是簇被其他快照索引,这两种情况都要做写拷贝,簇未分配时在该qcow2虚拟磁盘存在母卷时需要从母卷中读取数据,簇被其他快照索引时需要从原簇中拷贝数据。In this embodiment, each secondary index item is 64 bits. If the highest bit is 1, it means that it is directly available. At this time, there is no need to allocate a new cluster. If the highest bit is 0, it means that a new cluster needs to be allocated. There are also two situations when a new cluster needs to be allocated. One is that the cluster is not allocated, and the secondary index entries are all 0s. The other is that the cluster is indexed by other snapshots. In both cases, write copy is required. When the cluster is not allocated When the qcow2 virtual disk has a parent volume, data needs to be read from the parent volume, and data needs to be copied from the original cluster when the cluster is indexed by other snapshots.
以下为步骤S120的细化流程。本实施例中,步骤S120包括:The following is a detailed flow of step S120. In this embodiment, step S120 includes:
步骤S1201,分别计算
Figure PCTCN2020099512-appb-000002
Figure PCTCN2020099512-appb-000003
的值,判断所述
Figure PCTCN2020099512-appb-000004
的值与所述
Figure PCTCN2020099512-appb-000005
的值是否相等,其中,P为簇偏移,L为簇的预设长度,B为簇的实际大小,N为簇内二级索引项数量;
Step S1201, calculate separately
Figure PCTCN2020099512-appb-000002
and
Figure PCTCN2020099512-appb-000003
The value of to determine the
Figure PCTCN2020099512-appb-000004
The value of the
Figure PCTCN2020099512-appb-000005
Whether the values of are equal, where P is the cluster offset, L is the preset length of the cluster, B is the actual size of the cluster, and N is the number of secondary index entries in the cluster;
步骤S1202,若
Figure PCTCN2020099512-appb-000006
的值与
Figure PCTCN2020099512-appb-000007
的值不相等,则对簇内二级索引项数量进行减1操作,得到直接可用的簇的数量。
Step S1202, if
Figure PCTCN2020099512-appb-000006
And the value of
Figure PCTCN2020099512-appb-000007
If the value of is not equal, the number of secondary index entries in the cluster is subtracted by 1 to obtain the number of directly available clusters.
簇的预设长度是预先设置好的,例如,可将簇的预设长度预先设置为64KB,若簇的实际大小为64KB,则64KB长度的簇的数量为1,根据二级索引表簇偏移、所分配簇起始簇偏移和连续分配簇个数,更新二级索引缓存项中二级索引项并记录历史二级索引项,并根据被更新二级索引缓存项更新缓存项中的脏位,释放历史二级索引项所表示的簇(即解引用),即将所表簇的引用计数减1。The preset length of the cluster is preset. For example, the preset length of the cluster can be preset to 64KB. If the actual size of the cluster is 64KB, the number of clusters with a length of 64KB is 1. According to the cluster bias of the secondary index table Shift, the starting cluster offset of the allocated clusters and the number of consecutively allocated clusters, update the secondary index entries in the secondary index cache entries and record the historical secondary index entries, and update the cache entries according to the updated secondary index cache entries Dirty bit, release the cluster represented by the historical secondary index entry (ie dereference), that is, decrement the reference count of the listed cluster by one.
Qemu-kvm写qcow2虚拟磁盘时,主要有两种情形下刷写缓存:1.该qcow2虚拟磁盘禁用cache,那么每次写操作后都会有刷写二级索引表缓存(只刷被更新过的二级索引缓存项,即有新的簇被分配)和引用计数块缓存(只刷被更新过的引用计数块缓存项,即有新的簇被分配);2,客户操作系统调用FLUSH(刷缓存)操作时,会将二级索引表缓存和引用计数块缓存刷入文件。When Qemu-kvm writes a qcow2 virtual disk, there are two main situations for flushing the cache: 1. The qcow2 virtual disk disables the cache, then after each write operation, the secondary index table cache will be flushed (only the updated ones will be flushed). Secondary index cache items, that is, new clusters are allocated) and reference count block cache (only refreshed reference count block cache items, that is, new clusters are allocated); 2. The guest operating system calls FLUSH (flushing). During the cache operation, the secondary index table cache and the reference counting block cache will be flushed to the file.
对于原来的实现,只要每次缓存项中存在项的更新,那么在缓存时就会整块地写入文件,我们以簇大小为4M为例,假设用户写模型为随机写4K,当随机写4K的区域要分配新的簇时,这些写操作会引起4M大小的二级索引表缓存项的刷写和4M大小的引用计数表缓存项的刷写,额外带来8M元数据写放大。For the original implementation, as long as there is an item update in the cache item, the file will be written in a whole block during the cache. Let's take a cluster size of 4M as an example, assuming that the user write model is random write 4K, when random write When a new cluster is allocated in a 4K area, these write operations will cause the flushing of 4M secondary index table cache entries and 4M reference counting table cache entries, which will additionally cause 8M metadata write amplification.
在缓存项中加上脏位位图时,假设每个脏位表示4KB大小的区域,那么这种元数据写放大可以减少的4KB+4KB=8KB,极大地减少需分配新的簇进行写操作时带来的元数据的写放大。When adding a dirty bitmap to the cache item, assuming that each dirty bit represents a 4KB area, then this metadata write amplification can reduce 4KB+4KB=8KB, which greatly reduces the need to allocate new clusters for write operations Time to bring the write amplification of metadata.
通过预置标记程序标记缓存项中脏位位图的所有位,以及将缓存项中脏位位图中的脏数据刷写入文件中,避免重复刷写数据,减小了写放大,提高了磁盘性能。All bits of the dirty bitmap in the cache item are marked by the preset marking program, and the dirty data in the dirty bitmap in the cache item is flushed into the file, avoiding repeated flushing of data, reducing write amplification, and improving Disk performance.
参照图5,图5为本申请磁盘性能优化装置的一个实施例的功能模块示意图。本实施例中,磁盘性能优化装置包括:Referring to FIG. 5, FIG. 5 is a schematic diagram of functional modules of an embodiment of the disk performance optimization apparatus of the present application. In this embodiment, the disk performance optimization device includes:
获取模块10,用于获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始 大小与簇的实际大小之间的差值;The obtaining module 10 is configured to obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
设置模块20,用于在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;The setting module 20 is configured to set flushing parameters in the cache item. The flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the actual size of the cluster and the dirty bitmap. The ratio of the granularity, the size of the dirty bitmap is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the granularity of the dirty bit is used to indicate the amount of data represented by each bit;
脏位位图分配模块30,用于根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;The dirty bitmap allocating module 30 is configured to determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula and initialize the target dirty bitmap;
刷写数据判断模块40,用于判断磁盘是否接收到刷写数据的请求;The data flashing judgment module 40 is used to judge whether the disk has received a request for flashing data;
脏数据识别模块50,用于若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。The dirty data identification module 50 is configured to, if the disk receives the request for flushing data, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
在本实施例中,所述脏脏数据识别模块30包括:In this embodiment, the dirty data identification module 30 includes:
引用计数项判断单元,用于若所述磁盘接收到刷写数据的请求,则判断引用计数块中的任一引用计数项是否发生更新,其中,所述引用计数块为磁盘中用于记录引用计数项的模块,所述引用计数项用于记录缓存有数据的位图;The reference count item determining unit is configured to determine whether any reference count item in the reference count block has been updated if the disk receives a request for flushing data, wherein the reference count block is used to record references in the disk A module for counting items, where the reference counting item is used to record a bitmap with data buffered;
目标脏位位图识别单元,用于若引用计数块中的任一引用计数项发生更新,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。The target dirty bitmap identification unit is configured to, if any reference count item in the reference count block is updated, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
在本实施例中,所述磁盘性能优化装置还包括:In this embodiment, the disk performance optimization device further includes:
历史二级索引表索引判断模块,用于判断一级索引项是否索引到历史二级索引表,所述一级索引项与所述历史二级索引表存在预置映射关系,所述一级索引项用于索引历史二级索引表;The historical secondary index table index judgment module is used to judge whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index Item is used to index the historical secondary index table;
加载模块,用于若所述一级索引项索引到所述历史二级索引表,则将所述历史二级索引表加载至缓存项中。The loading module is configured to load the historical secondary index table into the cache entry if the primary index entry is indexed into the historical secondary index table.
在本实施例中,所述磁盘性能优化装置还包括:In this embodiment, the disk performance optimization device further includes:
目标二级索引表索引模块,用于通过一级索引项索引目标二级索引表;The target secondary index table index module is used to index the target secondary index table through the primary index item;
二级索引表分配簇模块,用于为所述目标二级索引表分配簇。The secondary index table allocating cluster module is used for allocating clusters for the target secondary index table.
可选地,所述磁盘性能优化装置还包括:Optionally, the disk performance optimization device further includes:
簇直接可用判断模块,用于判断簇是否直接可用;The cluster directly usable judgment module is used to judge whether the cluster is directly usable;
计算模块,用于若簇直接可用,则计算直接可用的簇的数量。The calculation module is used to calculate the number of directly available clusters if the clusters are directly available.
在本实施例中,所述簇直接可用判断模块包括:In this embodiment, the cluster directly usable judging module includes:
起始二级索引项获取单元,用于根据目标二级索引表获取起始二级索引项,其中,所述目标二级索引表与起始二级索引项存在预置映射关系;A starting secondary index entry acquiring unit, configured to acquire a starting secondary index entry according to a target secondary index table, wherein the target secondary index table and the starting secondary index entry have a preset mapping relationship;
簇的最高位判断单元,用于根据所述起始二级索引项判断所述簇的最高位是否为预设值;The highest bit determination unit of the cluster is configured to determine whether the highest bit of the cluster is a preset value according to the initial secondary index entry;
簇直接可用判定单元,用于若所述起始二级索引项的最高位为预设值,则判定所述簇直接可用。The cluster directly available determining unit is configured to determine that the cluster is directly available if the highest bit of the initial secondary index entry is a preset value.
在本实施例中,所述计算模块包括以下单元:In this embodiment, the calculation module includes the following units:
值是否相等判断单元,用于分别计算
Figure PCTCN2020099512-appb-000008
Figure PCTCN2020099512-appb-000009
的值,判断所述
Figure PCTCN2020099512-appb-000010
的值与所述
Figure PCTCN2020099512-appb-000011
的值是否相等,其中,P为簇偏移,L为簇的预设长度,B为簇的实际大小,N为簇内二级索引项数量;
Whether the values are equal or not judging unit, used to calculate separately
Figure PCTCN2020099512-appb-000008
and
Figure PCTCN2020099512-appb-000009
The value of to determine the
Figure PCTCN2020099512-appb-000010
The value of the
Figure PCTCN2020099512-appb-000011
Whether the values of are equal, where P is the cluster offset, L is the preset length of the cluster, B is the actual size of the cluster, and N is the number of secondary index entries in the cluster;
直接可用的簇的数量获取单元,用于若
Figure PCTCN2020099512-appb-000012
的值与
Figure PCTCN2020099512-appb-000013
的值不相等,则对簇内二级索引项数量进行减1操作,得到直接可用的簇的数量。
The number of directly available clusters obtains the unit, which is used if
Figure PCTCN2020099512-appb-000012
And the value of
Figure PCTCN2020099512-appb-000013
If the value of is not equal, the number of secondary index entries in the cluster is subtracted by 1 to obtain the number of directly available clusters.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质可以是非易失性,也可以是易失性。The present application also provides a computer-readable storage medium. The computer-readable storage medium may be non-volatile or volatile.
本实施例中,所述计算机可读存储介质上存储有磁盘性能优化程序,所述磁盘性能优化程序被处理器执行时实现如上述任一项实施例中所述的磁盘性能优化方法的步骤。In this embodiment, a disk performance optimization program is stored on the computer-readable storage medium, and the disk performance optimization program is executed by a processor to implement the steps of the disk performance optimization method described in any of the above embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above implementation manners, those skilled in the art can clearly understand that the above-mentioned embodiment method can be implemented by means of software plus the necessary general hardware platform, of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM/RAM), including Several instructions are used to make a terminal (which can be a mobile phone, a computer, a server or a network device, etc.) execute the methods described in the various embodiments of the present application.
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,这些均属于本申请的保护之内。The embodiments of the application are described above with reference to the accompanying drawings, but the application is not limited to the above-mentioned specific embodiments. The above-mentioned specific embodiments are only illustrative and not restrictive. Those of ordinary skill in the art are Under the enlightenment of this application, without departing from the purpose of this application and the scope of protection of the claims, many forms can be made, any equivalent structure or equivalent process transformation made by using the content of the description and drawings of this application, or It is directly or indirectly used in other related technical fields, and these all fall within the protection of this application.

Claims (20)

  1. 一种磁盘性能优化方法,其中,所述磁盘性能优化方法包括:A method for optimizing disk performance, wherein the method for optimizing disk performance includes:
    获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;Acquiring a cluster offset, and allocating a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
    在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;Set flushing parameters in the cache entry, the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
    根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;Determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
    判断磁盘是否接收到刷写数据的请求;Determine whether the disk has received a request for flashing data;
    若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If the disk receives the request for flushing data, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  2. 如权利要求1所述的磁盘性能优化方法,其中,所述若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写,包括:The method for optimizing the performance of a disk according to claim 1, wherein if the disk receives the request for flushing data, the target dirty bitmap is used to identify the corresponding dirty data, and the dirty Data flashing, including:
    若所述磁盘接收到刷写数据的请求,则判断引用计数块中的任一引用计数项是否发生更新,其中,所述引用计数块为磁盘中用于记录引用计数项的模块,所述引用计数项用于记录缓存有数据的位图;If the disk receives a request for flushing data, it is determined whether any reference count item in the reference count block has been updated, wherein the reference count block is a module for recording reference count items in the disk, and the reference count The count item is used to record the bitmap with data in the buffer;
    若引用计数块中的任一引用计数项发生更新,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If any reference count item in the reference count block is updated, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  3. 如权利要求1所述的磁盘性能优化方法,其中,在所述获取簇偏移,并基于所述簇偏移分配缓存项之后,在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小之前还包括:5. The method for optimizing disk performance according to claim 1, wherein after said obtaining the cluster offset and allocating a cache entry based on the cluster offset, a flushing parameter is set in the cache entry, and the flushing parameter is Before including the dirty bit granularity and the dirty bit bitmap size, it also includes:
    判断一级索引项是否索引到历史二级索引表,所述一级索引项与所述历史二级索引表存在预置映射关系,所述一级索引项用于索引历史二级索引表;Judging whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index entry is used to index the historical secondary index table;
    若所述一级索引项索引到所述历史二级索引表,则将所述历史二级索引表加载至缓存项中。If the primary index entry is indexed into the historical secondary index table, the historical secondary index table is loaded into the cache entry.
  4. 如权利要求3所述的磁盘性能优化方法,其中,在所述获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值之前,还包括:The method for optimizing disk performance according to claim 3, wherein, in the obtaining of the cluster offset, a cache entry is allocated based on the cluster offset, and the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster. Before the difference, it also includes:
    通过一级索引项索引目标二级索引表;Index the target secondary index table through the primary index item;
    为所述目标二级索引表分配簇。Allocate clusters for the target secondary index table.
  5. 如权利要求4所述的磁盘性能优化方法,其中,在所述为所述目标二级索引表分配簇之后,在所述获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值之前,还包括:The method for optimizing disk performance according to claim 4, wherein after the clusters are allocated to the target secondary index table, after the cluster offset is obtained, a cache entry is allocated based on the cluster offset, and the cluster Before the offset is the difference between the initial size of the cluster and the actual size of the cluster, it also includes:
    判断簇是否直接可用;Determine whether the cluster is directly available;
    若簇直接可用,则计算直接可用的簇的数量。If the clusters are directly available, calculate the number of directly available clusters.
  6. 如权利要求5所述的磁盘性能优化方法,其中,所述判断簇是否直接可用包括:7. The method for optimizing disk performance according to claim 5, wherein said determining whether the cluster is directly available comprises:
    根据目标二级索引表获取起始二级索引项,其中,所述目标二级索引表与起始二级索引项存在预置映射关系;Obtaining a starting secondary index entry according to the target secondary index table, where the target secondary index table and the starting secondary index entry have a preset mapping relationship;
    根据所述起始二级索引项判断所述簇的最高位是否为预设值;Judging whether the highest bit of the cluster is a preset value according to the initial secondary index item;
    若所述起始二级索引项的最高位为预设值,则判定所述簇直接可用。If the highest bit of the initial secondary index entry is a preset value, it is determined that the cluster is directly available.
  7. 如权利要求5所述的磁盘性能优化方法,其中,所述若簇直接可用,则计算直接可用的簇的数量,包括:The method for optimizing disk performance according to claim 5, wherein, if the clusters are directly available, calculating the number of directly available clusters includes:
    分别计算
    Figure PCTCN2020099512-appb-100001
    Figure PCTCN2020099512-appb-100002
    的值,判断所述
    Figure PCTCN2020099512-appb-100003
    的值与所述
    Figure PCTCN2020099512-appb-100004
    的值是否相等,其中, P为簇偏移,L为簇的预设长度,B为簇的实际大小,N为簇内二级索引项数量;
    Calculate separately
    Figure PCTCN2020099512-appb-100001
    and
    Figure PCTCN2020099512-appb-100002
    The value of to determine the
    Figure PCTCN2020099512-appb-100003
    The value of the
    Figure PCTCN2020099512-appb-100004
    Whether the values of are equal, where P is the cluster offset, L is the preset length of the cluster, B is the actual size of the cluster, and N is the number of secondary index entries in the cluster;
    Figure PCTCN2020099512-appb-100005
    的值与
    Figure PCTCN2020099512-appb-100006
    的值不相等,则对簇内二级索引项数量进行减1操作,得到直接可用的簇的数量。
    like
    Figure PCTCN2020099512-appb-100005
    And the value of
    Figure PCTCN2020099512-appb-100006
    If the value of is not equal, the number of secondary index entries in the cluster is subtracted by 1 to obtain the number of directly available clusters.
  8. 一种磁盘性能优化装置,其中,所述磁盘性能优化装置包括以下模块:A disk performance optimization device, wherein the disk performance optimization device includes the following modules:
    获取模块,用于获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;An obtaining module, configured to obtain a cluster offset, and allocate a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
    设置模块,用于在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;The setting module is used to set flashing parameters in the cache item, the flashing parameters including dirty bit granularity and dirty bitmap size, wherein the dirty bitmap size is equal to the actual size of the cluster and the dirty bit granularity The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
    脏位位图分配模块,用于根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;A dirty bitmap allocation module, configured to determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
    刷写数据判断模块,用于判断磁盘是否接收到刷写数据的请求;The flashing data judgment module is used to judge whether the disk has received a request for flashing data;
    脏数据识别模块,用于若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。The dirty data identification module is configured to, if the disk receives the request for flushing data, identify the corresponding dirty data through the target dirty bitmap, and flush the dirty data.
  9. 一种磁盘性能优化设备,其中,所述磁盘性能优化设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的磁盘性能优化程序,所述磁盘性能优化程序被所述处理器执行时实现如下所述的磁盘性能优化方法的步骤:A disk performance optimization device, wherein the disk performance optimization device includes a memory, a processor, and a disk performance optimization program that is stored on the memory and can run on the processor, and the disk performance optimization program is The steps of the method for optimizing disk performance as described below are implemented when the processor is executed:
    获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;Acquiring a cluster offset, and allocating a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
    在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;Set flushing parameters in the cache entry, the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
    根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;Determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
    判断磁盘是否接收到刷写数据的请求;Determine whether the disk has received a request for flashing data;
    若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If the disk receives the request for flushing data, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  10. 如权利要求9所述的磁盘性能优化设备,其中,所述磁盘性能优化程序被所述处理器执行所述若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写的步骤时,还执行以下步骤:The disk performance optimization device according to claim 9, wherein the disk performance optimization program is executed by the processor, and if the disk receives the request for flushing data, it passes the target dirty bit When the graph identifies the corresponding dirty data and performs the steps of flashing the dirty data, the following steps are also performed:
    若所述磁盘接收到刷写数据的请求,则判断引用计数块中的任一引用计数项是否发生更新,其中,所述引用计数块为磁盘中用于记录引用计数项的模块,所述引用计数项用于记录缓存有数据的位图;If the disk receives a request for flushing data, it is determined whether any reference count item in the reference count block has been updated, where the reference count block is a module used to record the reference count item in the disk, and the reference count The count item is used to record the bitmap with data in the buffer;
    若引用计数块中的任一引用计数项发生更新,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If any reference count item in the reference count block is updated, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  11. 如权利要求9所述的磁盘性能优化设备,其中,所述磁盘性能优化程序被所述处理器执行所述获取簇偏移,并基于所述簇偏移分配缓存项之后,在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小的步骤之前,还执行以下步骤:9. The disk performance optimization device according to claim 9, wherein the disk performance optimization program is executed by the processor to obtain the cluster offset and allocate a cache item based on the cluster offset. Before setting the flashing parameters, the flashing parameters include the dirty bit granularity and the dirty bitmap size, the following steps are also performed:
    判断一级索引项是否索引到历史二级索引表,所述一级索引项与所述历史二级索引表存在预置映射关系,所述一级索引项用于索引历史二级索引表;Judging whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index entry is used to index the historical secondary index table;
    若所述一级索引项索引到所述历史二级索引表,则将所述历史二级索引表加载至缓存项中。If the primary index entry is indexed into the historical secondary index table, the historical secondary index table is loaded into the cache entry.
  12. 如权利要求11所述的磁盘性能优化设备,其中,所述磁盘性能优化程序被所述处理器执行所述所述获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大 小与簇的实际大小之间的差值的步骤之前,还执行以下步骤:The disk performance optimization device according to claim 11, wherein the disk performance optimization program is executed by the processor, the acquiring cluster offset, and the cache entry is allocated based on the cluster offset, and the cluster offset is Before the step for the difference between the initial size of the cluster and the actual size of the cluster, the following steps are also performed:
    通过一级索引项索引目标二级索引表;Index the target secondary index table through the primary index item;
    为所述目标二级索引表分配簇。Allocate clusters for the target secondary index table.
  13. 如权利要求12所述的磁盘性能优化设备,其中,所述磁盘性能优化程序被所述处理器执行所述获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值的步骤之前,还执行以下步骤:The disk performance optimization device according to claim 12, wherein the disk performance optimization program is executed by the processor to obtain the cluster offset, and allocate cache entries based on the cluster offset, the cluster offset being a cluster Before the step of the difference between the initial size of the cluster and the actual size of the cluster, the following steps are also performed:
    判断簇是否直接可用;Determine whether the cluster is directly available;
    若簇直接可用,则计算直接可用的簇的数量。If the clusters are directly available, calculate the number of directly available clusters.
  14. 如权利要求13所述的磁盘性能优化设备,其中,所述磁盘性能优化程序被所述处理器执行所述判断簇是否直接可用的步骤时,还执行以下步骤:11. The disk performance optimization device of claim 13, wherein when the disk performance optimization program is executed by the processor in the step of determining whether the cluster is directly usable, the following steps are further performed:
    根据目标二级索引表获取起始二级索引项,其中,所述目标二级索引表与起始二级索引项存在预置映射关系;Obtaining a starting secondary index entry according to the target secondary index table, where the target secondary index table and the starting secondary index entry have a preset mapping relationship;
    根据所述起始二级索引项判断所述簇的最高位是否为预设值;Judging whether the highest bit of the cluster is a preset value according to the initial secondary index item;
    若所述起始二级索引项的最高位为预设值,则判定所述簇直接可用。If the highest bit of the initial secondary index entry is a preset value, it is determined that the cluster is directly available.
  15. 如权利要求13所述的磁盘性能优化设备,其中,所述磁盘性能优化程序被所述处理器执行所述若簇直接可用,则计算直接可用的簇的数量的步骤时,还执行以下步骤:The disk performance optimization device according to claim 13, wherein when the disk performance optimization program is executed by the processor in the step of calculating the number of directly available clusters, if the clusters are directly available, the following steps are further executed:
    分别计算
    Figure PCTCN2020099512-appb-100007
    Figure PCTCN2020099512-appb-100008
    的值,判断所述
    Figure PCTCN2020099512-appb-100009
    的值与所述
    Figure PCTCN2020099512-appb-100010
    的值是否相等,其中,P为簇偏移,L为簇的预设长度,B为簇的实际大小,N为簇内二级索引项数量;
    Calculate separately
    Figure PCTCN2020099512-appb-100007
    and
    Figure PCTCN2020099512-appb-100008
    The value of to determine the
    Figure PCTCN2020099512-appb-100009
    The value of the
    Figure PCTCN2020099512-appb-100010
    Whether the values of are equal, where P is the cluster offset, L is the preset length of the cluster, B is the actual size of the cluster, and N is the number of secondary index entries in the cluster;
    Figure PCTCN2020099512-appb-100011
    的值与
    Figure PCTCN2020099512-appb-100012
    的值不相等,则对簇内二级索引项数量进行减1操作,得到直接可用的簇的数量。
    like
    Figure PCTCN2020099512-appb-100011
    And the value of
    Figure PCTCN2020099512-appb-100012
    If the value of is not equal, the number of secondary index entries in the cluster is subtracted by 1 to obtain the number of directly available clusters.
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有磁盘性能优化程序,所述磁盘性能优化程序被处理器执行时实现如下所述的磁盘性能优化方法的步骤:A computer-readable storage medium, wherein a disk performance optimization program is stored on the computer-readable storage medium, and when the disk performance optimization program is executed by a processor, the steps of the disk performance optimization method described below are implemented:
    获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值;Acquiring a cluster offset, and allocating a cache entry based on the cluster offset, where the cluster offset is the difference between the initial size of the cluster and the actual size of the cluster;
    在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小,其中,所述脏位位图大小等于簇的实际大小与脏位粒度的比值,所述脏位位图大小用于指示存储脏数据的脏位位图的总位数,所述脏位粒度用于指示每一个位表示的数据量;Set flushing parameters in the cache entry, the flushing parameters include dirty bit granularity and dirty bitmap size, where the dirty bitmap size is equal to the ratio of the actual size of the cluster to the dirty bit granularity, the The dirty bitmap size is used to indicate the total number of bits of the dirty bitmap storing dirty data, and the dirty bit granularity is used to indicate the amount of data represented by each bit;
    根据所述脏位位图大小和预置公式确定目标脏位位图并初始化所述目标脏位位图;Determine a target dirty bitmap according to the size of the dirty bitmap and a preset formula, and initialize the target dirty bitmap;
    判断磁盘是否接收到刷写数据的请求;Determine whether the disk has received a request for flashing data;
    若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If the disk receives the request for flushing data, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  17. 如权利要求16所述的计算机可读存储介质,其中,所述磁盘性能优化程序被处理器执行所述若所述磁盘接收到所述刷写数据的请求,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写的步骤时,还执行如下步骤:The computer-readable storage medium according to claim 16, wherein the disk performance optimization program is executed by the processor, and if the disk receives the request for flushing data, it passes the target dirty bitmap When identifying the corresponding dirty data and flashing the dirty data, the following steps are also performed:
    若所述磁盘接收到刷写数据的请求,则判断引用计数块中的任一引用计数项是否发生更新,其中,所述引用计数块为磁盘中用于记录引用计数项的模块,所述引用计数项用于记录缓存有数据的位图;If the disk receives a request for flushing data, it is determined whether any reference count item in the reference count block has been updated, wherein the reference count block is a module for recording reference count items in the disk, and the reference count The count item is used to record the bitmap with data in the buffer;
    若引用计数块中的任一引用计数项发生更新,则通过所述目标脏位位图识别对应的脏数据,并对所述脏数据进行刷写。If any reference count item in the reference count block is updated, the corresponding dirty data is identified through the target dirty bitmap, and the dirty data is flushed.
  18. 如权利要求16所述的计算机可读存储介质,其中,所述磁盘性能优化程序被处理器执行所述获取簇偏移,并基于所述簇偏移分配缓存项之后,在所述缓存项内设置刷写参数,所述刷写参数包括脏位粒度和脏位位图大小的步骤之前,还执行如下步骤:16. The computer-readable storage medium according to claim 16, wherein the disk performance optimization program is executed by the processor to obtain the cluster offset, and allocate a cache entry based on the cluster offset, and then store it in the cache entry Before setting the flashing parameters, the flashing parameters include the dirty bit granularity and the dirty bitmap size, the following steps are also performed:
    判断一级索引项是否索引到历史二级索引表,所述一级索引项与所述历史二级索引表存在预置映射关系,所述一级索引项用于索引历史二级索引表;Judging whether the primary index entry is indexed to the historical secondary index table, the primary index entry has a preset mapping relationship with the historical secondary index table, and the primary index entry is used to index the historical secondary index table;
    若所述一级索引项索引到所述历史二级索引表,则将所述历史二级索引表加载至缓存项中。If the primary index entry is indexed into the historical secondary index table, the historical secondary index table is loaded into the cache entry.
  19. 如权利要求18所述的计算机可读存储介质,其中,所述磁盘性能优化程序被所述处理器执行所述所述获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值的步骤之前,还执行以下步骤:The computer-readable storage medium of claim 18, wherein the disk performance optimization program is executed by the processor, the acquiring cluster offset, and the cache entry is allocated based on the cluster offset, and the cluster offset is Before the step of shifting to the difference between the initial size of the cluster and the actual size of the cluster, the following steps are also performed:
    通过一级索引项索引目标二级索引表;Index the target secondary index table through the primary index item;
    为所述目标二级索引表分配簇。Allocate clusters for the target secondary index table.
  20. 如权利要求19所述的计算机可读存储介质,其中,所述磁盘性能优化程序被所述处理器执行所述获取簇偏移,基于所述簇偏移分配缓存项,所述簇偏移为簇的初始大小与簇的实际大小之间的差值的步骤之前,还执行以下步骤:19. The computer-readable storage medium of claim 19, wherein the disk performance optimization program is executed by the processor to obtain the cluster offset, and allocate cache entries based on the cluster offset, the cluster offset being Before the step of the difference between the initial size of the cluster and the actual size of the cluster, the following steps are also performed:
    判断簇是否直接可用;Determine whether the cluster is directly available;
    若簇直接可用,则计算直接可用的簇的数量。If the clusters are directly available, calculate the number of directly available clusters.
PCT/CN2020/099512 2020-03-05 2020-06-30 Disk performance optimization method, apparatus and device, and computer readable storage medium WO2021174731A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010146235.7 2020-03-05
CN202010146235.7A CN111459405A (en) 2020-03-05 2020-03-05 Disk performance optimization method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
WO2021174731A1 true WO2021174731A1 (en) 2021-09-10

Family

ID=71683214

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/099512 WO2021174731A1 (en) 2020-03-05 2020-06-30 Disk performance optimization method, apparatus and device, and computer readable storage medium

Country Status (2)

Country Link
CN (1) CN111459405A (en)
WO (1) WO2021174731A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113961153A (en) * 2021-12-21 2022-01-21 杭州趣链科技有限公司 Method and device for writing index data into disk and terminal equipment
CN115268798A (en) * 2022-09-27 2022-11-01 天津卓朗昆仑云软件技术有限公司 Cache data flushing method and system

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112380004B (en) * 2020-11-04 2023-06-13 成都佰维存储科技有限公司 Memory management method, memory management device, computer readable storage medium and electronic equipment
CN112835528A (en) * 2021-02-22 2021-05-25 北京金山云网络技术有限公司 Dirty page refreshing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049397A (en) * 2012-12-20 2013-04-17 中国科学院上海微系统与信息技术研究所 Method and system for internal cache management of solid state disk based on novel memory
US20140359226A1 (en) * 2013-05-30 2014-12-04 Hewlett-Packard Development Company, L.P. Allocation of cache to storage volumes
US20180067854A1 (en) * 2016-09-07 2018-03-08 Intel Corporation Aggressive write-back cache cleaning policy optimized for non-volatile memory
CN109783023A (en) * 2019-01-04 2019-05-21 平安科技(深圳)有限公司 The method and relevant apparatus brushed under a kind of data
US20190188156A1 (en) * 2017-12-19 2019-06-20 Seagate Technology Llc Stripe aligned cache flush

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049397A (en) * 2012-12-20 2013-04-17 中国科学院上海微系统与信息技术研究所 Method and system for internal cache management of solid state disk based on novel memory
US20140359226A1 (en) * 2013-05-30 2014-12-04 Hewlett-Packard Development Company, L.P. Allocation of cache to storage volumes
US20180067854A1 (en) * 2016-09-07 2018-03-08 Intel Corporation Aggressive write-back cache cleaning policy optimized for non-volatile memory
US20190188156A1 (en) * 2017-12-19 2019-06-20 Seagate Technology Llc Stripe aligned cache flush
CN109783023A (en) * 2019-01-04 2019-05-21 平安科技(深圳)有限公司 The method and relevant apparatus brushed under a kind of data

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113961153A (en) * 2021-12-21 2022-01-21 杭州趣链科技有限公司 Method and device for writing index data into disk and terminal equipment
CN113961153B (en) * 2021-12-21 2022-11-04 杭州趣链科技有限公司 Method and device for writing index data into disk and terminal equipment
CN115268798A (en) * 2022-09-27 2022-11-01 天津卓朗昆仑云软件技术有限公司 Cache data flushing method and system

Also Published As

Publication number Publication date
CN111459405A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
US11579773B2 (en) Memory system and method of controlling memory system
WO2021174731A1 (en) Disk performance optimization method, apparatus and device, and computer readable storage medium
CN110678836B (en) Persistent memory for key value storage
US10776278B2 (en) Storage control apparatus and computer-readable storage medium storing storage control program
US11030094B2 (en) Apparatus and method for performing garbage collection by predicting required time
JP6613375B2 (en) Profiling cache replacement
CA2938242A1 (en) Array controller, solid state disk, and method for controlling solid state disk to write data
CN110377233B (en) SSD (solid State disk) reading performance optimization method and device, computer equipment and storage medium
WO2021027340A1 (en) Storage method and apparatus for key value (kv) and storage device
CN108073359B (en) Operation method of data storage device
US9524236B1 (en) Systems and methods for performing memory management based on data access properties
WO2017000821A1 (en) Storage system, storage management device, storage device, hybrid storage device, and storage management method
KR101026634B1 (en) A method of data storage for a hybrid flash memory
CN113434470A (en) Data distribution method and device and electronic equipment
JP6430039B2 (en) Storage device and storage device control method
US20210271389A1 (en) Method and apparatus for deleting index in internal memory
KR20210089055A (en) Flash memory storage with improved erase performance and method thereof
CN117785018A (en) Key value storage method and system

Legal Events

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

Ref document number: 20923313

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20923313

Country of ref document: EP

Kind code of ref document: A1