Cache mode switching methods, apparatus, computer devices and storage media
Patent Information
- Application Number
- CN202610685939.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-18
- Publication Date
- 2026-09-01
- Estimated Expiration
- 2046-05-18
AI Technical Summary
[0003]传统技术中,在向存储前端缓存数据的过程中,存在缓存模式与数据流模式不匹配的情况,导致不能充分发挥存储系统的性能
[0055] If the mode switching result indicates a change in cache mode, the current cache mode of the target device is switched to the target cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
Smart Images

Figure CN122219857B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data storage technology, and in particular to a cache mode switching method, apparatus, computer device, and storage medium. Background Technology
[0002] Distributed storage systems are typically designed with multiple nodes, each of which can be divided into a storage front-end and a storage back-end. The storage front-end directly responds to user input, completing the write operation to the front-end cache disk and then providing feedback to the user. The storage back-end manages the actual read and write operations across multiple storage disks.
[0003] In traditional technologies, there is a mismatch between the caching mode and the data flow mode during the process of caching data to the storage front end, which prevents the storage system from fully utilizing its performance. Summary of the Invention
[0004] Therefore, it is necessary to provide a cache mode switching method, apparatus, computer device, and storage medium to address the above-mentioned technical problems, which can adapt the cache mode to the data flow mode, thereby improving the performance of the storage system.
[0005] Firstly, this application provides a method for switching cache modes, including:
[0006] Obtain storage volume information of the target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device;
[0007] The mode switching result of the cache mode of the target device is determined based on the storage volume information and the current cache mode;
[0008] If the mode switching result indicates a change in cache mode, the current cache mode of the target device is switched to the target cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0009] In the above embodiments, the first and second numbers of storage volumes of the target device are obtained, and the mode switching result is determined in combination with the current caching mode and the caching mode switching is completed. This enables the caching mode to dynamically match the input output (IO) business scenario, avoiding the performance degradation caused by the mismatch between the fixed caching mode and the IO business scenario, and improving the IO response speed and throughput of the distributed storage system.
[0010] In one embodiment, the step of determining the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode includes any one of the following:
[0011] If the first quantity exceeds the first threshold, and / or the sum of the second quantities in the storage volume information exceeds the second threshold, and the current cache mode is synchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode.
[0012] If the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current cache mode is an asynchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode.
[0013] In the above embodiments, the number of storage volumes and the total number of IO requests are quantitatively determined by the first threshold and the second threshold. Combined with the current caching mode, the mode switching result is accurately generated. This can quickly and accurately identify single-volume single-stream and multi-volume multi-stream business scenarios, avoid the problem of mismatch between caching mode and business scenario, reduce the probability of false switching, and improve the operating performance of distributed storage system.
[0014] In one embodiment, determining the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode includes:
[0015] If the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity exceeds a first threshold, and / or the sum of the second quantities in the storage volume information exceeds a second threshold, and the current caching mode is a synchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode.
[0016] If the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current caching mode is an asynchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode.
[0017] In the above embodiments, a precondition for determining whether the duration of the current caching mode exceeds a first duration is added. Combined with the storage volume information and the current caching mode, the mode switching result is determined. This can avoid frequent caching mode switching caused by instantaneous fluctuations in business I / O, reduce the overhead of repeated allocation of cache resources such as threads and memory, and improve the stability and reliability of the distributed storage system.
[0018] In one embodiment, the first quantity exceeding the first threshold includes the first quantity exceeding the first threshold and the duration exceeding the second duration; the sum of each second quantity in the storage volume information exceeding the second threshold includes the sum of each second quantity in the storage volume information exceeding the second threshold and the duration exceeding the third duration; the first quantity being less than or equal to the first threshold includes the first quantity being less than or equal to the first threshold and the duration exceeding the fourth duration; the sum of each second quantity in the storage volume information being less than or equal to the second threshold includes the sum of each second quantity in the storage volume information being less than or equal to the second threshold and the duration exceeding the fifth duration.
[0019] In the above embodiments, a duration constraint is added to the threshold determination of the number of storage volumes and the total number of IO requests. Only after the business scenario characteristics are maintained stably will it be determined that a cache mode switch is needed. This can eliminate the problem of erroneous switching caused by instantaneous fluctuations in IO, and further improve the accuracy of cache mode switching and the stability of system operation.
[0020] In one embodiment, the step of determining the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode includes any one of the following:
[0021] If the proportion of the third quantity in the first quantity exceeds the first preset ratio, and the current cache mode is the synchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode; wherein, the third quantity is the number of storage volumes corresponding to the target device whose second quantity exceeds the third threshold in each storage volume;
[0022] If the proportion of the fourth quantity in the first quantity exceeds the second preset proportion, and the current caching mode is the asynchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode; wherein, the fourth quantity is the number of storage volumes corresponding to the target device whose second quantity is less than or equal to the third threshold.
[0023] In the above embodiments, the scenario determination is made by using the proportion of the third and fourth quantities in the first quantity and the preset ratio. This can accurately identify the mainstream business mode in mixed IO scenarios, break through the limitations of single threshold determination, and improve the adaptability and rationality of caching mode switching in complex business scenarios.
[0024] In one embodiment, switching the current cache mode of the target device to the target cache mode includes:
[0025] The mode flag, IO processing rules, and cache resources of the current cache mode corresponding to the target device are updated to the mode flag, IO processing rules, and cache resources of the target cache mode, respectively.
[0026] In the above embodiments, by synchronously updating the configuration of mode flags, IO processing rules, and cache resources, the cache mode switching can be achieved, which can ensure the integrity and consistency of the cache mode switching, avoid problems such as IO processing abnormalities and data loss caused by configuration mismatch, and ensure the stable and efficient operation of the system after the switch.
[0027] In one embodiment, the current cache mode is the synchronous cache mode and the target cache mode is the asynchronous cache mode; updating the mode tag, IO processing rules, and cache resources of the current cache mode corresponding to the target device to the mode tag, IO processing rules, and cache resources of the target cache mode respectively includes:
[0028] Update the mode tag corresponding to the target device from the mode tag of the synchronous cache mode to the mode tag of the asynchronous cache mode;
[0029] Update the IO processing rules corresponding to the target device to IO aggregation processing rules;
[0030] Expand the cache resources corresponding to the target device.
[0031] In the above embodiments, when switching from synchronous caching mode to asynchronous caching mode, synchronously updating the mode flag, enabling IO aggregation rules, and expanding cache resources can fully leverage the advantages of asynchronous caching parallel processing and IO aggregation, thereby improving the throughput and resource utilization of distributed storage systems in multi-volume and multi-stream scenarios.
[0032] In one embodiment, the current caching mode is the asynchronous caching mode and the target caching mode is the synchronous caching mode; updating the mode tag, IO processing rules, and cache resources of the current caching mode corresponding to the target device to the mode tag, IO processing rules, and cache resources of the target caching mode respectively includes:
[0033] Update the mode tag corresponding to the target device from the mode tag of the asynchronous cache mode to the mode tag of the synchronous cache mode;
[0034] Update the IO processing rules corresponding to the target device to processing rules that do not perform IO aggregation;
[0035] Reduce the cache resources corresponding to the target device.
[0036] In the above embodiments, when switching from asynchronous caching mode to synchronous caching mode, synchronously updating the mode flag, disabling IO aggregation rules, and reducing cache resources can eliminate the additional overhead of asynchronous caching, fully leverage the low latency advantage of direct write of synchronous caching, and improve the IO response speed of distributed storage systems in single-volume single-stream scenarios.
[0037] In one embodiment, the method further includes:
[0038] Based on the target caching mode, respond to the IO access requests of each storage volume corresponding to the target device.
[0039] In the above embodiments, after the cache mode switch is completed, all storage volume IO access requests are responded to based on the rules of the target cache mode, so that the cache mode and IO processing logic are fully matched, maximizing the performance advantages of the target cache mode and ensuring efficient and stable processing of business IO.
[0040] Secondly, this application also provides a cache mode switching device, comprising:
[0041] An acquisition module is used to acquire storage volume information of a target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device;
[0042] The determining module is used to determine the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode;
[0043] The switching module is used to switch the current cache mode of the target device to the target cache mode when the mode switching result indicates a switch cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0044] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0045] Obtain storage volume information of the target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device;
[0046] The mode switching result of the cache mode of the target device is determined based on the storage volume information and the current cache mode;
[0047] If the mode switching result indicates a change in cache mode, the current cache mode of the target device is switched to the target cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0048] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0049] Obtain storage volume information of the target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device;
[0050] The mode switching result of the cache mode of the target device is determined based on the storage volume information and the current cache mode;
[0051] If the mode switching result indicates a change in cache mode, the current cache mode of the target device is switched to the target cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0052] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0053] Obtain storage volume information of the target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device;
[0054] The mode switching result of the cache mode of the target device is determined based on the storage volume information and the current cache mode;
[0055] If the mode switching result indicates a change in cache mode, the current cache mode of the target device is switched to the target cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0056] The aforementioned cache mode switching method, device, computer equipment, and storage medium obtain the first and second number of storage volumes of the target device, determine the mode switching result based on the current cache mode, and complete the cache mode switching. This enables the cache mode to dynamically match the IO business scenario, avoiding the performance degradation caused by the mismatch between the fixed cache mode and the IO business scenario, and improving the IO response speed and throughput of the distributed storage system. Attached Figure Description
[0057] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0058] Figure 1 This is an application environment diagram of the cache mode switching method in one embodiment;
[0059] Figure 2 This is a flowchart illustrating a cache mode switching method in one embodiment;
[0060] Figure 3 This is a flowchart illustrating the cache mode switching method in another embodiment;
[0061] Figure 4 This is a structural block diagram of a cache mode switching device in one embodiment;
[0062] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0063] 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.
[0064] First, the technical terms used in this application will be explained.
[0065] Single volume, single stream: Only one input / output (IO) read / write request is processed on a single storage volume at any given time. The next IO read / write request is processed only after the current IO read / write request is completed, and a serial execution method is adopted.
[0066] Multi-volume multi-stream: Multiple storage volumes simultaneously carry IO read and write requests, and a single storage volume processes multiple concurrent IO read and write requests at the same time, adopting a parallel execution method.
[0067] Synchronous caching mode: I / O read and write requests are processed serially in a single thread. The entire I / O read and write request is executed within this thread and does not flow across threads. It does not use an asynchronous scheduling mechanism.
[0068] Asynchronous caching mode: Multiple threads process multiple IO access requests in parallel, and by dynamically adjusting IO aggregation rules, multiple IO requests are merged to reduce the number of disk writes and improve disk utilization efficiency.
[0069] The cache mode switching method provided in this application embodiment can be applied to, for example, Figure 1 The application environment shown illustrates this. Distributed storage systems are typically designed with multiple nodes, each consisting of a storage front-end and a storage back-end. The storage front-end directly responds to user input, completing the write operation to the front-end cache disk and providing feedback to the user. The storage back-end manages the actual read and write operations across multiple storage disks. The storage front-end and storage back-end are connected via a network. To ensure data security, redundancy is usually implemented; that is, for every copy of user data written, one access is made to the storage front-end, but the data needs to be written to the disks of n storage back-ends (where n is the number of replicas in the system).
[0070] In single-volume, single-stream application scenarios with no concurrency requirements, synchronous caching can achieve optimal performance through its characteristics of no overhead, single-threaded operation, and direct write-to-disk. In multi-volume, multi-stream scenarios with high concurrency, asynchronous caching can achieve optimal storage system performance through its characteristics of parallel processing, IO aggregation, and resource sharing.
[0071] The application scenarios of single-volume single-stream or multi-volume multi-stream change dynamically according to business needs. A scenario that was single-volume single-stream one moment may change to multi-volume multi-stream the next. Therefore, the cache mode switching method provided in this application embodiment can adapt to changes in user scenarios and dynamically adjust the cache mode to improve the performance of the storage system.
[0072] This method can be executed by a server or terminal in the storage system. The server can be a standalone physical server, a server cluster or distributed system consisting of multiple physical servers, or a cloud server providing cloud computing services. The terminal can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted displays, etc. Head-mounted displays can include virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc.
[0073] In one exemplary embodiment, such as Figure 2 The diagram illustrates a method for switching caching modes. Taking the application of this method to a server as an example, it includes the following steps:
[0074] S201, Obtain storage volume information for the target device.
[0075] The target device is a computing node in a distributed storage system that handles storage volume I / O processing and manages cache mode.
[0076] The storage volume information includes a first number of storage volumes corresponding to the target device, which is the total number of storage volumes mounted on the node, and / or a second number of IO access requests for each storage volume corresponding to the target device, which is the number of IO requests received by a single storage volume per unit time.
[0077] The data acquisition process can be initiated in real time using the server's built-in switching controller. The node volume management module reads all storage volumes mounted on the node to obtain the initial number of storage volumes. Simultaneously, the IO monitoring module connects to the IO interface of each storage volume to collect the number of user IO access requests received by each storage volume within a statistical period, i.e., the second number. The acquisition process employs a non-blocking design, without consuming IO processing resources, ensuring the real-time nature and accuracy of storage volume information. The acquisition frequency can be configured according to system performance.
[0078] S202, determine the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode.
[0079] The system can read the identifier of the current caching mode of the node, and then compare the first quantity and the second quantity with the preset thresholds for single-volume single-stream scenarios and multi-volume multi-stream scenarios. If the current caching mode is synchronous and the storage volume information matches the multi-volume multi-stream feature, or the current caching mode is asynchronous and the storage volume information matches the single-volume single-stream feature, then a mode switching result that needs to be switched is generated; if the storage volume information matches the current caching mode, then a mode switching result that does not need to be switched is generated.
[0080] S203, if the mode switching result indicates a change in cache mode, switch the current cache mode of the target device to the target cache mode.
[0081] Among them, the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0082] When the mode switching result indicates a change in cache mode, the current cache mode of the target device can be switched to the target cache mode. This can be achieved by first sending a thread locking command, waiting for all currently processed IO requests to complete, then modifying the node cache mode flag, and synchronously adjusting IO processing rules and cache resource configurations. This switching process does not interrupt user services or result in data loss, achieving a seamless transition between synchronous and asynchronous cache modes and ensuring the continuous and stable operation of the storage system.
[0083] In the above embodiments, the first and second numbers of storage volumes of the target device are obtained, and the mode switching result is determined in combination with the current caching mode and the caching mode switching is completed. This enables the caching mode to dynamically match the IO business scenario, avoiding the performance degradation caused by the mismatch between the fixed caching mode and the IO business scenario, and improving the IO response speed and throughput of the distributed storage system.
[0084] In some alternative implementations, responses can be made to I / O access requests for each storage volume corresponding to the target device based on the target caching pattern.
[0085] If the target caching mode is synchronous caching mode, a single-threaded direct write logic can be used to process each storage volume's IO request one by one, store the IO request data in the storage front end, and immediately feed back to the IO request end without thread switching or aggregation waiting; if the target caching mode is asynchronous caching mode, a multi-threaded parallel logic can be used to aggregate IO requests, store the IO request data in the storage front end, and feed back to the request end.
[0086] In the above embodiments, after the cache mode switch is completed, all storage volume IO access requests are responded to based on the rules of the target cache mode, so that the cache mode and IO processing logic are fully matched, maximizing the performance advantages of the target cache mode and ensuring efficient and stable processing of business IO.
[0087] In some optional implementations, the mode switching result can be determined by comparing the first quantity and the second quantity with the preset thresholds for single-volume single-stream scenarios and multi-volume multi-stream scenarios, combined with the current caching mode.
[0088] For example, if the first quantity exceeds the first threshold, and / or the sum of the second quantities in the storage volume information exceeds the second threshold, and the current cache mode is synchronous cache mode, then the mode switching result of determining the cache mode of the target device represents the switch cache mode.
[0089] The first threshold is a preset threshold for the number of storage volumes used to determine if the target device is in a multi-volume, multi-stream scenario. The second threshold is a preset threshold for the total number of I / O access requests for all storage volumes used to determine if the target device is in a multi-volume, multi-stream scenario.
[0090] When the first quantity is detected to exceed the first threshold, or the sum of all the second quantities exceeds the second threshold, or the first quantity is detected to exceed the first threshold and the sum of all the second quantities exceeds the second threshold, and the current caching mode is synchronous caching mode, it can be determined that the mode switching result is that the caching mode needs to be switched. This judgment logic is suitable for multi-volume and multi-stream business scenarios that switch from synchronous caching mode to asynchronous caching mode.
[0091] Optionally, if the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current cache mode is asynchronous cache mode, then the mode switching result of determining the cache mode of the target device represents the switch cache mode.
[0092] When it is detected that the first quantity is less than or equal to the first threshold, or the sum of all the second quantities is less than or equal to the second threshold, or the first quantity is less than or equal to the first threshold and the sum of all the second quantities is less than or equal to the second threshold, and the current caching mode is asynchronous caching mode, it can be determined that the mode switching result is that the caching mode needs to be switched. This judgment logic is suitable for single-volume single-stream business scenarios that switch from asynchronous caching mode to synchronous caching mode.
[0093] In the above embodiments, the number of storage volumes and the total number of IO requests are quantitatively determined by the first threshold and the second threshold. Combined with the current caching mode, the mode switching result is accurately generated. This can quickly and accurately identify single-volume single-stream and multi-volume multi-stream business scenarios, avoid the problem of mismatch between caching mode and business scenario, reduce the probability of false switching, and improve the operating performance of distributed storage system.
[0094] In some alternative implementations, to avoid frequent switching, the cache mode can be switched after running in the current cache mode for a period of time.
[0095] For example, if the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity exceeds a first threshold, and / or the sum of the second quantities in the storage volume information exceeds a second threshold, and the current caching mode is a synchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode.
[0096] The first duration is the minimum stable runtime that the current caching mode needs to maintain, which is used to prevent frequent switching of caching mode caused by instantaneous fluctuations in business I / O.
[0097] The duration of the current caching mode on the target device can be measured using the server's timing module. A preliminary check can be performed to determine if the duration of the current caching mode on the target device exceeds the first duration. If the duration does not exceed the first duration, regardless of changes in the storage volume information, this switch check can be ignored, and the current caching mode can be kept running stably.
[0098] If the duration exceeds the first duration, if the current caching mode is synchronous caching mode, and the first quantity exceeds the first threshold, and / or the sum of all second quantities exceeds the second threshold, then the mode switching result is determined to be that a switch is required.
[0099] Optionally, if the duration of the current caching mode of the target device exceeds the first duration, and if the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current caching mode is asynchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode.
[0100] Similarly, if the duration does not exceed the first duration, regardless of how the storage volume information changes, the current switch judgment can be ignored, and the current cache mode can be kept running stably.
[0101] If the duration exceeds the first duration, the current caching mode is asynchronous caching mode, and the first quantity is less than or equal to the first threshold, and / or the sum of all second quantities is less than or equal to the second threshold, then the mode switching result is determined to be a switch required. Pre-determination based on duration filters out instantaneous business fluctuations, thereby improving the stability of the switching decision.
[0102] In the above embodiments, a precondition for determining whether the duration of the current caching mode exceeds a first duration is added. Combined with the storage volume information and the current caching mode, the mode switching result is determined. This can avoid frequent caching mode switching caused by instantaneous fluctuations in business I / O, reduce the overhead of repeated allocation of cache resources such as threads and memory, and improve the stability and reliability of the distributed storage system.
[0103] In some alternative implementations, to avoid misjudging business scenarios, the business scenario can be determined by the storage volume information within a continuous time period.
[0104] Based on this, the first quantity exceeding the first threshold in the above embodiments may include the first quantity exceeding the first threshold and the duration exceeding the second duration; the sum of each second quantity in the storage volume information exceeding the second threshold may include the sum of each second quantity in the storage volume information exceeding the second threshold and the duration exceeding the third duration; the first quantity being less than or equal to the first threshold may include the first quantity being less than or equal to the first threshold and the duration exceeding the fourth duration; the sum of each second quantity in the storage volume information being less than or equal to the second threshold may include the sum of each second quantity in the storage volume information being less than or equal to the second threshold and the duration exceeding the fifth duration.
[0105] The second, third, fourth, and fifth durations can be the same or different, and can be set according to actual needs. No specific restrictions are made here.
[0106] In this case, the judgment logic for determining the mode switching result can be as follows: if the first quantity exceeds the first threshold and the duration exceeds the second duration, and / or the sum of the second quantities in the storage volume information exceeds the second threshold and the duration exceeds the third duration, and the current cache mode is synchronous cache mode, then the mode switching result of the target device's cache mode represents the switch cache mode.
[0107] Alternatively, if the first quantity is less than or equal to the first threshold and the duration exceeds the fourth duration, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold and the duration exceeds the fifth duration, and the current cache mode is asynchronous cache mode, then the mode switching result of determining the cache mode of the target device represents the switch cache mode.
[0108] Alternatively, if the duration of the current caching mode of the target device exceeds the first duration, and if the first quantity exceeds the first threshold and the duration exceeds the second duration, and / or the sum of the second quantities in the storage volume information exceeds the second threshold and the duration exceeds the third duration, and the current caching mode is synchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode.
[0109] Alternatively, if the duration of the current caching mode of the target device exceeds the first duration, and if the first quantity is less than or equal to the first threshold and the duration exceeds the fourth duration, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold and the duration exceeds the fifth duration, and the current caching mode is asynchronous caching mode, then the mode switching result of the target device's caching mode is determined to represent the switching of the caching mode.
[0110] In the above embodiments, a duration constraint is added to the threshold determination of the number of storage volumes and the total number of IO requests. Only after the business scenario characteristics are maintained stably will it be determined that a cache mode switch is needed. This can eliminate the problem of erroneous switching caused by instantaneous fluctuations in IO, and further improve the accuracy of cache mode switching and the stability of system operation.
[0111] In some alternative implementations, the mode switching result can also be determined based on the number of I / O access requests for each storage volume.
[0112] For example, if the proportion of the third quantity in the first quantity exceeds the first preset proportion, and the current caching mode is the synchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode; wherein, the third quantity is the number of storage volumes in each storage volume corresponding to the target device whose corresponding second quantity exceeds the third threshold.
[0113] If the proportion of the fourth quantity in the first quantity exceeds the second preset proportion, and the current caching mode is the asynchronous caching mode, then the mode switching result of the target device's caching mode is determined to represent the switching of the caching mode; wherein, the fourth quantity is the number of storage volumes in each storage volume corresponding to the target device whose corresponding second quantity is less than or equal to the third threshold.
[0114] The third quantity is the total number of storage volumes corresponding to the target device where the second quantity exceeds the third threshold. The fourth quantity is the total number of storage volumes corresponding to the target device where the second quantity is less than or equal to the third threshold.
[0115] The first preset ratio is the critical value of the third quantity in the first quantity, used to determine the scenario where multi-stream storage volumes dominate. The second preset ratio is the critical value of the fourth quantity in the first quantity, used to determine the scenario where single-stream storage volumes dominate.
[0116] The third threshold is the critical value for determining whether a single storage volume is a multi-stream IO access request, used to distinguish between single-stream and multi-stream storage volumes.
[0117] The first preset ratio and the second preset ratio can be the same or different; the third threshold, the first preset ratio and the second preset ratio can be set according to the characteristics of the cluster business, and no specific restrictions are made here.
[0118] For example, the second quantity can be compared with the third threshold to count the number of storage volumes whose second quantity exceeds the third threshold, i.e., the third quantity, and the number of storage volumes whose second quantity is less than or equal to the third threshold, i.e., the fourth quantity.
[0119] Calculate the proportion of the third quantity in the first quantity. If the proportion exceeds the first preset proportion and the current caching mode is synchronous caching mode, then the mode switching result is determined to be that a switch is required. This judgment logic is suitable for mixed scenarios where multi-stream storage volumes dominate and it is necessary to switch to asynchronous caching mode.
[0120] Calculate the proportion of the fourth quantity in the first quantity. If the proportion exceeds the second preset proportion and the current caching mode is asynchronous caching mode, then the mode switching result is determined to be that a switch is required. This judgment logic is suitable for mixed scenarios where single-stream storage volumes dominate and a switch to synchronous caching mode is required.
[0121] In the above embodiments, the scenario determination is made by using the proportion of the third and fourth quantities in the first quantity and the preset ratio. This can accurately identify the mainstream business mode in mixed IO scenarios, break through the limitations of single threshold determination, and improve the adaptability and rationality of caching mode switching in complex business scenarios.
[0122] In some optional implementations, the current cache mode of the target device is switched to the target cache mode, which includes updating the mode flag, IO processing rules and cache resources of the current cache mode of the target device to the mode flag, IO processing rules and cache resources of the target cache mode, respectively.
[0123] The mode flag is a parameter bit in the target device used to identify the current cache mode, and is used to identify the cache mode. The IO processing rules are the rules for the target device to aggregate, write to disk, and transfer IO access requests. The cache resources are the hardware resources allocated to the target device for caching IO access requests, such as the number of threads, memory pool, and disk cache quota.
[0124] For example, when the mode switching result indicates that the cache mode needs to be switched, the switching controller in the server can send a thread locking instruction to the IO processing module in the target device to suspend the access of new IO access requests and wait for all currently processed IO access requests to complete disk write and transmission operations, ensuring that there is no residual IO data or data disorder during the switching process. The locking process takes a very short time, is imperceptible to the user, and will not interrupt business operations.
[0125] Then, the mode tag of the current cache mode corresponding to the target device is updated to the mode tag of the target cache mode, the IO processing rules of the current cache mode are replaced with the IO processing rules of the target cache mode, and cache resources are reallocated, adjusting the cache resource configuration of the current cache mode to the cache resource configuration of the target cache mode to adapt to the resource requirements of the new mode.
[0126] After the configuration update is complete, switch the controller to unlock the IO processing thread, resume the access of new IO requests, and process user services normally based on the updated mode flags, IO processing rules, and cache resources.
[0127] In the above embodiments, by synchronously updating the configuration of mode flags, IO processing rules, and cache resources, the cache mode switching can be achieved, which can ensure the integrity and consistency of the cache mode switching, avoid problems such as IO processing abnormalities and data loss caused by configuration mismatch, and ensure the stable and efficient operation of the system after the switch.
[0128] In some optional implementations, if the current cache mode is synchronous and the target cache mode is asynchronous, the process of updating the mode flag, IO processing rules, and cache resource configuration is as follows:
[0129] Update the mode tag corresponding to the target device from the synchronous cache mode mode tag to the asynchronous cache mode mode tag; update the IO processing rules corresponding to the target device to the IO aggregation processing rules; and expand the cache resources corresponding to the target device.
[0130] The processing rule for IO aggregation is to merge multiple IO access requests according to the IO aggregation threshold and then perform network transmission and disk write-to-disk processing in one go.
[0131] If the switch instruction is confirmed to be a switch from synchronous caching mode to asynchronous caching mode, first wait for all IO requests in synchronous caching mode to be written directly to disk to ensure that there are no unprocessed synchronous IO residues.
[0132] Furthermore, the mode tag corresponding to the target device is updated from the synchronous caching mode mode tag to the asynchronous caching mode mode tag; and the IO processing rules corresponding to the target device are updated to IO aggregation processing rules. An IO aggregation threshold can be preset, and multiple IO requests will be automatically merged after reaching the IO aggregation threshold, reducing the number of network requests and disk writes, and improving resource utilization. In addition, the cache resources corresponding to the target device can be expanded. Based on the parallel processing requirements of asynchronous mode, the number of IO processing threads can be increased, the memory pool threshold can be expanded, and the cache disk quota can be increased to support high-concurrency IO processing in multi-volume, multi-stream scenarios.
[0133] After resource expansion and rule updates are completed, the target device processes and aggregates I / O access requests in parallel according to the logic of asynchronous caching mode, giving full play to the performance advantages of asynchronous caching.
[0134] In the above embodiments, when switching from synchronous caching mode to asynchronous caching mode, synchronously updating the mode flag, enabling IO aggregation rules, and expanding cache resources can fully leverage the advantages of asynchronous caching parallel processing and IO aggregation, thereby improving the throughput and resource utilization of distributed storage systems in multi-volume and multi-stream scenarios.
[0135] In some optional implementations, if the current cache mode is asynchronous and the target cache mode is synchronous, the process of updating the mode flag, IO processing rules, and cache resource configuration is as follows:
[0136] Update the mode flag corresponding to the target device from the asynchronous cache mode mode flag to the synchronous cache mode mode flag; update the IO processing rules corresponding to the target device to the processing rules that do not perform IO aggregation; and reduce the cache resources corresponding to the target device.
[0137] Among them, the processing rule of not performing IO aggregation refers to the processing rule that directly executes disk write and network transmission after the IO access request arrives, without merging waiting or aggregation operation.
[0138] If the switch instruction is confirmed to be switching from asynchronous caching mode to synchronous caching mode, first wait for all IO requests in asynchronous caching mode to be cleared, complete IO aggregation, network transmission, disk write, and other operations to ensure that there are no asynchronous IO residues and avoid data loss or processing disorder.
[0139] Furthermore, the mode tag corresponding to the target device is updated from the asynchronous caching mode mode tag to the synchronous caching mode mode tag; the IO processing rules corresponding to the target device are then updated to processing rules that do not perform IO aggregation, and IO requests are immediately written to disk upon arrival without any waiting or aggregation operations, reducing IO processing latency; and the cache resources corresponding to the target device are reduced, based on the resource requirements of synchronous mode single-threaded direct write, multi-threading is reduced to single-threading, the memory pool threshold is reduced, and the cache disk quota is reduced, reducing unnecessary resource consumption.
[0140] After resource reduction and rule updates are completed, the target device follows the logic of synchronous caching mode, performing single-threaded direct writing and real-time response to single-volume single-stream IO access requests.
[0141] In the above embodiments, when switching from asynchronous caching mode to synchronous caching mode, synchronously updating the mode flag, disabling IO aggregation rules, and reducing cache resources can eliminate the additional overhead of asynchronous caching, fully leverage the low latency advantage of direct write of synchronous caching, and improve the IO response speed of distributed storage systems in single-volume single-stream scenarios.
[0142] In some alternative implementations, see [link to relevant documentation]. Figure 3 , Figure 3 A flowchart illustrating another method for switching caching modes is provided, which includes the following steps:
[0143] Step 1: Analyze the changes in the number of volumes on the target device, volume operations, and the duration of the current caching mode. Volume operations include volume creation and destruction, as well as mapping operations.
[0144] Step 2: Periodically sample IO request data. IO request data includes the number of volume IOs, IO size, IO type, and IO continuity. For example, collect the number of input / output IO access requests for each storage volume corresponding to the target device, and count the IO size, IO type, and IO continuity.
[0145] Step 3: Decide whether to switch the cache working mode.
[0146] Step 4: If switching from asynchronous caching mode to synchronous caching mode, update the mode flag of the target device from the asynchronous caching mode mode flag to the synchronous caching mode mode flag; update the IO processing rules of the target device to the processing rules that do not perform IO aggregation; and reduce the cache resources of the target device.
[0147] For example, first wait for all IO requests in asynchronous caching mode to be completely cleared, and complete IO aggregation, network transmission, disk write, and other operations to ensure that there are no asynchronous IO residues and avoid data loss or processing disorder.
[0148] Furthermore, the mode tag corresponding to the target device is updated from the asynchronous caching mode mode tag to the synchronous caching mode mode tag; the IO processing rules corresponding to the target device are then updated to processing rules that do not perform IO aggregation, and IO requests are immediately written to disk upon arrival without any waiting or aggregation operations, reducing IO processing latency; and the cache resources corresponding to the target device are reduced, based on the resource requirements of synchronous mode single-threaded direct write, multi-threading is reduced to single-threading, the memory pool threshold is reduced, and the cache disk quota is reduced, reducing unnecessary resource consumption.
[0149] Step 5: If the synchronous caching mode is switched to the asynchronous caching mode, update the mode tag corresponding to the target device from the synchronous caching mode mode tag to the asynchronous caching mode mode tag; update the IO processing rules corresponding to the target device to the IO aggregation processing rules; and expand the cache resources corresponding to the target device.
[0150] For example, first wait for all IO requests in synchronous caching mode to complete the direct write to disk to ensure that there are no unprocessed synchronous IO residues.
[0151] Furthermore, the mode tag corresponding to the target device is updated from the synchronous caching mode mode tag to the asynchronous caching mode mode tag; and the IO processing rules corresponding to the target device are updated to IO aggregation processing rules. An IO aggregation threshold can be preset, and multiple IO requests will be automatically merged after reaching the threshold, reducing the number of network requests and disk writes, and improving resource utilization. In addition, the cache resources corresponding to the target device can be expanded. Based on the parallel processing requirements of asynchronous mode, the number of IO processing threads can be increased, the memory pool threshold can be expanded, and the cache disk quota can be increased to support high-concurrency IO processing in multi-volume, multi-stream scenarios.
[0152] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0153] Based on the same inventive concept, this application also provides a cache mode switching device for implementing the cache mode switching method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more cache mode switching device embodiments provided below can be found in the limitations of the cache mode switching method described above, and will not be repeated here.
[0154] In one exemplary embodiment, such as Figure 4 As shown, a cache mode switching device is provided, comprising:
[0155] The acquisition module 10 is used to acquire storage volume information of the target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output IO access requests for each storage volume corresponding to the target device;
[0156] The determination module 20 is used to determine the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode;
[0157] The switching module 30 is used to switch the current cache mode of the target device to the target cache mode when the mode switching result indicates a switch cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode.
[0158] The aforementioned cache mode switching device obtains the first and second quantities of storage volumes of the target device, determines the mode switching result based on the current cache mode, and completes the cache mode switching. This enables the cache mode to dynamically match the IO business scenario, avoiding the performance degradation caused by the mismatch between the fixed cache mode and the IO business scenario, and improving the IO response speed and throughput of the distributed storage system.
[0159] In one embodiment, the determining module 20 is configured to perform any of the following:
[0160] If the first quantity exceeds the first threshold, and / or the sum of the second quantities in the storage volume information exceeds the second threshold, and the current cache mode is synchronous cache mode, then the mode switching result of the target device's cache mode is used to represent the switch cache mode.
[0161] If the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current cache mode is asynchronous cache mode, then the mode switching result of determining the cache mode of the target device represents the switch cache mode.
[0162] In one embodiment, the determining module 20 is specifically used for:
[0163] If the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity exceeds a first threshold, and / or the sum of the second quantities in the storage volume information exceeds a second threshold, and the current caching mode is synchronous caching mode, then the caching mode switching result of the target device is determined to represent a caching mode switch; if the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current caching mode is asynchronous caching mode, then the caching mode switching result of the target device is determined to represent a caching mode switch.
[0164] In one embodiment, the first quantity exceeding the first threshold includes the first quantity exceeding the first threshold and the duration exceeding the second duration; the sum of each second quantity in the storage volume information exceeding the second threshold includes the sum of each second quantity in the storage volume information exceeding the second threshold and the duration exceeding the third duration; the first quantity being less than or equal to the first threshold includes the first quantity being less than or equal to the first threshold and the duration exceeding the fourth duration; the sum of each second quantity in the storage volume information being less than or equal to the second threshold includes the sum of each second quantity in the storage volume information being less than or equal to the second threshold and the duration exceeding the fifth duration.
[0165] In one embodiment, the determining module 20 is configured to perform any of the following:
[0166] If the proportion of the third quantity in the first quantity exceeds the first preset proportion, and the current cache mode is synchronous cache mode, then the cache mode switching result of the target device is determined to represent the switch cache mode; where the third quantity is the number of storage volumes corresponding to the target device whose second quantity exceeds the third threshold.
[0167] If the proportion of the fourth quantity in the first quantity exceeds the second preset proportion, and the current caching mode is the asynchronous caching mode, then the mode switching result of the target device's caching mode is determined to represent the switching of the caching mode; wherein, the fourth quantity is the number of storage volumes in each storage volume corresponding to the target device whose corresponding second quantity is less than or equal to the third threshold.
[0168] In one embodiment, the switching module 30 is specifically used for:
[0169] Update the mode flag, IO processing rules, and cache resources of the current cache mode corresponding to the target device to the mode flag, IO processing rules, and cache resources of the target cache mode, respectively.
[0170] In one embodiment, the current caching mode is synchronous caching mode and the target caching mode is asynchronous caching mode; the switching module 30 is specifically used for:
[0171] Update the mode tag corresponding to the target device from the synchronous cache mode mode tag to the asynchronous cache mode mode tag; update the IO processing rules corresponding to the target device to the IO aggregation processing rules; expand the cache resources corresponding to the target device.
[0172] In one embodiment, the current caching mode is asynchronous caching mode and the target caching mode is synchronous caching mode; the switching module 30 is specifically used for:
[0173] Update the mode flag corresponding to the target device from the asynchronous cache mode mode flag to the synchronous cache mode mode flag; update the IO processing rules corresponding to the target device to the processing rules that do not perform IO aggregation; reduce the cache resources corresponding to the target device.
[0174] In one embodiment, the device further includes a response module for:
[0175] Based on the target caching pattern, respond to the IO access requests of each storage volume corresponding to the target device.
[0176] Each module in the aforementioned cache mode switching 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 a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0177] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and databases. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a cache mode switching method.
[0178] Those skilled in the art will understand that Figure 5 The 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.
[0179] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the cache mode switching method described in any of the above embodiments.
[0180] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the cache mode switching method described in any of the above embodiments.
[0181] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the cache mode switching method described in any of the above embodiments.
[0182] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0183] 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, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0184] 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 application.
[0185] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. 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 application should be determined by the appended claims.
Claims
1. A method for switching cache modes, characterized in that, The method includes: Obtain storage volume information of the target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device; The mode switching result of the cache mode of the target device is determined based on the storage volume information and the current cache mode; If the mode switching result indicates a change in cache mode, the current cache mode of the target device is switched to the target cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode; The mode switching result of determining the cache mode of the target device based on the storage volume information and the current cache mode includes any one of the following: If the first quantity exceeds the first threshold, and / or the sum of the second quantities in the storage volume information exceeds the second threshold, and the current cache mode is synchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode. If the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current cache mode is an asynchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode.
2. The method according to claim 1, characterized in that, If the first quantity exceeds a first threshold, and / or the sum of the second quantities in the storage volume information exceeds a second threshold, and the current cache mode is a synchronous cache mode, then determining the cache mode switching result of the target device to represent the cache mode switching includes: If the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity exceeds a first threshold, and / or the sum of the second quantities in the storage volume information exceeds a second threshold, and the current caching mode is a synchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode. If the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current caching mode is asynchronous caching mode, then determining the caching mode switching result of the target device to represent the caching mode switching includes: If the duration of the current caching mode of the target device exceeds a first duration, and if the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current caching mode is an asynchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode.
3. The method according to claim 1 or 2, characterized in that, The first quantity exceeding the first threshold includes the first quantity exceeding the first threshold and the duration exceeding the second duration; the sum of each second quantity in the storage volume information exceeding the second threshold includes the sum of each second quantity in the storage volume information exceeding the second threshold and the duration exceeding the third duration. The first quantity being less than or equal to the first threshold includes the first quantity being less than or equal to the first threshold and lasting for more than a fourth duration. The sum of each second quantity in the storage volume information being less than or equal to the second threshold includes the sum of each second quantity in the storage volume information being less than or equal to the second threshold and lasting for more than a fifth duration.
4. The method according to claim 1, characterized in that, The method of determining the cache mode switching result of the target device based on the storage volume information and the current cache mode further includes any one of the following: If the proportion of the third quantity in the first quantity exceeds the first preset ratio, and the current cache mode is the synchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode; wherein, the third quantity is the number of storage volumes corresponding to the target device whose second quantity exceeds the third threshold in each storage volume; If the proportion of the fourth quantity in the first quantity exceeds the second preset proportion, and the current caching mode is the asynchronous caching mode, then the mode switching result of the caching mode of the target device is determined to represent the switching of the caching mode; wherein, the fourth quantity is the number of storage volumes corresponding to the target device whose second quantity is less than or equal to the third threshold.
5. The method according to any one of claims 1, 2, or 4, characterized in that, The step of switching the current cache mode of the target device to the target cache mode includes: The mode flag, IO processing rules, and cache resources of the current cache mode corresponding to the target device are updated to the mode flag, IO processing rules, and cache resources of the target cache mode, respectively.
6. The method according to claim 5, characterized in that, The current cache mode is the synchronous cache mode and the target cache mode is the asynchronous cache mode; updating the mode flag, IO processing rules, and cache resources of the current cache mode corresponding to the target device to the mode flag, IO processing rules, and cache resources of the target cache mode respectively includes: Update the mode tag corresponding to the target device from the mode tag of the synchronous cache mode to the mode tag of the asynchronous cache mode; Update the IO processing rules corresponding to the target device to IO aggregation processing rules; Expand the cache resources corresponding to the target device.
7. The method according to claim 5, characterized in that, The current caching mode is the asynchronous caching mode and the target caching mode is the synchronous caching mode; updating the mode flag, IO processing rules, and cache resources of the current caching mode corresponding to the target device to the mode flag, IO processing rules, and cache resources of the target caching mode respectively includes: Update the mode tag corresponding to the target device from the mode tag of the asynchronous cache mode to the mode tag of the synchronous cache mode; Update the IO processing rules corresponding to the target device to processing rules that do not perform IO aggregation; Reduce the cache resources corresponding to the target device.
8. The method according to any one of claims 1, 2 or 4, characterized in that, The method further includes: Based on the target caching mode, respond to the IO access requests of each storage volume corresponding to the target device.
9. A cache mode switching device, characterized in that, The device includes: An acquisition module is used to acquire storage volume information of a target device; wherein, the storage volume information includes a first number of storage volumes corresponding to the target device and / or a second number of input / output I / O access requests for each storage volume corresponding to the target device; The determining module is used to determine the mode switching result of the cache mode of the target device based on the storage volume information and the current cache mode; A switching module is used to switch the current cache mode of the target device to the target cache mode when the mode switching result indicates a switch cache mode; wherein the current cache mode and the target cache mode are different cache modes in synchronous cache mode and asynchronous cache mode; The determination module is used to perform any of the following: If the first quantity exceeds the first threshold, and / or the sum of the second quantities in the storage volume information exceeds the second threshold, and the current cache mode is synchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode. If the first quantity is less than or equal to the first threshold, and / or the sum of the second quantities in the storage volume information is less than or equal to the second threshold, and the current cache mode is an asynchronous cache mode, then the mode switching result of the cache mode of the target device is determined to represent the switch cache mode.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, 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 8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for determining parameter adjustment strategy, server and storage medium
CN120216154A