A multi-control multi-copy cache method, device and computer equipment

By generating multi-controller, multi-replica cache methods using circular arrays, linear arrays, and binary tree structures, the problems of unstable write request load and high latency in existing technologies are solved, achieving load balancing and improved response capabilities.

CN115455048BActive Publication Date: 2026-01-27INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211001424.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-19
Publication Date
2026-01-27
Estimated Expiration
2042-08-19

AI Technical Summary

Technical Problem

Existing multi-controller, multi-replica caching methods cannot meet the performance requirements of high-end storage, resulting in high host latency and fluctuating business load, and failing to guarantee stable write request load.

Method used

By generating circular arrays, linear arrays, and binary tree structures, and performing preorder hierarchical traversal based on the binary tree, a forwarding lookup table is generated to achieve multi-controller, multi-copy caching.

Benefits of technology

It reduces write latency, improves the responsiveness and load stability of the host system, and ensures load balancing within the controller cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115455048B_ABST
    Figure CN115455048B_ABST
Patent Text Reader

Abstract

The application relates to a multi-controller multi-copy cache method, device and computer equipment, the method is applied to a controller cluster, the method comprises the following steps: generating a ring array based on the controller identification in the controller cluster; generating a linear array with each controller identification in the ring array as a first element based on the ring array, and the linear array is at least one; generating a binary tree based on the controller identification in the linear array, and the number of the binary tree is consistent with the number of the linear array; performing a pre-order hierarchical traversal on each controller identification in the binary tree, and generating a forwarding lookup table based on each controller identification to realize multi-controller multi-copy cache.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage technology, and in particular to a multi-controller, multi-copy caching method, apparatus, and computer device. Background Technology

[0002] With the increasing demand for data processing across industries and the growing need for real-time data processing, single-node controller storage systems can no longer meet user needs. Therefore, controller clusters composed of multiple controllers have emerged. Multi-node controller clusters offer high cost-effectiveness, high availability, and high scalability. In terms of performance, they can meet the real-time requirements of massive data processing. Multiple controllers are interconnected via fiber optic networks to form a cluster system, providing application services to users as a whole.

[0003] In existing technologies, to enhance data security, data is typically stored across several or all controllers in a controller cluster; this is a common multi-controller, multi-replica data storage method. Currently, a common multi-controller, multi-replica data storage method involves serially connecting the controllers in the controller cluster, such as... Figure 6 As shown, after a host write request enters the storage system, the data is stored sequentially within the controllers according to the serial connection order; alternatively, a controller is selected as the master controller from the controller cluster, and the other controllers that need to store data are connected to the master controller in parallel, such as... Figure 7 As shown, after a host write request enters the storage system, the data is first stored in the main controller, and then the main controller sends the request to other controllers connected to it for data storage. However, both of these commonly used multi-controller, multi-replica caching methods have certain technical drawbacks and cannot meet the stringent performance requirements of high-end storage. For example, connecting controllers in a controller cluster serially and storing data according to the order of the serially connected controllers results in high host latency; connecting controllers in parallel to the main controller and having the main controller send the request to other controllers connected to it for data storage results in significant business load spikes and a severe reduction in the actual communication capacity of the initiating controller.

[0004] Therefore, there is an urgent need to propose a multi-controller, multi-replica caching method, device, and computer equipment that can ensure stable system write request load while providing low write latency. Summary of the Invention

[0005] Therefore, it is necessary to provide a multi-controller, multi-replica caching method, apparatus, and computer equipment that can ensure stable write request load and reduce write latency to address the aforementioned technical problems.

[0006] On the one hand, a multi-controller, multi-replica caching method is provided, which is applied to a controller cluster, and the method includes:

[0007] Step A: Generate a circular array based on the controller identifiers within the controller cluster;

[0008] Step B: Based on the circular array, generate a linear array with each controller identifier in the circular array as the first element, wherein the linear array is at least one;

[0009] Step C: Based on the controller identifiers in the linear array, generate a binary tree, the number of which is the same as the number of the linear array;

[0010] Step D: Perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0011] In one embodiment, generating a linear array based on the circular array, with each controller identifier in the circular array as a first element, includes: selecting controller identifiers in the circular array one by one as first controller identifiers based on the circular array; using the first controller identifier as the first index, sequentially obtaining controller identifiers in the circular array other than the first controller identifier according to a forward indexing rule; and generating a linear array based on the first controller identifier as the first element.

[0012] In one embodiment, generating a binary tree based on the controller identifiers in the linear array includes: taking the first controller identifier in the linear array as the root node; sequentially obtaining the controller identifiers in the linear array, creating child nodes layer by layer in a loop, and generating a binary tree.

[0013] In one embodiment, a preorder hierarchical traversal of each controller identifier in the binary tree is performed, and a forwarding lookup table is generated based on each controller identifier to achieve multi-controller multi-replica caching. This includes: preorder hierarchical traversal of each node in the binary tree, obtaining the child nodes of each node until the node is a leaf node; obtaining the root node in the binary tree, and defining the controller identifier corresponding to the root node as the master controller identifier; after determining the master controller identifier, obtaining the child nodes of each node based on each node, generating a forwarding lookup table, wherein the controller identifier corresponding to the node is the second controller identifier, and the controller identifier corresponding to the child node is the third controller identifier.

[0014] In one embodiment, after determining the master controller identifier, and obtaining the child nodes of each node based on each node, and generating a forwarding lookup table, the method further includes: after a write request enters the controller cluster, obtaining the master controller identifier in the binary tree based on the binary tree, writing the master controller identifier as a message header into the write request header, and generating a first write request; the second controller identifier obtains the master controller identifier based on the first write request; the second controller identifier performs a replica caching operation based on the write request in the first write request, and after the replica caching operation is completed, the second controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier; the second controller identifier retrieves the forwarding lookup table based on the master controller identifier, and forwards the first write request to the third controller identifier based on the forwarding lookup table.

[0015] In one embodiment, the second controller identifier forwards the first write request to the third controller identifier based on the forwarding lookup table, including: the third controller identifier obtaining the master controller identifier based on the first write request, and performing a replica caching operation based on the write request in the first write request; after the replica caching operation is completed, the third controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier.

[0016] In one embodiment, after the third controller identifier returns the write operation completion information to the master controller identifier, the method further includes: the master controller identifier counting the total number of received write operation completion information and the total number of nodes in the binary tree; if the total number of received write operation completion information is equal to the total number of nodes in the binary tree, then it is determined that the multi-controller multi-replica cache is complete.

[0017] In one embodiment, the method further includes: obtaining controllers within the controller cluster; and generating a controller identifier for each controller, wherein the controller identifier is unique.

[0018] On the other hand, a multi-controller, multi-replica cache device is provided, which is applied to a controller cluster, and the device includes:

[0019] An array generation unit is configured to generate a circular array based on controller identifiers within the controller cluster; and to generate a linear array based on the circular array, with each controller identifier within the circular array as a first element, wherein the linear array is at least one.

[0020] A binary tree generation unit is used to generate binary trees based on controller identifiers in the linear array, the number of binary trees being the same as the number of linear arrays;

[0021] A forwarding lookup table generation unit is used to perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0022] In another aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0023] Step A: Generate a circular array based on the controller identifiers within the controller cluster;

[0024] Step B: Based on the circular array, generate a linear array with each controller identifier in the circular array as the first element, wherein the linear array is at least one;

[0025] Step C: Based on the controller identifiers in the linear array, generate a binary tree, the number of which is the same as the number of the linear array;

[0026] Step D: Perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0027] In another aspect, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, performs the following steps:

[0028] Step A: Generate a circular array based on the controller identifiers within the controller cluster;

[0029] Step B: Based on the circular array, generate a linear array with each controller identifier in the circular array as the first element, wherein the linear array is at least one;

[0030] Step C: Based on the controller identifiers in the linear array, generate a binary tree, the number of which is the same as the number of the linear array;

[0031] Step D: Perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0032] The aforementioned multi-controller multi-replica caching method, apparatus, and computer device, the method comprising: generating a circular array based on controller identifiers within the controller cluster; generating a linear array based on the circular array, with each controller identifier within the circular array as the first element, wherein the linear array is at least one; generating a binary tree based on the controller identifiers in the linear array, wherein the number of binary trees is consistent with the number of linear arrays; performing a preorder level-order traversal of each controller identifier in the binary tree, and generating a forwarding lookup table based on each controller identifier, thereby realizing multi-controller multi-replica caching. Firstly, by generating a circular array and a linear array sequentially based on the controller identifiers within the controller cluster before generating a binary tree, the controller identifiers within the controller cluster can generate binary tree structures for all possible scenarios, ensuring a clear and comprehensive binary tree generation process without overlooking any cases. Secondly, the binary tree structure can improve the speed of replica caching and reduce the process load pressure on the host system. Finally, implementing replica caching across multiple controllers using the binary tree structure can also reduce the processing time of replica caching, thereby improving the responsiveness of the host system. Attached Figure Description

[0033] Figure 1 This is a flowchart illustrating a multi-controller, multi-replica caching method in one embodiment;

[0034] Figure 2 This is a schematic diagram of the structure of a circular array in one embodiment;

[0035] Figure 3 This is a schematic diagram of the structure of a binary tree in one embodiment;

[0036] Figure 4 This is a structural block diagram of a multi-controller, multi-replica cache device in one embodiment;

[0037] Figure 5 An internal structural diagram of a computer device in one embodiment.

[0038] Figure 6 This is a schematic diagram of the structure of a serially connected controller in the prior art;

[0039] Figure 7 This is a schematic diagram of the structure of a parallel-connected controller in the prior art. Detailed Implementation

[0040] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0041] The multi-controller, multi-replica caching method provided in this application is applied to a controller cluster, such as... Figure 1 As shown, the method includes the following steps:

[0042] Step A: Generate a circular array based on the controller identifiers within the controller cluster;

[0043] Step B: Based on the circular array, generate a linear array with each controller identifier in the circular array as the first element, wherein the linear array is at least one;

[0044] Step C: Based on the controller identifiers in the linear array, generate a binary tree, the number of which is the same as the number of the linear array;

[0045] Step D: Perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0046] The aforementioned multi-controller multi-replica caching method, apparatus, and computer device, the method comprising: generating a circular array based on controller identifiers within the controller cluster; generating a linear array based on the circular array, with each controller identifier within the circular array as the first element, wherein the linear array is at least one; generating a binary tree based on the controller identifiers in the linear array, wherein the number of binary trees is consistent with the number of linear arrays; performing a preorder level-order traversal of each controller identifier in the binary tree, and generating a forwarding lookup table based on each controller identifier, thereby realizing multi-controller multi-replica caching. Firstly, by generating a circular array and a linear array sequentially based on the controller identifiers within the controller cluster before generating a binary tree, the controller identifiers within the controller cluster can generate binary tree structures for all possible scenarios, ensuring a clear and comprehensive binary tree generation process without overlooking any cases. Secondly, the binary tree structure can improve the speed of replica caching and reduce the process load pressure on the host system. Finally, implementing replica caching across multiple controllers using the binary tree structure can also reduce the processing time of replica caching, thereby improving the responsiveness of the host system.

[0047] In one embodiment, the controller identifier is unique; the controller identifier corresponds to a controller setting, and the controller cluster contains several controllers, with a controller identifier generated based on each controller. It is important to understand that after generating a controller identifier for each controller, it must be compared with an existing controller identifier to ensure that each generated controller identifier is unique.

[0048] In one embodiment, generating a linear array based on the circular array, with each controller identifier within the circular array as a first element, includes: sequentially selecting each controller identifier within the circular array as a first controller identifier; using the first controller identifier as the first index, and following a forward indexing rule, sequentially obtaining all controller identifiers within the circular array except the first controller identifier; and generating a linear array based on the first controller identifier as the first element. It should be understood that the forward indexing rule described in this application is not necessarily mandatory. Those skilled in the art can choose an appropriate indexing method based on the actual application scenario requirements, such as a reverse indexing rule, as long as it ensures that all controller identifiers existing within the circular array can be used as the first controller identifier to generate a linear array.

[0049] Specifically, a linear array is generated using each controller identifier within the circular array as the first element, including: such as Figure 2 As shown, the circular array contains 5 controller identifiers, numbered 1, 2, 3, 4, and 5. Therefore, at least 5 linear arrays should be generated. These 5 linear arrays include linear arrays with element 1 as the first element, linear arrays with element 2 as the first element, linear arrays with element 3 as the first element, linear arrays with element 4 as the first element, and linear arrays with element 5 as the first element. The first element is the first element in each linear array. Based on a forward indexing rule, the controller identifiers within the circular array, excluding the first controller identifier, are sequentially obtained. This includes, taking controller identifier 1 as an example, selecting controller identifier 1 as the first controller identifier within the circular array, and then, according to the forward indexing rule, sequentially obtaining the controller identifiers within the circular array, excluding the first controller identifier, namely controller identifier 2, controller identifier 3, controller identifier 4, and controller identifier 5.

[0050] Furthermore, to ensure that no controller identifiers are omitted when generating the linear array, the first controller identifier is used as the first element when generating the linear array based on the first controller identifier and the controller identifiers other than the first controller identifier. The elements of the linear array are then generated sequentially according to a forward indexing rule. For example, when generating the linear array with controller identifier 1 as the first element, controller identifiers 2, 3, 4, and 5 (excluding controller identifier 1) within the circular array are sequentially obtained according to the forward indexing rule. Based on the first controller identifier and the controller identifiers, the linear array {1,2,3,4,5} is generated.

[0051] In one embodiment, generating a binary tree based on the controller identifiers in the linear array includes: using the first controller identifier in the linear array as the root node; sequentially obtaining the controller identifiers in the linear array, and creating child nodes layer by layer in a loop to generate the binary tree. Here, creating child nodes layer by layer in a loop means, based on the structure of the binary tree, creating child nodes from the root node, from the top to the bottom, and from the left subtree to the right subtree, to generate the binary tree.

[0052] In one embodiment, a preorder hierarchical traversal of each controller identifier in the binary tree is performed. Based on each controller identifier, a forwarding lookup table is generated to achieve multi-controller, multi-replica caching. This includes: preorder hierarchical traversal of each node in the binary tree, obtaining the child nodes of each node until the node is a leaf node; obtaining the root node in the binary tree and defining the controller identifier corresponding to the root node as the master controller identifier; after determining the master controller identifier, obtaining the child nodes of each node and generating a forwarding lookup table, where the controller identifier corresponding to the node is the second controller identifier, and the controller identifier corresponding to the child node is the third controller identifier. Here, preorder hierarchical traversal of each node in the binary tree refers to traversing each node in the binary tree based on its structure, starting from the root node, from top to bottom, and from left subtree to right subtree.

[0053] In one embodiment, after determining the master controller identifier, and obtaining the child nodes of each node based on each node, and generating a forwarding lookup table, the method further includes: after a write request enters the controller cluster, obtaining the master controller identifier in the binary tree based on the binary tree, writing the master controller identifier as a message header into the write request header, and generating a first write request; the second controller identifier obtains the master controller identifier based on the first write request; the second controller identifier performs a replica caching operation based on the write request in the first write request, and after the replica caching operation is completed, the second controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier; the second controller identifier retrieves the forwarding lookup table based on the master controller identifier, and forwards the first write request to the third controller identifier based on the forwarding lookup table.

[0054] It should be understood that the second and third controller identifiers in this application are only relative. That is, relative to its parent node, the controller identifier corresponding to a child node in a binary tree is the third controller identifier, while the parent node of the child node is the second controller identifier. However, when the aforementioned child node also has its own child nodes, the controller identifier corresponding to the child node relative to its own child nodes is the second controller identifier, and the controller identifier corresponding to the child node's child nodes is the third controller identifier. Figure 3 In the binary tree shown, the controller identifier corresponding to node 2 is the second controller identifier relative to the controller identifier corresponding to node 4, and the controller identifier corresponding to node 4 is the third controller identifier. However, the controller identifier corresponding to node 4 is the second controller identifier relative to the controller identifier corresponding to node 6, and the controller identifier corresponding to node 6 is the third controller identifier. That is, if a node is not a leaf node, the controller identifier corresponding to that node may be both the second and third controller identifier.

[0055] In one embodiment, the second controller identifier forwards the first write request to the third controller identifier based on the forwarding lookup table. This includes: the third controller identifier obtaining the master controller identifier based on the first write request, and performing a replica caching operation based on the write request in the first write request; after the replica caching operation is completed, the third controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier. It should be understood that when the controller identifier corresponding to the node is both the second controller identifier and the third controller identifier, the replica caching operation will only be performed when it is the third controller identifier, and only then will the write operation completion information be generated and returned to the master controller identifier after the replica caching operation is completed. This ensures that the controller does not perform repeated caching of replicas multiple times, and also ensures that the master controller receives write operation completion information sent by other controllers in the controller cluster only once, further ensuring the accuracy of the structure of the total number of write operation completion information received by the master controller.

[0056] In one embodiment, after the third controller identifier returns the write operation completion information to the master controller identifier, the method further includes: the master controller identifier counting the total number of received write operation completion information and the total number of nodes in the binary tree; if the total number of received write operation completion information is equal to the total number of nodes in the binary tree, then it is determined that the multi-controller multi-replica cache is complete.

[0057] In one embodiment, a forwarding lookup table is generated based on each controller identifier, including: obtaining the controller identifier corresponding to the root node in the binary tree as the main controller identifier; performing a preorder hierarchical traversal of the controller identifier corresponding to each node in the binary tree to obtain the child nodes of each node; and generating a forwarding lookup table based on the nodes and the child nodes. It should be understood that the purpose of generating the forwarding lookup table is to determine which controller identifier(s) each controller identifier should forward the received first write request to when the root nodes of the binary tree are different, i.e., when the main controller identifiers are different. Figure 3 As shown in the diagram, the root node 1 of the binary tree corresponds to the controller identifier 1, and node 2 corresponds to controller identifier 2. Controller identifier 2 has two child nodes, node 4 and node 5, which correspond to controller 4 and controller 5, respectively. The forwarding lookup table generated based on controller identifier 2 is shown in Table 1 below. Correspondingly, the forwarding lookup table generated based on controller identifier 3 corresponding to node 3 is shown in Table 1 below.

[0058] Table 1 Forwarding Lookup Table

[0059] Main controller identifier Second controller identifier Third controller node 1 2 4,5 1 3 none

[0060] It should be understood that, although Figure 1 The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figure 1 At least some of the steps in the process may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least some of the sub-steps or stages of other steps.

[0061] In one embodiment, such as Figure 4 As shown, a multi-controller, multi-replica cache device is provided, comprising: an array generation unit, a binary tree generation unit, and a forwarding lookup table generation unit, wherein:

[0062] An array generation unit is configured to generate a circular array based on controller identifiers within the controller cluster; and to generate a linear array based on the circular array, with each controller identifier within the circular array as a first element, wherein the linear array is at least one.

[0063] A binary tree generation unit is used to generate binary trees based on controller identifiers in the linear array, the number of binary trees being the same as the number of linear arrays;

[0064] A forwarding lookup table generation unit is used to perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0065] In one embodiment, the array generation unit is further configured to, based on the circular array, sequentially select controller identifiers within the circular array as first controller identifiers; using the first controller identifier as the first index, sequentially obtain controller identifiers within the circular array other than the first controller identifier according to a forward indexing rule; and generate a linear array based on the first controller identifier as the first element.

[0066] In one embodiment, the binary tree generation unit is further configured to take the first controller identifier in the linear array as the root node; sequentially obtain the controller identifier in the linear array, and create child nodes layer by layer to generate a binary tree.

[0067] In one embodiment, the forwarding lookup table generation unit is further configured to perform a preorder hierarchical traversal of each node in the binary tree, obtain the child nodes of each node, until the node is a leaf node; obtain the root node in the binary tree, and define the controller identifier corresponding to the root node as the master controller identifier; after determining the master controller identifier, obtain the child nodes of each node based on each node, generate a forwarding lookup table, wherein the controller identifier corresponding to the node is the second controller identifier, and the controller identifier corresponding to the child node is the third controller identifier.

[0068] In one embodiment, the apparatus further includes: an information sending unit, configured to, after a write request enters the controller cluster, obtain the master controller identifier in the binary tree based on the binary tree, write the master controller identifier as a message header into the write request header, and generate a first write request; a second controller identifier obtains the master controller identifier based on the first write request; the second controller identifier performs a replica caching operation based on the write request in the first write request, and after the replica caching operation is completed, the second controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier; the second controller identifier retrieves the forwarding lookup table based on the master controller identifier, and forwards the first write request to the third controller identifier based on the forwarding lookup table.

[0069] In one embodiment, the information sending unit is further configured to have the third controller identifier obtain the master controller identifier based on the first write request, and perform a replica caching operation based on the write request in the first write request; after the replica caching operation is completed, the third controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier.

[0070] In one embodiment, the device further includes: an information statistics unit, used by the main controller to identify the total number of write operation completion messages received and the total number of nodes in the binary tree; if the total number of write operation completion messages received is equal to the total number of nodes in the binary tree, then it is determined that the multi-controller multi-replica cache is complete.

[0071] In one embodiment, the apparatus further includes: an identifier generation unit for acquiring controllers within the controller cluster; and generating a controller identifier based on each controller, wherein the controller identifier is unique.

[0072] For specific limitations regarding the multi-controller, multi-replica caching device, please refer to the limitations of the multi-controller, multi-replica caching method above, which will not be repeated here. Each module in the aforementioned multi-controller, multi-replica caching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0073] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, network interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements a multi-controller, multi-copy caching method. The display screen can be an LCD screen or an e-ink display screen. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

[0074] Those skilled in the art will understand that Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0075] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to perform the following steps:

[0076] Step A: Generate a circular array based on the controller identifiers within the controller cluster;

[0077] Step B: Based on the circular array, generate a linear array with each controller identifier in the circular array as the first element, wherein the linear array is at least one;

[0078] Step C: Based on the controller identifiers in the linear array, generate a binary tree, the number of which is the same as the number of the linear array;

[0079] Step D: Perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0080] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0081] Based on the circular array, the controller identifiers in the circular array are selected one by one as the first controller identifier; using the first controller identifier as the first index, the controller identifiers in the circular array other than the first controller identifier are obtained in sequence according to the forward indexing rule; using the first controller identifier as the first element, a linear array is generated based on the controller identifier.

[0082] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0083] The first controller identifier in the linear array is taken as the root node; the controller identifiers in the linear array are obtained sequentially, and child nodes are created layer by layer to generate a binary tree.

[0084] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0085] A preorder level-order traversal is performed on each node in the binary tree to obtain the child nodes of each node until the node is a leaf node. The root node in the binary tree is obtained, and the controller identifier corresponding to the root node is defined as the master controller identifier. After determining the master controller identifier, the child nodes of each node are obtained based on each node, and a forwarding lookup table is generated. The controller identifier corresponding to the node is the second controller identifier, and the controller identifier corresponding to the child node is the third controller identifier.

[0086] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0087] After a write request enters the controller cluster, the master controller identifier in the binary tree is obtained, and the master controller identifier is written as a message header into the write request header to generate a first write request. The second controller identifier obtains the master controller identifier based on the first write request. The second controller identifier performs a replica caching operation based on the write request in the first write request. After the replica caching operation is completed, the second controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier. Based on the master controller identifier, the second controller identifier retrieves the forwarding lookup table and forwards the first write request to the third controller identifier based on the forwarding lookup table.

[0088] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0089] The third controller identifier obtains the master controller identifier based on the first write request, and performs a replica caching operation based on the write request in the first write request; after the replica caching operation is completed, the third controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier.

[0090] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0091] The main controller identifies the total number of write operation completion messages received and the total number of nodes in the binary tree; if the total number of write operation completion messages received is equal to the total number of nodes in the binary tree, then the multi-controller multi-replica cache is determined to be complete.

[0092] In one embodiment, the processor, when executing a computer program, also performs the following steps:

[0093] Obtain the controllers within the controller cluster; generate a controller identifier for each controller, wherein the controller identifier is unique.

[0094] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:

[0095] Step A: Generate a circular array based on the controller identifiers within the controller cluster;

[0096] Step B: Based on the circular array, generate a linear array with each controller identifier in the circular array as the first element, wherein the linear array is at least one;

[0097] Step C: Based on the controller identifiers in the linear array, generate a binary tree, the number of which is the same as the number of the linear array;

[0098] Step D: Perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

[0099] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0100] Based on the circular array, the controller identifiers in the circular array are selected one by one as the first controller identifier; using the first controller identifier as the first index, the controller identifiers in the circular array other than the first controller identifier are obtained in sequence according to the forward indexing rule; using the first controller identifier as the first element, a linear array is generated based on the controller identifier.

[0101] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0102] The first controller identifier in the linear array is taken as the root node; the controller identifiers in the linear array are obtained sequentially, and child nodes are created layer by layer to generate a binary tree.

[0103] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0104] A preorder level-order traversal is performed on each node in the binary tree to obtain the child nodes of each node until the node is a leaf node. The root node in the binary tree is obtained, and the controller identifier corresponding to the root node is defined as the master controller identifier. After determining the master controller identifier, the child nodes of each node are obtained based on each node, and a forwarding lookup table is generated. The controller identifier corresponding to the node is the second controller identifier, and the controller identifier corresponding to the child node is the third controller identifier.

[0105] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0106] After a write request enters the controller cluster, the master controller identifier in the binary tree is obtained, and the master controller identifier is written as a message header into the write request header to generate a first write request. The second controller identifier obtains the master controller identifier based on the first write request. The second controller identifier performs a replica caching operation based on the write request in the first write request. After the replica caching operation is completed, the second controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier. Based on the master controller identifier, the second controller identifier retrieves the forwarding lookup table and forwards the first write request to the third controller identifier based on the forwarding lookup table.

[0107] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0108] The third controller identifier obtains the master controller identifier based on the first write request, and performs a replica caching operation based on the write request in the first write request; after the replica caching operation is completed, the third controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier.

[0109] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0110] The main controller identifies the total number of write operation completion messages received and the total number of nodes in the binary tree; if the total number of write operation completion messages received is equal to the total number of nodes in the binary tree, then the multi-controller multi-replica cache is determined to be complete.

[0111] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:

[0112] Obtain the controllers within the controller cluster; generate a controller identifier for each controller, wherein the controller identifier is unique.

[0113] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0114] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0115] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A multi-controller, multi-replica caching method, characterized in that, The method is applied to a controller cluster, and the method includes: A circular array is generated based on the controller identifiers within the controller cluster; Based on the circular array, a linear array is generated with each controller identifier in the circular array as the first element, and the linear array is at least one; Based on the controller identifiers in the linear array, a binary tree is generated, and the number of binary trees is the same as the number of linear arrays. A preorder hierarchical traversal of each controller identifier in the binary tree is performed. Based on each controller identifier, a forwarding lookup table is generated to implement multi-controller, multi-replica caching, including: The preorder level-order traversal of each node in the binary tree is performed to obtain the child nodes of each node until the node is a leaf node. The preorder level-order traversal refers to traversing each node in the binary tree based on its structure, starting from the root node, from the upper level to the lower level, and from the left subtree to the right subtree. Obtain the root node in the binary tree, and define the controller identifier corresponding to the root node as the main controller identifier; After determining the main controller identifier, based on each node, obtain the child nodes of each node and generate a forwarding lookup table. The controller identifier corresponding to the node is the second controller identifier, and the controller identifier corresponding to the child node is the third controller identifier. After generating the forwarding lookup table, the method further includes: After a write request enters the controller cluster, the master controller identifier in the binary tree is obtained based on the binary tree, and the master controller identifier is written as the message header into the write request header to generate the first write request. The second controller identifier is obtained from the main controller identifier based on the first write request; The second controller identifier performs a replica caching operation based on the write request in the first write request. After the replica caching operation is completed, the second controller identifier generates write operation completion information and returns the write operation completion information to the master controller identifier. The second controller identifier retrieves the forwarding lookup table based on the master controller identifier, and forwards the first write request to the third controller identifier based on the forwarding lookup table; The third controller identifier obtains the master controller identifier based on the first write request, and performs a replica cache operation based on the write request in the first write request; After the replica caching operation is completed, the third controller identifier generates write operation completion information and returns the write operation completion information to the main controller identifier.

2. The multi-controller, multi-replica caching method according to claim 1, characterized in that, Based on the circular array, a linear array is generated with each controller identifier within the circular array as the first element, including: Based on the circular array, the controller identifiers within the circular array are selected one by one as the first controller identifier; Using the first controller identifier as the first index, the controller identifiers in the circular array, excluding the first controller identifier, are sequentially obtained according to the forward indexing rule; Using the first controller identifier as the first element, a linear array is generated based on the controller identifier.

3. The multi-controller, multi-replica caching method according to claim 2, characterized in that, Based on the controller identifiers in the linear array, a binary tree is generated, including: The first controller identifier in the linear array is taken as the root node; The controller identifiers in the linear array are obtained sequentially, and child nodes are created layer by layer to generate a binary tree.

4. The multi-controller, multi-replica caching method according to claim 3, characterized in that, After the third controller identifier returns the write operation completion information to the main controller identifier, the method further includes: The main controller identifies the total number of write operation completion messages received and the total number of nodes in the binary tree. If the total number of received write operation completion messages is equal to the total number of nodes in the binary tree, then the multi-controller multi-replica cache is determined to be complete.

5. The multi-controller, multi-replica caching method according to any one of claims 1 to 4, characterized in that, The method further includes: Obtain the controllers within the controller cluster; For each of the aforementioned controllers, a controller identifier is generated, and the controller identifier is unique.

6. A multi-controller multi-replica cache apparatus for implementing the multi-controller multi-replica cache method as described in any one of claims 1-5, characterized in that, The device is used in a controller cluster, and the device includes: An array generation unit is configured to generate a circular array based on controller identifiers within the controller cluster; and to generate a linear array based on the circular array, with each controller identifier within the circular array as a first element, wherein the linear array is at least one. A binary tree generation unit is used to generate binary trees based on controller identifiers in the linear array, the number of binary trees being the same as the number of linear arrays; A forwarding lookup table generation unit is used to perform a preorder hierarchical traversal of each controller identifier in the binary tree, and generate a forwarding lookup table based on each controller identifier to achieve multi-controller multi-copy caching.

7. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Metadata distribution management method in distributed object storage system

    CN107689876A

  • Method for managing balanced binary tree and memory index implementation method

    CN114911791A