Method, device and equipment for executing random write task of imbricated mechanical disk and storage medium
By monitoring the media cache status of the tiled mechanical hard disk and selecting reasonable write operations, the problem of poor random write performance of the tiled mechanical hard disk is solved, improving user experience and expanding application scenarios.
Patent Information
- Application Number
- CN202510569974.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-30
- Publication Date
- 2025-07-18
AI Technical Summary
When tile-type mechanical hard disks write random data, the performance of random writes is poor, resulting in slow system response and reduced data processing efficiency, especially in data-intensive applications where frequent random writes are written.
By monitoring the internal media cache status of the tiled mechanical hard disk, obtaining cache usage feedback information, and selecting target write operations based on the feedback information, including directly writing data to the outer ring track of the hard disk when the media cache is blocked, and reasonably adjusting data processing and storage to avoid the problem of poor stability of random write performance.
It improves the user experience of stacked mechanical hard disks, expands its application scenarios, avoids hard disk jams or restarts caused by media cache blockage, and improves data writing efficiency and reliability.
Smart Images

Figure CN120335729A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of disk management, and particularly to a method, apparatus, device and storage medium for executing a random write task on a shingled magnetic disk. Background Art
[0002] A hard disk drive (HDD) is one of the most common storage devices in a computer. It reads and writes data through rotating magnetic disks and read / write heads. There are multiple disks inside the hard disk, and each disk is coated with a layer of magnetic material. Data is stored on these disks in the form of magnetic signals.
[0003] With the continuous development of computer technology, the storage capacity of hard disk drives has been continuously increasing. A shingled magnetic hard disk is a high-capacity disk that uses a new magnetic storage technology. It improves the storage density of the disk by overlapping the data tracks on the disk, just like the tiles on a roof. The main advantage of a shingled magnetic hard disk is to provide a higher storage capacity and a lower price per unit capacity. Due to the overlapping of tracks, when randomly writing data on a shingled magnetic hard disk, adjacent tracks need to be rewritten, which makes the write operation complex and time-consuming. In data-intensive applications that require frequent random writes (such as databases and virtualization environments), the random write stability of a shingled magnetic hard disk is poor, which may lead to a slow system response and a decrease in data processing efficiency.
[0004] It can be seen that how to enhance the random write stability of a shingled magnetic hard disk is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of the embodiments of the present invention is to provide a method, apparatus, device and storage medium for executing a random write task on a shingled magnetic disk, which can effectively monitor the hard disk state to avoid the problem of poor random write performance stability in advance, and thus improve the actual user experience of a shingled magnetic hard disk. The specific solutions are as follows:
[0006] In a first aspect, the present application discloses a method for executing a random write task on an X shingled magnetic disk, including:
[0007] Obtaining a random write task sent by a client for a shingled magnetic disk, and determining whether to start a status query operation for the internal media cache of the shingled magnetic disk based on the random write task;
[0008] If the status query operation for the internal media cache is started, obtaining the cache usage feedback information of the internal media cache based on the status query operation;
[0009] Determine a target write operation from a preset hard disk writing mechanism based on cache usage feedback information, and execute a random write task based on the target write operation.
[0010] Optionally, obtain a random write task sent by the client for the shingled magnetic disk, and determine whether to start a status query operation for the internal media cache of the shingled magnetic disk based on the random write task, including:
[0011] Obtain the current write task sent by the client for the shingled magnetic disk;
[0012] If the logical address corresponding to the current write task is not a continuous address, determine the current write task as a random write task;
[0013] Determine whether the random write task meets the preset status query condition to determine whether to start a status query operation for the internal media cache of the shingled magnetic disk;
[0014] The preset status query conditions include: the random write data volume corresponding to the random write task is greater than a preset data volume threshold; and / or, the reconstruction write trigger frequency corresponding to the random write task is greater than a preset write frequency threshold.
[0015] Optionally, if the status query operation for the internal media cache is started, obtain the cache usage feedback information of the internal media cache based on the status query operation, including:
[0016] If the status query operation for the internal media cache is started, modify the value of the preset status register to the value corresponding to the status query operation;
[0017] After the preset register monitoring tool polls that the value of the preset status register is the value corresponding to the status query operation, generate an interrupt signal through the preset register monitoring tool;
[0018] Send the interrupt signal to the preset hard disk controller through the preset register monitoring tool so that the preset hard disk controller forwards the interrupt signal to the central processing unit of the corresponding host;
[0019] Obtain the status query command issued by the central processing unit based on the interrupt signal, and obtain the cache usage feedback information of the internal media cache based on the status query command.
[0020] Optionally, determine a target write operation from a preset hard disk writing mechanism based on the cache usage feedback information, and execute a random write task based on the target write operation, including:
[0021] Obtain the cache usage feedback information to obtain the remaining amount of the current media cache;
[0022] Obtain the reconstruction write trigger frequency corresponding to the random write task and the disk temperature data of the shingled magnetic disk;
[0023] Based on the preset data normalization operation, normalize the current media cache remaining amount, the reconstruction write trigger frequency, and the disk temperature data respectively to obtain the processed remaining amount, the processed frequency, and the processed temperature;
[0024] Substitute the processed remaining amount, the processed frequency, and the processed temperature into the preset media cache usage value function to obtain the current cache usage value;
[0025] Compare the current cache usage value with the first usage threshold and the second usage threshold respectively;
[0026] If the current cache usage value is less than the first usage threshold, directly write the data to be written corresponding to the random write task into the internal media cache to execute the random write task;
[0027] If the current cache usage value is greater than the first usage threshold and less than the second usage threshold, give a media cache congestion warning through the preset visualization interface, and write the data to be written corresponding to the random write task into the internal media cache to execute the random write task;
[0028] If the current cache usage value is greater than the second usage threshold, give a media cache congestion warning through the preset visualization interface, and write the data to be written corresponding to the random write task into the preset disk storage area of the shingled magnetic recording disk to execute the random write task.
[0029] Optionally, based on the preset data normalization operation, normalize the current media cache remaining amount, the reconstruction write trigger frequency, and the disk temperature data respectively to obtain the processed remaining amount, the processed frequency, and the processed temperature, including:
[0030] Normalize the current media cache remaining amount based on the total media cache amount of the internal media cache to obtain the processed remaining amount;
[0031] Normalize the reconstruction write trigger frequency based on the preset frequency normalization threshold to obtain the processed frequency;
[0032] Normalize the disk temperature data based on the preset rated hard disk temperature to obtain the processed temperature.
[0033] Optionally, writing the data to be written corresponding to the random write task into the preset disk storage area of the shingled magnetic recording disk to execute the random write task includes:
[0034] Close the internal media cache, and write the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled magnetic recording disk to execute the random write task.
[0035] Optionally, writing the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled magnetic disk to execute the random write task further includes:
[0036] Writing the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled magnetic disk, and starting a timed status query operation for the internal media cache;
[0037] Monitoring the current cache usage value of the internal media cache based on the timed status query operation;
[0038] When the current cache usage value is not greater than the second usage threshold, starting the internal media cache and writing the remaining data to be written corresponding to the random write task to the internal media cache to execute the random write task.
[0039] In a second aspect, the present application discloses a device for executing a random write task of a shingled magnetic disk, including:
[0040] A cache status query module, configured to obtain a random write task for the shingled magnetic disk sent by the client, and determine whether to start a status query operation for the internal media cache of the shingled magnetic disk based on the random write task;
[0041] A feedback information acquisition module, configured to, if starting a status query operation for the internal media cache, obtain cache usage feedback information of the internal media cache based on the status query operation;
[0042] A task execution module, configured to determine a target write operation from a preset hard disk writing mechanism based on the cache usage feedback information, and execute a random write task based on the target write operation.
[0043] In a third aspect, the present application discloses an electronic device, including:
[0044] A memory, configured to store a computer program;
[0045] A processor, configured to execute the computer program to implement the foregoing method for executing a random write task of a shingled magnetic disk.
[0046] In a fourth aspect, the present application discloses a computer-readable storage medium, configured to store a computer program, and when the computer program is executed by a processor, the foregoing method for executing a random write task of a shingled magnetic disk is implemented.
[0047] In the present invention, a random write task sent by a client for a shingled magnetic disk is obtained, and based on the random write task, it is determined whether to initiate a status query operation for the internal media cache of the shingled magnetic disk; if the status query operation for the internal media cache is initiated, cache usage feedback information is obtained based on the status query operation; a target write operation is determined from a preset hard disk writing mechanism based on the cache usage feedback information, and the random write task is executed based on the target write operation.
[0048] As can be seen from the above technical solution, in the present invention, after determining the random write task, the corresponding internal media cache status query operation is initiated, and through the internal media cache status query operation, cache usage feedback information is obtained. Finally, based on the obtained cache usage feedback information, the corresponding target write operation is selected, and the random write task is ultimately executed according to the target write operation. In this way, by establishing a query feedback mechanism for the status of the shingled magnetic hard disk media cache, the hard disk status is effectively supervised to select the corresponding target write operation, so as to avoid the problem of poor random write performance stability, which helps to improve the actual user experience of the shingled magnetic hard disk and expand its application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0050] Figure 1 It is a schematic diagram of the performance statistics results in the pure random write scenario test of a shingled magnetic hard disk disclosed by the present invention;
[0051] Figure 2 It is a flowchart of a method for executing a random write task of a shingled magnetic disk disclosed by the present invention;
[0052] Figure 3 It is a flowchart of a specific method for executing a random write task of a shingled magnetic disk disclosed by the present invention;
[0053] Figure 4 It is a schematic structural diagram of a device for executing a random write task of a shingled magnetic disk disclosed by the present invention;
[0054] Figure 5 It is a structural diagram of an electronic device disclosed by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0055] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present invention.
[0056] The terms "including" and "having" in the specification of the present invention and the accompanying drawings above, and any variations related to "including" and "having", are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may include steps or units not listed.
[0057] To enable those skilled in the art of the present technology to better understand the solution of the present invention, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0058] The shingled magnetic recording hard disk improves the storage density of the disk by overlapping the data tracks on the disk platter, and can provide higher storage capacity and lower price per unit capacity. In the face of the scenario of random write data, to modify the data in a certain area, the shingled magnetic recording hard disk needs to read out all the data in the area and its adjacent tracks, modify it and then write it back. Such a rewrite process will consume more time. To improve the random write performance of the shingled magnetic recording hard disk, some hard disk manufacturers adopt the media cache strategy.
[0059] Here, the media cache strategy will be described. The media cache strategy is a cache mechanism located inside the hard disk, which is used to temporarily store the data that the user wants to write to the hard disk, so as to achieve fast access when reading is required. In a shingled magnetic recording hard disk, when the hard disk receives a random write request, the data is first written into the media cache, rather than directly written to the disk. In the media cache, the hard disk will merge and sort the received random write data, and finally write it sequentially into the free area of the disk. In this way, the hard disk can convert multiple small random write requests into a large sequential write request, thereby improving the efficiency of random write data. However, as Figure 1As shown, the capacity of the media cache is limited. When the media cache is full, the hard disk needs to pause the write operation to wait for the media cache space to be released, which may cause a temporary decrease in write performance. After the cache space is released, the random write performance resumes. Taking a certain Seagate shingled magnetic recording hard disk as an example, during a pure random write scenario test of about 2 hours, the random write performance of the hard disk drops severely, and at this time, the media cache usage value of the hard disk > 95%. According to the random write test of the shingled magnetic recording hard disk, in a continuous long-term random write scenario, the media cache of the hard disk will be full, and at this time, the random write performance will also decrease. If the user's command requests are not responded to for a long time, the phenomenon of hard disk restart may also occur. Therefore, the present invention will specifically introduce a method for executing a random write task on a shingled magnetic recording disk to solve the above problems.
[0060] See Figure 2 As shown, an embodiment of the present invention discloses a method for executing a random write task on a shingled magnetic recording disk, including:
[0061] Step S11: Obtain a random write task for the shingled magnetic recording disk sent by the client, and determine whether to start a status query operation for the internal media cache of the shingled magnetic recording disk based on the random write task.
[0062] In this embodiment, a random write task sent by a client for a shingled magnetic disk is obtained, and based on the random write task, it is determined whether to start a status query operation for the internal media cache of the shingled magnetic disk, including: obtaining the current write task sent by the client for the shingled magnetic disk; if the logical address corresponding to the current write task is not a continuous address, determining the current write task as a random write task; determining whether the random write task meets a preset status query condition to determine whether to start the status query operation for the internal media cache of the shingled magnetic disk; the preset status query condition includes: the random write data volume corresponding to the random write task is greater than a preset data volume threshold; and / or, the reconstruction write trigger frequency corresponding to the random write task is greater than a preset write frequency threshold. First, the present invention establishes dynamic random write task quantization and intelligent recording. Specifically, first, the random write task and the sequential write task are distinguished according to whether the logical address of the data written by the user is continuous. The logical address of the data written in the sequential write task is continuous. If the logical address of the written data is not continuous, it is determined as a random write task, and the computer (or shingled magnetic hard disk) needs to record each random write task sent by the user. Then, based on two indicators, namely the random write data volume and the reconstruction write trigger frequency of the shingled magnetic hard disk, the random write pressure of the hard disk is quantified, and the media cache pressure is evaluated. In the present invention, when the random write data volume corresponding to the random write task is greater than the preset data volume threshold; and / or, when the reconstruction write trigger frequency corresponding to the random write task is greater than the preset write frequency threshold, it is determined that the random write pressure of the hard disk is relatively large, and the status query operation for the internal media cache of the shingled magnetic disk can be started. For example, in the actual operation process, when the random write task reaches a certain amount (such as the continuously randomly written data volume exceeds 1 GB) or the reconstruction write trigger frequency reaches a certain ratio (such as the reconstruction write trigger frequency reaches 50%), it is determined that the random write pressure of the hard disk is relatively large, and the status query operation for the internal media cache of the shingled magnetic disk can be started. Of course, if these conditions are not met, it means that the random write pressure of the hard disk is normal, and the read and write tasks of the user can be normally executed.
[0063] Step S12: If the status query operation for the internal media cache is started, the cache usage feedback information of the internal media cache is obtained based on the status query operation.
[0064] In this embodiment, if the status query operation of the internal media cache is initiated, the cache usage feedback information of the internal media cache is obtained based on the status query operation, including: if the status query operation of the internal media cache is initiated, the value of the preset status register is modified to the value corresponding to the status query operation; after the preset register monitoring tool polls that the value of the preset status register is the value corresponding to the status query operation, an interrupt signal is generated through the preset register monitoring tool; the interrupt signal is sent to the preset hard disk controller through the preset register monitoring tool, so that the preset hard disk controller forwards the interrupt signal to the central processing unit of the corresponding host; the status query command issued by the central processing unit based on the interrupt signal is obtained, and the cache usage feedback information of the internal media cache is obtained based on the status query command. Specifically, after the status query operation of the internal media cache is initiated, the value of the status register is set to 1 (i.e., the value corresponding to the above status query operation). After the monitoring module polls the value of the status register, the hard disk controller is notified by generating an interrupt signal. These signals will be forwarded by the hard disk controller to the CPU (Central Processing Unit, i.e., the central processing unit) of the host computer to inform the change of the hard disk load, and the CPU actively issues a media cache status query command to obtain the status (actual usage value) of the shingled magnetic disk media cache.
[0065] Step S13: Determine the target write operation from the preset hard disk writing mechanism based on the cache usage feedback information, and execute the random write task based on the target write operation.
[0066] In this embodiment, determining the target write operation from the preset hard disk writing mechanism based on the cache usage feedback information and executing the random write task based on the target write operation includes: obtaining the cache usage feedback information to obtain the remaining amount of the current media cache; obtaining the reconstruction write trigger frequency corresponding to the random write task and the disk temperature data of the shingled magnetic disk; performing normalization processing on the current media cache remaining amount, the reconstruction write trigger frequency, and the disk temperature data respectively based on the preset data normalization processing operation to obtain the processed remaining amount, the processed frequency, and the processed temperature.
[0067] In this embodiment, the hard disk writing behavior and user requests are dynamically optimized according to the status of the media cache to ensure the stability of the random write performance of the shingled magnetic disk. Based on the three indicators of the remaining amount of the current media cache, the reconstruction write trigger frequency, and the hard disk temperature, a dynamic media cache usage value is set. That is, normalization processing is performed on the current media cache remaining amount, the reconstruction write trigger frequency, and the disk temperature data respectively based on the preset data normalization processing operation to obtain the processed remaining amount (C 剩余量 ), the processed frequency (C 重写频率 ), and the processed temperature (C 温度), including: normalizing the current remaining media cache based on the total media cache of the internal media cache to obtain the processed remaining amount; normalizing the reconstruction write trigger frequency based on a preset frequency normalization threshold to obtain the processed frequency; normalizing the disk temperature data based on a preset hard disk rated temperature to obtain the processed temperature. Specifically, the formula for normalizing the remaining media cache is: C 剩余量 = current media cache usage / total media cache; the formula for normalizing the rewrite frequency is: when the reconstruction write trigger frequency is less than 50 times per second, C 重写频率 = 0; otherwise C 重写频率 = 1; the formula for normalizing the hard disk temperature is: C 温度 = current hard disk temperature / hard disk rated temperature. After obtaining the corresponding processed remaining amount, processed frequency, and processed temperature through the above formulas, input the obtained processed remaining amount, processed frequency, and processed temperature into a preset media cache usage value function. The preset media cache usage value function is: media cache usage value = w1 × C 使用量 + w2 × C 重写频率 + w3 × C 温度 . Among them, w1, w2, and w3 are the index weights respectively, which can be set to 0.4, 0.3, and 0.3 respectively. The index weights can be adjusted according to the actual situation.
[0068] Further, substitute the remaining amount, frequency, and temperature after processing into a preset media cache usage value function to obtain the current cache usage value; compare the current cache usage value with a first usage threshold and a second usage threshold respectively; if the current cache usage value is less than the first usage threshold, directly write the data to be written corresponding to the random write task into the internal media cache to execute the random write task; if the current cache usage value is greater than the first usage threshold and less than the second usage threshold, give a media cache congestion warning through a preset visualization interface, and write the data to be written corresponding to the random write task into the internal media cache to execute the random write task; if the current cache usage value is greater than the second usage threshold, give a media cache congestion warning through a preset visualization interface, and write the data to be written corresponding to the random write task into a preset disk storage area of the shingled magnetic disk to execute the random write task. That is, if the usage value of the shingled magnetic hard disk media cache is less than 60% (the first usage threshold), the media cache is working normally at this time, and the user does not need to make additional coping strategies; if the usage value of the shingled magnetic hard disk media cache is between 60% and 90%, the media cache is in a heavy-load state at this time, and it is necessary to remind and guide the user to actively reduce the current random write task, and give a hard disk cache usage warning. However, there is still a certain margin in the hard disk media at this time, which will not cause significant performance degradation, and there is no need to make additional adjustments to the hard disk write mode; if the usage value of the shingled magnetic hard disk media cache is greater than 90% (the second usage threshold), the media cache of the hard disk is in a congested state at this time. On the basis of reminding and guiding the user to actively reduce the current random write task, it is also necessary to make additional adjustments to the hard disk write mode to reserve sufficient time for the media cache of the hard disk to release the cache space to prevent the hard disk from restarting due to untimely response to user commands.
[0069] In this embodiment, for the scenario where the usage value of the shingled mechanical hard disk media cache is greater than 90%, on the basis of reminding and guiding the user to actively reduce the current random write tasks, it is also necessary to adjust the data writing mechanism of the hard disk, that is, write the data to be written corresponding to the random write task into the preset disk storage area of the shingled mechanical disk to execute the random write task, including: closing the internal media cache and writing the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled mechanical disk to execute the random write task. That is to say, first, the media cache working mechanism is closed at the hard disk end. At this time, the data written by the user needs to be directly written to the disk storage area without passing through the media cache area, and at the same time, the action of refreshing the data from the media cache to the hard disk storage area is closed. In this way, although directly writing the user data to the hard disk storage area will reduce the writing data performance of the user, it avoids the problems of hard disk jamming or hard disk restart caused by the media cache being blocked. In order to ensure the user's data writing performance in the scenario where the media cache usage value is greater than 90%, the data layout is optimized at the hard disk end, and the outer tracks of the hard disk are preferentially allocated to store the user's current random write tasks at this time. The randomly written data is concentrated in the adjacent tracks or sectors of the outer circle, reducing the moving distance of the magnetic head and improving the writing efficiency.
[0070] In addition, writing the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled mechanical disk to execute the random write task further includes: writing the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled mechanical disk, and starting a timed status query operation for the internal media cache. Based on the timed status query operation, the current cache usage value of the internal media cache is monitored regularly; when the current cache usage value is not greater than the second usage threshold, the internal media cache is started, and the remaining data to be written corresponding to the random write task is written to the internal media cache to execute the random write task. That is, it is also necessary to query the status of the media cache regularly (such as every 1 second). When the media cache releases space and the media cache usage value is less than 90%, the working mechanism of the media cache is restored in time to ensure the user's random write behavior.
[0071] In this embodiment, a random write task for the shingled mechanical disk sent by the user end is obtained, and it is determined whether to start a status query operation for the internal media cache of the shingled mechanical disk based on the random write task; if the status query operation for the internal media cache is started, cache usage feedback information of the internal media cache is obtained based on the status query operation; a target write operation is determined from the preset hard disk writing mechanism based on the cache usage feedback information, and the random write task is executed based on the target write operation.
[0072] In addition, corresponding queues can be set in the disk to relieve the pressure on the internal media cache. For example, a first-in-first-out queue can be set in the shingled magnetic disk. When the usage value of the media cache in the shingled magnetic hard disk is greater than 90%, the media cache of the hard disk is in a blocked state. At this time, the internal media cache is closed, and the data to be written corresponding to the random write task is written into this first-in-first-out queue. When the current cache usage value is not greater than the second usage threshold, the internal media cache is started, and the data in the first-in-first-out queue is rewritten into the internal media cache in order. In this way, the problem of hard disk freezing or hard disk restart caused by the blocked media cache is avoided, and the write data performance of the user is not reduced.
[0073] As Figure 3 shown, it can be seen from the above technical solution that in this embodiment, after determining the random write task, the corresponding internal media cache status query operation is started, and through the internal media cache status query operation, the cache usage feedback information is obtained. Finally, based on the obtained cache usage feedback information, the corresponding target write operation is selected, and finally the random write task is executed according to the target write operation. In this way, by establishing a query feedback mechanism for the media cache status of the shingled magnetic hard disk, the hard disk status is effectively supervised to select the corresponding target write operation to avoid the problem of poor random write performance stability, which helps to improve the actual user experience of the shingled magnetic hard disk and expand its application scenarios.
[0074] In other words, by monitoring the media cache status of the shingled magnetic hard disk, an information feedback mechanism with the host CPU is established to guide the user to reasonably adjust the processing and storage of data according to the media cache status of the shingled magnetic hard disk, and to discover and avoid in advance the problem of poor random write performance stability of the shingled magnetic hard disk in actual use (especially in scenarios that require frequent random writes), so as to improve data reliability and the actual user experience. At present, shingled magnetic hard disks are mainly used in scenarios with relatively low requirements for randomly written data, such as consumer desktops, data backup and archival hard disks, etc. The present invention establishes a feedback mechanism for the media cache status of the shingled magnetic hard disk, effectively supervises the hard disk status to avoid the problem of poor random write performance stability in advance, which helps to improve the actual user experience of the shingled magnetic hard disk and expand its application scenarios.
[0075] Referring Figure 4 to, the embodiment of the present application also correspondingly discloses a device for executing a random write task on a shingled magnetic disk, including:
[0076] A cache status query module 11, configured to obtain a random write task for the shingled magnetic disk sent by the user end, and determine whether to start a status query operation of the internal media cache of the shingled magnetic disk based on the random write task;
[0077] A feedback information acquisition module 12, configured to, if a status query operation for the internal media cache is started, acquire cache usage feedback information of the internal media cache based on the status query operation;
[0078] A task execution module 13, configured to determine a target write operation from a preset hard disk writing mechanism based on the cache usage feedback information, and execute a random write task based on the target write operation.
[0079] It can be seen that in this embodiment, after determining the random write task, the corresponding internal media cache status query operation is started, and through the internal media cache status query operation, the cache usage feedback information is acquired. Finally, based on the acquired cache usage feedback information, the corresponding target write operation is selected, and the random write task is finally executed according to the target write operation. In this way, by establishing a query feedback mechanism for the status of the shingled magnetic disk media cache, the hard disk status is effectively supervised to select the corresponding target write operation, so as to avoid the problem of poor random write performance stability, which helps to improve the actual user experience of the shingled magnetic disk and expand its application scenarios.
[0080] Furthermore, an embodiment of the present application also discloses an electronic device, Figure 5 which is a structural diagram of an electronic device shown according to an exemplary embodiment. The content in the figure should not be considered as any limitation to the scope of use of the present application. The electronic device may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. Among them, the memory 22 is used to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the method for executing a random write task of a shingled magnetic disk disclosed in any of the foregoing embodiments. In addition, the electronic device in this embodiment may specifically be an electronic computer.
[0081] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and external devices, and the communication protocol it follows is any communication protocol applicable to the technical solution of the present application, and no specific limitation is imposed on it here; the input / output interface 25 is used to acquire external input data or output data to the outside, and its specific interface type can be selected according to specific application needs, and no specific limitation is made here.
[0082] In addition, as a carrier for resource storage, the memory 22 may be a read-only memory, a random access memory, a magnetic disk, or an optical disc, etc. The resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage method may be temporary storage or permanent storage.
[0083] Among them, the operating system 221 is used to manage and control each hardware device and computer program 222 on the electronic device, and it can be Windows Server, Netware, Unix, Linux, etc. In addition to the computer program that can be used to complete the shingled mechanical disk random write task execution method executed by the electronic device disclosed in any of the foregoing embodiments, the computer program 222 may further include computer programs that can be used to complete other specific tasks.
[0084] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the shingled mechanical disk random write task execution method disclosed above is implemented. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.
[0085] Furthermore, the present application also discloses a computer program product, including a computer program / instructions; wherein, when the computer program / instructions are executed by a processor, the alarm aggregation method disclosed above is implemented. For the specific steps of this method, reference can be made to the corresponding content disclosed in the foregoing embodiments, and details will not be repeated here.
[0086] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and reference can be made to the description in the method part for the relevant parts.
[0087] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0088] The steps of the methods or algorithms described in combination with the embodiments disclosed in this article can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the technical field.
[0089] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the element.
[0090] The technical solutions provided in this application have been introduced in detail above. Specific examples are used in this text to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A method for executing a random write task of an overlapping mechanical disk, characterized in that, Including: Obtain a random write task sent by a client for a shingled magnetic disk, and determine whether to start a status query operation for the internal media cache of the shingled magnetic disk based on the random write task; If the status query operation for the internal media cache is started, obtain cache usage feedback information of the internal media cache based on the status query operation; Determine a target write operation from a preset hard disk write mechanism based on the cache usage feedback information, and execute the random write task based on the target write operation.
2. The method for performing a random write task of an overlapping mechanical disk according to claim 1, wherein The obtaining a random write task sent by a client for a shingled magnetic disk, and determining whether to start a status query operation for the internal media cache of the shingled magnetic disk based on the random write task includes: Obtain the current write task sent by the client for the shingled magnetic disk; If the logical address corresponding to the current write task is not a continuous address, determine the current write task as a random write task; Judge whether the random write task meets a preset status query condition to determine whether to start a status query operation for the internal media cache of the shingled magnetic disk; The preset status query condition includes: the random write data volume corresponding to the random write task is greater than a preset data volume threshold; and / or, the reconstruction write trigger frequency corresponding to the random write task is greater than a preset write frequency threshold.
3. The method for performing a random write task on a shingled mechanical disk according to claim 1, wherein The if the status query operation for the internal media cache is started, obtain cache usage feedback information of the internal media cache based on the status query operation includes: If the status query operation for the internal media cache is started, modify the value of a preset status register to the value corresponding to the status query operation; After a preset register monitoring tool polls that the value of the preset status register is the value corresponding to the status query operation, generate an interrupt signal through the preset register monitoring tool; Send the interrupt signal to a preset hard disk controller through the preset register monitoring tool, so that the preset hard disk controller forwards the interrupt signal to the central processing unit of the corresponding host; Obtain a status query command issued by the central processing unit based on the interrupt signal, and obtain cache usage feedback information of the internal media cache based on the status query command.
4. The method for performing a shingled mechanical disk random write task according to any one of claims 1 to 3, characterized in that, The determining a target write operation from a preset hard disk write mechanism based on the cache usage feedback information, and executing the random write task based on the target write operation includes: Obtain the cache usage feedback information to obtain the remaining amount of the current media cache; Obtain the reconstruction write trigger frequency corresponding to the random write task and the disk temperature data of the shingled magnetic disk; Perform normalization processing on the remaining amount of the current media cache, the reconstruction write trigger frequency, and the disk temperature data respectively based on a preset data normalization processing operation to obtain a processed remaining amount, a processed frequency, and a processed temperature; Substitute the processed remaining amount, the processed frequency, and the processed temperature into a preset media cache usage value function to obtain a current cache usage value; Compare the current cache usage value with a first usage threshold and a second usage threshold respectively; If the current cache usage value is less than the first usage threshold, directly write the data to be written corresponding to the random write task to the internal media cache to execute the random write task; If the current cache usage value is greater than the first usage threshold and less than the second usage threshold, issue a warning for media cache congestion through a preset visualization interface, and write the data to be written corresponding to the random write task to the internal media cache to execute the random write task; If the current cache usage value is greater than the second usage threshold, issue a warning for media cache congestion through a preset visualization interface, and write the data to be written corresponding to the random write task to a preset disk storage area of the shingled magnetic disk to execute the random write task.
5. The method for performing a random write task of an overlapping mechanical disk according to claim 4, wherein The normalization processing of the current remaining media cache, the reconstructed write trigger frequency, and the disk temperature data respectively based on the preset data normalization processing operation to obtain the processed remaining amount, the processed frequency, and the processed temperature includes: Normalize the current remaining media cache based on the total media cache capacity of the internal media cache to obtain the processed remaining amount; Normalize the reconstructed write trigger frequency based on a preset frequency normalization threshold to obtain the processed frequency; Normalize the disk temperature data based on a preset rated hard disk temperature to obtain the processed temperature.
6. The method for performing a random write task on an overlapping mechanical hard disk according to claim 4, wherein The writing the data to be written corresponding to the random write task to a preset disk storage area of the shingled magnetic disk to execute the random write task includes: Close the internal media cache, and write the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled magnetic disk to execute the random write task.
7. The method for performing a random write task on a shingled mechanical disk according to claim 6, wherein The writing the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled magnetic disk to execute the random write task further includes: Write the data to be written corresponding to the random write task to the outer track / sector of the hard disk of the shingled magnetic disk, and start a timed status query operation for the internal media cache; Monitor the current cache usage value of the internal media cache based on the timed status query operation; When the current cache usage value is not greater than the second usage threshold, start the internal media cache, and write the remaining data to be written corresponding to the random write task to the internal media cache to execute the random write task.
8. A device for executing a random write task of an overlapping mechanical disk, characterized in that Includes: A cache status query module, configured to obtain a random write task for a shingled magnetic disk sent by a client, and determine whether to start a status query operation for the internal media cache of the shingled magnetic disk based on the random write task; A feedback information acquisition module, configured to, if the status query operation for the internal media cache is started, obtain cache usage feedback information of the internal media cache based on the status query operation; A task execution module, configured to determine a target write operation from a preset hard disk writing mechanism based on the cache usage feedback information, and execute the random write task based on the target write operation.
9. An electronic device, characterized in that, Includes: A memory for storing a computer program; A processor for executing the computer program to implement the steps of the method for performing a shingled mechanical disk random write task according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for performing a shingled mechanical disk random write task according to any one of claims 1 to 7 are implemented.