A method, system and apparatus for distributed storage
Patent Information
- Application Number
- CN202310425670.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-20
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2043-04-20
AI Technical Summary
在该种方法下,会存在读写业务的带宽较低,IOPS(Input/Output Operations Per Second,每秒进行写/读操作的次数)较低
[0046] This application provides a method, system, and apparatus for distributed storage, applied in the storage field. The method includes: dividing a cache disk corresponding to a data disk in a storage pool according to the access frequency of the stored data; upon receiving a write operation request, determining the access frequency of the data corresponding to the write operation request; saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request; upon receiving a read operation request, determining the access frequency of the data corresponding to the read operation request; searching for the data of the read operation request in the space corresponding to the access frequency of the data of the read operation request, and returning the data of the read operation request to the sending end of the read operation request. By dividing the cache disk according to the data access frequency, saving data to the corresponding space upon receiving a write operation, and searching for data in that space upon receiving a read operation request, the data search time is shortened, and the read operation speed is accelerated.
Smart Images

Figure CN116450042B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of storage, and in particular to a method, system and apparatus for distributed storage. Background Technology
[0002] Ceph is a decentralized distributed storage system that offers good performance, reliability, and scalability. It primarily uses SSDs (Solid State Drives) as a cache layer on top of HDDs (Hard Disk Drives), which have slower I / O (input / output) speeds, thereby improving the I / O rate of the HDDs. One caching device (SSD) can provide caching for multiple backend devices (HDDs) simultaneously. However, this approach suffers from lower read / write bandwidth and lower IOPS (Input / Output Operations Per Second). Therefore, improving the read / write speed of distributed storage systems is a crucial problem to be solved. Summary of the Invention
[0003] The purpose of this invention is to provide a method, system, and apparatus for distributed storage, which shortens the time for searching data and speeds up read operations.
[0004] To address the aforementioned technical problems, this invention provides a distributed storage method, comprising:
[0005] The cache disks corresponding to the data disks in the storage pool are allocated space according to the access frequency of the stored data;
[0006] Upon receiving a write operation request, determine the access frequency of the data corresponding to the write operation request;
[0007] Save the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request;
[0008] Upon receiving a read operation request, determine the access frequency of the data corresponding to the read operation request;
[0009] The data requested for the read operation is located within the space corresponding to the access frequency of the data requested for the read operation, and the data requested for the read operation is returned to the sending end of the read operation request.
[0010] Preferably, the cache disk corresponding to the data disk in the storage pool is allocated space according to the access frequency of the stored data, including:
[0011] The cache disk is divided into a first space, a second space, and a third space according to the access frequency of the stored data;
[0012] The first space is used to store logs, the second space is used to store the storage path of data, and the third space is used to store cached data other than the storage logs and the storage path of data. The access frequency of the storage logs is higher than the access frequency of the storage path of data, and the access frequency of the storage path of data is higher than the access frequency of the cached data.
[0013] Preferably, before allocating space for the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data, the method further includes:
[0014] Clear the signature data in the data disk and the cache disk;
[0015] Format the data disk and the cache disk.
[0016] Preferably, after determining the access frequency of the data corresponding to the write operation request, the method further includes:
[0017] Determine whether the size of the data corresponding to the write operation request is greater than the data threshold;
[0018] If the value is greater than the specified value, the data corresponding to the write operation request will be directly saved to the data disk.
[0019] If it is not greater than, then proceed to the step of saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request.
[0020] Preferably, searching for the data requested by the read operation within the space corresponding to the access frequency of the data requested by the read operation includes:
[0021] Determine the address of the data requested by the read operation in the space corresponding to the access frequency of the data requested by the read operation;
[0022] Starting from the corresponding address, search for the data requested in the read operation within a preset data capacity;
[0023] If the data requested for the read operation is not found, then the data requested for the read operation is searched from the data disk and returned to the sending end of the read operation request.
[0024] If the data requested in the read operation is found, then proceed to the step of returning the data requested in the read operation to the sending end of the read operation request.
[0025] Preferably, before receiving a write operation request or a read operation request, the method further includes:
[0026] The caching strategy between the data disk and the cache disk is set to a write-back strategy, wherein the write-back strategy is to first write the data to the cache disk, and then the cache disk writes the data to the data disk.
[0027] The percentage of the write-back policy is set, whereby the percentage represents the proportion of dirty data written to the data disk from the cache disk, and the dirty data is modified data.
[0028] After saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request, the method further includes:
[0029] Determine whether the proportion of dirty data on the cache disk exceeds the stated percentage;
[0030] If the percentage is exceeded, the data in the cache disk will be flushed to the data disk until the proportion of dirty data in the cache disk does not exceed the stated percentage.
[0031] Preferably, after saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request, the method further includes:
[0032] Determine whether the capacity of the data in the cache disk exceeds the capacity threshold;
[0033] If the capacity is exceeded, the data in the cache disk will be flushed to the data disk until the capacity of the data in the cache disk does not exceed the capacity threshold.
[0034] Preferably, after setting the caching policy between the data disk and the cache disk to a write-back policy, the method further includes:
[0035] When the delay time of a write operation request exceeds the maximum delay time of the write operation request or the delay time of a read operation request exceeds the maximum delay time of the read operation request, the number of write operation requests or the number of read operation requests received within a preset time is reduced.
[0036] To address the aforementioned technical problems, the present invention also provides a distributed storage system, comprising:
[0037] The partitioning unit is used to divide the space of the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data;
[0038] The first determining unit is used to determine the access frequency of the data corresponding to the write operation request when a write operation request is received.
[0039] A storage unit is used to save the data of the write operation request to a space corresponding to the access frequency of the data of the write operation request.
[0040] The second determining unit is used to determine the access frequency of the data corresponding to the read operation request when a read operation request is received;
[0041] The searching unit is used to search for the data requested by the read operation within the space corresponding to the access frequency of the data requested by the read operation;
[0042] The return unit is used to return the data of the read operation request to the sending end of the read operation request.
[0043] To address the aforementioned technical problems, the present invention also provides a distributed storage device, comprising:
[0044] Memory, used to store computer programs;
[0045] The processor is used to execute the computer program in the steps of the above-described distributed storage method.
[0046] This application provides a method, system, and apparatus for distributed storage, applied in the storage field. The method includes: dividing a cache disk corresponding to a data disk in a storage pool according to the access frequency of the stored data; upon receiving a write operation request, determining the access frequency of the data corresponding to the write operation request; saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request; upon receiving a read operation request, determining the access frequency of the data corresponding to the read operation request; searching for the data of the read operation request in the space corresponding to the access frequency of the data of the read operation request, and returning the data of the read operation request to the sending end of the read operation request. By dividing the cache disk according to the data access frequency, saving data to the corresponding space upon receiving a write operation, and searching for data in that space upon receiving a read operation request, the data search time is shortened, and the read operation speed is accelerated. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings used in the prior art and embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 A flowchart of a distributed storage method provided by the present invention;
[0049] Figure 2 A schematic diagram of the structure of a distributed storage system provided by the present invention;
[0050] Figure 3 This is a schematic diagram of the structure of a distributed storage device provided by the present invention. Detailed Implementation
[0051] The core of this invention is to provide a method, system, and apparatus for distributed storage, which shortens the time for searching data and speeds up read operations.
[0052] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] Ceph is a decentralized distributed storage system that offers good performance, reliability, and scalability. It primarily uses SSDs (Solid State Drives) as a cache layer on top of HDDs (Hard Disk Drives), which have slower I / O (input / output) speeds, thereby improving the I / O rate of the HDDs. One caching device (SSD) can provide caching for multiple backend devices (HDDs) simultaneously. However, this approach suffers from lower read / write bandwidth and lower IOPS (Input / Output Operations Per Second). Therefore, improving the read / write speed of distributed storage systems is a crucial problem to be solved.
[0054] Figure 1 A flowchart of a distributed storage method provided by the present invention, the distributed storage method comprising:
[0055] S11: Allocate space for the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data;
[0056] It is understandable that the data stored in the cache disk includes various types. When searching for data, the more data in the space, the longer the search time will be, and the longer the read and write operations will take. Considering that the presence of various types of data in the cache disk can lead to excessively long data search times, the cache disk is divided into spaces according to the access frequency of the data. Data with different access frequencies will not be stored in the same space, thus reducing search time. Specific division criteria include, but are not limited to, the division based on data access frequency mentioned above; this application does not impose further limitations here.
[0057] S12: Upon receiving a write operation request, determine the access frequency of the data corresponding to the write operation request;
[0058] S13: Save the data requested by the write operation to the space corresponding to the access frequency of the data requested by the write operation;
[0059] When a write operation request is received, in order to accurately write the data to the corresponding space, it is first necessary to determine the access frequency of the data that the write operation request needs to write to the cache disk. Only after the data access frequency is determined will the data be saved to the corresponding space.
[0060] S14: Upon receiving a read operation request, determine the access frequency of the data corresponding to the read operation request;
[0061] S15: Locate the data requested for the read operation within the space corresponding to the access frequency of the data requested for the read operation, and return the data requested for the read operation to the sending end of the read operation request.
[0062] Correspondingly, since data is written to the space corresponding to the access frequency during the writing process, when a read operation request is received, the data can be found from the data corresponding to the read operation request. Before searching for the data, the access frequency of the data corresponding to the read operation request is determined in advance. Based on the access frequency of the data corresponding to the read operation request, the data is found from the corresponding space and returned to the sender of the read operation request.
[0063] During write operations, data is saved to the corresponding space according to the access frequency. During read operations, the time to find data can be reduced, and the speed of read operations can be improved.
[0064] It should also be noted that the distributed storage method provided in this application is applied to the operating system of the server, and the operating system executes the above steps.
[0065] This application provides a distributed storage method applied in the storage field, comprising: dividing the cache disk corresponding to the data disk in the storage pool into spaces according to the access frequency of the stored data; upon receiving a write operation request, determining the access frequency of the data corresponding to the write operation request; saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request; upon receiving a read operation request, determining the access frequency of the data corresponding to the read operation request; searching for the data of the read operation request in the space corresponding to the access frequency of the data of the read operation request, and returning the data of the read operation request to the sending end of the read operation request. After dividing the cache disk into spaces according to the data access frequency, when a write operation is received, the data is saved to the corresponding space, and when a read operation request is received, the data is searched from that space, which shortens the data search time and speeds up the read operation.
[0066] Based on the above embodiments:
[0067] As a preferred embodiment, the cache disk corresponding to the data disk in the storage pool is partitioned according to the access frequency of the stored data, including:
[0068] The cache disk is divided into three spaces: the first space, the second space, and the third space, based on the access frequency of the stored data.
[0069] The first space is used to store logs, the second space is used to store the storage path of data, and the third space is used to store cached data other than the storage path of logs and data. The access frequency of the storage path of logs is higher than that of the storage path of data, and the access frequency of the storage path of data is higher than that of the cached data.
[0070] Considering that different types of data are accessed at different frequencies, the cache disk can be divided into three levels based on the frequency of data access, with each level having corresponding space.
[0071] Specifically, it is divided into three spaces:
[0072] The first space is the ultra-high-speed space (WAL): it mainly stores .log files generated internally by RocksDB, such as storage logs, and its capacity is generally 15GB;
[0073] The second space is the high-speed space (DB): it stores metadata generated internally by BlueStore, such as search directories or directory structures, and its capacity is generally 30GB.
[0074] The third space is the cache space: it caches other business data besides the two types of data mentioned above. The capacity calculation formula is as follows:
[0075] Cache = (Single cache disk capacity * Number of cache disks) / Number of data disks – Ultra-high-speed space capacity (WAL) – High-speed space capacity (DB).
[0076] The three spaces have the same read / write speed, but different storage sizes and store different types of data.
[0077] By dividing the cache disk into the three spaces mentioned above, when different types of data access requests are received, the corresponding space can be searched for the data, which can speed up the read operation.
[0078] As a preferred embodiment, before allocating space to the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data, the method further includes:
[0079] Clear the signature data from the data disk and cache disk;
[0080] Format the data disk and cache disk.
[0081] Considering that distributed storage distributes space of equal capacity to store data, taking 1MB of space allocated each time as an example, if 4KB of data needs to be stored, then 1MB of space will be allocated, storing only 4KB of data, with the remainder free. Therefore, before partitioning the cache disk, it needs to be formatted to align each data address within the cache disk.
[0082] At the same time, the data disk is also formatted before the distributed storage is put into use to store data. The purpose of clearing the signature data is that if the signature is not cleared, errors will occur during the partitioning and formatting process.
[0083] Specifically, the execution code is as follows:
[0084] a) Clear the cache disk (SSD) signature:
[0085] Use the wipefs command to remove signatures from all SSDs. See the following for the specific command:
[0086] wipefs -a / dev / nvme0n1;
[0087] b) Format the cache disk (SSD):
[0088] Use the nvme command to format all SSDs. See the following for specific commands:
[0089] nvme format-s 1-f / dev / nvme0n1;
[0090] Adjusting the data distribution on the data disk is equivalent to formatting the HDD disk;
[0091] a) Clear the signature of the data disk (HDD):
[0092] Use the wipefs command to remove all HDD drive signatures. See the following for the specific command:
[0093] wipefs -a / dev / sda;
[0094] b) Format the data disk (HDD):
[0095] Use the dd command to format the first 20MB of data on the HDD. See below for the specific command instructions:
[0096] dd if= / dev / zero of= / dev / sda bs=1M count=20.
[0097] Since the first 20MB of data stored in an HDD is often pointer data, clearing the first 20MB of data can be understood as emptying the HDD.
[0098] In addition, the distributed storage system will undergo placement group weight balancing, with the following steps:
[0099] a) ceph osd set-require-min-compat-client luminous--yes-i-really-mean-it---Sets the permissions to allow PG (placement group) leveling operations;
[0100] b) `ceph osd getmap -o osd.map` – Gets a map of all OSDs;
[0101] c) osdmaptool osd.map --upmap out.txt --upmap-pool rbdpool --upmap-max2000 -- Performs PG load balancing operation on storage pool rbdpool;
[0102] d)source out.txt – Export PG equalization results.
[0103] In a preferred embodiment, after determining the access frequency of the data corresponding to the write operation request, the method further includes:
[0104] Determine if the size of the data corresponding to the write operation request is greater than the data threshold;
[0105] If the value is greater than the specified value, the data corresponding to the write operation request will be saved directly to the data disk.
[0106] If it is not greater than, then proceed to the step of saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request.
[0107] The value of the parameter "sequential_cutoff" is preset, and the set value is the data threshold. Once the size of consecutive IO operations exceeds this data threshold, it will bypass the cache disk and save directly to the data disk.
[0108] When a write operation request is received, in addition to determining the access frequency of the data corresponding to the write operation request, it is also necessary to determine the size of the data. If the data exceeds the data threshold set by the sequential_cutoff parameter, the data will not be written to the cache disk, but will be written directly to the data disk.
[0109] It should be noted that this application sets the parameter sequential_cutoff to 4M, meaning that data not exceeding 4M can be saved to the cache disk. The value of the data threshold can be set according to actual needs, and this application does not impose any restrictions here.
[0110] As a preferred embodiment, searching for the data requested by a read operation within the space corresponding to the access frequency of the data requested by the read operation includes:
[0111] Determine the address of the data requested by the read operation in the space corresponding to the access frequency of the data requested by the read operation;
[0112] Starting from the corresponding address, search for the data requested for the read operation within the preset data capacity;
[0113] If the data requested for the read operation is not found, the data requested for the read operation is searched from the data disk and returned to the sender of the read operation request.
[0114] If the data requested for the read operation is found, proceed to the step of returning the data requested for the read operation to the sender of the read operation request.
[0115] The value set for the parameter "readahead" is the preset data capacity. It's understandable that after determining the space corresponding to the data access frequency, a corresponding address is also determined. However, this corresponding address is not the exact storage address of the data; it can be the starting address of that space or a preset location address. To improve data read operation speed, the system does not search all addresses in the cache disk based on the corresponding address. Instead, it only searches for data within the preset data capacity, starting from the corresponding address. If the data is found, it is returned to the sender of the read operation request; if the data is not found within the preset data capacity, it is retrieved from the cache disk and returned to the sender of the read operation request.
[0116] It should be noted that this application sets the parameter readahead to 1M, which means that the corresponding address is used as the starting address and 1M of data is searched after it. The value of the preset data capacity can be set according to actual needs, and this application does not impose any restrictions here.
[0117] As a preferred embodiment, before receiving a write operation request or a read operation request, the method further includes:
[0118] Set the caching strategy between the data disk and the cache disk to a write-back strategy. The write-back strategy means that the data is first written to the cache disk, and then the cache disk writes the data to the data disk.
[0119] The percentage of the write-back policy is set, which represents the proportion of dirty data written to the data disk from the cache disk. Dirty data refers to modified data.
[0120] After saving the data requested by the write operation to the space corresponding to the access frequency of the data requested by the write operation, it also includes:
[0121] Determine if the percentage of dirty data on the cache disk exceeds a certain threshold;
[0122] If the percentage exceeds the limit, the data in the cache disk will be flushed to the data disk until the percentage of dirty data in the cache disk does not exceed the limit.
[0123] There are several caching strategies that can be configured between the data disk and the cache disk, such as:
[0124] writeback: The writeback strategy means that all data will first be written to the cache disk, and then wait for the system to write the data back to the backend data disk.
[0125] Writethrough: The write-through strategy (default strategy) will write data to both the cache disk and the backend data disk simultaneously.
[0126] writearoud: Data will be written directly to the backend disk.
[0127] The parameter "cache_mode" can be one of writethrough, writeback, or writearound. Setting the parameter "cache_mode" to writeback will achieve a higher read operation speed.
[0128] To set the parameter "cache_mode", please refer to the following command:
[0129] echo "writeback"> / sys / block / bcache0 / bcache / cache_mode.
[0130] Set the parameter "writeback_percent", the data of which represents the percentage of the writeback strategy;
[0131] Taking setting the parameter "writeback_percent" to 40, which means the writeback strategy percentage is 40%, as an example, the specific command is as follows:
[0132] echo 40> / sys / block / bcache0 / bcache / writeback_percent.
[0133] The parameter "writeback_running" represents the state of writing back dirty data. It is 1 when enabled and 0 when disabled. If disabled, dirty data will not be written back and will still be added to the cache until it is full.
[0134] To set the writeback state for dirty data to enabled (i.e., setting the parameter "writeback_running" to 1), the specific command is as follows:
[0135] echo 1> / sys / block / bcache0 / bcache / writeback_running.
[0136] After setting the caching policy to write-back, after saving the data corresponding to the write operation to the corresponding space, it is necessary to determine whether the proportion of dirty data in the cache disk exceeds a certain percentage. If it exceeds the percentage, the data needs to be flushed to the data disk until the proportion of dirty data in the cache disk is lower than the percentage.
[0137] As a preferred embodiment, after saving the write operation request data to the space corresponding to the access frequency of the write operation request data, the method further includes:
[0138] Determine if the capacity of the data in the cache disk exceeds the capacity threshold;
[0139] If the limit is exceeded, the data in the cache disk will be flushed to the data disk until the capacity of the data in the cache disk does not exceed the capacity threshold.
[0140] Considering the limited capacity of the cache disk, when the data volume in the cache disk becomes too large and reaches the capacity threshold, it will cause a decrease in the read and write operation speeds of the cache disk. Therefore, it is necessary to flush the data from the cache disk to the data disk until the data volume of the cache disk is lower than the capacity threshold.
[0141] Specifically, the capacity threshold can be set as a value or a percentage based on the capacity of the cache disk; this application does not impose further limitations here.
[0142] As a preferred embodiment, after setting the caching policy between the data disk and the cache disk to a write-back policy, the method further includes:
[0143] If the delay time of a write operation request exceeds the maximum delay time of a write operation request or the delay time of a read operation request exceeds the maximum delay time of a read operation request, the number of write operation requests or read operation requests received within a preset time is reduced.
[0144] The parameter "congested_read_threshold_us" is preset to represent the maximum latency for read operations, i.e., the read congestion control term. When the latency exceeds the threshold, the flow is gradually reduced. For example, to set the maximum latency for read operations to 20,000 microseconds, the specific command is as follows:
[0145] echo 20000> / sys / fs / bcache / * / congested_read_threshold_us;
[0146] The parameter "congested_write_threshold_us" represents the maximum delay time for write operations, i.e., the write congestion control term. When the delay exceeds the threshold, the flow is gradually reduced. For example, to set the maximum delay time for write operations to 200,000 microseconds, the specific command is as follows:
[0147] echo 200000> / sys / fs / bcache / * / congested_write_threshold_us.
[0148] If the latency of a write operation exceeds the maximum latency for a write operation request, the number of received write operation requests should be reduced. Similarly, if the latency of a read operation exceeds the maximum latency for a read operation request, the number of received read operation requests should be reduced.
[0149] Specifically, when the operating system receives a read operation request or a write operation request, it executes the corresponding read operation request and write operation request. If the delay time of the read operation or the delay time of the write operation exceeds the corresponding maximum delay time, the read operation request or write operation request is queued and the user is prompted so as to reduce the number of read operation requests or write operation requests received within a preset time.
[0150] It should also be noted that this application also allows for the configuration of the values of some parameters, which can improve the speed of read and write operations after the corresponding values are configured.
[0151] Specifically, it includes the following eight parameters:
[0152] 1. mon_clock_drift_allowed: This parameter determines the allowed clock skew between nodes. This value may affect the stability of the Ceph monitor and Ceph storage cluster. Set it to 2.
[0153] 2. mon_clock_drift_warn_backoff: After a time inconsistency is detected, the cluster will issue an alarm after the mon_clock_drift_warn_backoff number of times has been reached. Set to 30.
[0154] The two parameters mentioned above affect the stability of the distributed storage system. They are negatively correlated with the speed of read and write operations; that is, the larger the values of these two parameters are set, the slower the speed of read and write operations will be.
[0155] 3. osd_client_message_cap: The maximum number of messages a client is allowed to have in memory. This is the number of client requests that the OSD network layer accepts. Set to 1000.
[0156] 4. osd_client_message_size_cap: The maximum amount of data (bytes) that the client is allowed to store in memory. The size of the client request accepted by the OSD network layer is set to 2GB.
[0157] 5. osd_op_num_shards_hdd: The cache queue for the HDD disk, set to 10;
[0158] 6. osd_op_num_shards_ssd: SSD cache queue, set to 16;
[0159] 7. osd_op_num_threads_per_shard_hdd: The number of threads in the cache queue for each data disk. The product of osd_op_num_shards_hdd and osd_op_num_threads_per_shard_hdd is the number of threads used by the OSD process to handle IO requests. The default value is 5*1. Changing it to 10*2 can ensure that the compression algorithm performs at its maximum performance. Set it to 2.
[0160] 8. osd_op_num_threads_per_shard_ssd: The number of threads in the cache queue per cache disk. It functions similarly to osd_op_num_threads_per_shard_hdd and is set to 4.
[0161] The above six parameters are positively correlated with the speed of read and write operations; that is, the larger the values of these two parameters are set, the faster the read and write operations will be.
[0162] Figure 2 This invention provides a schematic diagram of the structure of a distributed storage system, which includes:
[0163] The partitioning unit 21 is used to partition the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data.
[0164] The first determining unit 22 is used to determine the access frequency of the data corresponding to the write operation request when a write operation request is received;
[0165] The storage unit 23 is used to save the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request;
[0166] The second determining unit 24 is used to determine the access frequency of the data corresponding to the read operation request when a read operation request is received;
[0167] The searching unit 25 is used to search for the data requested by the read operation within the space corresponding to the access frequency of the data requested by the read operation;
[0168] Return unit 26 is used to return the data of the read operation request to the sending end of the read operation request.
[0169] Based on the above embodiments:
[0170] The partitioning unit 21 is specifically used to divide the cache disk into a first space, a second space, and a third space according to the access frequency of the stored data;
[0171] The first space is used to store logs, the second space is used to store the storage path of data, and the third space is used to store cached data other than the storage path of logs and data. The access frequency of the storage path of logs is higher than that of the storage path of data, and the access frequency of the storage path of data is higher than that of the cached data.
[0172] Also includes:
[0173] The clear unit is used to clear the signature data in the data disk and cache disk;
[0174] The formatting unit is used to format the data disk and cache disk.
[0175] The first judgment unit is used to determine whether the size of the data corresponding to the write operation request is greater than the data threshold; if yes, the second saving unit is triggered; otherwise, the saving unit 23 is triggered.
[0176] The second storage unit is used to directly save the data corresponding to the write operation request to the data disk;
[0177] The third determining unit is used to determine the corresponding address of the data requested by the read operation in the space corresponding to the access frequency of the data requested by the read operation.
[0178] Search unit 25 is used to search for the data requested for the read operation within a preset data capacity, starting from the corresponding address; if the data requested for the read operation is not found, the second search unit is triggered; if the data requested for the read operation is found, the process returns to unit 26.
[0179] The second searching unit is used to search for the data requested by the read operation from the data disk and return the data requested by the read operation to the sending end of the read operation request;
[0180] The first setting unit is used to set the caching strategy between the data disk and the cache disk to a write-back strategy, which means that the data is first written to the cache disk and then the data is written to the data disk.
[0181] The second setting unit is used to set the percentage of the write-back policy. The percentage represents the proportion of dirty data written to the data disk from the cache disk. Dirty data refers to modified data.
[0182] The second judgment unit is used to determine whether the proportion of dirty data on the cache disk exceeds a certain percentage; if so, the first flush unit is triggered.
[0183] The first flush unit is used to flush data from the cache disk to the data disk until the proportion of dirty data on the cache disk does not exceed a certain percentage.
[0184] The third judgment unit is used to determine whether the capacity of the data in the cache disk exceeds the capacity threshold; if so, the second flush unit is triggered.
[0185] The second flush unit flushes the data from the cache disk to the data disk until the capacity of the data in the cache disk does not exceed the capacity threshold.
[0186] The adjustment unit is used to reduce the number of write operation requests or read operation requests received within a preset time when the delay time of a write operation request exceeds the maximum delay time of a write operation request or the delay time of a read operation request exceeds the maximum delay time of a read operation request.
[0187] This application provides a distributed storage system applied in the storage field, comprising: dividing the cache disk corresponding to the data disk in the storage pool into spaces according to the access frequency of the stored data; upon receiving a write operation request, determining the access frequency of the data corresponding to the write operation request; saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request; upon receiving a read operation request, determining the access frequency of the data corresponding to the read operation request; searching for the data of the read operation request in the space corresponding to the access frequency of the data of the read operation request, and returning the data of the read operation request to the sending end of the read operation request. After dividing the cache disk into spaces according to the data access frequency, when a write operation is received, the data is saved to the corresponding space, and when a read operation request is received, the data is searched from that space, which shortens the data search time and speeds up the read operation.
[0188] Figure 3 A schematic diagram of a distributed storage device provided by the present invention. The distributed storage device includes:
[0189] Memory 31 is used to store computer programs;
[0190] The processor 32 is used to implement the steps of the above-described distributed storage method when executing a computer program.
[0191] The steps that processor 32 performs when executing a computer program are as follows:
[0192] S11: Allocate space for the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data;
[0193] S12: Upon receiving a write operation request, determine the access frequency of the data corresponding to the write operation request;
[0194] S13: Save the data requested by the write operation to the space corresponding to the access frequency of the data requested by the write operation;
[0195] S14: Upon receiving a read operation request, determine the access frequency of the data corresponding to the read operation request;
[0196] S15: Locate the data requested for the read operation within the space corresponding to the access frequency of the data requested for the read operation, and return the data requested for the read operation to the sending end of the read operation request.
[0197] Based on the above embodiments:
[0198] The cache disk corresponding to the data disk in the storage pool is allocated space according to the access frequency of the stored data, including:
[0199] The cache disk is divided into three spaces: the first space, the second space, and the third space, based on the access frequency of the stored data.
[0200] The first space is used to store logs, the second space is used to store the storage path of data, and the third space is used to store cached data other than the storage path of logs and data. The access frequency of the storage path of logs is higher than that of the storage path of data, and the access frequency of the storage path of data is higher than that of the cached data.
[0201] Before allocating space for the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data, the following steps are also included:
[0202] Clear the signature data from the data disk and cache disk;
[0203] Format the data disk and cache disk.
[0204] After determining the access frequency of the data corresponding to the write operation request, the following steps are also included:
[0205] Determine if the size of the data corresponding to the write operation request is greater than the data threshold;
[0206] If the value is greater than the specified value, the data corresponding to the write operation request will be saved directly to the data disk.
[0207] If it is not greater than, then proceed to the step of saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request.
[0208] The data for the read operation request is located within the space corresponding to the access frequency of the data in the read operation request, including:
[0209] Determine the address of the data requested by the read operation in the space corresponding to the access frequency of the data requested by the read operation;
[0210] Starting from the corresponding address, search for the data requested for the read operation within the preset data capacity;
[0211] If the data requested for the read operation is not found, the data requested for the read operation is searched from the data disk and returned to the sender of the read operation request.
[0212] If the data requested for the read operation is found, proceed to the step of returning the data requested for the read operation to the sender of the read operation request.
[0213] Before receiving a write or read operation request, the process also includes:
[0214] Set the caching strategy between the data disk and the cache disk to a write-back strategy. The write-back strategy means that the data is first written to the cache disk, and then the cache disk writes the data to the data disk.
[0215] The percentage of the write-back policy is set, which represents the proportion of dirty data written to the data disk from the cache disk. Dirty data refers to modified data.
[0216] After saving the data requested by the write operation to the space corresponding to the access frequency of the data requested by the write operation, it also includes:
[0217] Determine if the percentage of dirty data on the cache disk exceeds a certain threshold;
[0218] If the percentage exceeds the limit, the data in the cache disk will be flushed to the data disk until the percentage of dirty data in the cache disk does not exceed the limit.
[0219] After saving the data requested by the write operation to the space corresponding to the access frequency of the data requested by the write operation, it also includes:
[0220] Determine if the capacity of the data in the cache disk exceeds the capacity threshold;
[0221] If the limit is exceeded, the data in the cache disk will be flushed to the data disk until the capacity of the data in the cache disk does not exceed the capacity threshold.
[0222] After setting the caching policy between the data disk and the cache disk to a write-back policy, the following is also included:
[0223] If the delay time of a write operation request exceeds the maximum delay time of a write operation request or the delay time of a read operation request exceeds the maximum delay time of a read operation request, the number of write operation requests or read operation requests received within a preset time is reduced.
[0224] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0225] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0226] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0227] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0228] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for distributed storage, characterized in that, include: The cache disks corresponding to the data disks in the storage pool are allocated space according to the access frequency of the stored data; Upon receiving a write operation request, determine the access frequency of the data corresponding to the write operation request; Save the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request; Upon receiving a read operation request, determine the access frequency of the data corresponding to the read operation request; The data requested for the read operation is located within the space corresponding to the access frequency of the data requested for the read operation, and the data requested for the read operation is returned to the sending end of the read operation request.
2. The distributed storage method as described in claim 1, characterized in that, The cache disk corresponding to the data disk in the storage pool is allocated space according to the access frequency of the stored data, including: The cache disk is divided into a first space, a second space, and a third space according to the access frequency of the stored data; The first space is used to store logs, the second space is used to store the storage path of the data, and the third space is used to store cached data other than the storage logs and the storage path of the data. The access frequency of the storage logs is higher than the access frequency of the storage path of the data, and the access frequency of the storage path of the data is higher than the access frequency of the cached data.
3. The distributed storage method as described in claim 1, characterized in that, Before allocating space for the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data, the following steps are also included: Clear the signature data in the data disk and the cache disk; Format the data disk and the cache disk.
4. The distributed storage method as described in claim 1, characterized in that, After determining the access frequency of the data corresponding to the write operation request, the method further includes: Determine whether the size of the data corresponding to the write operation request is greater than the data threshold; If the value is greater than the specified value, the data corresponding to the write operation request will be directly saved to the data disk. If it is not greater than, then proceed to the step of saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request.
5. The distributed storage method as described in claim 1, characterized in that, Locating the data requested for the read operation from the space corresponding to the access frequency of the data requested for the read operation includes: Determine the address of the data requested by the read operation in the space corresponding to the access frequency of the data requested by the read operation; Starting from the corresponding address, search for the data requested in the read operation within a preset data capacity; If the data requested for the read operation is not found, then the data requested for the read operation is searched from the data disk and returned to the sending end of the read operation request. If the data requested in the read operation is found, then proceed to the step of returning the data requested in the read operation to the sending end of the read operation request.
6. The distributed storage method according to any one of claims 1 to 5, characterized in that, Before receiving a write or read operation request, the process also includes: The caching strategy between the data disk and the cache disk is set to a write-back strategy, wherein the write-back strategy is to first write the data to the cache disk, and then the cache disk writes the data to the data disk. The percentage of the write-back policy is set, whereby the percentage represents the proportion of dirty data written to the data disk from the cache disk, and the dirty data is modified data. After saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request, the method further includes: Determine whether the proportion of dirty data on the cache disk exceeds the stated percentage; If the percentage is exceeded, the data in the cache disk will be flushed to the data disk until the proportion of dirty data in the cache disk does not exceed the stated percentage.
7. The distributed storage method as described in claim 6, characterized in that, After saving the data of the write operation request to the space corresponding to the access frequency of the data of the write operation request, the method further includes: Determine whether the capacity of the data in the cache disk exceeds the capacity threshold; If the capacity is exceeded, the data in the cache disk will be flushed to the data disk until the capacity of the data in the cache disk does not exceed the capacity threshold.
8. The distributed storage method as described in claim 6, characterized in that, After setting the caching policy between the data disk and the cache disk to a write-back policy, the following is also included: When the delay time of a write operation request exceeds the maximum delay time of the write operation request or the delay time of a read operation request exceeds the maximum delay time of the read operation request, the number of write operation requests or the number of read operation requests received within a preset time is reduced.
9. A distributed storage system, characterized in that, include: The partitioning unit is used to divide the space of the cache disk corresponding to the data disk in the storage pool according to the access frequency of the stored data; The first determining unit is used to determine the access frequency of the data corresponding to the write operation request when a write operation request is received. A storage unit is used to save the data of the write operation request to a space corresponding to the access frequency of the data of the write operation request. The second determining unit is used to determine the access frequency of the data corresponding to the read operation request when a read operation request is received; The searching unit is used to search for the data requested by the read operation within the space corresponding to the access frequency of the data requested by the read operation; The return unit is used to return the data of the read operation request to the sending end of the read operation request.
10. A distributed storage device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the distributed storage method as described in any one of claims 1 to 8 when executing the computer program.
Citation Information
Patent Citations
Mirror image mapping optimization processing method for specific rule data in storage device
CN113094004A
Storage management method and system and server
CN115167778A