Cache mode setting method and device, computer equipment and storage medium
By flexibly switching cache mode and setting the duration of writeback mode, the problem of single cache mode setting strategy in the prior art is solved, and the adaptability of multi-controller scenarios, the performance and data security of storage clusters are improved.
Patent Information
- Application Number
- CN202411280554.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-09-12
AI Technical Summary
In the prior art, the cache mode setting strategy is single, and the adaptability to multi-controller scenarios is low, resulting in performance degradation and insufficient data security.
By determining the number of controllers in the storage cluster, setting the duration of the write-back mode, flexibly switching the cache mode, and dynamically adjusting the cache mode according to user needs and failure recovery scenarios, thereby improving the performance and adaptability of the storage cluster.
It realizes flexible switching of cache mode in single-control and multi-control states, improves fault recovery capabilities and user experience, enhances adaptability to multi-controller scenarios, and improves overall processing efficiency and data security.
Smart Images

Figure CN119148941A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a cache mode setting method, device, computer equipment and storage medium. Background Art
[0002] The storage cluster has different cache modes for processing cache data, including cache data write-back and cache data write-through. When the cache mode is cache data write-back, the data is returned after being written to the cache and does not need to be flushed, which helps to reduce latency and improve data read and write performance; when the cache mode is cache data write-through, the data needs to be flushed after being written to the cache, and the maximum flush rate is always maintained. In this mode, the performance of data read and write will be reduced, but a certain degree of data security can be guaranteed.
[0003] At present, the cache mode setting strategy for different storage cluster controllers is to adjust the cache mode of the storage cluster according to the redundant status of the controllers in the storage cluster. If there are multiple redundant controllers, the cache mode is set to cache data write-back, and the data is stored in the cache module mirror; if there is only one controller, the cache mode is set to cache data write-through, and the data is saved to the lower disk. The cache mode setting strategy is single, and the write-through mode is fixedly turned on in the single-controller state, resulting in performance degradation and low adaptability to multi-controller scenarios.
[0004] Therefore, the related technology has the problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios. Summary of the invention
[0005] In view of this, the present invention provides a cache mode setting method, apparatus, computer equipment and storage medium to solve the problem that the cache mode setting strategy is single and has low adaptability to multi-controller scenarios.
[0006] In a first aspect, the present invention provides a cache mode setting method, comprising:
[0007] Determine the number of controllers in the storage cluster;
[0008] When the number of controllers is less than or equal to a first preset value, determining a setting duration of the write-back mode, and if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to the write-back mode, and maintaining the cache mode of the storage cluster in the write-back mode within the setting duration;
[0009] After setting the duration, set the cache mode of the storage cluster to write-through mode;
[0010] When the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to the write-through mode.
[0011] The cache mode setting method provided in this embodiment, when the number of controllers is less than or equal to the first preset value, adjusts the cache mode of the storage cluster by setting different setting durations of the write-back mode, so that the cache mode can be flexibly switched between the write-back / write-through modes, and the user sets the duration of the write-back mode, and after the set duration, the cache mode of the storage cluster is set to the write-through mode. The redundancy mechanism for coping with failure and failure recovery scenarios is improved, and setting the cache mode to the write-back mode helps improve the performance of the storage cluster in a single-controller state, facilitates users to select the cache mode, and improves the user experience. The problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios is solved.
[0012] In some optional implementations, determining a setting duration of the write-back mode, and if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to the write-back mode includes:
[0013] In response to a command line modification instruction for configuring a setting duration, using a first callback function to obtain a value of a first variable structure, and using the value of the first variable structure as the setting duration;
[0014] If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is a write-back mode;
[0015] If yes, reset the duration of the write-back mode according to the set duration;
[0016] If not, set the cache mode of the storage cluster to write-back mode and set the duration to the duration of write-back mode.
[0017] In this embodiment, the first callback function is used to obtain the value of the first variable structure, and the value of the first variable structure is used as the setting duration to set the cache mode of the storage cluster to the write-back mode, and the setting duration is set to the duration of the write-back mode. The value of the variable structure is identified by the callback function, and the cache mode of the storage cluster is adjusted according to the change of the variable structure value, so as to better meet user needs and adjust data performance.
[0018] In some optional implementations, setting the cache mode of the storage cluster to the write-back mode and maintaining the cache mode of the storage cluster in the write-back mode for a set time period includes:
[0019] By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value;
[0020] Set the third variable structure to the fourth preset value;
[0021] When the third variable structure is a fourth preset value, the second callback function is called;
[0022] According to the second callback function and the set duration, a timer is set, and the cache mode is marked as a write-back mode, wherein the timer is used to determine the duration of the write-back mode;
[0023] When the timer time is less than the set duration, the cache mode is kept in write-back mode.
[0024] In this embodiment, by setting the second variable structure to the third preset value, setting the cache mode to the write-back mode, identifying the value of the variable structure through the callback function, and adjusting the cache mode of the storage cluster according to the change in the value of the variable structure, it is better to adapt to user needs and adjust data performance. According to the second callback function and the set duration, a timer is set to determine the duration of the write-back mode, which is convenient for controlling the cache mode.
[0025] In some optional implementations, after setting the duration, setting the cache mode of the storage cluster to a write-through mode includes:
[0026] When the timer time is equal to the set duration, the third callback function is called;
[0027] Using the third callback function, the fourth variable structure is set to the fifth preset value;
[0028] When the fourth variable structure is the fifth preset value, by setting the second variable structure to the sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.
[0029] In this embodiment, the third callback function is used to set the fourth variable structure to the fifth preset value and the second variable structure to the sixth preset value, so that the cache mode is set to the write-through mode. The callback function identifies the value of the variable structure and adjusts the cache mode of the storage cluster according to the change in the value of the variable structure, so as to better meet user needs and adjust data performance.
[0030] In some optional implementations, when the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode includes:
[0031] When the set duration is less than or equal to the second preset value, determining whether the cache mode is a write-back mode;
[0032] If yes, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value;
[0033] If not, set the cache mode to write-through.
[0034] In some optional implementations, after determining the number of controllers in the storage cluster, the method further includes:
[0035] When the number of controllers is greater than a first preset value, determining whether a storage cluster fails;
[0036] If the storage cluster is not faulty, set the cache mode of the storage cluster to write-back mode;
[0037] If a storage cluster fails, a target controller is determined from the controllers, and the storage cluster is set to a control mode based on the target controller;
[0038] Determine the duration of the write-back mode setting;
[0039] If the set duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;
[0040] If the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to a write-through mode;
[0041] Determine whether a command line modification instruction is received, and if received, determine the modification duration of the write-back mode according to the command line modification instruction;
[0042] If the modification duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;
[0043] If the modification duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to a write-through mode;
[0044] If the storage cluster fails over, set the storage cluster to a control mode based on the number of controllers and set the cache mode of the storage cluster to write-back mode.
[0045] In this embodiment, if the storage cluster has not failed, the cache mode of the storage cluster is set to the write-back mode; if the storage cluster has failed, the storage cluster is set to the control mode based on the target controller; and the duration of the write-back mode is set according to the setting duration and modification duration of the write-back mode. If the storage cluster fails and recovers, the storage cluster is set to the control mode based on the number of controllers, and the cache mode of the storage cluster is set to the write-back mode. The redundancy mechanism for coping with failure and failure recovery scenarios is improved, and the default write-back mode also helps to improve the overall performance of the storage cluster in a single-control state. Combined with the node failure / failure recovery scenarios, different cache modes can be provided according to scenario changes and user settings, thereby improving overall processing efficiency and smooth experience.
[0046] In some optional embodiments, the method further comprises:
[0047] When the number of controllers is less than or equal to the first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command;
[0048] Determine whether the cache mode of the storage cluster is a write-back mode according to the identification field;
[0049] If the cache mode of the storage cluster is the write-back mode, whether to end the write-back mode is determined according to the timestamp.
[0050] In a second aspect, the present invention provides a cache mode setting device, comprising:
[0051] A determination module, used to determine the number of controllers in the storage cluster;
[0052] A first setting module is used to determine the setting duration of the write-back mode when the number of controllers is less than or equal to a first preset value, and if the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and keep the cache mode of the storage cluster in the write-back mode within the setting duration;
[0053] The second setting module is used to set the cache mode of the storage cluster to a write-through mode after a set time period;
[0054] The third setting module is used to set the cache mode of the storage cluster to the write-through mode when the set duration is less than or equal to the second preset value.
[0055] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the cache mode setting method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0056] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the cache mode setting method of the first aspect or any corresponding embodiment thereof.
[0057] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the cache mode setting method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 is a flow chart of a method for setting a cache mode according to an embodiment of the present invention;
[0060] Figure 2 is a schematic diagram of setting a cache mode according to the number of storage cluster controllers according to an embodiment of the present invention;
[0061] Figure 3 is a schematic diagram of setting a cache mode according to a set duration according to an embodiment of the present invention;
[0062] Figure 4 is a schematic diagram of setting a cache mode according to a write-back mode duration according to an embodiment of the present invention;
[0063] Figure 5 is a schematic diagram of a variable structure according to an embodiment of the present invention;
[0064] Figure 6 is a schematic diagram of a callback function according to an embodiment of the present invention;
[0065] Figure 7 is a flowchart of setting cache modes for a single controller and multiple controllers in a storage cluster respectively according to an embodiment of the present invention;
[0066] Figure 8 is a schematic diagram of setting a cache mode for multiple controllers in a storage cluster according to an embodiment of the present invention;
[0067] Fig. 9 is a structural block diagram of a cache mode setting device according to an embodiment of the present invention;
[0068] Fig.10 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0070] Currently, for data redundancy protection, if there is only one controller in a mirror pair, the cache mode will be locked as write-through on low-end and mid-end storage products. Because there is only one node in the mirror pair in this scenario, there is only one copy of the cached data. Once a node fails, the data in the cache is at risk of being lost. In write-through mode, after the data is written to the cache, it will be flushed to the disk first, and the back-end storage array will provide data redundancy protection, which has higher data security. In high-end storage products, customers have higher requirements for the front-end business throughput in various scenarios. In the single-control scenario, the write-back mode needs to be maintained for a certain period of time to maintain business traffic. During this period, customers can repair the on-site environment by restoring the failed controller and other means to get it out of the single-control state.
[0071] Therefore, the current data mode processing strategies for different storage cluster controllers are relatively simple. Since most current storage systems are based on dual control, the processing strategies adopted are to flush data in single control mode and write data back in multi-controller mode. The cache data mode of the existing technology is relatively simple, unable to provide users with selectable data mode switching, and the write-through mode is fixed in single control mode, resulting in performance degradation; the adaptability to multi-controller scenarios is low.
[0072] Based on the above content, an embodiment of the present invention provides a cache mode setting method, which can switch the cache mode of a storage cluster including a single controller and configure the duration of the cache mode. In the single controller mode, the user can set the cache mode and the corresponding setting duration through the command line. The setting duration is used to set the cache mode in the single controller state to remain in the write-back mode or change it to the write-through mode, and the expiration time of the write-back mode can be set and queried. This multi-functional mode of cache state switching better combines the node failure / fault recovery scenario. In order to provide different cache modes according to scenario changes and user settings, improve the overall processing efficiency and smooth experience, and better adapt to user needs and adjust data performance.
[0073] According to an embodiment of the present invention, a cache mode setting embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0074] In this embodiment, a cache mode setting method is provided, which can be used for the above-mentioned computer device. Figure 1 is a flow chart of a method for setting a cache mode according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0075] Step S101, determining the number of controllers in the storage cluster.
[0076] Specifically, this embodiment sets the cache mode of the storage cluster according to the number of controllers in the storage cluster. The number of controllers in the storage cluster is determined. For example, if the storage cluster has only one controller, the storage cluster is in single-controller mode; if the storage cluster has multiple controllers, the storage cluster can be in multi-controller mode.
[0077] When the number of controllers in the storage cluster is greater than 1, that is, more than one controller is processing cache data, the cache mode of the storage cluster is set to write-back mode to ensure data processing efficiency; when the number of controllers in the cluster is 1, that is, there is only one controller in the storage system currently processing cache data, the cache mode in the storage cluster is set to write-back mode through the ONEWAYCACHE (one-way cache) switch. ONEWAYCACHE is a cache consistency model that is mainly used to manage cache data consistency in multi-processor or multi-node systems. This model allows data to be transmitted unidirectionally between different processors or nodes, thereby ensuring data consistency.
[0078] The above process is as follows Figure 2 As shown, determine the number of controllers in the cluster and determine whether the number is greater than 1. If it is greater than 1, set the cache mode of the storage cluster to the data write-back mode. Otherwise, set the cache mode of the storage cluster to the single-controller data write-back mode. It should be noted that there is no difference between the single-controller data write-back mode and the data write-back mode.
[0079] Step S102, when the number of controllers is less than or equal to a first preset value, determine the set duration of the write-back mode. If the set duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and keep the cache mode of the storage cluster in the write-back mode within the set duration.
[0080] Specifically, the first preset value is, for example, 1 or other smaller integers. When the number of controllers is less than or equal to the first preset value, the storage cluster can be considered to be in single-control mode. At this time, it is necessary to determine the set duration of the write mode, which is set by the user through the command line. The second preset value is, for example, 0 or other smaller values. If the set duration is greater than the second preset value, it can be determined that the user needs to set the cache mode of the storage cluster to write-back mode and maintain the set duration. Therefore, the cache mode of the storage cluster is set to write-back mode, and the cache mode of the storage cluster is maintained in write-back mode within the set duration.
[0081] The above process is as follows Figure 3As shown, the default duration of a single controller is 2 days (Day), the user-set duration T is determined, and it is judged whether T is greater than 0. If T is greater than 0, the cache mode of the storage cluster is set to the single-control write-back mode, that is, the write-back mode.
[0082] Step S103: after setting the duration, setting the cache mode of the storage cluster to a write-through mode.
[0083] Specifically, in addition to adjusting the cache mode of the storage cluster according to the set duration, this embodiment also adds a user-selectable and settable mode time, that is, the cache mode is set to the write-back mode duration by setting the time. Within the set duration, the cache mode is maintained in the write-back mode; after the set duration, the cache mode of the storage cluster is set to the write-through mode.
[0084] The above process is as follows Figure 4 As shown, determine the single-control data write-back time, and determine whether it has timed out. If it has timed out, set the cache mode of the storage cluster to the single-control write-through mode, i.e., the write-through mode. If it has not timed out, continue to keep the cache mode of the storage cluster set to the single-control write-back mode, i.e., the write-back mode.
[0085] Step S104: When the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to a write-through mode.
[0086] Specifically, the user can choose to enable write-back mode in single-control mode, or disable write-back mode and enable write-through mode by setting different setting durations. When the number of controllers is less than or equal to the first preset value, the cache mode of data write-back is adopted by default, and the default duration is 2 natural days. If the setting duration set by the user is less than or equal to the second preset value, there is no need to set the cache mode of the storage cluster to write-back mode, and it can be directly set to write-through mode.
[0087] The above process is as follows Figure 3 As shown, the default duration of a single controller is 2 days (Day), the user-set duration T is determined, and it is judged whether T is greater than 0. If T is not greater than 0, the cache mode of the storage cluster is set to the single-controller write-through mode, that is, the write-through mode.
[0088] The cache mode setting method provided in this embodiment, when the number of controllers is less than or equal to the first preset value, adjusts the cache mode of the storage cluster by setting different setting durations of the write-back mode, so that the cache mode can be flexibly switched between the write-back / write-through modes, and the user sets the duration of the write-back mode, and after the set duration, the cache mode of the storage cluster is set to the write-through mode. The redundancy mechanism for coping with failure and failure recovery scenarios is improved, and setting the cache mode to the write-back mode helps improve the performance of the storage cluster in a single-controller state, facilitates users to select the cache mode, and improves the user experience. The problem of a single cache mode setting strategy and low adaptability to multi-controller scenarios is solved.
[0089] In some optional implementations, determining a setting duration of the write-back mode, and if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to the write-back mode includes:
[0090] In response to a command line modification instruction for configuring a setting duration, using a first callback function to obtain a value of a first variable structure, and using the value of the first variable structure as the setting duration;
[0091] If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is a write-back mode;
[0092] If yes, reset the duration of the write-back mode according to the set duration;
[0093] If not, set the cache mode of the storage cluster to write-back mode and set the duration to the duration of write-back mode.
[0094] Specifically, this embodiment adds a command line control process, so that the user can query and set the status of single control write back through cli (Command Line Interface) commands. The command line modification instructions are included in the cli commands. The command line modification instructions are, for example: chonewaycache time. Through the command line modification instructions, different setting durations of the write back mode can be set.
[0095] In order to facilitate the control of the switching of each module recognition and response cache mode, this embodiment adds multiple variable structures to control state changes, such as Figure 5As shown, the present embodiment sets a plurality of variable structures, for example: the first variable structure timerDuration, timerDuration is used to set and identify the duration of single-control writeback, and also includes variable structures timerChanged, timerSwitch, timerExpired and ONEWAYCACHE, timerChanged is used to identify and control whether to switch the state or time, timerSwitch is used to control and identify the opening of single-control writeback, ONEWAYCACHE is used to set the writeback switch when running the cache mode, and timerExpired is used to identify and control whether the single-control writeback times out. The value of timerDuration is the duration set by the user. The state value callback function can monitor the value of the above variable structure, determine the change of the state machine state, and switch the cache mode by setting ONEWAYCACHE, so as to control the cache mode of the storage cluster to write back / write-through by monitoring whether the variable switches the state value.
[0096] The status value callback function is as follows Figure 6 As shown, this embodiment sets three callback functions, namely: callback function A, callback function B, callback function C. The first callback function is, for example, callback function C. Callback function C is used to mark timerChanged as true when the set timerDuration value is 0; when the set timerDuration value is greater than 0, determine whether the cache mode of the current storage cluster is in write-back mode, and adjust the cache mode of the storage cluster according to the set duration.
[0097] When the user issues a command line modification instruction to modify the write-back mode setting time, in response to the command line modification instruction for configuring the setting duration, when the setting duration changes, the first callback function is called. The first callback function is used to obtain the value of the first variable structure (timerDuration), and the value of the first variable structure is used as the setting duration.
[0098] The second preset value is, for example, 0 or other smaller values. If the set duration is less than or equal to the second preset value, the flag timerChanged is true. If the set duration is greater than the second preset value, determine whether the cache mode of the storage cluster is the write-back mode. If it is the write-back mode, reset the duration of the write-back mode according to the set duration, for example, cancel the original timer; reset the timer according to the set duration. If it is not in write-back mode, set the cache mode of the storage cluster to write-back mode, and set the set duration to the duration of the write-back mode. For example, set the variable structure timerSwitch to true, and set ONEWAYCACHE to true. Turn on the ONEWAYCACHE switch to set the cache mode of the storage cluster to write-back mode. ONEWAYCACHE is a flag in the cache module state machine, indicating that the internal control turns on the single-controller write-back mode. TimerSwitch is the switch of the timer. Turning on timerSwitch means turning on the timer switch and the timer starts working. Setting ONEWAYCACHE means setting the flag to true. At this time, even if it is a single controller state, the write-back mode will continue. Otherwise, the cache mode will be switched to write-through in the single controller state.
[0099] The above process is as follows Figure 6 As shown, callback function C: when a change in timerDuration is detected, callback function C is called to determine whether the value of timerDuration is greater than 0. If it is equal to 0, timerChanged is set to true; if it is greater than 0, it is determined whether the timer is turned on. If it is turned on, the original timer is canceled and the timer is reset; if it is not turned on, timerChanged is set to true.
[0100] In this embodiment, the first callback function is used to obtain the value of the first variable structure, and the value of the first variable structure is used as the setting duration to set the cache mode of the storage cluster to the write-back mode, and the setting duration is set to the duration of the write-back mode. The value of the variable structure is identified by the callback function, and the cache mode of the storage cluster is adjusted according to the change of the variable structure value, so as to better meet user needs and adjust data performance.
[0101] In some optional implementations, setting the cache mode of the storage cluster to the write-back mode and maintaining the cache mode of the storage cluster in the write-back mode for a set time period includes:
[0102] By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value;
[0103] Set the third variable structure to the fourth preset value;
[0104] When the third variable structure is a fourth preset value, the second callback function is called;
[0105] According to the second callback function and the set duration, a timer is set, and the cache mode is marked as a write-back mode, wherein the timer is used to determine the duration of the write-back mode;
[0106] When the timer time is less than the set duration, the cache mode is kept in write-back mode.
[0107] Specifically, the second variable structure is, for example, ONEWAYCACHE, the third variable structure is, for example, timerSwitch, and the second callback function is, for example, callback function A.
[0108] The third preset value is, for example, true. The storage cluster is configured to set the cache mode to write-back mode when the second variable structure is the third preset value. For example, by setting ONEWAYCACHE to true, turning on the ONEWAYCACHE switch to set the cache mode of the storage cluster to write-back mode.
[0109] The fourth preset value is, for example, true. The third variable structure (timerSwitch) is set to true, and callback function A is called when a change in the value of timerSwitch is detected.
[0110] When the value of timerSwitch changes to true, callback function A sets a timer with the set duration through the uttm structure and marks the cache mode as write-back mode. When the timer is less than the set duration, the cache mode remains in write-back mode. When the value of timerSwitch changes to false, callback function A turns off the running uttm timer.
[0111] The above process is as follows Figure 6 As shown, callback function A: Determine whether timerSwitch has changed and call callback function A. Determine whether the value of timerSwitch is true, if so, set the timer, if false, turn off the timer.
[0112] In this embodiment, by setting the second variable structure to the third preset value, setting the cache mode to the write-back mode, identifying the value of the variable structure through the callback function, and adjusting the cache mode of the storage cluster according to the change in the value of the variable structure, it is better to adapt to user needs and adjust data performance. According to the second callback function and the set duration, a timer is set to determine the duration of the write-back mode, which is convenient for controlling the cache mode.
[0113] In some optional implementations, after setting the duration, setting the cache mode of the storage cluster to a write-through mode includes:
[0114] When the timer time is equal to the set duration, the third callback function is called;
[0115] Using the third callback function, the fourth variable structure is set to the fifth preset value;
[0116] When the fourth variable structure is the fifth preset value, by setting the second variable structure to the sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.
[0117] Specifically, the third callback function is, for example, callback function B. The fourth variable structure is, for example, timerExpired, and the second variable structure is, for example, ONEWAYCACHE.
[0118] When the timer time is equal to the set duration, it is determined that the duration of the write-back mode reaches the user-set duration. After that, the duration of the write-back mode will exceed the set duration. It is necessary to turn off the write-back mode and change the cache mode of the storage cluster to the write-through mode. The third callback function is called and the cache mode of the storage cluster is changed to the write-through mode using the third callback function.
[0119] The fifth preset value is, for example, true, and the third callback function is used to set timerExpired to true.
[0120] The sixth preset value is, for example, false. When timerExpired is true, the second variable structure (ONEWAYCACHE) is set to false. The storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value. For example, by setting ONEWAYCACHE to false, turning off the ONEWAYCACHE switch, the cache mode of the storage cluster is set to the write-through mode.
[0121] The above process is as follows Figure 6 As shown, callback function B: when the timer times out, callback function B is called, timerExpired=true is set, and the cache mode is set to write-through mode.
[0122] In this embodiment, the third callback function is used to set the fourth variable structure to the fifth preset value and the second variable structure to the sixth preset value, so that the cache mode is set to the write-through mode. The callback function identifies the value of the variable structure and adjusts the cache mode of the storage cluster according to the change in the value of the variable structure, so as to better meet user needs and adjust data performance.
[0123] In some optional implementations, when the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode includes:
[0124] When the set duration is less than or equal to the second preset value, determining whether the cache mode is a write-back mode;
[0125] If yes, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value;
[0126] If not, set the cache mode to write-through.
[0127] Specifically, the second preset value is, for example, 0 or other smaller values.
[0128] The user can modify the instruction to set the duration of the write-back mode through the command line, for example: chonewaycache time.
[0129] If the set duration is less than or equal to the second preset value, it means that the cache mode of the storage cluster needs to be set to write-through mode, including:
[0130] The sixth preset value is, for example, false, and the second variable structure is, for example, ONEWAYCACHE. It is determined whether the cache mode is the write-back mode. If it is the write-back mode, by setting ONEWAYCACHE to false, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value. For example, by setting ONEWAYCACHE to false, turning off the ONEWAYCACHE switch, and setting the cache mode of the storage cluster to the write-through mode. If it is not the write-back mode, the cache mode is directly set to the write-through mode.
[0131] In addition, if the user does not modify the instruction to set the setting duration of the write-back mode through the command line, the write-back state is enabled by default when there is only one controller left in the cluster and remains for two days.
[0132] In some optional implementations, after determining the number of controllers in the storage cluster, the method further includes:
[0133] When the number of controllers is greater than a first preset value, determining whether a storage cluster fails;
[0134] If the storage cluster is not faulty, set the cache mode of the storage cluster to write-back mode;
[0135] If a storage cluster fails, a target controller is determined from the controllers, and the storage cluster is set to a control mode based on the target controller;
[0136] Determine the duration of the write-back mode setting;
[0137] If the set duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;
[0138] If the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to a write-through mode;
[0139] Determine whether a command line modification instruction is received, and if received, determine the modification duration of the write-back mode according to the command line modification instruction;
[0140] If the modification duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;
[0141] If the modification duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to a write-through mode;
[0142] If the storage cluster fails over, set the storage cluster to a control mode based on the number of controllers and set the cache mode of the storage cluster to write-back mode.
[0143] Specifically, through the above variable structure, callback function and command line setting instructions, the timer state value and the corresponding cache mode state change can be effectively controlled, and different corresponding changes can be made when performing operations in different states. Figure 7 As shown, determine the state machine state change. If there is only one controller in the cluster, determine whether timerDuration is greater than 0. If so, turn on timerSwitch and set ONEWAYCACHE; determine whether timerExpired is false. If false, cancel ONEWAYCACHE. Determine whether timerChanged is true. If true, set ONEWAYCACHE according to duration. If there are multiple controllers in the cluster, turn off timerSwitch and cancel ONEWAYCACHE.
[0144] When the number of controllers is greater than a first preset value, determine whether the storage cluster fails. If the storage cluster does not fail, set the cache mode of the storage cluster to write-back mode. If the storage cluster fails, it is necessary to set the storage cluster to a single controller, determine a target controller from the controllers, and set the storage cluster to a control mode based on the target controller. The number of target controllers can be 1 or other smaller integers.
[0145] The second preset value is, for example, 0 or other smaller values. Determine the setting duration of the write-back mode set by the user. If a node failure occurs in the storage cluster in a multi-control state, and the setting duration is greater than the second preset value, the storage cluster becomes single-control, and the cache mode of the storage cluster is set to write-back mode. If a node failure occurs in the storage cluster in a multi-control state, and the setting duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to write-through mode.
[0146] In addition, the user can set the modification duration of the write-back mode through the command line modification instruction. Determine whether the command line modification instruction is received. If received, determine the modification duration of the write-back mode according to the command line modification instruction. If the modification duration is greater than the second preset value, set the cache mode of the storage cluster to write-back mode. If the modification duration is less than or equal to the second preset value, or the write-back mode runs until the timer times out, set the cache mode of the storage cluster to write-through mode.
[0147] If the storage cluster fails and recovers, the storage cluster is set to a control mode based on the number of controllers, that is, the storage cluster is switched to a multi-controller state, and the cache mode of the storage cluster is set to a write-back mode.
[0148] The above process is as follows Figure 8 As shown in the figure, when the storage cluster is multi-controller, you can modify the duration >= 0 through timerDuration, that is, the single-controller write-back duration >= 0. If the node fails and the single-controller write-back duration = 0, set the cluster to single-controller write-through. If the node fails and recovers, set the cluster to multi-controller. When the storage system's cache mode is single-controller write-through, you can enable the single-controller write-back mode through allowOneWay, timerSwitch, and timerChanged. When the storage cluster is multi-controller, if a node fails in the storage cluster and the single-controller write-back duration set by the user is greater than 0, you can enable the single-controller write-back mode through allowOneWay and timerSwitch. When the storage cluster is in single-controller write-back mode, you can modify the single-controller write-back duration to be greater than 0 through timerDuration and timerUttm. If the timer of the single-controller write-back mode times out, you can switch the storage cluster's cache mode to single-controller write-through through timerExpired, timerSwitch, and allowOneWay. When the storage cluster is in single-control write-back mode, if the user sets the duration = 0, you can use timerChanged, timerSwitch, and allowOneWay to switch the storage cluster's cache mode to single-control write-through. When the storage cluster is in single-control write-back mode, if the node fails and recovers, you can use timerSwitch and allowOneWay to switch the storage cluster to multi-control mode.
[0149] In this embodiment, if the storage cluster has not failed, the cache mode of the storage cluster is set to the write-back mode; if the storage cluster has failed, the storage cluster is set to the control mode based on the target controller; and the duration of the write-back mode is set according to the setting duration and modification duration of the write-back mode. If the storage cluster fails and recovers, the storage cluster is set to the control mode based on the number of controllers, and the cache mode of the storage cluster is set to the write-back mode. The redundancy mechanism for coping with failure and failure recovery scenarios is improved, and the default write-back mode also helps to improve the overall performance of the storage cluster in a single-control state. Combined with the node failure / failure recovery scenarios, different cache modes can be provided according to scenario changes and user settings, thereby improving overall processing efficiency and smooth experience.
[0150] In some optional implementations, the process of determining whether the storage cluster failure is recovered may include steps A1 to A4.
[0151] Step A1, dividing all configuration items of the storage cluster into a number of minimum unit configuration items;
[0152] Step A2, query the configuration information corresponding to the minimum unit configuration item and write the queried configuration information into the corresponding file; the file is named after the query command;
[0153] Step A3, calculating the hash value of each file, comparing the difference between the minimum unit configuration item before and after the storage cluster system failure recovery, and storing the difference in a folder or recursive folder according to the level of the difference;
[0154] Specifically, the hash value of each file is calculated, and the difference between the minimum unit configuration items before and after the storage cluster system failure recovery is compared; the minimum unit configuration items that have no difference before and after the storage cluster system failure recovery are placed in a first-level folder; for example, system feature configuration-SSL protocol and security level, volume protection status; the minimum unit configuration items that have differences before and after the storage cluster system failure recovery are processed and placed in a recursive folder according to the difference level. The check of the configuration parameters of the minimum unit configuration item is converted into a check comparison of the hash value of the minimum unit configuration item, which significantly reduces the amount of comparison data and simplifies the detection and analysis process.
[0155] Step A4, calculating the first hash value of all minimum unit configuration item files in the folder and recursive folder before the storage cluster failure recovery and the second hash value of all minimum unit configuration item files in the folder and recursive folder after the storage cluster failure recovery;
[0156] Step A5: compare the first hash value with the second hash value and output the result.
[0157] Specifically, if the first hash value is the same as the second hash value, it means that the storage cluster failure recovery is normal, and the successful recovery information is output as the result; otherwise, the storage cluster failure recovery fails, and the minimum unit configuration items corresponding to the different first hash values and second hash values are recorded and output as the result.
[0158] In this embodiment, all configuration items of the storage cluster are first divided into several minimum unit configuration items, the first hash value and the second hash value of all minimum unit configuration item files are calculated, and the first hash value and the second hash value are compared to determine whether the storage cluster has failed and whether it has recovered. The above process can improve the detection efficiency while simplifying the workflow and standardizing the operation, which is convenient for sharing, copying and transferring the knowledge of the automated detection method. The design principle of this embodiment is reliable, the structure is simple, and it has a very broad application prospect.
[0159] In some optional embodiments, the method further comprises:
[0160] When the number of controllers is less than or equal to the first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command;
[0161] Determine whether the cache mode of the storage cluster is a write-back mode according to the identification field;
[0162] If the cache mode of the storage cluster is the write-back mode, whether to end the write-back mode is determined according to the timestamp.
[0163] Specifically, this embodiment adds a command line control process, which can query and set the state of single-control writeback through cli commands. The first preset value is, for example, 0 or other smaller integers. When the number of controllers is less than or equal to the first preset value, a set duration query command is generated, and the set duration query command is included in the cli command, for example: lsiogrpiogrpid, through which the single-control writeback state and duration in the corresponding iogrp can be queried.
[0164] After entering the query command for setting the duration, the identification field corresponding to the write-back mode and the corresponding write-back mode expiration timestamp will be displayed. Determine whether the cache mode of the storage cluster is write-back mode based on the identification field. If the cache mode of the storage cluster is write-back mode, determine whether to end the write-back mode based on the timestamp. According to the timestamp, it can be known at what time the write-back state will end after the single-control write-back is enabled. After this time, the cache mode switches to write-through. If the single-control write-back is not enabled / has expired and is closed, a past timestamp is displayed.
[0165] In this embodiment, a cache mode setting device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0166] This embodiment provides a cache mode setting device, such as Fig. 9 As shown, including:
[0167] A determination module 901 is used to determine the number of controllers in the storage cluster;
[0168] A first setting module 902 is used to determine the setting duration of the write-back mode when the number of controllers is less than or equal to a first preset value, and if the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and keep the cache mode of the storage cluster in the write-back mode within the setting duration;
[0169] The second setting module 903 is used to set the cache mode of the storage cluster to a write-through mode after the set time period;
[0170] The third setting module 904 is configured to set the cache mode of the storage cluster to a write-through mode when the set duration is less than or equal to a second preset value.
[0171] In some optional implementations, the first setting module 902 determines the setting duration of the write-back mode, and if the setting duration is greater than a second preset value, sets the cache mode of the storage cluster to the write-back mode, including:
[0172] In response to a command line modification instruction for configuring a setting duration, using a first callback function to obtain a value of a first variable structure, and using the value of the first variable structure as the setting duration;
[0173] If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is a write-back mode;
[0174] If yes, reset the duration of the write-back mode according to the set duration;
[0175] If not, set the cache mode of the storage cluster to write-back mode and set the duration to the duration of write-back mode.
[0176] In some optional implementations, the first setting module 902 sets the cache mode of the storage cluster to the write-back mode, and keeps the cache mode of the storage cluster in the write-back mode for a set time period, including:
[0177] By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value;
[0178] Set the third variable structure to the fourth preset value;
[0179] When the third variable structure is a fourth preset value, the second callback function is called;
[0180] According to the second callback function and the set duration, a timer is set, and the cache mode is marked as a write-back mode, wherein the timer is used to determine the duration of the write-back mode;
[0181] When the timer time is less than the set duration, the cache mode is kept in write-back mode.
[0182] In some optional implementations, after setting the duration, the second setting module 903 sets the cache mode of the storage cluster to the write-through mode, including:
[0183] When the timer time is equal to the set duration, the third callback function is called;
[0184] Using the third callback function, the fourth variable structure is set to the fifth preset value;
[0185] When the fourth variable structure is the fifth preset value, by setting the second variable structure to the sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.
[0186] In some optional implementations, the third setting module 904 sets the cache mode of the storage cluster to the write-through mode when the set duration is less than or equal to the second preset value, including:
[0187] When the set duration is less than or equal to the second preset value, determining whether the cache mode is a write-back mode;
[0188] If yes, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value;
[0189] If not, set the cache mode to write-through.
[0190] In some optional implementations, after determining the number of controllers in the storage cluster, the apparatus is configured to:
[0191] When the number of controllers is greater than a first preset value, determining whether a storage cluster fails;
[0192] If the storage cluster is not faulty, set the cache mode of the storage cluster to write-back mode;
[0193] If a storage cluster fails, a target controller is determined from the controllers, and the storage cluster is set to a control mode based on the target controller;
[0194] Determine the duration of the write-back mode setting;
[0195] If the set duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;
[0196] If the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to a write-through mode;
[0197] Determine whether a command line modification instruction is received, and if received, determine the modification duration of the write-back mode according to the command line modification instruction;
[0198] If the modification duration is greater than the second preset value, the cache mode of the storage cluster is set to write-back mode;
[0199] If the modification duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to a write-through mode;
[0200] If the storage cluster fails over, set the storage cluster to a control mode based on the number of controllers and set the cache mode of the storage cluster to write-back mode.
[0201] In some optional embodiments, the device is also used for:
[0202] When the number of controllers is less than or equal to the first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command;
[0203] Determine whether the cache mode of the storage cluster is a write-back mode according to the identification field;
[0204] If the cache mode of the storage cluster is the write-back mode, whether to end the write-back mode is determined according to the timestamp.
[0205] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0206] The cache mode setting device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0207] The embodiment of the present invention also provides a computer device having the above Fig. 9 The cache mode setting device is shown.
[0208] See also Fig.10 , Fig.10 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.10 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.10 A processor 10 is taken as an example.
[0209] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0210] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0211] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0212] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0213] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0214] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0215] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0216] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined in this application.
Claims
1. A cache mode setting method, It is characterized in that The method comprises: Determine the number of controllers in the storage cluster; When the number of the controllers is less than or equal to a first preset value, determining a setting duration of the write-back mode, and if the setting duration is greater than a second preset value, setting the cache mode of the storage cluster to the write-back mode, and maintaining the cache mode of the storage cluster as the write-back mode within the setting duration; After the set time period, setting the cache mode of the storage cluster to a write-through mode; When the set duration is less than or equal to the second preset value, the cache mode of the storage cluster is set to the write-through mode.
2. The method according to claim 1, It is characterized in that The determining of the setting duration of the write-back mode, and setting the cache mode of the storage cluster to the write-back mode if the setting duration is greater than a second preset value, comprises: In response to a command line modification instruction for configuring the set duration, using a first callback function to obtain a value of a first variable structure, and using the value of the first variable structure as the set duration; If the set duration is greater than the second preset value, determining whether the cache mode of the storage cluster is the write-back mode; If yes, resetting the duration of the write-back mode according to the set duration; If not, the cache mode of the storage cluster is set to the write-back mode, and the set duration is set to the duration of the write-back mode.
3. The method according to claim 1, It is characterized in that The step of setting the cache mode of the storage cluster to the write-back mode and maintaining the cache mode of the storage cluster to the write-back mode within the set time period includes: By setting the second variable structure to a third preset value, the storage cluster is configured to set the cache mode to the write-back mode when the second variable structure is the third preset value; Set the third variable structure to the fourth preset value; When the third variable structure is the fourth preset value, calling the second callback function; According to the second callback function and the set duration, a timer is set, and the cache mode is marked as the write-back mode, wherein the timer is used to determine the duration of the write-back mode; When the time of the timer is less than the set duration, the cache mode is kept in the write-back mode.
4. The method according to claim 3, It is characterized in that After the set time period, setting the cache mode of the storage cluster to a write-through mode includes: When the time of the timer is equal to the set duration, calling the third callback function; Using the third callback function to set the fourth variable structure to a fifth preset value; When the fourth variable structure is the fifth preset value, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value.
5. The method according to claim 3, It is characterized in that When the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode includes: When the set duration is less than or equal to the second preset value, determining whether the cache mode is the write-back mode; If yes, by setting the second variable structure to a sixth preset value, the storage cluster is configured to set the cache mode to the write-through mode when the second variable structure is the sixth preset value; If not, the cache mode is set to the write-through mode.
6. The method according to claim 1, It is characterized in that After determining the number of controllers in the storage cluster, the method further includes: When the number of the controllers is greater than the first preset value, determining whether a failure occurs in the storage cluster; If the storage cluster does not fail, setting the cache mode of the storage cluster to the write-back mode; If the storage cluster fails, determining a target controller from the controllers, and setting the storage cluster to a control mode based on the target controller; Determining a setting duration of the write-back mode; If the set duration is greater than the second preset value, setting the cache mode of the storage cluster to the write-back mode; If the set duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode; Determining whether a command line modification instruction is received, and if received, determining a modification duration of the write-back mode according to the command line modification instruction; If the modification duration is greater than the second preset value, setting the cache mode of the storage cluster to the write-back mode; If the modification duration is less than or equal to the second preset value, setting the cache mode of the storage cluster to the write-through mode; If the storage cluster fails and recovers, the storage cluster is set to a control mode of controllers based on the number of controllers, and the cache mode of the storage cluster is set to the write-back mode.
7. The method according to claim 1, It is characterized in that The method further comprises: In the case that the number of the controllers is less than or equal to the first preset value, a set duration query command is generated, and an identification field and a timestamp corresponding to the write-back mode are acquired through the set duration query command; Determining whether the cache mode of the storage cluster is the write-back mode according to the identification field; If the cache mode of the storage cluster is the write-back mode, determining whether to end the write-back mode is determined according to the timestamp.
8. A cache mode setting device, It is characterized in that The device comprises: A determination module, used to determine the number of controllers in the storage cluster; A first setting module is used to determine a setting duration of the write-back mode when the number of the controllers is less than or equal to a first preset value, and if the setting duration is greater than a second preset value, set the cache mode of the storage cluster to the write-back mode, and keep the cache mode of the storage cluster in the write-back mode within the setting duration; A second setting module, configured to set the cache mode of the storage cluster to a write-through mode after the set time period; A third setting module is configured to set the cache mode of the storage cluster to the write-through mode when the set duration is less than or equal to the second preset value.
9. A computer device, It is characterized in that include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the cache mode setting method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the cache mode setting method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Write buffer mode switching method, device, apparatus, and readable storage medium
CN109213446A
Data write-back method and device, electronic equipment and computer readable storage medium
CN116909485A
Methods and systems for implementing shared disk array management functions
US20020188655A1
Dynamic cache write policy
US20140189252A1
Transactional execution in a multi-processor environment that monitors memory conflicts in a shared cache
US20150378910A1
