[go: up one dir, main page]

CN109840217B - Cache resource allocation and device - Google Patents

Cache resource allocation and device Download PDF

Info

Publication number
CN109840217B
CN109840217B CN201711213099.3A CN201711213099A CN109840217B CN 109840217 B CN109840217 B CN 109840217B CN 201711213099 A CN201711213099 A CN 201711213099A CN 109840217 B CN109840217 B CN 109840217B
Authority
CN
China
Prior art keywords
quota
volume
allocated
write data
cache
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201711213099.3A
Other languages
Chinese (zh)
Other versions
CN109840217A (en
Inventor
吴超
潘浩
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201711213099.3A priority Critical patent/CN109840217B/en
Publication of CN109840217A publication Critical patent/CN109840217A/en
Application granted granted Critical
Publication of CN109840217B publication Critical patent/CN109840217B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A method and a device for allocating cache resources comprise the steps of receiving a data writing request, wherein the data writing request is used for writing data to be written into a target volume, the storage device comprises a plurality of volumes and a cache, the space of the cache comprises a private space and a public space, the private space is divided into a plurality of parts, each part is allocated to one of the volumes as a quota, and the target volume is one of the volumes. And judging whether the debt information of the target volume is larger than zero or not, wherein the debt information is used for indicating whether the quota distributed for the target volume is overdraft or not. And if the debt information of the target volume is greater than zero, allocating cache resources for the data writing request from the public space. The efficiency of processing the service by the storage device can be improved.

Description

一种缓存资源分配和装置A cache resource allocation and device

技术领域Technical field

本申请涉及存储技术领域,特别是一种缓存资源分配和装置。This application relates to the field of storage technology, in particular to a cache resource allocation and device.

背景技术Background technique

存储设备在处理业务请求时会申请缓存资源。通常的做法是将缓存空间视作一个缓存资源池,按照先到先得的原则从缓存资源池中为业务请求分配缓存资源。然而,资源释放速度较慢的业务会对那些对资源释放速度快的业务在资源层面进行一定的压制,影响存储设备处理业务的效率。The storage device will apply for cache resources when processing business requests. The usual approach is to regard the cache space as a cache resource pool, and allocate cache resources to business requests from the cache resource pool on a first-come, first-served basis. However, services with a slow resource release speed will suppress those services with a fast resource release speed at the resource level, affecting the efficiency of the storage device in processing services.

发明内容Contents of the invention

本申请提供的缓存资源分配方法及装置,可以提高存储设备处理业务的效率。The cache resource allocation method and device provided by this application can improve the efficiency of storage equipment processing services.

第一方面提供了一种缓存资源分配方法。在该方法中,处理器接收写数据请求,所述写数据请求用于将待写入数据写入目标卷中,所述存储设备包括多个卷和缓存,所述缓存的空间包括私有空间和公共空间,所述私有空间被划分为若干个部分,每个部分作为配额分配给所述多个卷中的一个卷,所述目标卷是所述多个卷中的一个卷。处理器再判断所述目标卷的债务信息是否大于零,所述债务信息用于指示为所述目标卷分配的配额是否已透支。若所述目标卷的债务信息大于零,则从所述公共空间中为所述写数据请求分配缓存资源。The first aspect provides a cache resource allocation method. In this method, a processor receives a write data request, which is used to write data to be written into a target volume. The storage device includes multiple volumes and a cache. The cache space includes a private space and a cache. Public space, the private space is divided into several parts, each part is allocated as a quota to one of the plurality of volumes, and the target volume is one of the plurality of volumes. The processor then determines whether the debt information of the target volume is greater than zero, and the debt information is used to indicate whether the quota allocated for the target volume has been overdrawn. If the debt information of the target volume is greater than zero, cache resources are allocated from the public space for the write data request.

根据第一方面,缓存的空间包括私有空间和公共空间,所述私有空间被划分为若干个部分,每个部分作为配额分配给所述多个卷中的一个卷。当接收写数据请求时,根据所要访问的目标卷的债务信息来判断如何为该写数据请求分配缓存资源。若所述目标卷的债务信息大于零,则从所述公共空间中为所述写数据请求分配缓存资源。债务信息大于零是指其他卷尚且欠所述目标卷一些配额,因此对于所述写数据请求,则可以从公共空间中为其分配缓存资源,避免目标卷的配额被进一步占用而被影响效率,从而提高了针对所述目标卷的写数据请求的处理效率。According to the first aspect, the cached space includes a private space and a public space, the private space is divided into several parts, and each part is allocated as a quota to one of the plurality of volumes. When receiving a write data request, it determines how to allocate cache resources for the write data request based on the debt information of the target volume to be accessed. If the debt information of the target volume is greater than zero, cache resources are allocated from the public space for the write data request. Debt information greater than zero means that other volumes still owe some quota to the target volume. Therefore, for the write data request, cache resources can be allocated from the public space to avoid the target volume's quota being further occupied and affecting efficiency. This improves the processing efficiency of write data requests for the target volume.

结合第一方面,在第一方面的第一种实施方式中,当释放所述为所述写数据请求分配的缓存资源时,处理器将所述释放的缓存资源添加到为所述目标卷分配的配额中。按照第一种实施方式,当债务信息大于0时,说明其他卷欠目标卷一些配额,将释放的缓存资源添加到为所述目标卷分配的配额中,避免其他卷欠目标卷的配额更多而拖累针对所述目标卷的写数据请求的处理效率。With reference to the first aspect, in a first implementation manner of the first aspect, when the cache resources allocated for the write data request are released, the processor adds the released cache resources to the cache resources allocated for the target volume. of quota. According to the first implementation, when the debt information is greater than 0, it means that other volumes owe the target volume some quotas, and the released cache resources are added to the quota allocated for the target volume to avoid other volumes owing more quotas to the target volume. This drags down the processing efficiency of write data requests for the target volume.

结合第一方面,在第一方面的第二种实施方式中,所述债务信息等于当前周期内申请或释放缓存资源后对基准配额进行更新后的数值,所述基准配额等于新配额减去旧配额所得的差值,所述新配额为当前周期内为所述目标卷分配的配额,所述旧配额为历史周期内为所述目标卷分配的配额。In conjunction with the first aspect, in a second implementation manner of the first aspect, the debt information is equal to the updated value of the baseline quota after applying for or releasing cache resources in the current cycle, and the baseline quota is equal to the new quota minus the old quota. The difference between the quotas, the new quota is the quota allocated to the target volume in the current period, and the old quota is the quota allocated to the target volume in the historical period.

结合第一方面,在第一方面的第三种实施方式中,每个卷对应一个缓冲队列,所述缓冲队列中保存有一个或正在等待处理的写数据请求。处理器根据每个卷所对应的缓冲队列中包含的写数据请求的数量以及写数据请求的尺寸为卷分配所述配额,其中,缓冲队列中包含的写数据请求的数量越多,为该缓冲队列所述对应的卷分配的配额越多,缓冲队列中包含的写数据请求的尺寸越大,为该缓冲队列所述对应的卷分配的配额越多。按照第三种实施方式,根据每个卷的业务压力为其分配配额,缓存资源向业务压力大的卷的倾斜,提高了存储设备服务业务的效率。With reference to the first aspect, in a third implementation manner of the first aspect, each volume corresponds to a buffer queue, and the buffer queue stores a write data request or is waiting to be processed. The processor allocates the quota to the volume according to the number of write data requests contained in the buffer queue corresponding to each volume and the size of the write data requests. The greater the number of write data requests contained in the buffer queue, the higher the number of write data requests contained in the buffer queue. The more quotas are allocated to the corresponding volume in the queue and the larger the size of the write data request contained in the buffer queue, the more quotas are allocated to the corresponding volume in the buffer queue. According to the third implementation manner, a quota is allocated to each volume according to its business pressure, and cache resources are tilted toward volumes with greater business pressure, thereby improving the efficiency of the storage device in serving services.

结合第一方面,在第一方面的第四种实施方式中,处理器根据每个卷的缓存并发数为卷分配所述配额,所述缓存并发数用于指示当缓存中的数据复制到硬盘时,能够并发写入卷的写请求的数量。按照第四种实施方式,根据每个卷对应的缓存并发数为其分配配额,缓存资源向并发能力高的卷的倾斜,提高了存储设备服务业务的效率。In connection with the first aspect, in a fourth implementation manner of the first aspect, the processor allocates the quota to the volume according to the cache concurrency number of each volume, the cache concurrency number is used to indicate when the data in the cache is copied to the hard disk. The number of write requests that can be written to the volume concurrently. According to the fourth implementation manner, a quota is allocated to each volume according to its corresponding cache concurrency number, and cache resources are tilted toward volumes with high concurrency capabilities, thereby improving the efficiency of storage device service services.

结合第一方面的第二种实施方式,在第一方面的第三种实施方式中,所述历史周期是所述当前前期的前一个周期。With reference to the second implementation manner of the first aspect, in a third implementation manner of the first aspect, the historical period is a period before the current previous period.

本申请第二方面提供一种缓存资源分配装置,所述装置用于执行第一方面以及第一方面任意一种实现方式中的方法。A second aspect of this application provides a cache resource allocation device, which is configured to execute the first aspect and the method in any implementation of the first aspect.

本申请第三方面提供一种存储设备,包括处理器和缓存。所述处理器调用缓存中的程序代码实现执行第一方面以及第一方面任意一种实现方式中的方法。A third aspect of this application provides a storage device, including a processor and a cache. The processor calls the program code in the cache to implement the method in the first aspect and any implementation manner of the first aspect.

本申请第四方面提供了一种计算机程序产品,包括存储了程序代码的计算机可读存储介质,所述程序代码包括的指令可以由上述第一方面的至少一种方法。A fourth aspect of the present application provides a computer program product, including a computer-readable storage medium storing program code, and the program code includes instructions that can be implemented by at least one method of the first aspect.

附图说明Description of the drawings

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍。In order to explain the technical solutions of the embodiments of the present invention more clearly, the drawings required to be used in the embodiments will be briefly introduced below.

图1是本发明实施例提供的系统架构图;Figure 1 is a system architecture diagram provided by an embodiment of the present invention;

图2是本发明实施例提供的缓存空间示意图;Figure 2 is a schematic diagram of the cache space provided by an embodiment of the present invention;

图3是本发明实施例提供的缓存资源分配方法的流程示意图;Figure 3 is a schematic flowchart of a cache resource allocation method provided by an embodiment of the present invention;

图4是本发明实施例提供的缓存资源释放方法的流程示意图;Figure 4 is a schematic flowchart of a cache resource release method provided by an embodiment of the present invention;

图5是本发明实施例提供的缓存资源分配装置的结构示意图。Figure 5 is a schematic structural diagram of a cache resource allocation device provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合附图,对本发明实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings.

图1是本发明实施例提供的系统架构图,本实施例提供的存储系统包括主机20、控制器11和多个硬盘22。控制器11可以是一种计算设备,如服务器、台式计算机等等。在控制器11上安装有操作系统以及应用程序。控制器通过存储区域网络(storage area network,SAN)与主机20连接。具体的,主机20可以向控制器11发送写数据请求,控制器11接收所述写数据请求之后为其分配缓存资源,以将所述写数据请求中携带的数据暂时保存在缓存102中。当缓存102存储的数据达到一定水位时再将缓存102中的数据写入硬盘22中。另外,主机20还可以向控制器11发送读数据请求,控制器11接收所述读数据请求之后,根据所述读数据请求中的地址查找其缓存102中是否保存有待读取的数据,如果有则直接将所述待读取的数据发送给主机20,如果没有则从硬盘22中获得该数据并发送给主机20。在实际应用中,控制器11和硬盘22可以集成在一个存储设备中,也可以位于相互独立的两个设备中,本发明实施例对控制器11和硬盘22的位置关系做任何限定。为了方便描述,在本实施例中,将控制器11和硬盘22统称为存储设备。Figure 1 is a system architecture diagram provided by an embodiment of the present invention. The storage system provided by this embodiment includes a host 20, a controller 11 and multiple hard disks 22. Controller 11 may be a computing device such as a server, desktop computer, etc. An operating system and application programs are installed on the controller 11 . The controller is connected to the host 20 through a storage area network (SAN). Specifically, the host 20 may send a write data request to the controller 11. After receiving the write data request, the controller 11 allocates cache resources to the controller 11 to temporarily store the data carried in the write data request in the cache 102. When the data stored in the cache 102 reaches a certain level, the data in the cache 102 is written to the hard disk 22 . In addition, the host 20 can also send a read data request to the controller 11. After receiving the read data request, the controller 11 searches whether there is data to be read in its cache 102 according to the address in the read data request. If so, Then the data to be read is directly sent to the host 20. If not, the data is obtained from the hard disk 22 and sent to the host 20. In practical applications, the controller 11 and the hard disk 22 may be integrated in one storage device, or may be located in two independent devices. The embodiment of the present invention places no restrictions on the positional relationship between the controller 11 and the hard disk 22 . For convenience of description, in this embodiment, the controller 11 and the hard disk 22 are collectively referred to as a storage device.

在实际应用中,将存储设备的硬盘22进行逻辑组合,并应用需要的RAID级别,得到RAID集。RAID集因为将多个硬盘组合,通常容量较大,所以将RAID集的可用容量划分为较小的单元,称为卷,卷向主机20隐藏了RAID集的组织和构成。一个卷可以在初始化时分配给一个主机20使用,也可以分配给多个主机20使用。In actual applications, the hard disks 22 of the storage devices are logically combined and the required RAID levels are applied to obtain a RAID set. Because a RAID set combines multiple hard disks and usually has a large capacity, the available capacity of the RAID set is divided into smaller units, called volumes. The volumes hide the organization and composition of the RAID set from the host 20 . A volume can be allocated to one host 20 for use during initialization, or can be allocated to multiple hosts 20 for use.

下面介绍控制器11的结构,如图1所示,控制器11至少包括处理器101,缓存102和接口(图1中未示出)。处理器101是一个中央处理器(英文:central processing unit,CPU)。在本发明实施例中,处理器101可以用于接收来自主机20的读数据请求以及写数据请求、处理所述读数据请求以及写数据请求。The structure of the controller 11 is introduced below. As shown in Figure 1, the controller 11 at least includes a processor 101, a cache 102 and an interface (not shown in Figure 1). The processor 101 is a central processing unit (English: central processing unit, CPU). In the embodiment of the present invention, the processor 101 may be configured to receive read data requests and write data requests from the host 20 and process the read data requests and write data requests.

缓存102用于临时存储从主机20接收的数据或从硬盘22读取的数据。控制器11接收主机发送的多个写数据请求时,可以将所述多个写数据请求中的数据暂时保存在缓存102中。当缓存102的容量达到一定阈值时,将缓存102存储的数据发送给硬盘22。硬盘22存储所述数据。缓存102包括易失性存储器,非易失性存储器或其组合。易失性存储器例如为随机访问存储器(英文:random-access memory,RAM)。非易失性存储器例如软盘、硬盘、固态硬盘(solid state disk,SSD)、光盘等各种可以存储程序代码的机器可读介质。可以理解的是,存储设备在执行写数据请求或者读数据请求均需要使用缓存102。The cache 102 is used to temporarily store data received from the host 20 or data read from the hard disk 22 . When the controller 11 receives multiple write data requests sent by the host, the data in the multiple write data requests may be temporarily stored in the cache 102 . When the capacity of the cache 102 reaches a certain threshold, the data stored in the cache 102 is sent to the hard disk 22 . Hard disk 22 stores the data. Cache 102 includes volatile memory, non-volatile memory, or a combination thereof. Volatile memory is, for example, random-access memory (English: random-access memory, RAM). Non-volatile memories include floppy disks, hard disks, solid state disks (SSD), optical disks, and other machine-readable media that can store program codes. It can be understood that the storage device needs to use the cache 102 when executing a write data request or a data read request.

如图2所示,缓存102的存储空间包括私有空间和公共空间。其中私有空间可以划分为若干个部分,每个部分作为配额分配给一个卷。例如,配额1分配给卷1,配额2分配给卷2,配额n分配给卷n。每个卷所分配的配额可以相同,也可以不同。控制器11在进行初始设置时,可以将所述私有空间平均分配给每个卷,也可以按照一定原则分配。在初始分配以后,每隔一个周期,处理器101会根据前端业务压力或者后端数据刷盘能力对每个卷分配的配额进行调整,以得到新配额。周期是指相同的时间间隔,在本发明实施例中可以由定时器来实现周期的管理。新配额是相对于旧配额而言的,具体的,新配额是指当前周期内分配的配额,旧配额是指历史周期内分配的配额。公共空间不会预先分配给任何卷,每个卷可以根据自己的债务信息使用所述公共空间。As shown in Figure 2, the storage space of cache 102 includes private space and public space. The private space can be divided into several parts, and each part is allocated to a volume as a quota. For example, quota 1 is assigned to volume 1, quota 2 is assigned to volume 2, and quota n is assigned to volume n. The quota allocated to each volume can be the same or different. When performing initial settings, the controller 11 may allocate the private space to each volume equally, or may allocate it according to certain principles. After the initial allocation, every cycle, the processor 101 will adjust the quota allocated to each volume according to the front-end business pressure or the back-end data flushing capability to obtain a new quota. The cycle refers to the same time interval, and in the embodiment of the present invention, the cycle management can be implemented by a timer. The new quota is relative to the old quota. Specifically, the new quota refers to the quota allocated in the current cycle, and the old quota refers to the quota allocated in the historical cycle. Common space is not pre-allocated to any volume, each volume can use said common space based on its own debt information.

一种情况下,处理器101可以根据前端业务压力来调整每个卷的配额。每个卷对应一个缓冲队列,所述缓冲队列中保存有一个或正在等待处理的写数据请求。根据每个卷所对应的缓冲队列中包含的写数据请求的数量以及写数据请求的尺寸为卷分配所述配额,其中,缓冲队列中包含的写数据请求的数量越多,为该缓冲队列所述对应的卷分配的配额越多,缓冲队列中包含的写数据请求的尺寸越大,为该缓冲队列所述对应的卷分配的配额越多。具体的,可以计算每个卷对应的正在排队的写数据请求的数量和预设的写数据请求的尺寸的乘积,乘积越大,分配的配额越多。所述缓存队列位于缓存102中。In one case, the processor 101 can adjust the quota of each volume according to the front-end business pressure. Each volume corresponds to a buffer queue, and the buffer queue stores a write data request or is waiting to be processed. The quota is allocated to the volume according to the number of write data requests contained in the buffer queue corresponding to each volume and the size of the write data requests. The greater the number of write data requests contained in the buffer queue, the larger the number of write data requests contained in the buffer queue. The more quotas are allocated to the corresponding volume, the larger the size of the write data request contained in the buffer queue, and the more quotas are allocated to the corresponding volume in the buffer queue. Specifically, the product of the number of queued write data requests corresponding to each volume and the preset size of the write data requests can be calculated. The larger the product, the more quotas are allocated. The cache queue is located in cache 102.

另一种情况下,处理器101可以根据后端数据刷盘能力来调整每个卷的配额。具体的,可以根据每个卷的缓存并发数为卷分配所述配额,所述缓存并发数用于指示当缓存中的数据复制到硬盘时,能够并发写入该卷的写请求的数量。这里的写请求是指用于从缓存102中的数据写入硬盘22的请求,区别于从主机接收的用于写入控制器11的写数据请求。In another case, the processor 101 can adjust the quota of each volume according to the backend data flushing capability. Specifically, the quota may be allocated to the volume according to the cache concurrency number of each volume. The cache concurrency number is used to indicate the number of write requests that can be written to the volume concurrently when the data in the cache is copied to the hard disk. The write request here refers to a request for writing data from the cache 102 to the hard disk 22 , which is different from a write data request received from the host for writing to the controller 11 .

下面请参考图3,图3为本实施例提供的缓存资源分配方法,该方法可以应用在图1所示的系统中,由处理器101执行。具体的,该方法包括以下步骤。Please refer to Figure 3 below. Figure 3 shows a cache resource allocation method provided in this embodiment. This method can be applied in the system shown in Figure 1 and is executed by the processor 101. Specifically, the method includes the following steps.

在S301中,处理器101接收写数据请求,所述写数据请求包括待写入数据的地址。根据该地址可以确定所述待写入数据所要写入的卷。为了方便描述,将待写入数据所要写入的卷称为目标卷。In S301, the processor 101 receives a write data request, which includes an address of data to be written. The volume to which the data to be written can be determined based on this address. For convenience of description, the volume to which the data to be written is called the target volume.

在S302中,处理器101判断所述目标卷的债务信息是否大于、小于或者等于0。所述债务信息用于指示为所述目标卷分配的配额是否已透支。若债务信息大于0,说明其他卷欠目标卷一些配额;若债务信息等于0,说明目标卷的配额刚好够用,不欠其他卷的,其他卷也不欠所述目标卷的。若债务信息小于0,说明目标卷欠其他卷一些配额。In S302, the processor 101 determines whether the debt information of the target volume is greater than, less than, or equal to 0. The debt information is used to indicate whether the quota allocated for the target volume has been overdrawn. If the debt information is greater than 0, it means that other volumes owe some quota to the target volume; if the debt information is equal to 0, it means that the quota of the target volume is just enough, and it does not owe other volumes, and other volumes do not owe the target volume. If the debt information is less than 0, it means that the target volume owes some quota to other volumes.

具体的,债务信息等于当前周期内申请或释放缓存资源后对基准配额进行更新后的数值。所述基准配额等于新配额减去旧配额所得的差值,所述新配额为当前周期内为所述目标卷分配的配额,所述旧配额为历史周期内为所述目标卷分配的配额。所述历史周期可以是当前周期的前一个周期,也可以再往前几个周期中的任意一个。举个例子,假设所述目标卷的新配额为2000,前一个周期的旧配额为1000,那么基准配额等于1000。基准配额大于0,说明此时其他卷欠所述目标卷1000的配额。在当前周期内,若处理器101处理了两个针对所述目标卷的写数据请求,分别申请了200配额和300配额,那么此时的债务信息等于1000-200-300=500。在S302中如果目标卷的债务信息大于0,执行S303;如果目标卷的债务信息等于0,执行S304;如果目标卷的债务信息小于0,执行S303。Specifically, the debt information is equal to the updated value of the baseline quota after applying for or releasing cache resources in the current cycle. The baseline quota is equal to the difference obtained by subtracting the old quota from the new quota. The new quota is the quota allocated to the target volume in the current period. The old quota is the quota allocated to the target volume in the historical period. The historical period may be the period before the current period, or any one of several previous periods. For example, assuming that the new quota of the target volume is 2000 and the old quota of the previous period is 1000, then the baseline quota is equal to 1000. The base quota is greater than 0, indicating that other volumes owe the quota of the target volume 1000 at this time. In the current cycle, if the processor 101 processes two data write requests for the target volume and applies for a quota of 200 and a quota of 300 respectively, then the debt information at this time is equal to 1000-200-300=500. In S302, if the debt information of the target volume is greater than 0, execute S303; if the debt information of the target volume is equal to 0, execute S304; if the debt information of the target volume is less than 0, execute S303.

在S303中,由于债务信息大于0,说明其他卷欠目标卷一些配额,那么此时为写数据请求分配的缓存资源就可以从公共空间中分配。In S303, since the debt information is greater than 0, it means that other volumes owe some quota to the target volume, so the cache resources allocated for the write data request at this time can be allocated from the public space.

在S304中,由于债务信息等于0,说明目标卷的配额刚好够用,那么此时为写数据请求分配的缓存资源仍然使用为所述目标卷分配的配额。In S304, since the debt information is equal to 0, it means that the quota of the target volume is just enough, so the cache resources allocated for the write data request at this time still use the quota allocated for the target volume.

在S305中,由于债务信息小于0,说明目标卷欠其他卷一些配额,因此此时为写数据请求分配的缓存资源仍然使用为所述目标卷分配的配额。In S305, since the debt information is less than 0, it means that the target volume owes some quotas to other volumes, so the cache resources allocated for the write data request at this time still use the quota allocated for the target volume.

按照图3所示的实施方式,缓存的空间包括私有空间和公共空间,所述私有空间被划分为若干个部分,每个部分作为配额分配给所述多个卷中的一个卷。当接收写数据请求时,根据所要访问的目标卷的债务信息来判断如何为该写数据请求分配缓存资源。若所述目标卷的债务信息大于零,则从所述公共空间中为所述写数据请求分配缓存资源。债务信息大于零是指其他卷尚且欠所述目标卷一些配额,因此对于所述写数据请求,则可以从公共空间中为其分配缓存资源,避免目标卷的配额被进一步占用而被影响效率,从而提高了针对所述目标卷的写数据请求的处理效率。According to the implementation shown in Figure 3, the cached space includes private space and public space. The private space is divided into several parts, and each part is allocated as a quota to one of the multiple volumes. When receiving a write data request, it determines how to allocate cache resources for the write data request based on the debt information of the target volume to be accessed. If the debt information of the target volume is greater than zero, cache resources are allocated from the public space for the write data request. Debt information greater than zero means that other volumes still owe some quota to the target volume. Therefore, for the write data request, cache resources can be allocated from the public space to avoid the target volume's quota being further occupied and affecting efficiency. This improves the processing efficiency of write data requests for the target volume.

可以理解的是,当数据被删除时,其所占用的缓存资源可以被释放。本实施例根据每个卷的债务信息决定释放后的缓存资源添加到为卷分配的配额里面,还是添加到公共空间中。请参考图4,图4是本发明实施例提供缓存资源释放的流程示意图。如图4所示,包括以下步骤:It can be understood that when data is deleted, the cache resources occupied by it can be released. This embodiment determines whether to add the released cache resources to the quota allocated for the volume or to the public space based on the debt information of each volume. Please refer to Figure 4, which is a schematic flowchart of cache resource release according to an embodiment of the present invention. As shown in Figure 4, it includes the following steps:

在S401中,处理器101接收数据删除请求,所述数据删除请求包括数据的地址。根据该地址可以确定所述待写入数据所要写入的卷。这里仍然以目标卷为例进行说明。In S401, the processor 101 receives a data deletion request, which includes the address of the data. The volume to which the data to be written can be determined based on this address. Here we still take the target volume as an example.

S402可参考图3中关于S302的描述,这里不再赘述。For S402, reference may be made to the description of S302 in Figure 3, which will not be described again here.

在S403中,由于债务信息大于0,说明其他卷欠目标卷一些配额,那么此时释放的缓存资源就应该还给所述目标卷,相应地,其操作是将释放的缓存资源添加到目标卷的配额中。In S403, since the debt information is greater than 0, it means that other volumes owe some quota to the target volume, so the cache resources released at this time should be returned to the target volume. Accordingly, the operation is to add the released cache resources to the target volume. of quota.

在S404中,由于债务信息等于0,说明目标卷的配额刚好够用,那么此时为写数据请求分配的缓存资源仍然还给所述目标卷。In S404, since the debt information is equal to 0, it means that the quota of the target volume is just enough, so the cache resources allocated for the write data request at this time are still returned to the target volume.

在S405中,由于债务信息小于0,说明目标卷欠其他卷一些配额,因此此时为写数据请求分配的缓存资源就应该还给其他卷,相应地,其操作是将释放的缓存资源添加到公共空间中。In S405, since the debt information is less than 0, it means that the target volume owes some quotas to other volumes. Therefore, the cache resources allocated for write data requests at this time should be returned to other volumes. Correspondingly, the operation is to add the released cache resources to in public space.

根据图4所示的实施方式,当债务信息大于0时,说明其他卷欠目标卷一些配额,将释放的缓存资源添加到为所述目标卷分配的配额中,避免其他卷欠目标卷的配额更多而拖累针对所述目标卷的写数据请求的处理效率。According to the implementation shown in Figure 4, when the debt information is greater than 0, it means that other volumes owe the target volume some quotas, and the released cache resources are added to the quota allocated for the target volume to avoid other volumes owing quotas to the target volume. More and drag down the processing efficiency of write data requests for the target volume.

请参考图5,图5是本发明实施例提供的缓存资源分配装置50,该装置50位于存储设备中,包括接收模块501、判断模块502、分配模块503。Please refer to Figure 5. Figure 5 is a cache resource allocation device 50 provided by an embodiment of the present invention. The device 50 is located in a storage device and includes a receiving module 501, a judgment module 502, and an allocation module 503.

接收模块501,用于接收写数据请求,所述写数据请求用于将待写入数据写入目标卷中,所述存储设备包括多个卷和缓存,所述缓存的空间包括私有空间和公共空间,所述私有空间被划分为若干个部分,每个部分作为配额分配给所述多个卷中的一个卷,所述目标卷是所述多个卷中的一个卷。接收模块501可以由处理器101调用缓存102中的程序代码实现,其具体实现可参考图3所示的S301。The receiving module 501 is configured to receive a write data request. The write data request is used to write the data to be written into the target volume. The storage device includes multiple volumes and caches. The cache space includes private space and public space. space, the private space is divided into several parts, each part is allocated as a quota to one of the plurality of volumes, and the target volume is one of the plurality of volumes. The receiving module 501 can be implemented by the processor 101 calling the program code in the cache 102. For its specific implementation, refer to S301 shown in Figure 3.

判断模块502,用于判断所述目标卷的债务信息是否大于零,所述债务信息用于指示为所述目标卷分配的配额是否已透支。判断模块502可以由处理器101调用缓存102中的程序代码实现,其具体实现可参考图3所示的S302。The judgment module 502 is used to judge whether the debt information of the target volume is greater than zero, and the debt information is used to indicate whether the quota allocated for the target volume has been overdrawn. The judgment module 502 can be implemented by the processor 101 calling the program code in the cache 102. For its specific implementation, reference can be made to S302 shown in Figure 3.

分配模块503,用于若所述目标卷的债务信息大于零,则从所述公共空间中为所述写数据请求分配缓存资源。分配模块503可以由处理器101调用缓存102中的程序代码实现,其具体实现可参考图3所示的S303。The allocation module 503 is configured to allocate cache resources from the public space to the write data request if the debt information of the target volume is greater than zero. The allocation module 503 can be implemented by the processor 101 calling the program code in the cache 102. For its specific implementation, refer to S303 shown in Figure 3.

可选的,装置50还可以包括释放模块504,用于当释放所述为所述写数据请求分配的缓存资源时,将所述释放的缓存资源添加到为所述目标卷分配的配额中。释放模块504可以由处理器101调用缓存102中的程序代码实现,其具体实现可参考图4所示的S403。Optionally, the apparatus 50 may further include a release module 504, configured to add the released cache resources to the quota allocated for the target volume when the cache resources allocated for the write data request are released. The release module 504 can be implemented by the processor 101 calling the program code in the cache 102. For its specific implementation, refer to S403 shown in Figure 4.

本领域普通技术人员将会理解,本发明的各个方面、或各个方面的可能实现方式可以被具体实施为系统、方法或者计算机程序产品。因此,本发明的各方面、或各个方面的可能实现方式可以采用完全硬件实施例、完全软件实施例(包括固件、驻留软件等等),或者组合软件和硬件方面的实施例的形式,在这里都统称为“电路”、“模块”或者“系统”。此外,本发明的各方面、或各个方面的可能实现方式可以采用计算机程序产品的形式,计算机程序产品是指存储在计算机可读介质中的计算机可读程序代码。Persons of ordinary skill in the art will understand that various aspects of the present invention, or possible implementations of various aspects, may be embodied as systems, methods, or computer program products. Accordingly, aspects of the invention, or possible implementations of aspects, may take the form of entirely hardware embodiments, entirely software embodiments (including firmware, resident software, etc.), or embodiments combining software and hardware aspects, in Here they are collectively referred to as "circuit", "module" or "system". In addition, various aspects of the present invention, or possible implementations of various aspects, may be in the form of a computer program product. The computer program product refers to a computer-readable program code stored in a computer-readable medium.

计算机可读介质包含但不限于电子、磁性、光学、电磁、红外或半导体系统、设备或者装置,或者前述的任意适当组合,如随机访问存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、光盘。Computer-readable media includes, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or devices, or any appropriate combination of the foregoing, such as random access memory (RAM), read only memory (ROM), removable Programmable read-only memory (EPROM), optical disk.

计算机中的处理器读取存储在计算机可读介质中的计算机可读程序代码,使得处理器能够执行在流程图中每个步骤、或各步骤的组合中规定的功能动作。The processor in the computer reads the computer-readable program code stored in the computer-readable medium, so that the processor can perform the functional actions specified in each step or a combination of steps in the flowchart.

计算机可读程序代码可以完全在用户的计算机上执行、部分在用户的计算机上执行、作为单独的软件包、部分在用户的计算机上并且部分在远程计算机上,或者完全在远程计算机或者服务器上执行。也应该注意,在某些替代实施方案中,在流程图中各步骤、或框图中各块所注明的功能可能不按图中注明的顺序发生。例如,依赖于所涉及的功能,接连示出的两个步骤、或两个块实际上可能被大致同时执行,或者这些块有时候可能被以相反顺序执行。The computer-readable program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server . It should also be noted that in some alternative implementations, the steps in the flowchart illustrations, or the functions noted in blocks in the block diagrams, may occur out of the order noted in the figures. For example, two steps, or blocks shown in succession may in fact be executed approximately concurrently, or the blocks may sometimes be executed in the reverse order, depending on the functionality involved.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. One of ordinary skill in the art may implement the described functionality using different methods for each specific application, but such implementations should not be considered to be beyond the scope of the present invention.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,本领域普通技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Those of ordinary skill in the art can easily think of changes or replacements within the technical scope disclosed by the present invention, and all of them should be covered. within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.

Claims (10)

1.一种缓存资源分配方法,其特征在于,包括:1. A cache resource allocation method, characterized by including: 接收写数据请求,所述写数据请求用于将待写入数据写入目标卷中,存储设备包括多个卷和缓存,所述缓存的空间包括私有空间和公共空间,所述私有空间被划分为若干个部分,每个部分作为配额分配给所述多个卷中的一个卷,所述目标卷是所述多个卷中的一个卷;Receive a write data request. The write data request is used to write the data to be written into the target volume. The storage device includes multiple volumes and caches. The cache space includes private space and public space. The private space is divided Be a plurality of parts, each part being allocated as a quota to one of the plurality of volumes, and the target volume is one of the plurality of volumes; 判断所述目标卷的债务信息是否大于零,所述债务信息用于指示为所述目标卷分配的配额是否已透支;Determine whether the debt information of the target volume is greater than zero, and the debt information is used to indicate whether the quota allocated for the target volume has been overdrawn; 若所述目标卷的债务信息大于零,则从所述公共空间中为所述写数据请求分配缓存资源;If the debt information of the target volume is greater than zero, allocate cache resources for the write data request from the public space; 当释放为所述写数据请求分配的缓存资源时,将释放的缓存资源添加到为所述目标卷分配的配额中。When the cache resources allocated for the write data request are released, the released cache resources are added to the quota allocated for the target volume. 2.根据权利要求1所述的方法,其特征在于,所述债务信息等于当前周期内申请缓存资源后对基准配额进行更新后的数值,或者,所述债务信息等于当前周期内释放缓存资源后对基准配额进行更新后的数值,所述基准配额等于新配额减去旧配额所得的差值,所述新配额为当前周期内为所述目标卷分配的配额,所述旧配额为历史周期内为所述目标卷分配的配额。2. The method according to claim 1, characterized in that the debt information is equal to the value after the baseline quota is updated after applying for cache resources in the current cycle, or the debt information is equal to the value after the cache resources are released in the current cycle. The updated value of the baseline quota. The baseline quota is equal to the difference obtained by subtracting the old quota from the new quota. The new quota is the quota allocated to the target volume in the current cycle. The old quota is the quota allocated to the target volume in the historical cycle. The allocated quota for the target volume. 3.根据权利要求1所述的方法,其特征在于,每个卷对应一个缓冲队列,所述缓冲队列中保存有一个或正在等待处理的写数据请求,还包括:3. The method according to claim 1, characterized in that each volume corresponds to a buffer queue, and the buffer queue stores a write data request or is waiting to be processed, and further includes: 根据每个卷所对应的缓冲队列中包含的写数据请求的数量以及写数据请求的尺寸为卷分配所述配额,其中,缓冲队列中包含的写数据请求的数量越多,为该缓冲队列对应的卷分配的配额越多,缓冲队列中包含的写数据请求的尺寸越大,为该缓冲队列所述对应的卷分配的配额越多。The quota is allocated to the volume according to the number of write data requests contained in the buffer queue corresponding to each volume and the size of the write data requests. The greater the number of write data requests contained in the buffer queue, the higher the number of write data requests contained in the buffer queue. The more quotas are allocated to a volume and the larger the size of the write data request contained in the buffer queue, the more quotas are allocated to the corresponding volume in the buffer queue. 4.根据权利要求1所述的方法,其特征在于,还包括:4. The method of claim 1, further comprising: 根据每个卷的缓存并发数为卷分配所述配额,所述缓存并发数用于指示当缓存中的数据复制到硬盘时,能够并发写入卷的写请求的数量。The quota is allocated to the volume according to the cache concurrency number of each volume, which is used to indicate the number of write requests that can be written to the volume concurrently when the data in the cache is copied to the hard disk. 5.根据权利要求2所述的方法,其特征在于,所述历史周期是所述当前周期的前一个周期。5. The method according to claim 2, characterized in that the historical period is a period before the current period. 6.一种缓存资源分配装置,其特征在于,所述装置位于存储设备中,包括:6. A cache resource allocation device, characterized in that the device is located in a storage device and includes: 接收模块,用于接收写数据请求,所述写数据请求用于将待写入数据写入目标卷中,所述存储设备包括多个卷和缓存,所述缓存的空间包括私有空间和公共空间,所述私有空间被划分为若干个部分,每个部分作为配额分配给所述多个卷中的一个卷,所述目标卷是所述多个卷中的一个卷;A receiving module, configured to receive a write data request. The write data request is used to write the data to be written into the target volume. The storage device includes multiple volumes and caches. The cache space includes private space and public space. , the private space is divided into several parts, each part is allocated as a quota to one of the plurality of volumes, and the target volume is one of the plurality of volumes; 判断模块,用于判断所述目标卷的债务信息是否大于零,所述债务信息用于指示为所述目标卷分配的配额是否已透支;A judgment module, used to judge whether the debt information of the target volume is greater than zero, and the debt information is used to indicate whether the quota allocated for the target volume has been overdrawn; 分配模块,用于若所述目标卷的债务信息大于零,则从所述公共空间中为所述写数据请求分配缓存资源;An allocation module, configured to allocate cache resources from the public space to the write data request if the debt information of the target volume is greater than zero; 释放模块,用于当释放为所述写数据请求分配的缓存资源时,将释放的缓存资源添加到为所述目标卷分配的配额中。A release module, configured to add the released cache resources to the quota allocated for the target volume when the cache resources allocated for the write data request are released. 7.根据权利要求6所述的装置,其特征在于,所述债务信息等于当前周期内申请缓存资源后对基准配额进行更新后的数值,或者,所述债务信息等于当前周期内释放缓存资源后对基准配额进行更新后的数值,所述基准配额等于新配额减去旧配额所得的差值,所述新配额为当前周期内为所述目标卷分配的配额,所述旧配额为历史周期内为所述目标卷分配的配额。7. The device according to claim 6, wherein the debt information is equal to the updated value of the baseline quota after applying for cache resources in the current cycle, or the debt information is equal to the value after releasing the cache resources in the current cycle. The updated value of the baseline quota. The baseline quota is equal to the difference obtained by subtracting the old quota from the new quota. The new quota is the quota allocated to the target volume in the current cycle. The old quota is the quota allocated to the target volume in the historical cycle. The allocated quota for the target volume. 8.根据权利要求6所述的装置,其特征在于,每个卷对应一个缓冲队列,所述缓冲队列中保存有一个或正在等待处理的写数据请求,8. The device according to claim 6, wherein each volume corresponds to a buffer queue, and a write data request is stored in the buffer queue or is waiting to be processed, 所述分配模块,还用于根据每个卷所对应的缓冲队列中包含的写数据请求的数量以及写数据请求的尺寸为卷分配所述配额,其中,缓冲队列中包含的写数据请求的数量越多,为该缓冲队列对应的卷分配的配额越多,缓冲队列中包含的写数据请求的尺寸越大,为该缓冲队列所述对应的卷分配的配额越多。The allocation module is also configured to allocate the quota to the volume according to the number of write data requests contained in the buffer queue corresponding to each volume and the size of the write data requests, wherein the number of write data requests contained in the buffer queue is The larger the number, the more quotas are allocated to the volume corresponding to the buffer queue, and the larger the size of the write data request contained in the buffer queue, the more quotas are allocated to the corresponding volume of the buffer queue. 9.根据权利要求6所述的装置,其特征在于,9. The device according to claim 6, characterized in that, 所述分配模块,还用于根据每个卷的缓存并发数为卷分配所述配额,所述缓存并发数用于指示当缓存中的数据复制到硬盘时,能够并发写入卷的写请求的数量。The allocation module is also configured to allocate the quota to the volume according to the cache concurrency number of each volume. The cache concurrency number is used to indicate the number of write requests that can be written to the volume concurrently when the data in the cache is copied to the hard disk. quantity. 10.根据权利要求7所述的装置,其特征在于,所述历史周期是所述当前周期的前一个周期。10. The device according to claim 7, wherein the historical period is a period before the current period.
CN201711213099.3A 2017-11-28 2017-11-28 Cache resource allocation and device Active CN109840217B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711213099.3A CN109840217B (en) 2017-11-28 2017-11-28 Cache resource allocation and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711213099.3A CN109840217B (en) 2017-11-28 2017-11-28 Cache resource allocation and device

Publications (2)

Publication Number Publication Date
CN109840217A CN109840217A (en) 2019-06-04
CN109840217B true CN109840217B (en) 2023-10-20

Family

ID=66879503

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711213099.3A Active CN109840217B (en) 2017-11-28 2017-11-28 Cache resource allocation and device

Country Status (1)

Country Link
CN (1) CN109840217B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306904B (en) * 2020-11-20 2022-03-29 新华三大数据技术有限公司 Cache data disk refreshing method and device
CN115826852A (en) * 2022-11-04 2023-03-21 超聚变数字技术有限公司 Cache management method of RAID card and related device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013023090A2 (en) * 2011-08-09 2013-02-14 Fusion-Io, Inc. Systems and methods for a file-level cache
CN103699496A (en) * 2012-09-27 2014-04-02 株式会社日立制作所 Hierarchy memory management

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016080953A1 (en) * 2014-11-17 2016-05-26 Hitachi, Ltd. Method and apparatus for data cache in converged system
US10031679B2 (en) * 2014-11-21 2018-07-24 Security First Corp. Gateway for cloud-based secure storage
US9684467B2 (en) * 2015-05-18 2017-06-20 Nimble Storage, Inc. Management of pinned storage in flash based on flash-to-disk capacity ratio
JP6540391B2 (en) * 2015-09-03 2019-07-10 富士通株式会社 Storage control device, storage control program, and storage control method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2013023090A2 (en) * 2011-08-09 2013-02-14 Fusion-Io, Inc. Systems and methods for a file-level cache
CN103699496A (en) * 2012-09-27 2014-04-02 株式会社日立制作所 Hierarchy memory management

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
多核系统共享内存资源分配和管理研究;高珂等;《计算机学报》;20150531(第05期);全文 *

Also Published As

Publication number Publication date
CN109840217A (en) 2019-06-04

Similar Documents

Publication Publication Date Title
US8782335B2 (en) Latency reduction associated with a response to a request in a storage system
US10860494B2 (en) Flushing pages from solid-state storage device
CN103329111B (en) Data processing method, device and system based on block storage
CN110196681B (en) Disk data write-in control method and device for business write operation and electronic equipment
CN112241320B (en) Resource allocation method, storage device and storage system
CN104461735B (en) A kind of method and apparatus that cpu resource is distributed under virtualization scene
CN112748869B (en) Data processing method and device
CN107203480B (en) Data prefetching method and device
US20230384934A1 (en) Method and system for managing memory associated with a peripheral component interconnect express (pcie) solid-state drive (ssd)
CN107577733B (en) A method and system for accelerating data replication
WO2022262623A1 (en) Data exchange method and apparatus
JP5893028B2 (en) System and method for efficient sequential logging on a storage device that supports caching
US9697047B2 (en) Cooperation of hoarding memory allocators in a multi-process system
CN109840217B (en) Cache resource allocation and device
US11579926B2 (en) Processing rest API requests based on resource usage satisfying predetermined limits
US20220129178A1 (en) Partitioning a cache for fulfilling storage commands
CN112162818B (en) Virtual memory allocation method and device, electronic equipment and storage medium
JP2023536237A (en) Acquiring cache resources for an expected write to a track in the writeset after the cache resources for the tracks in the writeset have been freed
CN110647476B (en) A method, device, device and storage medium for writing data in a solid-state hard disk
JP6578694B2 (en) Information processing apparatus, method, and program
US11099740B2 (en) Method, apparatus and computer program product for managing storage device
WO2018235149A1 (en) Storage device and method for managing storage regions
WO2016119618A1 (en) Remote memory allocation method, device and system
US10209906B2 (en) Target port processing of a data transfer
WO2017113329A1 (en) Cache management method for host cluster and host

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant