Compaction optimization method, apparatus, distributed storage device, and storage medium
By introducing a routing layer and a logical storage layer into the distributed storage system, dynamically scheduling write IO data and ordered data structure segments, converting them to read-only mode and performing local merging, the performance jitter problem caused by the compaction strategy in the LSM system is solved, and stable read and write performance and resource utilization are achieved.
Patent Information
- Application Number
- CN202211176401.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-26
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2042-09-26
AI Technical Summary
The compaction strategy of existing LSM systems causes performance jitter, making the CPU a bottleneck and affecting write I/O performance and read I/O efficiency.
In a distributed storage system, a routing layer and a logical storage layer are introduced. By scheduling write I/O data and logical storage units through routing nodes, ordered data structure segments are dynamically converted to read-only mode, and local merging operations are performed through compaction processes to reduce the occupation of disk I/O resources.
It achieves load balancing, reduces performance jitter, provides stable read and write performance, and reduces the disk resource consumption of merging operations.
Smart Images

Figure CN116263644B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of storage, in particular to a compaction optimization method and device, a distributed storage system and a computer readable storage medium. BACKGROUND
[0002] At present, the LSM (Log Structured Merge) system designs a compaction strategy to periodically merge ordered data structures to improve the performance of read IO. Since the system competes for the bandwidth of write IO when performing compaction periodically, and the computing overhead caused by maintaining ordered data structures and data synchronization also easily makes CPU a bottleneck, which is manifested as instantaneous write IO speed limit or blocking. Therefore, how to solve the problem of performance jitter caused by the introduction of the compaction strategy has become a top priority. SUMMARY
[0003] In view of the above problems, embodiments of the present application provide a compaction optimization method and device, a distributed storage system and a computer readable storage medium, which are used to solve the problem of performance jitter caused by the introduction of the compaction strategy in the prior art.
[0004] According to an aspect of an embodiment of the present application, a compaction optimization method is provided, which is applied to a distributed storage system, the distributed storage system comprising a routing layer located on an input / output (IO) path and a logical storage layer located in a memory, the logical storage layer comprising a plurality of logical storage units, the logical storage unit comprising an ordered data structure segment and a compaction subunit, the compaction optimization method comprising:
[0005] scheduling, by a routing node of the routing layer, write IO data and the plurality of logical storage units respectively;
[0006] writing the write IO data into the ordered data structure segment in the corresponding logical storage unit;
[0007] in a case where the data amount accumulated in the ordered data structure segment meets a preset condition, converting the working mode of the ordered data structure segment into a read-only mode;
[0008] performing a merge operation on the data in the ordered data structure segment in the read-only mode in the logical storage unit by a compaction process generated by the compaction subunit, and flushing the merged data to a disk.
[0009] In an optional manner, the scheduling, by the routing node of the routing layer, of the write IO data and the plurality of logical storage units respectively comprises:
[0010] Based on the preset routing strategy, the plurality of logical storage units are respectively dispatched to a plurality of nodes in the cluster through the routing nodes of the routing layer, and the first idle node in the plurality of nodes is scheduled in the write IO data.
[0011] In an optional manner, in a case where the accumulated data amount in the ordered data structure segment meets a preset condition, after the working mode of the ordered data structure segment is converted to the read-only mode, the method further includes:
[0012] Based on a preset compaction strategy, a compaction subunit generates a compaction process;
[0013] The compaction process is dispatched to a second idle node other than the first idle node.
[0014] In an optional manner, after the write IO data and the plurality of logical storage units are respectively dispatched through the routing nodes of the routing layer, the method further includes:
[0015] Each of the logical storage units is respectively bound to a processor of a corresponding node.
[0016] In an optional manner, after the data in the ordered data structure segment in the read-only mode in the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further includes:
[0017] The ordered data structure segment contained in the logical storage unit is updated.
[0018] In an optional manner, after the data in the ordered data structure segment in the read-only mode in the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further includes:
[0019] In a case where the usage rate of the memory in each node reaches a preset value, the cluster is expanded.
[0020] In an optional manner, after the data in the ordered data structure segment in the read-only mode in the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further includes:
[0021] In a case where IO blocking occurs, a self-protection mechanism is enabled to limit IO exceeding the carrying capacity of the cluster from entering the cluster.
[0022] According to another aspect of the embodiments of the present application, there is provided a compaction optimization device applied to a distributed storage system, the distributed storage system comprising a routing layer located on an input / output (IO) path and a logical storage layer located in a memory, the logical storage layer comprising a plurality of logical storage units, each of the logical storage units comprising an ordered data structure segment and a compaction subunit, the compaction optimization device comprising:
[0023] a scheduling module configured to schedule write IO data and the plurality of logical storage units respectively via routing nodes of the routing layer;
[0024] a writing module configured to write the write IO data into at least one ordered data structure segment of a corresponding logical storage unit;
[0025] a conversion module configured to convert a working mode of the ordered data structure segment into a read-only mode when an accumulated data amount in the ordered data structure segment meets a preset condition;
[0026] a merging module configured to perform a merging operation on data in the ordered data structure segment in the read-only mode via a compaction process generated by the compaction subunit, and flush the merged data to a disk.
[0027] In an optional manner, the scheduling module is specifically configured to schedule the plurality of logical storage units to a plurality of nodes in a cluster via the routing nodes of the routing layer based on a preset routing strategy, and schedule the write IO data to a first idle node in the plurality of nodes.
[0028] In an optional manner, the compaction optimization device further comprises:
[0029] a triggering module configured to trigger the compaction subunit to generate the compaction process based on a preset compaction strategy after the working mode of the ordered data structure segment is converted into the read-only mode when the accumulated data amount in the ordered data structure segment meets the preset condition;
[0030] a compaction scheduling module configured to schedule the compaction process to a second idle node other than the first idle node.
[0031] In an optional manner, the compaction optimization device further comprises:
[0032] a binding module configured to bind each of the logical storage units to a processor of a corresponding node after the write IO data and the plurality of logical storage units are scheduled respectively via the routing nodes of the routing layer.
[0033] In an optional manner, the compaction optimization device further comprises:
[0034] An expansion module is configured to perform a merge operation on data in an ordered data structure segment in a read-only mode in the logical storage unit by a compaction process generated by the compaction subunit, and to expand the cluster when the usage of the memory in each node reaches a preset value after the merged data is flushed to the disk.
[0035] In an alternative mode, the compaction optimization device further comprises:
[0036] A blocking module is configured to enable a self-protection mechanism to limit IOs exceeding the carrying capacity of the cluster from entering the cluster when IO blocking occurs after the merge operation on the data in the ordered data structure segment in the read-only mode in the logical storage unit by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk.
[0037] According to another aspect of the embodiment of the present application, a distributed storage device is provided, comprising a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface complete communication with each other through the communication bus;
[0038] The memory is used to store at least one executable instruction, and the executable instruction causes the processor to perform the following operations:
[0039] The write IO data and the plurality of logical storage units are respectively scheduled by a routing node of a routing layer;
[0040] The write IO data is written into an ordered data structure segment in the corresponding logical storage unit;
[0041] The working mode of the ordered data structure segment is converted to a read-only mode when the accumulated data amount in the ordered data structure segment meets a preset condition;
[0042] Data in an ordered data structure segment in a read-only mode in the logical storage unit is subjected to a merge operation by a compaction process generated by the compaction subunit, and the merged data is flushed to the disk.
[0043] In an alternative mode, the executable instruction causes the processor to perform the following operations:
[0044] The write IO data and the plurality of logical storage units are respectively scheduled by a routing node of a routing layer, which can include:
[0045] The plurality of logical storage units are respectively scheduled to a plurality of nodes in the cluster and the write IO data is scheduled to a first idle node in the plurality of nodes by the routing node of the routing layer based on a preset routing strategy.
[0046] In an alternative way, the executable instructions cause the processor to perform the following operations:
[0047] In the case where the accumulated data amount in the ordered data structure segment meets a preset condition, after converting the working mode of the ordered data structure segment into the read-only mode, the method can further include:
[0048] Triggering a compaction subunit to generate a compaction process based on a preset compaction strategy;
[0049] Scheduling the compaction process to a second idle node other than the first idle node.
[0050] In an alternative way, the executable instructions cause the processor to perform the following operations:
[0051] After the write IO data is scheduled to the plurality of logical storage units respectively by the routing nodes of the routing layer, the method can further include:
[0052] Binding each of the logical storage units to a processor of a corresponding node.
[0053] In an alternative way, the executable instructions cause the processor to perform the following operations:
[0054] After the data in the ordered data structure segment in the read-only mode of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method can further include:
[0055] Updating the ordered data structure segment contained in the logical storage unit.
[0056] In an alternative way, the executable instructions cause the processor to perform the following operations:
[0057] After the data in the ordered data structure segment in the read-only mode of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method can further include:
[0058] In the case where the usage rate of the memory in each node reaches a preset value, expanding the cluster.
[0059] In an alternative way, the executable instructions cause the processor to perform the following operations:
[0060] After the data in the ordered data structure segment in the read-only mode of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method can further include:
[0061] In the case of IO blocking, a self-protection mechanism is enabled to limit IOs exceeding the carrying capacity of the cluster from entering the cluster.
[0062] According to still another aspect of the embodiments of the present application, a computer readable storage medium is provided, in which at least one executable instruction is stored, which causes a distributed storage device to perform the following operations:
[0063] scheduling, by a routing node of a routing layer, the write IO data and the plurality of logical storage units respectively;
[0064] writing the write IO data into an ordered data structure segment in the corresponding logical storage unit;
[0065] in the case where the accumulated data amount in the ordered data structure segment meets a preset condition, converting the working mode of the ordered data structure segment into a read-only mode;
[0066] performing a merge operation on the data in the ordered data structure segment in the read-only mode in the logical storage unit by a compaction process generated by the compaction sub-unit, and flushing the merged data to a disk.
[0067] In an optional manner, the executable instruction causes the distributed storage device to perform the following operations:
[0068] The scheduling, by a routing node of a routing layer, the write IO data and the plurality of logical storage units respectively, comprises:
[0069] based on a preset routing strategy, scheduling, by the routing node of the routing layer, the plurality of logical storage units to a plurality of nodes in the cluster respectively, and scheduling the write IO data to a first idle node in the plurality of nodes.
[0070] In an optional manner, the executable instruction causes the distributed storage device to perform the following operations:
[0071] After converting the working mode of the ordered data structure segment into a read-only mode in the case where the accumulated data amount in the ordered data structure segment meets a preset condition, the operations further comprise:
[0072] triggering a compaction sub-unit to generate a compaction process based on a preset compaction strategy;
[0073] scheduling the compaction process to a second idle node other than the first idle node.
[0074] In an optional manner, the executable instruction causes the distributed storage device to perform the following operations:
[0075] After the write IO data is dispatched to the plurality of logical storage units respectively by the routing nodes of the routing layer, the method further comprises:
[0076] Each of the logical storage units is bound to a processor of a corresponding node.
[0077] In an optional mode, the executable instructions cause the distributed storage device to perform the following operations:
[0078] After the data in the read-only mode ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further comprises:
[0079] The ordered data structure segment contained in the logical storage unit is updated.
[0080] In an optional mode, the executable instructions cause the distributed storage device to perform the following operations:
[0081] After the data in the read-only mode ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further comprises:
[0082] In the case that the usage rate of the memory of each node reaches a preset value, the cluster is expanded.
[0083] In an optional mode, the executable instructions cause the distributed storage device to perform the following operations:
[0084] After the data in the read-only mode ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further comprises:
[0085] In the case of IO blocking, a self-protection mechanism is enabled to limit IO exceeding the carrying capacity of the cluster from entering the cluster.
[0086] The embodiment of the present application schedules the write IO data and the plurality of logical storage units respectively through the routing nodes of the routing layer in the distributed storage system additionally provided with the routing layer and the logical storage layer, so that the logical storage units and the write IO data are dynamically scheduled to balance the load and decouple the logical storage units and the write IO data. The write IO data is written into the ordered data structure segment in the corresponding logical storage unit, the ordered data structure segment is converted into the read-only mode after the preset condition is met, the data in the ordered data structure segment in the read-only mode in the logical storage unit is merged, and the merged data is flushed to the disk, so that the compaction operation is simplified from the global compaction to the local small IO compaction, the compaction overhead is fixed in a certain range, the occupation of the disk I / O resource is reduced, and the performance jitter problem caused by the compaction operation is solved, while the compaction task is completed, and good read / write performance is provided.
[0087] The above description is only a summary of the technical scheme of the embodiment of the present application, in order to more clearly understand the technical means of the embodiment of the present application, the content of the specification can be implemented, and in order to make the above and other purposes, characteristics and advantages of the embodiment of the present application more obvious and easy to understand, the specific embodiment of the present application is described below. BRIEF DESCRIPTION OF DRAWINGS
[0088] The accompanying drawings are included to provide a further understanding of the application and are incorporated herein and constitute a part of the detailed description. It should be noted that in the accompanying drawings, the same or similar elements are referred to using the same reference numerals.
[0089] Figure 1 A schematic diagram of an architecture of a distributed storage system provided by the embodiment of the present application is shown;
[0090] Figure 2 A flowchart of a compaction optimization method provided by the embodiment of the present application is shown;
[0091] Figure 3 A structure diagram of a compaction optimization device provided by the embodiment of the present application is shown;
[0092] Figure 4 A structure diagram of a distributed storage device provided by the embodiment of the present application is shown. DETAILED DESCRIPTION
[0093] The exemplary embodiments of the present application will be described in detail with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein.
[0094] The existing LSM-based compaction optimization method focuses on the following aspects:
[0095] (1) Data tiering: divide into hot and cold data, and do compaction with different frequencies.
[0096] (2) Parameter adjustment, thread optimization, and reduction of resources occupied by compaction.
[0097] (3) Compaction degree grading, divided into Minor Compaction and Major Compaction.
[0098] However, the existing optimization for compaction of LSM-based systems needs to consider the use scenario and details, and the parameter tuning work combined with cluster resources is also very complex. Moreover, since the prediction of business load is difficult, dynamic adjustment of parameter tuning is also difficult. For example: when the memory of the machine is large and the business load is small, even a daily timed compaction strategy can be used to merge data. When the business IO pressure is high and the compaction speed cannot keep up with the speed of business write IO data, the memory usage will be too high, causing the write IO data to be limited. At this time, the ordered data structure that reaches the scale limit will trigger a large number of compaction requirements and also occupy disk bandwidth, thereby affecting the read IO performance. We can set different compaction strategies for different businesses to adapt to the corresponding read-write load. For example, when to trigger compaction, and how much cpu and memory resources can be occupied by compaction.
[0099] This way can be controlled for scenarios with clear self-business, but for cloud storage vendors providing storage resources, such inflexible way is not suitable. The party providing cloud storage products should not have too many restrictions on the upper-layer business. Ideally, cloud storage products as the infrastructure of cloud computing should be able to provide relatively smooth performance in most scenarios.
[0100] Therefore, how to complete the compaction task while also providing good read-write performance has become a problem that needs to be solved urgently.
[0101] Before introducing the embodiments of the present application, first introduce the professional terms involved.
[0102] A computer cluster, which can be simply referred to as a cluster, is a computer system that is highly tightly cooperated to complete computing work through a group of loosely integrated computer software (and / or) hardware. A single computer in the cluster can be referred to as a node.
[0103] Cloud computing is a kind of distributed computing, which refers to decomposing huge data computing processing programs into numerous small programs through a network "cloud", and then processing and analyzing the small programs through a system composed of multiple servers to obtain results and return the results to users. The multiple servers form a server cluster of cloud computing.
[0104] Cloud storage is a new storage technology developed on the basis of cloud computing technology. Cloud storage is a cloud computing system with data storage and management as the core. Users can upload local resources to the cloud, and can access resources on the cloud from anywhere connected to the Internet.
[0105] IO (Input / Output) refers to the process of copying data between memory and peripherals. Input refers to copying data from peripherals to memory, and output refers to copying data from memory to peripherals.
[0106] In the embodiments of the present application, the distributed storage system can be an LSM (Log Structured Merge) distributed storage system, which can be applied to a cloud storage scenario.
[0107] Figure 1 An architecture diagram of a distributed storage system provided by an embodiment of the present application is shown. As shown in the figure, Figure 1 The distributed storage system includes a routing layer located on an input / output (IO) path and a logical storage layer located in memory. The routing layer can include routing nodes and a routing table. The logical storage layer includes a plurality of logical storage units (i.e., logical storage unit 1 to logical storage unit n), and the logical storage unit includes an ordered data structure segment (i.e., segment). The logical storage unit also includes a compaction subunit. The compaction subunit can be used to generate a compaction process, thereby implementing a merge down operation.
[0108] As shown in the figure, Figure 1 The distributed storage system can include a metadata center for managing metadata. The distributed storage system can also include a service cluster, and the service cluster mounts a plurality of disks (i.e., disk 1 to disk m).
[0109] In the distributed storage system, a logical storage layer is introduced, and logical storage units in the layer can be flexibly scheduled to different nodes under the control of a routing center. Write IO data is first written into a segment in the memory of the logical storage layer, and the segment is converted into a read-only mode when it reaches a certain size, and compaction is performed on the read-only mode segment to merge and flush it. After the flushing is completed, the segment on the logical storage unit is updated, and since the number of segments on the logical storage unit is constant, the merging overhead is fixed within a certain range. Since the logical storage unit can be scheduled to any node, and the compaction is in the form of a process and can also be scheduled to any node. In this way, when the business IO is high, the business IO can be scheduled to a relatively idle node to achieve load balancing. At the same time, the compaction can also be scheduled to other idle nodes, and even resource isolation can be achieved by binding the CPU. When the business pressure continues to increase, and the memory usage of all nodes is high, generally, cluster expansion is needed. If it is a transient pressure, it will cause a short-term IO blockage, and the cluster needs to start a self-protection mechanism to organize the IO exceeding the carrying capacity.
[0110] In the embodiment of the application, the distributed storage system can implement any compaction optimization method provided by the embodiment of the application, decouple the compaction and write IO data, and realize dynamic scheduling of the compaction task through the addition of a logical storage layer and a routing layer, remove the hierarchy, avoid the double-write problem, and perform merging in the memory and then directly flush to the disk.
[0111] The merging is always a local order, and in the block storage scenario, the merging of the compaction can be simplified from global merging to local small IO merging, the occupation of the disk I / O resource is reduced, and the advantage of continuous writing of the disk can be exerted. The logical storage layer is introduced on the IO path, the problem of resource occupation by the compaction and write IO data is solved in a more flexible way, and load balancing, reduction of performance jitter, provision of relatively stable throughput and delay, and the like can be achieved through the setting of a suitable routing strategy.
[0112] Figure 2 A flowchart of a compaction optimization method provided by the embodiment of the application is shown, and the method can be applied to the distributed storage system as shown in Figure 1 The compaction optimization method includes the following steps: Figure 2
[0113] Step 21, the write IO data and the plurality of logical storage units are respectively scheduled by the routing nodes of the routing layer.
[0114] Here, the routing node of the routing layer can be a routing center, a node capable of providing a routing query function. The write IO data can be data that needs to be written into the memory.
[0115] In the embodiment of the present application, the routing node located in the routing layer in the distributed storage system can determine the write IO data and the respective cluster nodes corresponding to each logical storage unit through the routing query function, and schedule the write IO data and each logical storage unit to the corresponding node.
[0116] Step 22, write the write IO data into the ordered data structure segment in the corresponding logical storage unit.
[0117] Here, there can be multiple ordered data structure segments in the logical storage unit. The ordered data structure segment can be a data file space, which can convert random IO into sequential IO. In the embodiment of the present application, the routing node schedules the write IO data to one or more nodes in the cluster, and there is one or more logical storage units scheduled by the routing node on these nodes. In each node, the write IO data is written into the ordered data structure segment in the logical storage unit, so that the IO is sequentially written into the memory.
[0118] In this way, the ordered data structure segment can realize IO ordering, which facilitates subsequent read IO and optimizes read IO performance.
[0119] Step 23, in the case that the accumulated data amount in the ordered data structure segment meets the preset condition, convert the working mode of the ordered data structure segment into a read-only mode.
[0120] Here, the accumulated data amount in the ordered data structure segment meeting the preset condition can be that the accumulated data amount is less than a preset value, wherein the preset value is less than the maximum storage data amount of the ordered data structure segment. It can also be that the accumulated time corresponding to the accumulated data amount exceeds a preset time period, wherein the preset time period can be set according to requirements.
[0121] The working mode of the ordered data structure segment can include but is not limited to a read-write mode, a write-only mode, and a read-only mode, etc. The write-only mode can be a mode for executing a write operation. The read-only mode can be a mode for executing a read operation. The read-write mode can be a mode for executing a read operation and a write operation.
[0122] In the embodiment of the present application, when the working mode of the ordered data structure segment is converted into the read-only mode, the write operation cannot be performed in the ordered data structure segment, but the read operation can be performed.
[0123] Step 24, perform a merging operation on the data in the ordered data structure segment in the read-only mode in the logical storage unit through a compaction process generated by a compaction subunit, and flush the merged data to the disk.
[0124] Here, the disk can be a bottom physical disk, can constitute a storage pool, and provide block storage services. The compaction process can be a process for performing compaction tasks. In the embodiment of the present application, the data in the ordered data structure segment in the read-only mode in the logical storage unit can reach a certain amount. The data in the ordered data structure segment in the read-only mode in the logical storage unit can be merged by the compaction process, and the merged data can be flushed from the memory to the disk. In this way, the local small IO is merged, the occupation of the disk I / O resource is reduced, and the merging overhead can be controlled within a certain range due to the limited number of ordered structure segments in the logical storage unit.
[0125] In the above embodiment, in the distributed storage system with an added routing layer and a logical storage layer, the routing nodes of the routing layer respectively schedule the write IO data and the plurality of logical storage units. In this way, the logical storage units and the write IO data are dynamically scheduled to balance the load and decouple the logical storage units and the write IO data. The write IO data is written into the ordered data structure segment in the corresponding logical storage unit. After a preset condition is met, the ordered data structure segment is converted into a read-only mode. The data in the ordered data structure segment in the read-only mode in the logical storage unit is merged, and the merged data is flushed to the disk. The compaction operation can be simplified from global merging to local small IO merging, the merging overhead is fixed within a certain range, the occupation of the disk I / O resource is reduced, and the performance jitter problem caused by the merging operation is solved. While completing the compaction task, good read / write performance is provided.
[0126] In an optional manner, step 21, the routing nodes of the routing layer respectively schedule the write IO data and the plurality of logical storage units, comprising:
[0127] Based on a preset routing strategy, the routing nodes of the routing layer respectively schedule the plurality of logical storage units to a plurality of nodes in the cluster and schedule the write IO data to a first idle node in the plurality of nodes.
[0128] Here, the preset routing strategy can be determined according to a pre-stored routing table. The first idle node can be a node with low load, that is, a node with a load less than a preset load.
[0129] In the embodiment of the present application, the routing nodes respectively schedule the plurality of logical storage units to any plurality of nodes in the cluster and schedule the data corresponding to the write IO data to the first idle node in the plurality of nodes according to the preset routing strategy by routing query. In this way, the write IO data can be dynamically scheduled, load balancing can be achieved, performance jitter can be reduced, relatively stable throughput and delay can be provided, and the increase of the memory caused by high write IO load can be controlled within a certain range, without causing write IO delay.
[0130] In an optional mode, after the write IO data is respectively dispatched to the plurality of logical storage units by the routing nodes of the routing layer in step 21, the method further comprises:
[0131] binding each logical storage unit to the processor of the corresponding node.
[0132] Here, the logical storage unit can be bound to the processor of the corresponding node by CPU (central processing unit) binding technology, so that the specified CPU can be isolated and exclusively occupied, resource isolation can be achieved, the running efficiency of the CPU can be improved, and the idle time of the CPU can be reduced.
[0133] In an optional mode, after the working mode of the ordered data structure segment is converted to the read-only mode when the accumulated data amount in the ordered data structure segment meets the preset condition in step 23, the compaction optimization method can further comprise:
[0134] triggering the compaction subunit to generate a compaction process based on a preset compaction strategy;
[0135] scheduling the compaction process to a second idle node other than the first idle node.
[0136] Here, the preset compaction strategy can include but is not limited to a timing trigger strategy and a trigger strategy in which the data in the read-only mode ordered data structure segment reaches a trigger amount. It can be understood that the compaction subunit can be triggered to generate a compaction process at a timing or when the data in the read-only mode ordered data structure segment reaches the trigger amount.
[0137] The second idle node can be an idle node in the cluster other than the first idle node, wherein the idle node can be a node with low load.
[0138] In the embodiment of the application, since the compaction operation can be completed by the compaction process, the routing node of the routing layer can schedule the compaction process to other idle nodes by routing query. In this way, the write IO thread and the compaction process can be separated, the free scheduling of the two can be achieved, the compaction can be scheduled to a node with low performance requirement, the bandwidth of the node can be temporarily requisitioned, and the occupation of the write IO bandwidth can be reduced.
[0139] Meanwhile, in the block storage scenario, a plurality of small IOs can be combined, the memory occupation can be reduced, and the advantage of continuous disk writing can be taken.
[0140] In an alternative way, after the data in the read-only mode ordered data structure segment in the logical storage unit is merged by the compaction sub-unit generated compaction process and the merged data is flushed to the disk, the compaction optimization further includes:
[0141] updating the ordered data structure segment on the flushed logical storage unit.
[0142] Here, after the flushing is completed, the ordered data structure segment on the flushed logical storage unit is updated to leave a write space for subsequent write operation.
[0143] In an alternative way, after the data in the read-only mode ordered data structure segment in the logical storage unit is merged by the compaction sub-unit generated compaction process and the merged data is flushed to the disk, the compaction optimization method further includes:
[0144] In the case that the usage of the memory in each node reaches a preset value, the cluster is expanded.
[0145] Here, the preset value can be 70% or above of the usage of each node. In the embodiment of the present application, the service pressure of the cluster is large and continuously increases, so that the usage of the memory in each node reaches the preset value. In order to make the cluster run normally, the cluster is expanded.
[0146] In an alternative way, after the data in the read-only mode ordered data structure segment in the logical storage unit is merged by the compaction sub-unit generated compaction process and the merged data is flushed to the disk, the compaction optimization further includes:
[0147] In the case of IO blocking, a self-protection mechanism is enabled to limit the IO exceeding the carrying capacity of the cluster from entering the cluster.
[0148] Here, when the cluster has transient service pressure, the case of IO blocking occurs. The self-protection mechanism is a safety protection measure for network abnormal fluctuation. Using the self-protection mechanism can make the cluster run more robustly and stably.
[0149] In the above embodiment, through the self-protection mechanism, in the case of IO blocking, the IO exceeding the carrying capacity of the cluster is prevented from entering the cluster, so as to ensure that the cluster runs robustly and stably.
[0150] Figure 3 A structure schematic diagram of a compaction optimization device provided by an embodiment of the present application is shown. The compaction optimization device can be applied to a distributed storage system as shown in Figure 1 As shown in Figure 3 The compaction optimization device 30 includes:
[0151] The scheduling module 31 is configured to schedule the write IO data and the plurality of logical storage units respectively by the routing nodes of the routing layer.
[0152] The writing module 32 is configured to write the write IO data into at least one ordered data structure segment in the corresponding logical storage unit.
[0153] The conversion module 33 is configured to convert the working mode of the ordered data structure segment into a read-only mode when the accumulated data amount in the ordered data structure segment meets a preset condition.
[0154] The merging module 34 is configured to perform a merging operation on the data in the ordered data structure segment in the read-only mode by a compaction process generated by a compaction subunit, and flush the merged data to the disk.
[0155] In the above embodiment, by adding a routing layer and a logical storage layer in the distributed storage system, the write IO data and the plurality of logical storage units are respectively scheduled by the routing nodes of the routing layer. In this way, the logical storage units and the write IO data are dynamically scheduled to balance the load and decouple the logical storage units and the write IO data. The write IO data is written into the ordered data structure segment in the corresponding logical storage unit, and the ordered data structure segment is converted into a read-only mode when a preset condition is met. The data in the ordered data structure segment in the read-only mode of the logical storage unit is merged, and the merged data is flushed to the disk. This can simplify the compaction operation merging from a global compaction to a local small IO merging, so that the merging overhead is fixed within a certain range, the occupation of the disk I / O resource is reduced, and the performance jitter problem caused by the merging operation is solved. At the same time, the compaction task is completed, and good read-write performance is provided.
[0156] In an optional manner, the scheduling module 31 is specifically configured to schedule the plurality of logical storage units to a plurality of nodes in the cluster and schedule the write IO data to a first idle node in the plurality of nodes based on a preset routing strategy by the routing nodes of the routing layer.
[0157] In an optional manner, the compaction optimization device 30 further comprises:
[0158] The triggering module is configured to trigger a compaction subunit to generate a compaction process based on a preset compaction strategy after the working mode of the ordered data structure segment is converted into the read-only mode when the accumulated data amount in the ordered data structure segment meets the preset condition.
[0159] The compaction scheduling module is configured to schedule the compaction process to a second idle node other than the first idle node.
[0160] In an alternative, the compaction optimization device 30 further comprises:
[0161] A binding module is configured to bind each logical storage unit to a processor of a corresponding node after the write IO data is dispatched to the logical storage units respectively by the routing nodes of the routing layer.
[0162] In an alternative, the compaction optimization device 30 further comprises:
[0163] An expansion module is configured to expand the cluster when the usage of the memory of each node reaches a preset value after the data in the read-only ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit and the merged data is flushed to the disk.
[0164] In an alternative, the compaction optimization device 30 further comprises:
[0165] A blocking module is configured to enable a self-protection mechanism to limit the IOs exceeding the carrying capacity of the cluster from entering the cluster when the IOs are blocked after the data in the read-only ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit and the merged data is flushed to the disk.
[0166] Figure 4 A structure diagram of a distributed storage device is shown, and the embodiments of the present application do not limit the specific implementation of the distributed storage device.
[0167] As shown in Figure 4 The distributed storage device can include a processor 42, a communications interface 44, a memory 46, and a communications bus 48.
[0168] The processor 42, the communications interface 44, and the memory 46 can communicate with each other through the communications bus 48. The communications interface 44 is configured to communicate with network elements such as clients or other servers. The processor 42 is configured to execute the program 410, and specifically can execute the related steps in the above-described compaction optimization method embodiments.
[0169] Specifically, the program 410 can include program code including computer executable instructions.
[0170] The processor 42 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present application. The distributed storage device includes one or more processors, which can be the same type of processor, such as one or more CPUs; or different types of processors, such as one or more CPUs and one or more ASICs.
[0171] The memory 46 stores a program 410. The memory 46 can include a high-speed RAM memory, and can also include a non-volatile memory, such as at least one disk memory.
[0172] The program 410 can be specifically invoked by the processor 42 to cause the distributed storage device to perform the following operations:
[0173] The write IO data and the plurality of logical storage units are respectively scheduled by a routing node of a routing layer;
[0174] The write IO data is written into a segment of an ordered data structure in the corresponding logical storage unit;
[0175] In a case where an accumulated data amount in the segment of the ordered data structure satisfies a preset condition, a working mode of the segment of the ordered data structure is converted into a read-only mode;
[0176] Data in the segment of the ordered data structure in the read-only mode in the logical storage unit is subjected to a merge operation by a compaction process generated by the compaction sub-unit, and the merged data is flushed to a disk.
[0177] In an alternative way, the program 410 can be specifically invoked by the processor 42 to cause the distributed storage device to perform the following operations:
[0178] The write IO data and the plurality of logical storage units are respectively scheduled by a routing node of a routing layer;
[0179] Based on a preset routing strategy, the plurality of logical storage units are respectively scheduled to a plurality of nodes in a cluster by the routing node of the routing layer, and the write IO data is scheduled to a first idle node in the plurality of nodes.
[0180] In an alternative way, the program 410 can be specifically invoked by the processor 42 to cause the distributed storage device to perform the following operations:
[0181] In a case where the accumulated data amount in the ordered data structure segment meets a preset condition, the working mode of the ordered data structure segment is converted to a read-only mode, and the method further includes:
[0182] The compaction sub-unit generates a compaction process based on a preset compaction strategy.
[0183] The compaction process is scheduled to a second idle node other than the first idle node.
[0184] In an optional manner, the program 410 can be specifically called by the processor 42 to enable the distributed storage device to perform the following operations:
[0185] After the write IO data and the plurality of logical storage units are respectively scheduled by the routing nodes of the routing layer, the method further includes:
[0186] Each of the logical storage units is bound to a processor of a corresponding node.
[0187] In an optional manner, the program 410 can be specifically called by the processor 42 to enable the distributed storage device to perform the following operations:
[0188] After the data in the ordered data structure segment in the read-only mode of the logical storage unit is merged by the compaction process generated by the compaction sub-unit, and the merged data is flushed to the disk, the method further includes:
[0189] The ordered data structure segment contained in the logical storage unit is updated.
[0190] In an optional manner, the program 410 can be specifically called by the processor 42 to enable the distributed storage device to perform the following operations:
[0191] After the data in the ordered data structure segment in the read-only mode of the logical storage unit is merged by the compaction process generated by the compaction sub-unit, and the merged data is flushed to the disk, the method further includes:
[0192] In a case where the usage rate of the memory of each node reaches a preset value, the cluster is expanded.
[0193] In an optional manner, the program 410 can be specifically called by the processor 42 to enable the distributed storage device to perform the following operations:
[0194] After the data in the ordered data structure segment in the read-only mode of the logical storage unit is merged by the compaction process generated by the compaction sub-unit, and the merged data is flushed to the disk, the method further includes:
[0195] In the case of IO blocking, a self-protection mechanism is enabled to limit IO exceeding the carrying capacity of the cluster from entering the cluster.
[0196] The embodiment of the present application provides a computer readable storage medium, the storage medium stores at least one executable instruction, and the executable instruction enables the distributed storage device to execute the compaction optimization method in any method embodiment.
[0197] The executable instruction can be specifically used for enabling the distributed storage device to execute the following operation:
[0198] The write IO data and the plurality of logical storage units are respectively scheduled by a routing node of a routing layer;
[0199] The write IO data is written into a segment of an ordered data structure in the corresponding logical storage unit;
[0200] In the case where the data amount accumulated in the segment of the ordered data structure meets a preset condition, the working mode of the segment of the ordered data structure is converted into a read-only mode;
[0201] The data in the segment of the ordered data structure in the read-only mode in the logical storage unit is subjected to a merging operation by a compaction process generated by the compaction subunit, and the merged data is flushed to a disk.
[0202] In an optional mode, the executable instruction enables the distributed storage device to execute the following operation:
[0203] The write IO data and the plurality of logical storage units are respectively scheduled by a routing node of a routing layer;
[0204] Based on a preset routing strategy, the plurality of logical storage units are respectively scheduled to a plurality of nodes in a cluster by the routing node of the routing layer, and the write IO data is scheduled to a first idle node in the plurality of nodes.
[0205] In an optional mode, the executable instruction enables the distributed storage device to execute the following operation:
[0206] After the working mode of the segment of the ordered data structure is converted into the read-only mode in the case where the data amount accumulated in the segment of the ordered data structure meets the preset condition, the method further includes the following operation:
[0207] Based on a preset compaction strategy, a compaction subunit generates a compaction process;
[0208] The compaction process is scheduled to a second idle node other than the first idle node.
[0209] In an alternative mode, the executable instructions cause the distributed storage device to perform the following operations:
[0210] After the write IO data is respectively scheduled to the plurality of logical storage units by the routing nodes of the routing layer, the method further comprises:
[0211] Each of the logical storage units is respectively bound to a processor of a corresponding node.
[0212] In an alternative mode, the executable instructions cause the distributed storage device to perform the following operations:
[0213] After the data in the read-only mode ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further comprises:
[0214] The ordered data structure segment contained in the logical storage unit is updated.
[0215] In an alternative mode, the executable instructions cause the distributed storage device to perform the following operations:
[0216] After the data in the read-only mode ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further comprises:
[0217] In the case that the usage rate of the memory of each node reaches a preset value, the cluster is expanded.
[0218] In an alternative mode, the executable instructions cause the distributed storage device to perform the following operations:
[0219] After the data in the read-only mode ordered data structure segment of the logical storage unit is merged by the compaction process generated by the compaction subunit, and the merged data is flushed to the disk, the method further comprises:
[0220] In the case of IO blocking, a self-protection mechanism is enabled to limit IO exceeding the carrying capacity of the cluster from entering the cluster.
[0221] The embodiment of the present application provides a computer program product, the computer program product comprises a computer program stored on a computer readable storage medium, the computer program comprises program instructions, when the program instructions run on a computer, the computer executes the compaction optimization method in any method embodiment.
[0222] The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems can be used with programs in accordance with the teachings herein, or it can prove convenient to construct more specialized apparatus to perform the required method steps. The required structure for a variety of these systems will be apparent from the description above. In addition, the present embodiments are not described with reference to any particular programming language. It will be appreciated that a variety of programming languages can be used to implement the teachings of the application as described herein, and any references below to specific languages are provided for disclosure of enablement of the best mode of the application.
[0223] In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the application can be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been described in detail in order not to obscure the understanding of this description.
[0224] Similarly, it is to be understood that the mechanical details of the application that have been set forth in the description above of exemplary embodiments of the application are intended to be illustrative only. As such, the scope of the application is not to be construed as being limited to such specific embodiments. Furthermore, while the application has been described in some embodiments with reference to specific apparatus, methods, and examples, the actual scope of the application is not limited to the embodiments. Rather, the scope of the application is defined by the appended claims and equivalents thereof.
[0225] Those of skill in the art will understand that modifications to the embodiments of the application can be made without departing from the scope of the present application, which is defined by the appended claims. In addition, well-known features such as components, steps, data structures, and techniques can not be described in great detail in this application. Furthermore, the connecting lines shown in the various figures contained herein are intended to represent example functional relationships and / or physical couplings between the various elements. It should be noted that many alternative or equivalent elements can be used in place of or in conjunction with the elements illustrated. It will also be appreciated by those of skill in the art that changes can be made to the embodiments described without departing from the true scope of the present application. The various embodiments presented are meant to be illustrative only and numerous changes and modifications can be made thereto by those of ordinary skill in the art without departing from the scope of the present application.
[0226] It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design many alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word 'comprising' does not exclude the presence of elements or steps other than those listed in a claim. The word 'a' or 'an' preceding an element does not exclude the presence of a plurality of such elements. The application can be implemented by means of both hardware and software, and any combination thereof. In a unitary claim, several devices, apparatuses or means can be listed, comprising means for carrying out a certain task. The use of the term'means' in a claim is intended to refer to a combination of devices, apparatuses or means for carrying out a task. The word 'first','second', 'third', etc. do not imply any order. The use of these terms is to be construed as an indication of particular embodiments. Steps in the above-described embodiments, unless otherwise specified, are not to be construed as necessarily limiting the order in which the steps are performed.
Claims
1. A compaction optimization method, characterized by, The application is applied to a distributed storage system, the distributed storage system comprises a routing layer located on an input / output (IO) path and a logical storage layer located in a memory, the logical storage layer comprises a plurality of logical storage units, the logical storage unit comprises an ordered data structure segment and a compaction subunit, and the compaction optimization method comprises: scheduling write IO data and the plurality of logical storage units by a routing node of the routing layer; writing the write IO data into the ordered data structure segment in the corresponding logical storage unit; in a case where a data amount accumulated in the ordered data structure segment meets a preset condition, converting a working mode of the ordered data structure segment into a read-only mode; performing a merging operation on data in the ordered data structure segment in the read-only mode in the logical storage unit by a compaction process generated by the compaction subunit, and flushing the merged data to a disk; wherein the scheduling the write IO data and the plurality of logical storage units by the routing node of the routing layer comprises: based on a preset routing strategy, scheduling the plurality of logical storage units to a plurality of nodes in a cluster by the routing node of the routing layer, and scheduling the write IO data to a first idle node in the plurality of nodes.
2. The compaction optimization method of claim 1, wherein, in a case where a data amount accumulated in the ordered data structure segment meets a preset condition, converting a working mode of the ordered data structure segment into a read-only mode, and then comprising: triggering the compaction subunit to generate a compaction process based on a preset compaction strategy; scheduling the compaction process to a second idle node other than the first idle node.
3. The compaction optimization method of claim 1, wherein, after the scheduling the write IO data and the plurality of logical storage units by the routing node of the routing layer, further comprising: binding each of the logical storage units to a processor of a corresponding node.
4. The compaction optimization method of claim 1, wherein, after the performing the merging operation on data in the ordered data structure segment in the read-only mode in the logical storage unit by the compaction process generated by the compaction subunit, and flushing the merged data to the disk, further comprising: updating the ordered data structure segment contained in the logical storage unit.
5. The compaction optimization method of claim 1, wherein, after the performing the merging operation on data in the ordered data structure segment in the read-only mode in the logical storage unit by the compaction process generated by the compaction subunit, and flushing the merged data to the disk, further comprising: in a case where a usage rate of a memory in each node reaches a preset value, expanding the cluster.
6. The compaction optimization method of claim 1, wherein, after the performing the merging operation on data in the ordered data structure segment in the read-only mode in the logical storage unit by the compaction process generated by the compaction subunit, and flushing the merged data to the disk, further comprising: in a case where IO blocking occurs, enabling a self-protection mechanism to limit IO exceeding a carrying capacity of the cluster from entering the cluster.
7. A compaction optimization device characterized by The application is applied to a distributed storage system, the distributed storage system comprises a routing layer located on an input / output (IO) path and a logical storage layer located in a memory, the logical storage layer comprises a plurality of logical storage units, the logical storage unit comprises an ordered data structure segment and a compaction subunit, and the compaction optimization method comprises: The scheduling module is configured to schedule write IO data and the plurality of logical storage units respectively via routing nodes of the routing layer. The writing module is configured to write the write IO data into at least one ordered data structure segment of the corresponding logical storage unit. The conversion module is configured to convert a working mode of the ordered data structure segment into a read-only mode when an accumulated data amount in the ordered data structure segment meets a preset condition. The merging module is configured to perform a merging operation on data in the ordered data structure segment in the read-only mode via a compaction process generated by the compaction sub-unit, and flush the merged data to a disk. The scheduling module is further configured to: schedule the plurality of logical storage units to a plurality of nodes in a cluster and schedule the write IO data to a first idle node in the plurality of nodes based on a preset routing strategy via the routing nodes of the routing layer.
8. A distributed storage device, characterized by The distributed storage device comprises: a processor, a memory, a communication interface and a communication bus, the processor, the memory and the communication interface are in communication with each other via the communication bus; the memory is configured to store at least one executable instruction, and the executable instruction causes the processor to perform the operations of the compaction optimization method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium stores at least one executable instruction, and the executable instruction causes the distributed storage device to perform the operations of the compaction optimization method according to any one of claims 1-6 when the distributed storage device runs.
Citation Information
Patent Citations
Data verification processing method and device, storage medium and processor
CN110955557A
Hbase data backup / recovery system, method and device and electronic equipment
CN111221678A