CN118656028A - Storage method, device, computer equipment, storage medium and program product - Google Patents
Storage method, device, computer equipment, storage medium and program product Download PDFInfo
- Publication number
- CN118656028A CN118656028A CN202410867666.0A CN202410867666A CN118656028A CN 118656028 A CN118656028 A CN 118656028A CN 202410867666 A CN202410867666 A CN 202410867666A CN 118656028 A CN118656028 A CN 118656028A
- Authority
- CN
- China
- Prior art keywords
- resource pool
- storage
- space
- target resource
- adjusted
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0638—Organizing or formatting or addressing of data
- G06F3/0644—Management of space entities, e.g. partitions, extents, pools
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/0802—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
- G06F12/0866—Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches for peripheral storage systems, e.g. disk cache
- G06F12/0871—Allocation or management of cache space
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input 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/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5011—Pool
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
Description
技术领域Technical Field
本申请涉及数据存储技术领域,特别是涉及一种存储方法、装置、计算机设备、存储介质和程序产品。The present application relates to the technical field of data storage, and in particular to a storage method, apparatus, computer equipment, storage medium and program product.
背景技术Background Art
随着海量数据的产生,对存储需求提出了高要求,因此大容量的机械硬盘被广泛应用于存储系统。但由于机械硬盘的性能较差,现有的存储系统中可以采用固态硬盘的缓存来优化这个问题,不仅可以解决容量和成本之间的均衡问题,而且还能保证了机械硬盘存储的大空间优势,以及固态硬盘的高性能特点。With the generation of massive data, high requirements are placed on storage, so large-capacity mechanical hard disks are widely used in storage systems. However, due to the poor performance of mechanical hard disks, the existing storage system can use solid-state drive cache to optimize this problem, which can not only solve the balance between capacity and cost, but also ensure the large space advantage of mechanical hard disk storage and the high performance characteristics of solid-state drives.
然而,针对多协议的数据存储时,上述结合固态硬盘进行缓存的存储方法仍然存在存储效率低的问题。However, when storing multi-protocol data, the above storage method combining solid-state hard disks for caching still has the problem of low storage efficiency.
发明内容Summary of the invention
基于此,有必要针对上述技术问题,提供一种能够提高存储效率的存储方法、装置、计算机设备、存储介质和程序产品。Based on this, it is necessary to provide a storage method, device, computer equipment, storage medium and program product that can improve storage efficiency in response to the above technical problems.
第一方面,本申请提供了一种存储方法,包括:In a first aspect, the present application provides a storage method, comprising:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
在其中一个实施例中,上述根据缓存中的共享资源池对目标资源池的存储空间进行调整,包括:In one embodiment, the adjusting the storage space of the target resource pool according to the shared resource pool in the cache includes:
根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量;Determine the space capacity to be adjusted based on the remaining space capacity in the target resource pool and the preset storage conditions;
根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整。Adjust the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted.
在其中一个实施例中,上述根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整,包括:In one embodiment, the step of adjusting the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted includes:
若共享资源池的空间容量小于待调整空间容量,则根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整;If the space capacity of the shared resource pool is less than the space capacity to be adjusted, the storage space of the target resource pool is adjusted according to the current request processing pressure of each type of resource pool;
若共享资源池的空间容量不小于待调整空间容量,则将待调整空间容量的空间从共享资源池中划分给目标资源池。If the space capacity of the shared resource pool is not less than the space capacity to be adjusted, the space of the space capacity to be adjusted is allocated from the shared resource pool to the target resource pool.
在其中一个实施例中,上述根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整,包括:In one embodiment, the above-mentioned adjusting the storage space of the target resource pool according to the current request processing pressure of each type of resource pool includes:
根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围;Determine the target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range;
对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。The storage space of each type of resource pool is adjusted so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
在其中一个实施例中,上述预设存储条件包括以下任一项:In one embodiment, the preset storage condition includes any one of the following:
存储请求所请求数据的数据量小于目标资源池中剩余空间容量;The amount of data requested by the storage request is less than the remaining space capacity in the target resource pool;
目标资源池的数据回刷效率大于或等于缓存效率。The data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
在其中一个实施例中,上述方法还包括:In one embodiment, the method further comprises:
对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。The local cache space is divided into resource pools, into multiple types of resource pools and shared resource pools.
在其中一个实施例中,上述根据调整后的目标资源池对存储请求所请求的数据进行存储,包括:In one embodiment, storing the data requested by the storage request according to the adjusted target resource pool includes:
确定调整后的目标资源池的剩余空间容量;Determine the remaining space capacity of the adjusted target resource pool;
若调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量,则将存储请求所请求的数据缓存至调整后的目标资源池;If the remaining space capacity of the adjusted target resource pool is not less than the data volume of the data requested by the storage request, the data requested by the storage request is cached in the adjusted target resource pool;
若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则将存储请求所请求的数据存储至机械硬盘中。If the remaining space of the adjusted target resource pool is less than the amount of data requested by the storage request, the data requested by the storage request is stored in the mechanical hard disk.
在其中一个实施例中,上述方法还包括:In one embodiment, the method further comprises:
在接收到读请求时,从缓存空间中读取读请求所请求的数据;When a read request is received, the data requested by the read request is read from the cache space;
若读取失败,则从机械硬盘中读取读请求所请求的数据。If the read fails, the data requested by the read request is read from the mechanical hard disk.
第二方面,本申请还提供了一种存储装置,包括:In a second aspect, the present application further provides a storage device, including:
确定模块,用于确定接收到的存储请求在缓存空间中对应的目标资源池;A determination module, used to determine a target resource pool corresponding to the received storage request in the cache space;
调整模块,用于在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;An adjustment module, used to adjust the storage space of the target resource pool according to the shared resource pool in the cache when the target resource pool does not meet the preset storage conditions;
存储模块,用于根据调整后的目标资源池对存储请求所请求的数据进行存储。The storage module is used to store the data requested by the storage request according to the adjusted target resource pool.
第三方面,本申请还提供了一种计算机设备,包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现以下步骤:In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
第四方面,本申请还提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the following steps are implemented:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
第五方面,本申请还提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
上述存储方法、装置、计算机设备、存储介质和程序产品,确定接收到的存储请求在缓存空间中对应的目标资源池,在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整,从而根据调整后的目标资源池对存储请求所请求的数据进行存储。通过建立共享资源池,在目标资源池不满足预设存储条件的情况下,对目标资源池的存储空间进行动态调整,使得目标资源池的存储空间可以随存储请求的需求进行调整,提高了存储请求的存储效率,以及提高了缓存空间的资源利用率,进一步地,根据调整后的目标资源池对存储请求所请求的数据进行存储,可以进一步发挥缓存性能。The above storage method, device, computer equipment, storage medium and program product determine the target resource pool corresponding to the received storage request in the cache space, and when the target resource pool does not meet the preset storage conditions, adjust the storage space of the target resource pool according to the shared resource pool in the cache, so as to store the data requested by the storage request according to the adjusted target resource pool. By establishing a shared resource pool, when the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is dynamically adjusted, so that the storage space of the target resource pool can be adjusted according to the needs of the storage request, thereby improving the storage efficiency of the storage request and the resource utilization of the cache space. Furthermore, the data requested by the storage request is stored according to the adjusted target resource pool, which can further exert the cache performance.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或相关技术中的技术方案,下面将对本申请实施例或相关技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
图1为一个实施例中存储方法的应用环境图;FIG1 is an application environment diagram of a storage method in one embodiment;
图2为一个实施例中存储方法的流程示意图;FIG2 is a schematic diagram of a storage method in one embodiment;
图3为一个实施例中存储系统架构示意图;FIG3 is a schematic diagram of a storage system architecture in one embodiment;
图4为另一个实施例中存储方法的流程示意图;FIG4 is a schematic diagram of a flow chart of a storage method in another embodiment;
图5为另一个实施例中存储方法的流程示意图;FIG5 is a schematic diagram of a flow chart of a storage method in another embodiment;
图6为另一个实施例中存储方法的流程示意图;FIG6 is a schematic flow chart of a storage method in another embodiment;
图7为另一个实施例中存储方法的流程示意图;FIG7 is a schematic diagram of a flow chart of a storage method in another embodiment;
图8为另一个实施例中的资源划分示意图;FIG8 is a schematic diagram of resource partitioning in another embodiment;
图9为另一个实施例中存储方法的流程示意图;FIG9 is a schematic flow chart of a storage method in another embodiment;
图10为另一个实施例中存储方法的流程示意图;FIG10 is a schematic flow chart of a storage method in another embodiment;
图11为另一个实施例中存储方法的流程示意图;FIG11 is a schematic flow chart of a storage method in another embodiment;
图12为一个实施例中存储装置的结构框图;FIG12 is a block diagram of a storage device in one embodiment;
图13为一个实施例中计算机设备的内部结构图。FIG. 13 is a diagram showing the internal structure of a computer device in one embodiment.
具体实施方式DETAILED DESCRIPTION
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
随着海量数据的产生,对存储需求提出了高要求,因此大容量的机械硬盘(HardDisk Drive,HDD)被广泛应用于存储系统,由于HDD的读写性能较差,现有的存储系统中通常采用固态硬盘(Solid State Drive,SSD)的缓存来优化这个问题,不仅可以解决容量和成本之间的均衡问题,而且还能保证了机械硬盘存储的大空间优势,以及固态硬盘的高性能特点。With the generation of massive data, high requirements are placed on storage needs. Therefore, large-capacity mechanical hard disks (HDD) are widely used in storage systems. Due to the poor read and write performance of HDD, existing storage systems usually use solid-state drives (SSD) cache to optimize this problem. This not only solves the balance between capacity and cost, but also ensures the large space advantage of mechanical hard disk storage and the high performance characteristics of solid-state drives.
存储系统在部署实施后,通常一种类型的单一存储协议的存储服务,可以基于该存储协议对应的缓存实例提供存储服务,由于用户端可能存在多协议的存储需求,因此出现了支持多存储协议的分布式存储系统,客户端层包含了不同存储协议对应的客户端服务,为用户提供相应的服务。当不同协议的输入输出(Input/Output,IO)请求下发到存储系统中,经卷设备与机械硬盘的磁盘设备映射层,转换为机械硬盘上对应的IO请求。对于不同的存储协议,会配置不同的缓存实例,IO请求首先被写入对应的缓存实例中,即可将IO请求的处理结果返回至客户端。在读写模式的缓存实例中,回刷流程会将写入的数据定时回刷到机械硬盘上,此时数据变为干净数据,固态硬盘上的对应空间可以被复用,这种缓存模式可以有效地提高写性能,同时数据在固态硬盘中有一份,在后续可提供读命中率,可加快读请求性能。After the storage system is deployed and implemented, usually a storage service of a single storage protocol of a type can provide storage services based on the cache instance corresponding to the storage protocol. Since the user side may have storage requirements for multiple protocols, a distributed storage system that supports multiple storage protocols has emerged. The client layer contains client services corresponding to different storage protocols to provide corresponding services for users. When input/output (IO) requests of different protocols are sent to the storage system, they are converted into corresponding IO requests on the mechanical hard disk through the disk device mapping layer of the volume device and the mechanical hard disk. Different cache instances are configured for different storage protocols. The IO request is first written to the corresponding cache instance, and the processing result of the IO request can be returned to the client. In the cache instance of the read-write mode, the flushing process will flush the written data back to the mechanical hard disk at a fixed time. At this time, the data becomes clean data, and the corresponding space on the solid-state drive can be reused. This cache mode can effectively improve the write performance. At the same time, there is a copy of the data in the solid-state drive, which can provide a read hit rate in the future and speed up the read request performance.
现有的支持多协议的存储方法中,每个缓存实例将使用自己的内存、线程、硬盘等资源,这些资源在不同缓存实例之间不能共享。当某种协议的业务停掉或者负载较低时,资源相对充裕,剩余资源也无法被其他的缓存实例充分利用,进而造成资源的浪费,无法保证缓存的高效能执行。因此,需要一种可以提高存储效率的存储方法。In the existing storage methods that support multiple protocols, each cache instance will use its own memory, threads, hard disk and other resources, which cannot be shared between different cache instances. When the service of a certain protocol is stopped or the load is low, the resources are relatively abundant, and the remaining resources cannot be fully utilized by other cache instances, resulting in a waste of resources and unable to ensure the efficient execution of the cache. Therefore, a storage method that can improve storage efficiency is needed.
本申请实施例提供的存储方法,可以应用于如图1所示的应用环境中。其中,客户端102通过网络与服务器104进行通信。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他网络服务器上。服务器104接收客户端102发送的存储请求。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能电视、智能空调、智能车载设备、投影设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。头戴设备可以为虚拟现实(Virtual Reality,VR)设备、增强现实(AugmentedReality,AR)设备、智能眼镜等。服务器104可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或分布式系统,还可以是提供云计算服务的云服务器。The storage method provided in the embodiment of the present application can be applied to the application environment shown in Figure 1. Among them, the client 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. The server 104 receives the storage request sent by the client 102. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server 104 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
在一个实施例中,如图2所示,提供了一种存储方法,以该方法应用于图1中的服务器为例进行说明,包括:In one embodiment, as shown in FIG. 2 , a storage method is provided, which is described by taking the method applied to the server in FIG. 1 as an example, including:
S201,确定接收到的存储请求在缓存空间中对应的目标资源池。S201, determining a target resource pool corresponding to a received storage request in a cache space.
其中,存储请求可以为IO请求中的写请求;缓存空间可以包括固态硬盘(SolidState Drive,SSD)的缓存资源和内存对应的处理资源;目标资源池可以为存储请求对应的存储类型的独立资源池。Among them, the storage request may be a write request in an IO request; the cache space may include cache resources of a solid state drive (SSD) and processing resources corresponding to a memory; and the target resource pool may be an independent resource pool of a storage type corresponding to the storage request.
在本申请实施例中,服务器中可以保护客户端层,通过客户端层接收客户端发送至服务器的存储请求,通过服务器中映射层可以确定存储请求与机械硬盘的映射关系,从而将存储请求转化为机械硬盘(Hard Disk Drive,HDD)对应的存储请求,确定该存储请求在缓存空间中对应的目标资源池,从而根据目标资源池的状态对该存储请求进行处理。In an embodiment of the present application, the client layer can be protected in the server, and the storage request sent by the client to the server can be received through the client layer. The mapping relationship between the storage request and the mechanical hard disk can be determined through the mapping layer in the server, thereby converting the storage request into a storage request corresponding to the mechanical hard disk (Hard Disk Drive, HDD), and determining the target resource pool corresponding to the storage request in the cache space, so as to process the storage request according to the status of the target resource pool.
可选的,可以根据存储请求对应的存储协议确定存储请求在缓存空间中对应的目标资源池。其中,存储协议可以包括块存储协议、文件存储协议和对象存储协议,相应地,独立资源池可以包括块资源池、文件资源池和对象资源池。若存储请求对应的存储协议为块存储协议,则目标资源池为块资源池;若存储请求对应的存储协议为文件存储协议,则目标资源池为文件资源池;若存储请求对应的存储协议为对象存储协议,则目标资源池为对象资源池。Optionally, the target resource pool corresponding to the storage request in the cache space can be determined according to the storage protocol corresponding to the storage request. Among them, the storage protocol can include a block storage protocol, a file storage protocol and an object storage protocol, and accordingly, the independent resource pool can include a block resource pool, a file resource pool and an object resource pool. If the storage protocol corresponding to the storage request is a block storage protocol, the target resource pool is a block resource pool; if the storage protocol corresponding to the storage request is a file storage protocol, the target resource pool is a file resource pool; if the storage protocol corresponding to the storage request is an object storage protocol, the target resource pool is an object resource pool.
示例性地,如图3所示,服务器可以通过客户端层向块存储客户端、文件存储客户端和对象存储客户端提供存储服务,缓存资源中包括块资源池、文件资源池、对象资源池、共享资源池,以及线程资源池。Exemplarily, as shown in FIG3 , the server can provide storage services to block storage clients, file storage clients, and object storage clients through the client layer, and the cache resources include a block resource pool, a file resource pool, an object resource pool, a shared resource pool, and a thread resource pool.
S202,在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整。S202: When the target resource pool does not meet a preset storage condition, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache.
其中,预设存储条件包括以下任一项:(1)存储请求所请求数据的数据量小于目标资源池中剩余空间容量;(2)目标资源池的数据回刷效率大于或等于缓存效率。The preset storage condition includes any one of the following: (1) the amount of data requested by the storage request is less than the remaining space capacity in the target resource pool; (2) the data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
在本申请实施例中,在目标资源池不满足预设存储条件的情况下,对目标资源池的存储空间进行调整,可选的,可以将共享资源池中预设大小的空间容量划分至目标资源池,以扩大目标资源池的存储空间;或者,可以将共享资源池中的空间容量中预设比例的空间划分至目标资源池,以扩大目标资源池的存储空间。示例性地,预设大小的空间容量可以为8MB,当目标资源池不满足预设存储条件时,可以将共享资源池中8MB的空间划分至目标资源池;或者,预设比例可以为10%,若共享资源池当前的空间容量为100MB,则将共享资源池中10MB的空间划分至目标资源池。In an embodiment of the present application, when the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted. Optionally, the space capacity of a preset size in the shared resource pool can be allocated to the target resource pool to expand the storage space of the target resource pool; or, a preset proportion of the space capacity in the shared resource pool can be allocated to the target resource pool to expand the storage space of the target resource pool. Exemplarily, the space capacity of the preset size can be 8MB. When the target resource pool does not meet the preset storage conditions, 8MB of space in the shared resource pool can be allocated to the target resource pool; or, the preset proportion can be 10%. If the current space capacity of the shared resource pool is 100MB, 10MB of space in the shared resource pool is allocated to the target resource pool.
可选的,在目标资源池满足预设存储条件的情况下,对存储请求所请求的数据进行存储,即将存储请求中携带的数据缓存至目标资源池,并根据预设的数据回刷方法将存储请求所请求的数据回刷至机械硬盘中。作为一种可选的实施方式,在将存储请求中携带的数据缓存至目标资源池后,服务器可以向客户端返回存储请求成功的消息。Optionally, when the target resource pool meets the preset storage conditions, the data requested by the storage request is stored, that is, the data carried in the storage request is cached to the target resource pool, and the data requested by the storage request is flushed back to the mechanical hard disk according to the preset data flushing method. As an optional implementation, after caching the data carried in the storage request to the target resource pool, the server can return a message to the client indicating that the storage request is successful.
可选的,可以在数据缓存至目标资源池中的时长达到预设时长时,将数据回刷至机械硬盘;或者,可以在目标资源池的存储空间全部写满数据后,统一将数据回刷至机械硬盘。Optionally, the data can be flushed back to the mechanical hard disk when the data is cached in the target resource pool for a preset period of time; or, the data can be flushed back to the mechanical hard disk in a unified manner after the storage space of the target resource pool is full of data.
S203,根据调整后的目标资源池对存储请求所请求的数据进行存储。S203: Store the data requested by the storage request according to the adjusted target resource pool.
在本申请实施例中,根据调整后的目标资源池确定存储请求所请求的数据的存储位置,存储位置可以包括机械硬盘、固态硬盘中的任一项。In an embodiment of the present application, the storage location of the data requested by the storage request is determined according to the adjusted target resource pool, and the storage location may include any one of a mechanical hard disk and a solid-state hard disk.
作为一种可选的实施方式,可以在调整后的目标资源池满足预设存储条件的情况下,将存储请求所请求的数据存储至固态硬盘;可以在调整后的目标资源池不满足预设存储条件的情况下,将存储请求所请求的数据存储至机械硬盘。As an optional implementation, the data requested by the storage request can be stored in a solid-state drive if the adjusted target resource pool meets the preset storage conditions; the data requested by the storage request can be stored in a mechanical hard drive if the adjusted target resource pool does not meet the preset storage conditions.
作为另一种可选的实施方式,可以确定目标资源池中干净数据的热度值,并确定热度值最低的干净数据所在的存储位置,将存储请求所请求的数据存储至该存储位置。As another optional implementation, the heat value of the clean data in the target resource pool may be determined, and the storage location where the clean data with the lowest heat value is located may be determined, and the data requested by the storage request may be stored in the storage location.
上述存储方法中,确定接收到的存储请求在缓存空间中对应的目标资源池,在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整,从而根据调整后的目标资源池对存储请求所请求的数据进行存储。通过建立共享资源池,在目标资源池不满足预设存储条件的情况下,对目标资源池的存储空间进行动态调整,使得目标资源池的存储空间可以随存储请求的需求进行调整,提高了存储请求的存储效率,以及提高了缓存空间的资源利用率,进一步地,根据调整后的目标资源池对存储请求所请求的数据进行存储,可以进一步发挥缓存性能。In the above storage method, the target resource pool corresponding to the received storage request in the cache space is determined. When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache, so that the data requested by the storage request is stored according to the adjusted target resource pool. By establishing a shared resource pool, when the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is dynamically adjusted, so that the storage space of the target resource pool can be adjusted according to the needs of the storage request, thereby improving the storage efficiency of the storage request and the resource utilization of the cache space. Furthermore, the data requested by the storage request is stored according to the adjusted target resource pool, which can further exert the cache performance.
在一个实施例中,提供了上述S202的一种实现方式,如图4所示,上述“根据缓存中的共享资源池对目标资源池的存储空间进行调整”,包括:In one embodiment, an implementation of the above S202 is provided, as shown in FIG4 , wherein the above “adjusting the storage space of the target resource pool according to the shared resource pool in the cache” includes:
S301,根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量。S301, determining the space capacity to be adjusted according to the remaining space capacity in the target resource pool and a preset storage condition.
在本申请实施例中,在存储请求所请求数据的数据量小于目标资源池中剩余空间容量时,确定存储请求所请求数据的数据量与目标资源池中剩余空间容量的差值,将该差值作为待调整空间容量;或者,在目标资源池的数据回刷效率小于缓存效率时,确定待调整空间容量为存储请求所请求数据的数据量。In an embodiment of the present application, when the data amount of the data requested by the storage request is less than the remaining space capacity in the target resource pool, the difference between the data amount of the data requested by the storage request and the remaining space capacity in the target resource pool is determined, and the difference is used as the space capacity to be adjusted; or, when the data flushing efficiency of the target resource pool is less than the cache efficiency, the space capacity to be adjusted is determined to be the data amount of the data requested by the storage request.
S302,根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整。S302: Adjust the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted.
在本申请实施例中,确定共享资源池的空间容量是否大于待调整空间容量,从而根据确定结果对目标资源池的存储空间进行调整。In the embodiment of the present application, it is determined whether the space capacity of the shared resource pool is greater than the space capacity to be adjusted, and the storage space of the target resource pool is adjusted according to the determination result.
可选的,若共享资源池的空间容量大于或等于待调整空间容量,则可以从共享资源池中划分部分空间至目标资源池,以扩大目标资源池的存储空间;若共享资源池的空间容量小于待调整空间容量,则可以不对目标资源池的存储空间进行调整,将存储请求所请求数据的存储至机械硬盘。Optionally, if the space capacity of the shared resource pool is greater than or equal to the space capacity to be adjusted, part of the space can be allocated from the shared resource pool to the target resource pool to expand the storage space of the target resource pool; if the space capacity of the shared resource pool is less than the space capacity to be adjusted, the storage space of the target resource pool may not be adjusted, and the data requested by the storage request can be stored on the mechanical hard disk.
本实施例所述的方法,首先确定待调整空间容量,从而根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整,使得对目标资源池的存储空间的调整更加精准,降低了存储资源浪费的概率。The method described in this embodiment first determines the capacity of the space to be adjusted, and then adjusts the storage space of the target resource pool according to the space capacity of the shared resource pool and the capacity of the space to be adjusted, so that the adjustment of the storage space of the target resource pool is more accurate and the probability of storage resource waste is reduced.
在一个实施例中,提供了上述S302的一种实现方式,如图5所示,上述“根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整”,包括:In one embodiment, an implementation of the above S302 is provided, as shown in FIG5 , wherein the above “adjusting the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted” includes:
S401,若共享资源池的空间容量小于待调整空间容量,则根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整。S401: If the space capacity of the shared resource pool is less than the space capacity to be adjusted, the storage space of the target resource pool is adjusted according to the current request processing pressure of each type of resource pool.
其中,各类型的资源池为各存储类型对应的独立资源池,各类型的资源池包括目标资源池。示例性地,各类型的资源池可以包括块资源池、文件资源池和对象资源池。Each type of resource pool is an independent resource pool corresponding to each storage type, and each type of resource pool includes a target resource pool. Exemplarily, each type of resource pool may include a block resource pool, a file resource pool, and an object resource pool.
在本申请实施例中,在共享资源池的空间容量小于待调整空间容量的情况下,确定各类型的资源池的当前请求处理压力,从而根据各类型的资源池的当前请求处理压力,对各类型的资源池和共享资源池的存储空间进行调整。In an embodiment of the present application, when the space capacity of the shared resource pool is less than the space capacity to be adjusted, the current request processing pressure of each type of resource pool is determined, and the storage space of each type of resource pool and the shared resource pool is adjusted according to the current request processing pressure of each type of resource pool.
可选的,可以预先设置压力阈值,若某类型的资源池的当前请求处理压力小于压力阈值,则将该资源池中预设大小的空间划分至共享资源池。Optionally, a pressure threshold may be preset, and if the current request processing pressure of a resource pool of a certain type is less than the pressure threshold, a space of a preset size in the resource pool is divided into the shared resource pool.
可选的,可以预先设置各类型的资源池的空间容量的最小值,各类型的资源池的空间容量的最小值可以相同,也可以不同,各类型的资源池的空间容量始终大于该资源池对应的最小值;或者,可以预先设置各类型的资源池的空间容量占总缓存资源的最小比例,各类型的资源池的占总缓存资源的最小比例可以相同,也可以不同,各类型的资源池的空间容量占总缓存资源的始终大于该资源池对应的最小比例。Optionally, a minimum space capacity of each type of resource pool may be pre-set, and the minimum space capacity of each type of resource pool may be the same or different, and the space capacity of each type of resource pool is always greater than the minimum value corresponding to the resource pool; or, a minimum proportion of the space capacity of each type of resource pool to the total cache resources may be pre-set, and the minimum proportion of the space capacity of each type of resource pool to the total cache resources may be the same or different, and the space capacity of each type of resource pool to the total cache resources is always greater than the minimum proportion corresponding to the resource pool.
S402,若共享资源池的空间容量不小于待调整空间容量,则将待调整空间容量的空间从共享资源池中划分给目标资源池。S402: If the space capacity of the shared resource pool is not less than the space capacity to be adjusted, the space of the space capacity to be adjusted is allocated from the shared resource pool to the target resource pool.
在本申请实施例中,在共享资源池的空间容量不小于待调整空间容量的情况下,共享资源池中的空间容量充足,则直接将待调整空间容量的空间从共享资源池中划分给目标资源池,以扩大目标资源池的存储空间。In an embodiment of the present application, when the space capacity of the shared resource pool is not less than the space capacity to be adjusted and the space capacity in the shared resource pool is sufficient, the space of the space capacity to be adjusted is directly allocated from the shared resource pool to the target resource pool to expand the storage space of the target resource pool.
本实施例所述的方法,在共享资源池的空间容量处于不同的情况时,根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整,或者,将待调整空间容量的空间从共享资源池中划分给目标资源池,对共享资源池和目标资源池的空间容量进行合理的分配,从而提高服务器的缓存效率。The method described in this embodiment adjusts the storage space of the target resource pool according to the current request processing pressure of each type of resource pool when the space capacity of the shared resource pool is in different situations, or divides the space with the space capacity to be adjusted from the shared resource pool to the target resource pool, and reasonably allocates the space capacity of the shared resource pool and the target resource pool, thereby improving the cache efficiency of the server.
在一个实施例中,提供了上述S401的一种实现方式,如图6所示,上述“根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整”,包括:In one embodiment, an implementation of the above S401 is provided, as shown in FIG6 , wherein the above “adjusting the storage space of the target resource pool according to the current request processing pressure of each type of resource pool” includes:
S501,根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围。S501, determining target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range.
在本申请实施例中,在共享资源池的空间容量小于待调整空间容量时,共享资源池的空间容量不足,则确定各类型的资源池的当前请求处理压力,从而根据各类型的资源池的当前请求处理压力,确定各类型的当前请求处理压力的比值,进而根据各类型的当前请求处理压力的比值,确定各类型的资源池的目标空间容量。In an embodiment of the present application, when the space capacity of the shared resource pool is less than the space capacity to be adjusted, the space capacity of the shared resource pool is insufficient, and the current request processing pressure of each type of resource pool is determined, and then the ratio of the current request processing pressure of each type of resource pool is determined based on the current request processing pressure of each type of resource pool, and then the target space capacity of each type of resource pool is determined based on the ratio of the current request processing pressure of each type.
可选的,可以根据预设时间段接收到的各类型的存储请求的数量确定各类型的资源池的当前请求处理压力。示例性地,若预设时间段内接收到块存储类型对应的存储请求的数量为10个,接收到文件存储类型对应的存储请求的数量为15个,接收到文件存储类型对应的存储请求的数量为25个,则各类型的当前请求处理压力的比值为2:3:5,各类型的资源池的目标空间容量也为2:3:5,即块存储资源池的目标空间容量占总缓存资源池的空间容量的20%,文件存储资源池的目标空间容量占总缓存资源池的空间容量的30%,对象存储资源池的目标空间容量占总缓存资源池的空间容量的50%。Optionally, the current request processing pressure of each type of resource pool can be determined based on the number of storage requests of each type received in a preset time period. For example, if the number of storage requests corresponding to the block storage type received in the preset time period is 10, the number of storage requests corresponding to the file storage type received is 15, and the number of storage requests corresponding to the file storage type received is 25, then the ratio of the current request processing pressure of each type is 2:3:5, and the target space capacity of each type of resource pool is also 2:3:5, that is, the target space capacity of the block storage resource pool accounts for 20% of the space capacity of the total cache resource pool, the target space capacity of the file storage resource pool accounts for 30% of the space capacity of the total cache resource pool, and the target space capacity of the object storage resource pool accounts for 50% of the space capacity of the total cache resource pool.
在本申请实施例中,目标空间容量处于预设容量范围,示例性地,若对象存储资源池的空间容量的预设容量范围为10%~40%,而根据各类型的资源池的当前请求处理压力确定出的对象存储资源池的目标空间容量占总缓存资源池的空间容量的50%,则将对象存储资源池的目标空间容量调整为总缓存资源池的空间容量的40%。In an embodiment of the present application, the target space capacity is within a preset capacity range. For example, if the preset capacity range of the space capacity of the object storage resource pool is 10% to 40%, and the target space capacity of the object storage resource pool determined based on the current request processing pressure of each type of resource pool accounts for 50% of the space capacity of the total cache resource pool, then the target space capacity of the object storage resource pool is adjusted to 40% of the space capacity of the total cache resource pool.
S502,对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。S502, adjusting the storage space of each type of resource pool so that the adjusted space capacity of each type of resource pool reaches the target space capacity.
在本申请实施例中,各类型的资源池的目标空间容量对各类型资源池的存储空间进行调整。In the embodiment of the present application, the target space capacity of each type of resource pool adjusts the storage space of each type of resource pool.
作为一种可选的实施方式,可以先对资源池当前的空间容量大于目标容量空间的资源池进行调整,确定该资源池当前的空间容量与目标空间容量的第一差值,从而将第一差值的空间从该资源池划分至共享资源池;再对资源池当前的空间容量大于目标容量空间的资源池进行调整,该资源池目标空间容量与当前的空间容量的第二差值,则将第二差值的空间从共享资源池划分至该资源池。As an optional implementation, the resource pool whose current space capacity is greater than the target capacity space can be adjusted first, and the first difference between the current space capacity of the resource pool and the target space capacity can be determined, thereby dividing the space of the first difference from the resource pool to the shared resource pool; then the resource pool whose current space capacity is greater than the target capacity space can be adjusted, and the second difference between the target space capacity of the resource pool and the current space capacity can be determined, and the space of the second difference can be divided from the shared resource pool to the resource pool.
作为另一种可选的实施方式,可以将大于目标容量空间的资源池中的空间划分至小于目标容量空间的资源池,使调整后的各类型的资源池的空间容量达到目标空间容量。As another optional implementation, the space in a resource pool that is larger than the target capacity space may be divided into resource pools that are smaller than the target capacity space, so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
可选的,由于各目标空间容量处于预设容量范围内,对各类型资源池的存储空间进行调整后,共享资源池中可能存在空间容量,可以对共享资源池中的空间容量进行保留,也可以将共享资源池中的空间容量分配至未超过预设容量范围的资源池。Optionally, since each target space capacity is within the preset capacity range, after adjusting the storage space of each type of resource pool, there may be space capacity in the shared resource pool. The space capacity in the shared resource pool can be reserved, or the space capacity in the shared resource pool can be allocated to a resource pool that does not exceed the preset capacity range.
本实施例所述的方法,在共享资源池的空间容量不足的情况下,根据各类型的资源池的当前请求处理压力,对各类型资源池的存储空间进行调整,使得对各资源池的资源分配更加合理,将资源利用最大化。The method described in this embodiment adjusts the storage space of each type of resource pool according to the current request processing pressure of each type of resource pool when the space capacity of the shared resource pool is insufficient, so as to make the resource allocation of each resource pool more reasonable and maximize the resource utilization.
在一个实施例中,如图7所示,上述存储方法还包括:In one embodiment, as shown in FIG7 , the storage method further includes:
S204,对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。S204, dividing the local cache space into resource pools, into multiple types of resource pools and a shared resource pool.
在本申请实施例中,如图8所示的资源划分示意图,按照预设的划分规则对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池,可选的,预设的划分规则可以为多个类型的资源池和共享资源池分别占本地的缓存空间的初始比例,示例性地,初始比例可以包括各类型的资源池均占本地的缓存空间的20%,则共享资源池占本地的缓存空间的40%;或者,初始比例也可以包括块存储资源池占本地的缓存空间的20%,文件存储资源池占本地的缓存空间的20%,对象存储资源池占本地的缓存空间的30%,则共享资源池占本地的缓存空间的30%。In an embodiment of the present application, as shown in the resource partitioning diagram of Figure 8, the local cache space is divided into resource pools according to a preset partitioning rule to divide multiple types of resource pools and shared resource pools. Optionally, the preset partitioning rule can be the initial proportions of the multiple types of resource pools and the shared resource pool in the local cache space. Exemplarily, the initial proportions may include each type of resource pool occupying 20% of the local cache space, and the shared resource pool occupying 40% of the local cache space; or, the initial proportions may also include the block storage resource pool occupying 20% of the local cache space, the file storage resource pool occupying 20% of the local cache space, and the object storage resource pool occupying 30% of the local cache space, and the shared resource pool occupying 30% of the local cache space.
本实施例所述的方法,预先划分出多个类型的资源池和共享资源池,使得各类型的资源池在容量空间不足时,可以请求共享资源池中的空间进行补充,使得服务器对存储请求进行处理的过程中对容量空间的利用更加灵活,从而提高了存储效率。The method described in this embodiment pre-divides multiple types of resource pools and shared resource pools, so that when each type of resource pool is short of capacity space, it can request space in the shared resource pool for replenishment, making the server more flexible in utilizing capacity space when processing storage requests, thereby improving storage efficiency.
在一个实施例中,提供了上述S203的一种实现方式,如图8所示,上述“据调整后的目标资源池对存储请求所请求的数据进行存储”,包括:In one embodiment, an implementation of the above S203 is provided, as shown in FIG8 , the above “storing the data requested by the storage request according to the adjusted target resource pool” includes:
S601,确定调整后的目标资源池的剩余空间容量。S601: Determine the remaining space capacity of the adjusted target resource pool.
在本申请实施例中,可以通过预设的工具实时采集资源池的使用数据,以确定调整后的目标资源池的剩余空间容量,调整后的目标资源池中包括该类型对应的独立资源池的空间容量以及一部分的共享资源池的空间容量,确定调整后的目标资源池的剩余空间容量,即调整后的目标资源池中未缓存数据的空间容量和/或缓存有干净数据的空间容量。进一步地,确定调整后的目标资源池的剩余空间容量是否小于存储请求所请求的数据的数据量。In an embodiment of the present application, the use data of the resource pool can be collected in real time through a preset tool to determine the remaining space capacity of the adjusted target resource pool, which includes the space capacity of the independent resource pool corresponding to the type and the space capacity of a portion of the shared resource pool, and determines the remaining space capacity of the adjusted target resource pool, that is, the space capacity of uncached data and/or the space capacity of cached clean data in the adjusted target resource pool. Further, determine whether the remaining space capacity of the adjusted target resource pool is less than the data volume of the data requested by the storage request.
S602,若调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量,则将存储请求所请求的数据缓存至调整后的目标资源池。S602: If the remaining space capacity of the adjusted target resource pool is not less than the data volume of the data requested by the storage request, cache the data requested by the storage request to the adjusted target resource pool.
在本申请实施例中,若调整后的目标资源池的剩余空间容量大于或等于存储请求所请求的数据的数据量,则当前目标资源池的剩余空间容量满足预设存储条件,将存储请求所请求的数据缓存至调整后的目标资源池。In an embodiment of the present application, if the remaining space capacity of the adjusted target resource pool is greater than or equal to the data amount requested by the storage request, the remaining space capacity of the current target resource pool meets the preset storage conditions, and the data requested by the storage request is cached to the adjusted target resource pool.
S603,若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则将存储请求所请求的数据存储至机械硬盘中。S603: If the remaining space of the adjusted target resource pool is smaller than the amount of data requested by the storage request, the data requested by the storage request is stored in the mechanical hard disk.
在本申请实施例中,若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则当前目标资源池的剩余空间容量仍不满足预设存储条件,无法将存储请求所请求的数据缓存至固态硬盘,将存储请求所请求的数据存储至机械硬盘中。In an embodiment of the present application, if the remaining space of the adjusted target resource pool is less than the amount of data requested by the storage request, the remaining space capacity of the current target resource pool still does not meet the preset storage conditions, and the data requested by the storage request cannot be cached to the solid-state drive, and the data requested by the storage request is stored in the mechanical hard disk.
本实施例所述的方法,对调整后的目标资源池的剩余空间容量进行判断,确定是否可以将存储请求所请求的数据缓存至调整后的目标资源池,充分利用目标资源池的空间容量,提高了数据的存储速度。The method described in this embodiment determines the remaining space capacity of the adjusted target resource pool to determine whether the data requested by the storage request can be cached to the adjusted target resource pool, thereby fully utilizing the space capacity of the target resource pool and improving the data storage speed.
在一个实施例中,如图9所示,上述存储方法还包括:In one embodiment, as shown in FIG9 , the storage method further includes:
S205,在接收到读请求时,从缓存空间中读取读请求所请求的数据。S205: When a read request is received, data requested by the read request is read from the cache space.
在本申请实施例中,在接收到读请求时,服务器中可以保护客户端层,通过客户端层接收客户端发送至服务器的读请求,通过服务器中映射层可以确定读请求与机械硬盘的映射关系,从而将存储请求转化为机械硬盘对应的读请求,并确定该读请求在缓存空间中对应的资源池。进一步地,从该资源池中查找读请求所请求的数据,若查找成功,则从该资源池中读取读请求所请求的数据,并将读请求所请求的数据发送至客户端。In the embodiment of the present application, when a read request is received, the server can protect the client layer, receive the read request sent by the client to the server through the client layer, and determine the mapping relationship between the read request and the mechanical hard disk through the mapping layer in the server, so as to convert the storage request into a read request corresponding to the mechanical hard disk, and determine the resource pool corresponding to the read request in the cache space. Further, the data requested by the read request is searched from the resource pool, and if the search is successful, the data requested by the read request is read from the resource pool, and the data requested by the read request is sent to the client.
可选的,若读取成功,可以增加该数据所在存储位置的热度,将该数据作为热数据继续存储在缓存中。Optionally, if the read is successful, the heat of the storage location where the data is located can be increased, and the data can continue to be stored in the cache as hot data.
S206,若读取失败,则从机械硬盘中读取读请求所请求的数据。S206: If the reading fails, the data requested by the read request is read from the mechanical hard disk.
在本申请实施例中,若缓存空间中未缓存有读请求所请求的数据,则从该资源池中读取读请求所请求的数据,并将读请求所请求的数据发生至客户端。In an embodiment of the present application, if the data requested by the read request is not cached in the cache space, the data requested by the read request is read from the resource pool, and the data requested by the read request is sent to the client.
本实施例所述的方法,若缓存空间中存在述读请求所请求的数据,可以直接从缓存空间中读取读请求所请求的数据,提高了数据的读取速度;若缓存空间中不存在述读请求所请求的数据,则从机械硬盘中读取读请求所请求的数据,保证了数据的读取成功率。The method described in this embodiment can directly read the data requested by the read request from the cache space if the data requested by the read request exists in the cache space, thereby improving the data reading speed; if the data requested by the read request does not exist in the cache space, the data requested by the read request is read from the mechanical hard disk, thereby ensuring the data reading success rate.
综合上述所有实施例,还提供了一种存储方法,如图10所示,该方法包括:Based on all the above embodiments, a storage method is also provided, as shown in FIG10 , the method includes:
S1,对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。S1, divide the local cache space into resource pools, and divide them into multiple types of resource pools and shared resource pools.
S2,确定接收到的存储请求在缓存空间中对应的目标资源池。S2, determining a target resource pool corresponding to the received storage request in the cache space.
S3,在目标资源池不满足预设存储条件的情况下,根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量;预设存储条件包括:存储请求所请求数据的数据量小于目标资源池中剩余空间容量;或,目标资源池的数据回刷效率大于或等于缓存效率。S3, when the target resource pool does not meet the preset storage conditions, determines the space capacity to be adjusted based on the remaining space capacity in the target resource pool and the preset storage conditions; the preset storage conditions include: the amount of data requested by the storage request is less than the remaining space capacity in the target resource pool; or, the data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
S4,若共享资源池的空间容量小于待调整空间容量,则执行S5-S6;若共享资源池的空间容量不小于待调整空间容量,则执行S7。S4, if the space capacity of the shared resource pool is less than the space capacity to be adjusted, execute S5-S6; if the space capacity of the shared resource pool is not less than the space capacity to be adjusted, execute S7.
S5,根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围。S5, determining the target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range.
S6,对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。S6, adjusting the storage space of each type of resource pool so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
S7,将待调整空间容量的空间从共享资源池中划分给目标资源池。S7, allocating the space whose capacity is to be adjusted from the shared resource pool to the target resource pool.
S8,确定调整后的目标资源池的剩余空间容量。S8, determining the remaining space capacity of the adjusted target resource pool.
S9,若调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量,则将存储请求所请求的数据缓存至调整后的目标资源池;若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则将存储请求所请求的数据存储至机械硬盘中。S9, if the remaining space capacity of the adjusted target resource pool is not less than the data volume of the data requested by the storage request, the data requested by the storage request is cached to the adjusted target resource pool; if the remaining space of the adjusted target resource pool is less than the data volume of the data requested by the storage request, the data requested by the storage request is stored in the mechanical hard disk.
S10,在接收到读请求时,从缓存空间中读取读请求所请求的数据;若读取失败,则从机械硬盘中读取读请求所请求的数据。S10, when a read request is received, the data requested by the read request is read from the cache space; if the read fails, the data requested by the read request is read from the mechanical hard disk.
上述存储方法中,确定接收到的存储请求在缓存空间中对应的目标资源池,在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整,从而根据调整后的目标资源池对存储请求所请求的数据进行存储。通过建立共享资源池,在目标资源池不满足预设存储条件的情况下,对目标资源池的存储空间进行动态调整,使得目标资源池的存储空间可以随存储请求的需求进行调整,提高了存储请求的存储效率,以及提高了缓存空间的资源利用率,进一步地,根据调整后的目标资源池对存储请求所请求的数据进行存储,可以进一步发挥缓存性能。In the above storage method, the target resource pool corresponding to the received storage request in the cache space is determined. When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache, so that the data requested by the storage request is stored according to the adjusted target resource pool. By establishing a shared resource pool, when the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is dynamically adjusted, so that the storage space of the target resource pool can be adjusted according to the needs of the storage request, thereby improving the storage efficiency of the storage request and the resource utilization of the cache space. Furthermore, the data requested by the storage request is stored according to the adjusted target resource pool, which can further exert the cache performance.
上述各步骤所述的方法在前述实施例中均有说明,详细内容请参见前述说明,此处不赘述。The methods described in the above steps are all described in the above embodiments. Please refer to the above description for details and will not be repeated here.
应该理解的是,虽然如上所述的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上所述的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的存储方法的存储装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个存储装置实施例中的具体限定可以参见上文中对于存储方法的限定,在此不再赘述。Based on the same inventive concept, the embodiment of the present application also provides a storage device for implementing the storage method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more storage device embodiments provided below can refer to the limitations on the storage method above, and will not be repeated here.
在一个实施例中,如图11所示,提供了一种存储装置,包括:确定模块10、调整模块和存储模块,其中:In one embodiment, as shown in FIG11 , a storage device is provided, including: a determination module 10, an adjustment module and a storage module, wherein:
确定模块10,用于确定接收到的存储请求在缓存空间中对应的目标资源池。The determination module 10 is used to determine the target resource pool corresponding to the received storage request in the cache space.
调整模块11,用于在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整。The adjustment module 11 is used to adjust the storage space of the target resource pool according to the shared resource pool in the cache when the target resource pool does not meet the preset storage condition.
存储模块12,用于根据调整后的目标资源池对存储请求所请求的数据进行存储。The storage module 12 is used to store the data requested by the storage request according to the adjusted target resource pool.
在一个实施例中,上述调整模块11,包括:第一确定单元和调整单元,其中:In one embodiment, the adjustment module 11 includes: a first determination unit and an adjustment unit, wherein:
第一确定单元,用于根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量;预设存储条件包括以下任一项:存储请求所请求数据的数据量小于目标资源池中剩余空间容量;目标资源池的数据回刷效率大于或等于缓存效率。The first determination unit is used to determine the space capacity to be adjusted based on the remaining space capacity in the target resource pool and preset storage conditions; the preset storage conditions include any one of the following: the amount of data requested by the storage request is less than the remaining space capacity in the target resource pool; the data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
调整单元,用于根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整。The adjustment unit is used to adjust the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted.
在一个实施例中,上述调整单元,具体用于在共享资源池的空间容量小于待调整空间容量的情况下,根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整;在共享资源池的空间容量不小于待调整空间容量的情况下,将待调整空间容量的空间从共享资源池中划分给目标资源池。In one embodiment, the above-mentioned adjustment unit is specifically used to adjust the storage space of the target resource pool according to the current request processing pressure of each type of resource pool when the space capacity of the shared resource pool is less than the space capacity to be adjusted; and to allocate the space of the space capacity to be adjusted from the shared resource pool to the target resource pool when the space capacity of the shared resource pool is not less than the space capacity to be adjusted.
在一个实施例中,上述调整单元,具体用于根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围;对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。In one embodiment, the above-mentioned adjustment unit is specifically used to determine the target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range; and the storage space of each type of resource pool is adjusted so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
在一个实施例中,上述存储装置还包括:划分模块,用于对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。In one embodiment, the storage device further includes: a partitioning module, configured to partition the local cache space into resource pools, and divide the resource pools into multiple types of resource pools and a shared resource pool.
在一个实施例中,上述存储模块12,包括:第二确定单元、第一存储单元和第二存储单元,其中:In one embodiment, the storage module 12 includes: a second determination unit, a first storage unit, and a second storage unit, wherein:
第二确定单元,用于确定调整后的目标资源池的剩余空间容量。The second determining unit is used to determine the remaining space capacity of the adjusted target resource pool.
第一存储单元,用于在调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量的情况下,将存储请求所请求的数据缓存至调整后的目标资源池。The first storage unit is used to cache the data requested by the storage request to the adjusted target resource pool when the remaining space capacity of the adjusted target resource pool is not less than the data amount of the data requested by the storage request.
第二存储单元,用于在调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量的情况下,将存储请求所请求的数据存储至机械硬盘中。The second storage unit is used to store the data requested by the storage request in the mechanical hard disk when the remaining space of the adjusted target resource pool is smaller than the data amount of the data requested by the storage request.
在一个实施例中,上述存储装置还包括:第一读取模块和第二读取模块,其中:In one embodiment, the storage device further includes: a first reading module and a second reading module, wherein:
第一读取模块,用于在接收到读请求时,从缓存空间中读取读请求所请求的数据。The first reading module is used to read the data requested by the read request from the cache space when receiving the read request.
第二读取模块,用于在读取失败时,从机械硬盘中读取读请求所请求的数据。The second reading module is used to read the data requested by the read request from the mechanical hard disk when the reading fails.
上述存储装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above storage device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
在一个示例性的实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图12所示。该计算机设备包括处理器、存储器、输入/输出接口(Input/Output,简称I/O)和通信接口。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储存储数据。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种存储方法。In an exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be shown in FIG12. The computer device includes a processor, a memory, an input/output interface (Input/Output, referred to as I/O) and a communication interface. The processor, the memory and the input/output interface are connected via a system bus, and the communication interface is connected to the system bus via the input/output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store storage data. The input/output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a storage method is implemented.
本领域技术人员可以理解,图12中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art will understand that the structure shown in FIG. 12 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
在一个实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现以下步骤:In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量;Determine the space capacity to be adjusted based on the remaining space capacity in the target resource pool and the preset storage conditions;
根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整。Adjust the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
若共享资源池的空间容量小于待调整空间容量,则根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整;If the space capacity of the shared resource pool is less than the space capacity to be adjusted, the storage space of the target resource pool is adjusted according to the current request processing pressure of each type of resource pool;
若共享资源池的空间容量不小于待调整空间容量,则将待调整空间容量的空间从共享资源池中划分给目标资源池。If the space capacity of the shared resource pool is not less than the space capacity to be adjusted, the space of the space capacity to be adjusted is allocated from the shared resource pool to the target resource pool.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围;Determine the target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range;
对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。The storage space of each type of resource pool is adjusted so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
存储请求所请求数据的数据量小于目标资源池中剩余空间容量;The amount of data requested by the storage request is less than the remaining space capacity in the target resource pool;
目标资源池的数据回刷效率大于或等于缓存效率。The data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。The local cache space is divided into resource pools, into multiple types of resource pools and shared resource pools.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
确定调整后的目标资源池的剩余空间容量;Determine the remaining space capacity of the adjusted target resource pool;
若调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量,则将存储请求所请求的数据缓存至调整后的目标资源池;If the remaining space capacity of the adjusted target resource pool is not less than the data volume of the data requested by the storage request, the data requested by the storage request is cached in the adjusted target resource pool;
若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则将存储请求所请求的数据存储至机械硬盘中。If the remaining space of the adjusted target resource pool is less than the amount of data requested by the storage request, the data requested by the storage request is stored in the mechanical hard disk.
在一个实施例中,处理器执行计算机程序时还实现以下步骤:In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
在接收到读请求时,从缓存空间中读取读请求所请求的数据;When a read request is received, the data requested by the read request is read from the cache space;
若读取失败,则从机械硬盘中读取读请求所请求的数据。If the read fails, the data requested by the read request is read from the mechanical hard disk.
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现以下步骤:In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量;Determine the space capacity to be adjusted based on the remaining space capacity in the target resource pool and the preset storage conditions;
根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整。Adjust the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
若共享资源池的空间容量小于待调整空间容量,则根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整;If the space capacity of the shared resource pool is less than the space capacity to be adjusted, the storage space of the target resource pool is adjusted according to the current request processing pressure of each type of resource pool;
若共享资源池的空间容量不小于待调整空间容量,则将待调整空间容量的空间从共享资源池中划分给目标资源池。If the space capacity of the shared resource pool is not less than the space capacity to be adjusted, the space of the space capacity to be adjusted is allocated from the shared resource pool to the target resource pool.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围;Determine the target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range;
对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。The storage space of each type of resource pool is adjusted so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
存储请求所请求数据的数据量小于目标资源池中剩余空间容量;The amount of data requested by the storage request is less than the remaining space capacity in the target resource pool;
目标资源池的数据回刷效率大于或等于缓存效率。The data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。The local cache space is divided into resource pools, into multiple types of resource pools and shared resource pools.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
确定调整后的目标资源池的剩余空间容量;Determine the remaining space capacity of the adjusted target resource pool;
若调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量,则将存储请求所请求的数据缓存至调整后的目标资源池;If the remaining space capacity of the adjusted target resource pool is not less than the data volume of the data requested by the storage request, the data requested by the storage request is cached in the adjusted target resource pool;
若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则将存储请求所请求的数据存储至机械硬盘中。If the remaining space of the adjusted target resource pool is less than the amount of data requested by the storage request, the data requested by the storage request is stored in the mechanical hard disk.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
在接收到读请求时,从缓存空间中读取读请求所请求的数据;When a read request is received, the data requested by the read request is read from the cache space;
若读取失败,则从机械硬盘中读取读请求所请求的数据。If the read fails, the data requested by the read request is read from the mechanical hard disk.
在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
确定接收到的存储请求在缓存空间中对应的目标资源池;Determine a target resource pool corresponding to the received storage request in the cache space;
在目标资源池不满足预设存储条件的情况下,根据缓存中的共享资源池对目标资源池的存储空间进行调整;When the target resource pool does not meet the preset storage conditions, the storage space of the target resource pool is adjusted according to the shared resource pool in the cache;
根据调整后的目标资源池对存储请求所请求的数据进行存储。The data requested by the storage request is stored according to the adjusted target resource pool.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
根据目标资源池中剩余空间容量和预设存储条件,确定待调整空间容量;Determine the space capacity to be adjusted based on the remaining space capacity in the target resource pool and the preset storage conditions;
根据共享资源池的空间容量和待调整空间容量,对目标资源池的存储空间进行调整。Adjust the storage space of the target resource pool according to the space capacity of the shared resource pool and the space capacity to be adjusted.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
若共享资源池的空间容量小于待调整空间容量,则根据各类型的资源池的当前请求处理压力,对目标资源池的存储空间进行调整;If the space capacity of the shared resource pool is less than the space capacity to be adjusted, the storage space of the target resource pool is adjusted according to the current request processing pressure of each type of resource pool;
若共享资源池的空间容量不小于待调整空间容量,则将待调整空间容量的空间从共享资源池中划分给目标资源池。If the space capacity of the shared resource pool is not less than the space capacity to be adjusted, the space of the space capacity to be adjusted is allocated from the shared resource pool to the target resource pool.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
根据各类型的资源池的当前请求处理压力,确定各类型的资源池的目标空间容量;目标空间容量处于预设容量范围;Determine the target space capacity of each type of resource pool according to the current request processing pressure of each type of resource pool; the target space capacity is within a preset capacity range;
对各类型资源池的存储空间进行调整,使调整后的各类型的资源池的空间容量达到目标空间容量。The storage space of each type of resource pool is adjusted so that the space capacity of each type of resource pool after adjustment reaches the target space capacity.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
存储请求所请求数据的数据量小于目标资源池中剩余空间容量;The amount of data requested by the storage request is less than the remaining space capacity in the target resource pool;
目标资源池的数据回刷效率大于或等于缓存效率。The data flushing efficiency of the target resource pool is greater than or equal to the cache efficiency.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
对本地的缓存空间进行资源池划分,划分出多个类型的资源池和共享资源池。The local cache space is divided into resource pools, into multiple types of resource pools and shared resource pools.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
确定调整后的目标资源池的剩余空间容量;Determine the remaining space capacity of the adjusted target resource pool;
若调整后的目标资源池的剩余空间容量不小于存储请求所请求的数据的数据量,则将存储请求所请求的数据缓存至调整后的目标资源池;If the remaining space capacity of the adjusted target resource pool is not less than the data volume of the data requested by the storage request, the data requested by the storage request is cached in the adjusted target resource pool;
若调整后的目标资源池的剩余空间小于存储请求所请求的数据的数据量,则将存储请求所请求的数据存储至机械硬盘中。If the remaining space of the adjusted target resource pool is less than the amount of data requested by the storage request, the data requested by the storage request is stored in the mechanical hard disk.
在一个实施例中,计算机程序被处理器执行时还实现以下步骤:In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
在接收到读请求时,从缓存空间中读取读请求所请求的数据;When a read request is received, the data requested by the read request is read from the cache space;
若读取失败,则从机械硬盘中读取读请求所请求的数据。If the read fails, the data requested by the read request is read from the mechanical hard disk.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性存储器和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(Resistive Random Access Memory,ReRAM)、磁变存储器(Magnetoresistive RandomAccess Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器、人工智能(Artificial Intelligence,AI)处理器等,不限于此。A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本申请记载的范围。The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims (12)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410867666.0A CN118656028A (en) | 2024-06-28 | 2024-06-28 | Storage method, device, computer equipment, storage medium and program product |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410867666.0A CN118656028A (en) | 2024-06-28 | 2024-06-28 | Storage method, device, computer equipment, storage medium and program product |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN118656028A true CN118656028A (en) | 2024-09-17 |
Family
ID=92698717
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410867666.0A Pending CN118656028A (en) | 2024-06-28 | 2024-06-28 | Storage method, device, computer equipment, storage medium and program product |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN118656028A (en) |
-
2024
- 2024-06-28 CN CN202410867666.0A patent/CN118656028A/en active Pending
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP5932043B2 (en) | Volatile memory representation of non-volatile storage set | |
| US10747673B2 (en) | System and method for facilitating cluster-level cache and memory space | |
| CN101997918B (en) | Method for allocating mass storage resources according to needs in heterogeneous SAN (Storage Area Network) environment | |
| CN113396566B (en) | Resource allocation based on comprehensive I/O monitoring in distributed storage systems | |
| CN104166628B (en) | Method, device and system for managing memory | |
| CN110663019A (en) | File System for Shingled Magnetic Recording (SMR) | |
| CN104603739A (en) | Block-level access to parallel storage | |
| CN113360098A (en) | Data writing method, device and system, electronic equipment and storage medium | |
| EP4174630A1 (en) | Stripe management method, storage system, stripe management apparatus, and storage medium | |
| CN120499269A (en) | Data management method, device, equipment and readable storage medium | |
| CN107172222A (en) | A kind of date storage method and device based on distributed memory system | |
| CN107608914B (en) | A method, device and mobile terminal for accessing a multi-channel storage device | |
| CN114816216A (en) | Method for adjusting capacity and related device | |
| CN118838540B (en) | Operation method and equipment of mixed multi-volume structure key value storage system in cloud environment | |
| CN116932196A (en) | Data processing method, device, equipment and system of fusion system | |
| CN118656028A (en) | Storage method, device, computer equipment, storage medium and program product | |
| CN119166055A (en) | Request processing method, device, computer equipment, storage medium and program product | |
| CN119718165A (en) | A data access method, CXL storage device and CXL controller | |
| EP4160422B1 (en) | Method for using intermediate device to process data, computer system, and intermediate device | |
| CN116737070A (en) | Data request processing method, device, computer equipment and storage medium | |
| CN116112498A (en) | A node IO forwarding method, device and medium of a multi-control cluster | |
| CN114706532A (en) | Disk configuration method, device, server, electronic device, and storage medium | |
| CN119376640B (en) | Write request processing method, device, computer equipment and storage medium | |
| US20250217239A1 (en) | Distributed storage system and operating method thereof | |
| CN119148929B (en) | Raid data processing method, system and electronic device |
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 |