Methods, apparatuses, and electronic devices for improving I / O read performance based on object affinity
By pre-setting garbage collection objects in the distributed storage system and using cache media to store data, the problems of read amplification and low cross-node transmission efficiency are solved, thereby improving read performance and system stability.
Patent Information
- Application Number
- CN202611389908.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-09
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2046-09-09
AI Technical Summary
Existing technologies in distributed storage systems suffer from read amplification problems and cross-node network transmission overhead, resulting in poor read performance.
By pre-setting an appropriate number of garbage collection objects in the storage cluster, calculating object affinity based on node and storage target information, storing data using cache media, and maintaining data locality and consistency during garbage collection, cross-network transmission is reduced.
It significantly improves read performance, reduces read amplification factor and cross-network transmission overhead, and ensures system stability and reliability.
Smart Images

Figure CN122902945B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hard disk read / write technology, specifically to methods, apparatuses, and electronic devices for improving I / O read performance based on object affinity. Background Technology
[0002] In distributed storage systems, to fully leverage the sequential write bandwidth advantage of underlying storage media (such as hard disk drives or solid-state drives), the industry commonly employs Redirect-on-Write (ROW) technology. This technology redirects and aggregates random, discrete small-block input / output (IO) requests sent from upper-layer applications to the storage pool, merging them into large-block sequential IOs. Based on a pre-defined data layout algorithm (such as consistent hashing and load balancing strategies), the aggregated data is evenly distributed to different storage targets (i.e., physical disks or storage nodes) within the storage pool, thereby significantly improving write performance.
[0003] To further optimize write efficiency, the append-only write mode has been widely adopted in the distributed storage field to avoid the read-modify-write overhead caused by traditional overwrite operations. However, the append-only write mechanism causes the old version of the data to become invalid garbage data after the data is updated. Therefore, the system must rely on the garbage collection (gc) mechanism to reclaim the above invalid space periodically to ensure the sustainable use of storage resources.
[0004] While the above techniques effectively improve write performance, they introduce inherent defects in the read path, specifically in the following two aspects:
[0005] First, there's the issue of read amplification. Because data is aggregated during foreground writes, the minimum physical read / write granularity of a storage system is typically no smaller than the aggregation unit size. For example, when the data aggregation granularity is 4KB, if a user initiates a small 1KB read request, the system still needs to read the complete 4KB data block from the physical disk, resulting in at least a 4x read amplification. These frequent additional disk I / O operations significantly increase the access load on the storage medium, leading to decreased read throughput and increased read latency.
[0006] Secondly, there's the issue of cross-node network transmission overhead. During garbage collection triggered by an overwrite operation, valid data originally located within the same object needs to be continuously migrated to newly allocated objects. Simultaneously, in a distributed layout based on redundant algorithms like consistent hashing, the migrated data is often redistributed across different physical nodes in the cluster due to load balancing requirements. Under this architecture, data read requests initiated by the front end often need to retrieve scattered data shards across multiple storage nodes, introducing a large amount of cross-network data transmission, significantly consuming network bandwidth and exacerbating read operation latency, resulting in overall low I / O service efficiency.
[0007] To address the aforementioned issues, there is an urgent need to develop a technical solution that can reduce read amplification, decrease cross-network transmission overhead, and improve the read performance of distributed storage systems. Summary of the Invention
[0008] To address the technical bottlenecks in existing ROW architectures caused by data aggregation and GC migration, resulting in read amplification and low cross-node transmission efficiency, this invention proposes a novel method for improving IO read performance based on object affinity. This method aims to optimize data layout and read paths, thereby effectively enhancing the read service capabilities of distributed storage systems.
[0009] This invention pre-defines an appropriate number of GC objects on each TGT based on the cluster size, and calculates the affinity GC objects on each TGT according to the node and TGT, storing them in a key-value database. Simultaneously, when requesting storage objects to store data through aggregate write or GC garbage collection migration write, it matches the affinity GC objects on the corresponding TGT according to the hash consistency principle and stores the nodeid. This allows the GC process to check the consistency between the storage object's nodeid and the nodeid of the current iteration when iterating to the GC object, ensuring that the index object, storage object, and GC object are always affinity-based and on the same node.
[0010] More specifically, this solution combines read-write caching. It pre-defines a certain number of GC objects for each TGT on a node and calculates the corresponding GC object for each TGT based on affinity. These are then stored in an RDB database in key-value pairs for easy access after a node restart. When a storage object is written, it is simultaneously written to an SSD cache, and its associated GC object is calculated according to the hash consistency principle to establish the relationship. The nodeid is also stored in the GC object. When iterating to a GC object, it checks whether the nodeid written to the storage object is affinity-compatible with the nodeid of the current iteration. If they are compatible, the storage object is added to the GC queue; otherwise, it checks the node's health status recorded in the storage object. When a node is unhealthy (offline), the primary node of the storage object is calculated using the jump map algorithm, ensuring that the storage object is only GC-enabled on the primary node. When the garbage collection threshold of storage objects is reached, GC migration is triggered, and newly generated storage objects are written to the SSD cache, while old storage objects are evicted. This ensures that even if GC migration is triggered after continuous overwrite, the foreground read IO can still read valid data from the cache of this node, reducing the performance loss of data transmission across the network and reading slow media, and significantly improving IO read performance.
[0011] Specifically, this application provides the following technical solutions:
[0012] The first aspect of this application provides a method for improving IO read performance based on object affinity, the method being applied to a distributed storage system employing Redirect-on-Write (ROW) technology, such as... Figure 1 As shown, it includes the following steps:
[0013] S1. Based on the topology information of the storage cluster, a set number of garbage collection objects are pre-set on each storage target end, and the garbage collection objects that are compatible with each storage target end are calculated according to the node information and storage target end information. The association relationship between the compatible garbage collection objects and the corresponding storage target end is established and stored.
[0014] S2. In response to the data aggregation write request, request a storage object, select a garbage collection object that is compatible with the storage target of the storage object according to the consistent hashing principle, establish the association between the storage object and the selected garbage collection object, and record the node identifier currently written by the storage object to the garbage collection object.
[0015] S3. Cache the written storage object data in the cache medium of the current node;
[0016] S4. During the garbage collection iteration, read the garbage collection object and its associated storage object. If the node identifier recorded in the storage object is consistent with the node identifier of the node in the current iteration, then determine that the storage object is compatible with the current node and add the storage object to the garbage collection queue.
[0017] S5. In response to the garbage collection trigger condition, retrieve the storage object from the garbage collection queue, move the valid data to the newly requested storage object on the current node, write the data of the newly requested storage object to the cache medium, update the metadata, and remove the original storage object from the cache medium.
[0018] Furthermore, in the method of this application, the step S1 of calculating the garbage collection objects associated with each storage target based on node information and storage target information specifically includes:
[0019] According to the preset coding rules, the node identifier and the storage target identifier are combined to generate a baseline object identifier. Based on the baseline object identifier, the garbage collection objects that are compatible with the current storage target are searched upwards until a preset number is reached.
[0020] Furthermore, in the method of this application, the step S1 of establishing and storing the association between the compatible garbage collection object and the corresponding storage target specifically includes:
[0021] The key is a combination of the base object identifier, node identifier, and storage target identifier, and the value is the corresponding garbage collection object. The data is stored in the database as key-value pairs.
[0022] Furthermore, in the method of this application, step S2, which involves selecting a garbage collection object that is compatible with the storage target of the stored object according to the consistent hashing principle, specifically includes:
[0023] The total number of garbage collection objects on the current node is determined based on the total number of storage targets on the current node and the number of garbage collection objects that are compatible with each storage target.
[0024] The obtained storage object identifier is moduloed by the total number of garbage objects, and the affinity storage target index and the affinity garbage object index on the storage target are determined based on the modulo result.
[0025] Furthermore, in the method of this application, the cache medium in step S3 includes node memory or solid-state drive.
[0026] Furthermore, in the method of this application, in step S4, if the node identifier recorded in the storage object is inconsistent with the node identifier of the node in the current iteration, then it is further determined whether the node recorded in the storage object is in an abnormal state:
[0027] If the node recorded in the storage object is abnormal, the master node of the garbage collection object is calculated by a preset master selection algorithm. If the node in the current iteration is the master node, the storage object is added to the garbage collection queue.
[0028] Furthermore, in the method of this application, the preset master selection algorithm is the Jump Consistent Hash algorithm.
[0029] Furthermore, the method of this application also includes: in response to a foreground read request, finding the target storage object based on metadata, first reading the data of the target storage object from the cache medium of the current node; if the cache is hit, the data is returned directly without cross-network transmission or reading from a slow storage medium.
[0030] A second aspect of this application provides an apparatus for improving I / O read performance based on object affinity. The apparatus is applied to a distributed storage system employing redirected write technology and implements the steps of the aforementioned method for improving I / O read performance based on object affinity during runtime, such as... Figure 2 As shown, the device includes:
[0031] The pre-configured module is used to pre-configure a set number of garbage collection objects on each storage target based on the topology information of the storage cluster, and calculate the garbage collection objects that are compatible with each storage target based on the node information and storage target information, and establish and store the association relationship between the compatible garbage collection objects and the corresponding storage target.
[0032] The write association module is used to respond to data aggregation write requests, request storage objects, select garbage collection objects that are compatible with the storage target of the storage object according to the consistent hash principle, establish the association relationship between the storage object and the selected garbage collection object, and record the node identifier currently written by the storage object to the garbage collection object.
[0033] The caching module is used to cache the written storage object data in the cache medium of the current node;
[0034] The garbage collection iteration module is used to read the garbage collection object and its associated storage object during the garbage collection iteration process. If the node identifier recorded in the storage object is consistent with the node identifier of the node in the current iteration, it is determined that the storage object is compatible with the current node and the storage object is added to the garbage collection queue.
[0035] The garbage collection and transfer module is used to retrieve storage objects from the garbage collection queue in response to garbage collection triggering conditions, move valid data to newly requested storage objects on the current node, write the data of the newly requested storage objects to the cache medium, update the metadata, and remove the original storage objects from the cache medium.
[0036] A third aspect of this application provides an electronic device, including: a memory and a processor;
[0037] Memory: Used to store computer programs;
[0038] Processor: Used to execute the computer program to implement the steps of the aforementioned method for improving I / O read performance based on object affinity.
[0039] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, it implements the steps of the aforementioned method for improving I / O read performance based on object affinity.
[0040] In summary, compared with the prior art, the advantages of this invention are:
[0041] (1) Solve the cache failure problem caused by object incompatibility: By pre-setting the node-compatible GC object and matching the compatible GC object according to the hash consistency principle during aggregate writing and GC migration, the index object, storage object and GC object are always in the same node, avoiding read cache failure caused by the cross-node distribution of new objects after GC migration, thereby significantly improving the cache hit rate.
[0042] (2) Reduce read amplification and cross-network transmission overhead: Reduce random disk writes by data aggregation writes, and use local high-speed cache (memory / SSD) on the node to directly respond to read requests, avoiding frequent reading of slow media and cross-network transmission, effectively reducing read amplification and improving read IO performance.
[0043] (3) Ensure data locality and reliability in the GC process: By recording the node identifier of the storage object in the GC object and performing node affinity verification during GC iteration, combined with node health status detection and master election algorithm, ensure that GC migration is only performed on the master node or affinity node, thus ensuring the locality of data layout and avoiding invalid operations on abnormal nodes, thereby improving system reliability.
[0044] (4) Improve the continuous read service capability of the distributed storage system: In the continuous overwrite scenario, even if the GC migration is triggered, the front-end read IO can still hit the valid data from the local cache of the node, reduce the read performance jitter caused by GC migration, and ensure the stability and consistency of the system's read service capability.
[0045] Other features and advantages of this application will be set forth in detail in the following description, or will become apparent through the implementation of the relevant technical solutions of this application. The objectives and other advantages of this application can be achieved through the technical features and means explicitly pointed out in the description, claims, and drawings, and will be obtained through the implementation of these technical contents. Attached Figure Description
[0046] To more clearly illustrate the technical solution of this application, the accompanying drawings involved in the description of this application will be briefly introduced below. It should be noted that the drawings only show some embodiments of the present invention. For those skilled in the art, other related drawings can be derived from these drawings without creative effort.
[0047] Figure 1 This is a flowchart illustrating the overall implementation of the method for improving IO read performance based on object affinity in this application.
[0048] Figure 2 This is a structural diagram of the device for improving IO read performance based on object affinity according to this application.
[0049] Figure 3 This is a diagram of the cluster topology involved in the embodiments of this application.
[0050] Figure 4 This is a schematic diagram illustrating the affinity calculation of the GC object in this application.
[0051] Figure 5 This is a schematic diagram of the data read / write process in this application.
[0052] Figure 6 This is a schematic diagram of the iteration of the gc object in this application.
[0053] Figure 7 This is a schematic diagram of GC relocation in the scheme of this application. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.
[0055] In this document, the term "comprising" and any variations thereof (such as "including," "including," etc.) are open-ended expressions and should be understood as "including but not limited to," meaning that the listed content is not exhaustive and may include other content not explicitly mentioned. The term "based on" should be understood as "at least partially based on," meaning that the basis or condition referred to may not be the only factor and may involve other relevant factors. The term "one embodiment" should be understood as "at least one embodiment," meaning that the described embodiment is not the only possible implementation, and other similar embodiments may exist.
[0056] In this application, the terms "a" and "a plurality of" are used to modify related elements or features, and their expression is illustrative rather than restrictive. Unless otherwise expressly stated in the context, "a" should be understood as "at least one," and "a plurality of" should be understood as "at least two." Those skilled in the art should reasonably interpret these terms based on the semantic and logical relationships of the context to ensure that they cover the possibility of "one or more."
[0057] Example: A method for improving I / O read performance based on object affinity
[0058] The implementation process of this plan is as follows:
[0059] Assuming a 3-node cluster, with each node having 4 disks, the cluster topology is as follows: Figure 3 As shown.
[0060] like Figure 3As shown, when user data is written, it is first mapped to an index object, and then mapped to the corresponding master node. For example, the master node for index_obj0 is node0, the master node for index_obj1 is node1, and the master node for index_obj2 is node2. After aggregate writing, each storage object is requested. Assuming 3-replica redundancy, 3 storage objects are requested: obj0 (tgt0, tgt4, tgt8), obj1 (tgt1, tgt5, tgt9), and obj2 (tgt2, tgt5, tgt9). obj0, obj1, and obj2 are associated with the garbage collection (GC) objects gc_obj0, gc_obj1, and gc_obj2 using a hash algorithm. Due to differences in layout algorithms, the master node of the index and the master node of the GC object may not be on the same node. For example, the master node of index_obj0 may be on node0, while the master node of gc_obj0 may be on node1, resulting in a scenario where the master nodes of the index and GC objects are not compatible. Thus, when aggregate writing to storage object obj0, the data is cached in the memory or cache disk of node0. If the data is read directly on node0, it will no longer go through the disk read and network transmission stages, greatly improving read performance. However, as append-overwrite writes continue, the data of storage object obj0 will be overwritten and become garbage, which will be reclaimed by gc_obj0. Since the master node of gc_obj0 is on node1, it will cause a GC migration on node1. The valid data of obj0 is read first and then written (i.e., migrated) to the new storage object obj00, and its data is also cached in the memory of node1. At the same time, the metadata will change from the original storage object obj0 to obj00. When the foreground IO reads again, it will still read data from node0, but it will read the new object obj00. Since obj00 was not generated on node0, the cache will miss. To address this problem of read cache miss due to object affinity, this invention proposes a method to improve read performance based on object affinity, the specific steps of which are as follows:
[0061] 1. Generate affinity GC objects: such as Figure 4 As shown, an appropriate number of GC objects are pre-set on each TGT, and a baseline object is generated on the corresponding TGT according to the node + TGT. The GC object affinity of this TGT is calculated through the cluster map information (the map records the cluster nodes and the disk distribution under the nodes, such as the node normal / failure, disk normal / failure, etc.). For example, if 100 GC objects are pre-set on each TGT, assuming a maximum support of 2 16 2 nodes and 2 16For each tgt, a baseline object is generated according to nodeid << 48 + tgtid << 32. Then, based on this value, GC objects that are compatible with the tgt are found upwards until 100 are found.
[0062] 2. Record GC objects in the RDB database: Store all TGT-affinity GC objects on each node in the database in a key-value format. Select the combination of baseid (e.g., 0xa000000000000000), nodeid, and TGTid as the key (baseid + nodeid << 48 + TGTid << 32), and the GC object as the value. Store it in the KV database for GC object retrieval after node restart.
[0063] 3. Data Aggregation Write: For example, taking a certain aggregation granularity of 1M as an example, if a user issues an IO of 4K, then 256 small 4K IOs need to be aggregated into a large 1M IO before being written to disk. The purpose is to improve disk write performance. When requesting a storage object obj for aggregation write, the GC object with TGT affinity is selected according to the hash consistency principle, and the association between the two is established on the GC object. At the same time, the nodeid currently being written to the storage object is recorded on the GC object.
[0064] 4. Selection of Affinity GC Objects: Assuming there are t tgts on a node, and each tgt has g GC objects that are compatible with it, then there are a total of t*g = k GC objects. The storage object ID is n, then n%(k) = m, m / g gives the index of its compatible tgt, and m%g gives the index of the GC object on its compatible tgt. For example, if there are 5 tgts on node1, and each tgt has 100 compatible GC objects, for a total of 500 GC objects, when the storage object ID is 1001, according to 1001%500 = 1, 1 / 100 = 0, 1%100 = 1, the first GC object of the 0th tgt is taken as its compatible GC object and written (the index starts counting from 0).
[0065] 5. Write caching: When an object (obj) is written, data is cached in units of obj in the corresponding node memory or high-speed media such as SSD. Figure 5 As shown, the red line indicates the writing process.
[0066] 6. Record the metadata of the stored object: Save the metadata of the stored object to disk.
[0067] 7. Reading Data: When a user reads data, the system first hashes to the index master node. Then, it locates the stored object `obj` using metadata and checks if `obj` is in the cache. If `obj` is in the cache, a cache hit occurs, and data can be read directly from node memory or high-speed media such as SSDs, avoiding network transmission and reading from slow media like HDDs, thus improving read performance. Figure 5 As shown, the green line represents the reading process.
[0068] 8. Iterating over GC objects: such as Figure 6 As shown, the GC object iterates over the GC objects written on the TGT at the TGT granularity, and obtains its associated storage object. If the nodeid written to the storage object is consistent with the nodeid where the current GC object is iterated, it is a friendly node, and the storage object is added to the queue to be GCd. If the nodeid written to the storage object is inconsistent with the nodeid where the current GC object is iterated, it is determined whether the nodeid written to the storage object is abnormal. If it is abnormal, the master node of the current GC object is calculated by the jump map master selection algorithm. If the iterated node is the master node, the storage object is added to the queue to be GCd.
[0069] 9. GC relocation: such as Figure 7 As shown, the storage object is retrieved from the GC queue. If the amount of garbage in storage object obj1 reaches the recycling threshold, the GC garbage collection mechanism is triggered. The valid data of obj1 is moved to the storage object obj2 that is compatible with this node by reading first and then writing (the selection method of the GC object compatible with storage object obj2 is the same as in steps 3-4); at the same time, the data of obj2 is written to the cache.
[0070] 10. Metadata Modification and Old Cache Removal: After the GC migration is complete, the metadata is changed from object obj1 to obj2, and the stored object obj1 is removed from the cache to save cache space.
[0071] 11. Read data: Same as step 7, except that the metadata is changed from obj1 to obj2.
[0072] As data is continuously overwritten, this solution can solve the problem of decreased read performance caused by object incompatibility due to continuous GC relocation, and greatly improve cache hit rate and read performance.
[0073] The flowcharts and block diagrams in the accompanying drawings illustrate possible implementations of apparatus, methods, and computer program products according to various embodiments of this application, including architecture, functionality, and operation. In these figures, each block may represent a module, program segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should be noted that each block in the block diagrams and / or flowcharts, and combinations thereof, can be implemented using either a dedicated hardware-based system or a combination of dedicated hardware and computer instructions to achieve the specified function or operation.
[0074] Embodiments of this application also disclose an electronic device, including: a processor, a communication interface, a memory for storing a processor-executable computer program, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The processor executes the executable computer program to implement the steps of the above-described method for improving I / O read performance based on object affinity.
[0075] It is understood that, in addition to memory and a processor, this electronic device may also include input devices (such as a keyboard), output devices (such as a display), and other communication modules. These input devices, output devices, and other communication modules all communicate with the processor through I / O interfaces (i.e., input / output interfaces).
[0076] The operations described in this application can be implemented by writing computer program code using one or more programming languages or a combination thereof. The programming languages include, but are not limited to, the following types:
[0077] Object-oriented programming languages, such as Java, Smalltalk, C++, etc.
[0078] Conventional procedural programming languages, such as "C" or similar programming languages.
[0079] The execution methods of program code include, but are not limited to:
[0080] It runs entirely on the user's computer;
[0081] Part of it executes on the user's computer, and part of it executes on a remote computer;
[0082] Execute as a standalone software package;
[0083] It is executed entirely on a remote computer or server.
[0084] In scenarios involving remote computers, the remote computer can connect to the user's computer via any type of network, including but not limited to local area networks (LANs) or wide area networks (WANs). Furthermore, the remote computer can also connect to external computers through an internet service provider, for example, by utilizing the internet for connection.
[0085] Furthermore, this application also discloses a computer-readable storage medium, wherein when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform the steps of the method for improving I / O read performance based on object affinity disclosed in this application.
[0086] In the context of this application, a computer-readable storage medium refers to a tangible medium capable of storing computer program code and related data. Specific examples include, but are not limited to, the following:
[0087] (1) Portable computer disk: such as floppy disks and other removable magnetic storage media.
[0088] (2) Hard disk: including mechanical hard disks and solid-state hard disks and other fixed storage devices.
[0089] (3) Random Access Memory (RAM): A volatile storage medium used for temporary storage of data and program code.
[0090] (4) Read-only memory (ROM): a non-volatile storage medium used to store fixed programs and data.
[0091] (5) Erasable programmable read-only memory (EPROM) or flash memory: non-volatile storage media that supports multiple erasures and reprogrammings.
[0092] (6) Fiber optic storage devices: storage media based on fiber optic technology.
[0093] (7) Portable compact disc read-only memory (CD-ROM): a read-only medium that stores data in the form of an optical disc.
[0094] (8) Optical storage devices: such as DVDs, Blu-ray discs and other storage media based on optical principles.
[0095] (9) Magnetic storage devices: such as magnetic tapes, disks and other storage media based on magnetic principles.
[0096] (10) Any suitable combination of the above: for example, combining multiple storage media to meet different storage needs.
[0097] These computer-readable storage media can be used to store the program code and related data described in this application to support program execution and persistent data storage.
[0098] Specifically, according to embodiments of this application, the processes described in the flowcharts can be implemented as computer software programs. For example, embodiments of this application relate to a computer program product comprising a computer program carried on a non-transitory computer-readable medium. This computer program includes program code for executing the method disclosed in this application for improving I / O read performance based on object affinity. When this computer program is executed by a processing device, it can achieve the functions defined in the embodiments of this application.
[0099] While the foregoing discussion contains several specific implementation details, these details should not be construed as limiting the scope of this application. The above description is merely a preferred embodiment of this application and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this application is not limited to technical solutions formed by specific combinations of the above-described technical features. Furthermore, this application should also cover other technical solutions formed by any combination of the above-described technical features or their equivalents without departing from the foregoing disclosed concept.
[0100] Those skilled in the art should also understand that modifications can be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features, without departing from the spirit and scope of the technical solutions of the embodiments of this application. These modifications or substitutions will not cause the essence of the corresponding technical solutions to deviate from the core spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for improving I / O read performance based on object affinity, characterized in that, The method is applied to a distributed storage system employing redirected write technology and includes the following steps: S1. Based on the topology information of the storage cluster, a set number of garbage collection objects are pre-set on each storage target end, and the garbage collection objects that are compatible with each storage target end are calculated according to the node information and storage target end information. The association relationship between the compatible garbage collection objects and the corresponding storage target end is established and stored. S2. In response to the data aggregation write request, request a storage object, select a garbage collection object that is compatible with the storage target of the storage object according to the consistent hashing principle, establish the association between the storage object and the selected garbage collection object, and record the node identifier currently written by the storage object to the garbage collection object. S3. Cache the written storage object data in the cache medium of the current node; S4. During the garbage collection iteration, read the garbage collection object and its associated storage object. If the node identifier recorded in the storage object is consistent with the node identifier of the node in the current iteration, then determine that the storage object is compatible with the current node and add the storage object to the garbage collection queue. If the node identifier recorded in the storage object is inconsistent with the node identifier of the current iteration, then it is further determined whether the node recorded in the storage object is in an abnormal state: if the node recorded in the storage object is abnormal, then the master node of the garbage collection object is calculated by a preset master selection algorithm; if the current iteration is the master node, then the storage object is added to the garbage collection queue. S5. In response to the garbage collection trigger condition, retrieve the storage object from the garbage collection queue, move the valid data to the newly requested storage object on the current node, write the data of the newly requested storage object to the cache medium, update the metadata, and remove the original storage object from the cache medium.
2. The method according to claim 1, characterized in that, Step S1, which involves calculating the garbage collection objects that are compatible with each storage target based on the node information and the storage target information, specifically includes: According to the preset coding rules, the node identifier and the storage target identifier are combined to generate a baseline object identifier. Based on the baseline object identifier, the garbage collection objects that are compatible with the current storage target are searched upwards until a preset number is reached.
3. The method according to claim 2, characterized in that, Step S1, which involves establishing and storing the association between the compatible garbage collection object and the corresponding storage target, specifically includes: The key is a combination of the base object identifier, node identifier, and storage target identifier, and the value is the corresponding garbage collection object. The data is stored in the database as key-value pairs.
4. The method according to claim 1, characterized in that, Step S2, which involves selecting a garbage collection object that is compatible with the storage target of the stored object according to the consistent hashing principle, specifically includes: The total number of garbage collection objects on the current node is determined based on the total number of storage targets on the current node and the number of garbage collection objects that are compatible with each storage target. The obtained storage object identifier is moduloed by the total number of garbage objects, and the affinity storage target index and the affinity garbage object index on the storage target are determined based on the modulo result.
5. The method according to claim 1, characterized in that, The cache medium mentioned in step S3 includes node memory or solid-state drive.
6. The method according to claim 1, characterized in that, The preset master election algorithm is the Jump ConsistentHash algorithm.
7. The method according to claim 1, characterized in that, The method further includes: responding to a foreground read request, finding the target storage object based on metadata, first reading the data of the target storage object from the cache medium of the current node; if the cache is hit, the data is returned directly without cross-network transmission or reading from a slow storage medium.
8. A device for improving I / O read performance based on object affinity, characterized in that, The apparatus is applied to a distributed storage system employing redirected write technology, and during operation implements the steps of the method for improving IO read performance based on object affinity as described in any one of claims 1-7, wherein the apparatus comprises: The pre-configured module is used to pre-configure a set number of garbage collection objects on each storage target based on the topology information of the storage cluster, and calculate the garbage collection objects that are compatible with each storage target based on the node information and storage target information, and establish and store the association relationship between the compatible garbage collection objects and the corresponding storage target. The write association module is used to respond to data aggregation write requests, request storage objects, select garbage collection objects that are compatible with the storage target of the storage object according to the consistent hash principle, establish the association relationship between the storage object and the selected garbage collection object, and record the node identifier currently written by the storage object to the garbage collection object. The caching module is used to cache the written storage object data in the cache medium of the current node; The garbage collection iteration module is used to read the garbage collection object and its associated storage object during the garbage collection iteration process. If the node identifier recorded in the storage object is consistent with the node identifier of the node in the current iteration, the storage object is determined to be compatible with the current node, and the storage object is added to the garbage collection queue. If the node identifier recorded in the storage object is inconsistent with the node identifier of the node in the current iteration, it is further determined whether the node recorded in the storage object is in an abnormal state. If the node recorded in the storage object is abnormal, the master node of the garbage collection object is calculated by a preset master selection algorithm. If the node in the current iteration is the master node, the storage object is added to the garbage collection queue. The garbage collection and transfer module is used to retrieve storage objects from the garbage collection queue in response to garbage collection triggering conditions, move valid data to newly requested storage objects on the current node, write the data of the newly requested storage objects to the cache medium, update the metadata, and remove the original storage objects from the cache medium.
9. An electronic device, characterized in that, include: Memory and processor; Memory: Used to store computer programs; Processor: for executing the computer program to implement the steps of the method for improving I / O read performance based on object affinity as described in any one of claims 1-7.
Citation Information
Patent Citations
Method and device for improving IO reading performance based on object affinity
CN120687043A
