Search

EP-4365749-B1 - RESOURCE ALLOCATION METHOD AND DEVICE

EP4365749B1EP 4365749 B1EP4365749 B1EP 4365749B1EP-4365749-B1

Inventors

  • JIANG, Zhou
  • CHENG, Zhuo
  • SHI, HAITAO
  • WANG, YUANYUAN
  • XIANG, Weijie

Dates

Publication Date
20260506
Application Date
20220321

Claims (9)

  1. A resource allocation method, wherein the method is applied to a storage system (100), the storage system (100) comprises a plurality of cache objects, and the method comprises: outputting (S320) a first model based on a page resource allocated to each cache object and a data read hit ratio of the cache object, wherein the page resource allocated to each cache object is from a memory pool (200) provided by the storage system (100), and the first model indicates a page resource that needs to be allocated to the cache object when a specific hit ratio is met; outputting (S330) a second model based on the first model corresponding to each cache object, wherein the second model indicates a target page resource to be allocated to each cache object; and adjusting (S340), based on the second model, the page resource allocated to each cache object, which includes an increase of the page resource, a decrease of the page resource, or no change, wherein the cache object is a memory space allocated from the memory pool (200), and the memory space is provided to be used by a specific type of data, wherein the outputting (S330) a second model based on the first model corresponding to each cache object comprises: obtaining a weight value corresponding to each cache object, wherein one weight value corresponds to one cache object; and outputting the second model based on the first model corresponding to each cache object and the weight value corresponding to the cache object, wherein the obtaining a weight value corresponding to each cache object comprises: obtaining statistical information, wherein the statistical information comprises bandwidth and a processing delay of the memory pool (200); and determining, based on the statistical information, the weight value corresponding to each cache object.
  2. The method according to claim 1, wherein the outputting a first model based on a page resource allocated to each cache object and a data read hit ratio of the cache object comprises: obtaining status information of the cache object, wherein the status information comprises a combination of at least one or more of a reuse distance, memory eviction information, and historical information, and the historical information comprises a correspondence that is between a page resource allocated to the cache object and a data read hit ratio of the cache object and that exists in an execution process of a historical service; and creating the first model based on the status information.
  3. The method according to claim 2, wherein the creating the first model based on the status information comprises: creating a first curve based on the reuse distance, wherein the first curve indicates a correspondence that is between a page resource allocated to the cache object and a data read hit ratio and that is obtained according to a first algorithm; creating a second curve based on the memory eviction information, wherein the second curve indicates a correspondence between a page resource of the cache object and a data read hit ratio after a part of a page resource allocated to the cache object is evicted; creating a third curve based on the historical information; and creating the first model based on at least one of the first curve, the second curve, and the third curve.
  4. The method according to any one of claims 1 to 3, wherein the adjusting, based on the second model, the page resource allocated to each cache object comprises: obtaining first information of each cache object, wherein the first information indicates at least one of a priority or a hotspot requirement of the cache object; and adjusting, based on the first information and the second model, the page resource allocated to each cache object.
  5. A resource allocation apparatus (600) adapted to be used in a storage system (100), the storage system (100) comprises a plurality of cache objects, and the apparatus (600) comprises: a first generation unit (640), configured to output a first model based on a page resource allocated to each cache object and a data read hit ratio of the cache object, wherein the page resource allocated to each cache object is from a memory pool (200) provided by the storage system (100), and the first model indicates a page resource that needs to be allocated to the cache object when a specific hit ratio is met; a second generation unit (650), configured to output a second model based on the first model corresponding to each cache object, wherein the second model indicates a target page resource to be allocated to each cache object; and an allocation unit (630), configured to adjust, based on the second model, the page resource allocated to each cache object, which includes an increase of the page resource, a decrease of the page resource, or no change, wherein the cache object is a memory space allocated from the memory pool (200), and the memory space is provided to be used by a specific type of data, wherein the second generation unit (650) is specifically configured to obtain a weight value corresponding to each cache object, wherein one weight value corresponds to one cache object; and the second generation unit (650) is further specifically configured to output the second model based on the first model corresponding to each cache object and the weight value corresponding to the cache object, wherein the second generation unit (650) is specifically configured to obtain statistical information, wherein the statistical information comprises bandwidth and a processing delay of the memory pool (200); and the second generation unit is further specifically configured to determine, based on the statistical information, the weight value corresponding to each cache object.
  6. The apparatus according to claim 5, wherein the first generation unit is specifically configured to obtain status information of the cache object, wherein the status information comprises a combination of at least one or more of a reuse distance, memory eviction information, and historical information, and the historical information comprises a correspondence that is between a page resource allocated to the cache object and a data read hit ratio of the cache object and that exists in an execution process of a historical service; and the first generation unit is further specifically configured to create the first model based on the status information.
  7. The apparatus according to claim 6, wherein the first generation unit is further specifically configured to create a first curve based on the reuse distance, wherein the first curve indicates a correspondence that is between a page resource allocated to the cache object and a data read hit ratio and that is obtained according to a first algorithm; the first generation unit is further specifically configured to create a second curve based on the memory eviction information, wherein the second curve indicates a correspondence that is between a page resource of the cache object and a data read hit ratio and that exists after a part of a page resource allocated to the cache object is evicted; the first generation unit is further specifically configured to create a third curve based on the historical information; and the first generation unit is further specifically configured to create the first model based on at least one of the first curve, the second curve, and the third curve.
  8. The apparatus according to any one of claims 5 to 7, wherein the allocation unit is specifically configured to obtain first information of each cache object, wherein the first information indicates at least one of a priority or a hotspot requirement of the cache object; and the allocation unit is further specifically configured to adjust, based on the first information and the second model, the page resource allocated to each cache object.
  9. A computer-readable storage medium, wherein the storage medium stores a computer program or instructions which, when executed by a computing device (700), cause the computing device (700) to carry out the method according to any one of claims 1 to 4 .

Description

TECHNICAL FIELD This application relates to the field of data storage, and in particular, to a resource allocation method and an apparatus. BACKGROUND A memory is a communication bridge between a processor and a hard disk in a storage system. The memory is configured to temporarily store computing data in the processor and data exchanged between the processor and an external memory such as the hard disk. One or more memories in the storage system may be virtualized as a memory pool. The memory pool is configured to store a plurality of cache objects needed by a service, for example, a data read cache (read cache) and a metadata cache (pool cache). Usually, the processor may evenly allocate page resources needed by a plurality of cache objects based on remaining resources of the memory pool. However, if the remaining resources in the memory pool are insufficient, the processor evicts data stored in the plurality of cache objects in the same proportion, and reclaims a page resource occupied by the data. Consequently, a hit ratio of a cache object with a large page resource requirement is reduced. Then, an overall hit ratio of the memory is reduced, and a service processing delay is increased. Therefore, how to manage a memory resource becomes an urgent problem that needs to be resolved currently. US 2016/117241 A1 discloses a method, a device, and a non-transitory computer readable medium that dynamically allocate cache resources, including monitoring a hit or miss rate of a service level objective for each of a plurality of prior workloads and a performance of each of a plurality of cache storage resources. SUMMARY This application provides a resource allocation method, a resource allocation apparatus, and a computer-readable storage medium, as defined in the appended set of claims, to resolve a problem that a hit ratio of a cache object with a large page resource requirement is reduced, an overall hit ratio of a memory is reduced, and a service processing delay is increased. To achieve the foregoing objective, the following technical solutions are used in this application. According to a first aspect, this application provides a resource allocation method. The method may be applied to a storage system, or the method may be applied to a computing device that can support the storage system in implementing the method. For example, the computing device includes a chip system. The resource allocation method includes: First, a processor outputs a first model based on a page resource allocated to each cache object and a data read hit ratio of the cache object, where the page resource allocated to each cache object is from a memory pool provided by the storage system, and the first model indicates a page resource that needs to be allocated to the cache object when a specific hit ratio is met; second, the processor outputs a second model based on the first model corresponding to each cache object, where the second model indicates a target page resource allocated to each cache object; and finally, the processor adjusts, based on the second model, the page resource allocated to each cache object. In the resource allocation method provided in this embodiment of this application, the processor uses the first model to determine the page resource that is determined when each cache object meets the specific hit ratio, and uses the second model to determine the target page resource to be allocated to each cache object. This helps the processor adjust the page resource of the cache object based on the second model, and avoids that the processor evenly allocates or evicts the page resource of the cache object, thereby improving utilization of the page resource in the memory pool, improving allocation rationality of the page resource in the memory pool, and reducing a service processing delay. It should be noted that the resource allocation method may be performed by the processor of the storage system, or may be performed by the computing device that communicates with the storage system. If the foregoing resource allocation method is executed by the computing device that communicates with the storage system, consumption of a computing resource in the storage system can be reduced, and a data read and write speed of the storage system can be improved. In addition, because the computing resource of the computing device is adjustable, for example, a user may insert computing devices with different processing capabilities into the storage system, compared with the processor in the storage system, the computing device can allocate a resource more quickly, thereby reducing time needed for resource allocation and reducing the service processing delay. In the following implementations, the resource allocation method executed by the processor of the storage system is provided as an example. In the invention, the cache object is a memory space allocated from the memory pool, and the memory space is provided to be used by a specific typ