CN107728939A - I O scheduling method, apparatus, equipment and storage medium based on Linux - Google Patents
I O scheduling method, apparatus, equipment and storage medium based on Linux Download PDFInfo
- Publication number
- CN107728939A CN107728939A CN201710884154.5A CN201710884154A CN107728939A CN 107728939 A CN107728939 A CN 107728939A CN 201710884154 A CN201710884154 A CN 201710884154A CN 107728939 A CN107728939 A CN 107728939A
- Authority
- CN
- China
- Prior art keywords
- disk
- read
- data
- linux
- queue
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
- G06F3/0611—Improving I/O performance in relation to response time
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
- G06F13/102—Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0659—Command handling arrangements, e.g. command buffers, queues, command scheduling
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0674—Disk device
- G06F3/0676—Magnetic disk device
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
- G06F9/5038—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Human Computer Interaction (AREA)
- Software Systems (AREA)
- Signal Processing For Digital Recording And Reproducing (AREA)
Abstract
本发明公开了一种基于Linux的IO调度方法,该方法包括以下步骤:通过第一进程监听队列中的读操作;如果第一进程监听到读缓存操作,则向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。应用本发明实施例所提供的技术方案,当存在读缓存操作时,表明在缓存中读取数据,在这种情况下,第二进程启动数据回写入磁盘的操作,不会影响读性能,同时使得缓存中的数据能够及时回写入磁盘,降低数据丢失概率。本发明还公开了一种基于Linux的IO调度装置、设备及存储介质,具有相应技术效果。
The invention discloses a Linux-based IO scheduling method, which includes the following steps: monitoring the read operation in the queue through the first process; if the first process monitors the read cache operation, sending data back to the second process to start writing message to cause the second process to start writing the data back to disk. Applying the technical solution provided by the embodiment of the present invention, when there is a read cache operation, it indicates that the data is read in the cache. In this case, the second process starts the operation of writing data back to the disk without affecting the read performance. At the same time, the data in the cache can be written back to the disk in time, reducing the probability of data loss. The invention also discloses a Linux-based IO scheduling device, equipment and storage medium, which have corresponding technical effects.
Description
技术领域technical field
本发明涉及计算机应用技术领域,特别是涉及基于Linux的IO调度方法、装置、设备及存储介质。The invention relates to the field of computer application technology, in particular to a Linux-based IO scheduling method, device, equipment and storage medium.
背景技术Background technique
随着计算机技术的快速发展,基于Linux的各种应用系统逐渐增多。Linux系统多是使用IO调度算法对进程的磁盘IO操作进行重新排序,公平有效地实现IO调度算法对Linux系统性能的提升有着很大的影响。With the rapid development of computer technology, various application systems based on Linux are gradually increasing. Most Linux systems use the IO scheduling algorithm to reorder the disk IO operations of the process, and the fair and effective implementation of the IO scheduling algorithm has a great impact on the improvement of the performance of the Linux system.
目前,在Linux系统中,常用的IO调度方法为AS(Anticipatory,预期)算法。该算法是在需要读数据时,先从缓存中读数据,缓存中没有待读取的数据时,执行IO操作对磁盘进行读操作;在需要写数据时,先将待写入的数据写入缓存中,等待内存空闲低于阈值时,将数据再回写到磁盘中。Currently, in the Linux system, the commonly used IO scheduling method is the AS (Anticipatory, anticipation) algorithm. The algorithm is to read the data from the cache first when the data needs to be read. When there is no data to be read in the cache, the IO operation is performed to read the disk; when the data needs to be written, the data to be written is written first. In the cache, when the free memory is lower than the threshold, the data is written back to the disk.
这种方法存在一定的缺点,数据写入到缓存中,如果等待较长时间内存空闲仍不低于阈值,使得数据无法回写到磁盘中,可能会导致数据丢失,即数据丢失概率较大。This method has certain disadvantages. After data is written into the cache, if the memory is free after waiting for a long time and still not lower than the threshold, the data cannot be written back to the disk, which may lead to data loss, that is, the probability of data loss is high.
发明内容Contents of the invention
本发明的目的是提供基于Linux的IO调度方法、装置、设备及存储介质,以及时将数据回写入磁盘,降低数据丢失概率。The purpose of the present invention is to provide a Linux-based IO scheduling method, device, equipment, and storage medium, so as to write data back into a disk in time and reduce the probability of data loss.
为解决上述技术问题,本发明提供如下技术方案:In order to solve the above technical problems, the present invention provides the following technical solutions:
一种基于Linux的IO调度方法,包括:A Linux-based IO scheduling method, comprising:
通过第一进程监听队列中的读操作;Monitor the read operations in the queue through the first process;
如果所述第一进程监听到读缓存操作,则向第二进程发送数据回写启动消息,以使所述第二进程启动数据回写入磁盘的操作。If the first process monitors the read cache operation, it sends a data write-back start message to the second process, so that the second process starts an operation of writing data back to the disk.
在本发明的一种具体实施方式中,还包括:In a specific embodiment of the present invention, it also includes:
如果所述第一进程监听到读磁盘操作,则向所述第二进程发送数据回写暂停消息,以使所述第二进程暂停数据回写入磁盘的操作。If the first process detects a disk read operation, it sends a data write-back pause message to the second process, so that the second process suspends the operation of writing data back to the disk.
在本发明的一种具体实施方式中,还包括:In a specific embodiment of the present invention, it also includes:
如果所述第一进程未监听到任何读操作,则向所述第二进程发送所述数据回写启动消息,以使所述第二进程启动数据回写入磁盘的操作。If the first process does not detect any read operation, then send the data write-back start message to the second process, so that the second process starts an operation of writing data back to the disk.
在本发明的一种具体实施方式中,在所述通过第一进程监听队列中的读操作之前,还包括:In a specific implementation manner of the present invention, before the first process monitors the read operation in the queue, it also includes:
在达到设定的时间间隔时启动所述第一进程。The first process is started when a set time interval is reached.
在本发明的一种具体实施方式中,所述通过第一进程监听队列中的读操作,包括:In a specific implementation manner of the present invention, the monitoring of the read operation in the queue by the first process includes:
在预设的监听时长内,通过第一进程监听队列中的读操作。Within the preset monitoring duration, the first process monitors the read operations in the queue.
一种基于Linux的IO调度装置,包括:A Linux-based IO scheduling device, comprising:
监听模块,用于通过第一进程监听队列中的读操作;A monitoring module, configured to monitor the read operations in the queue through the first process;
第一消息发送模块,用于在所述第一进程监听到读缓存操作时,向第二进程发送数据回写启动消息,以使所述第二进程启动数据回写入磁盘的操作。The first message sending module is configured to send a data write-back start message to the second process when the first process detects a read cache operation, so that the second process starts an operation of writing data back to the disk.
在本发明的一种具体实施方式中,还包括:In a specific embodiment of the present invention, it also includes:
第二消息发送模块,用于在所述第一进程监听到读磁盘操作时,向所述第二进程发送数据回写暂停消息,以使所述第二进程暂停数据回写入磁盘的操作。The second message sending module is configured to send a data write-back pause message to the second process when the first process detects a disk read operation, so that the second process suspends the operation of writing data back to the disk.
在本发明的一种具体实施方式中,所述第一消息发送模块,还用于:In a specific implementation manner of the present invention, the first message sending module is also used for:
在所述第一进程未监听到任何读操作时,向所述第二进程发送所述数据回写启动消息,以使所述第二进程启动数据回写入磁盘的操作。When the first process does not detect any read operation, send the data write-back start message to the second process, so that the second process starts an operation of writing data back to the disk.
一种基于Linux的IO调度设备,包括:A Linux-based IO scheduling device, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序时实现上述的基于Linux的IO调度方法的步骤。The processor is configured to implement the steps of the above Linux-based IO scheduling method when executing the computer program.
一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述的基于Linux的IO调度方法的步骤。A computer-readable storage medium, where 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 above-mentioned Linux-based IO scheduling method are implemented.
应用本发明实施例所提供的技术方案,通过第一进程监听队列中的读操作,如果第一进程监听到读缓存操作,则向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。当存在读缓存操作时,表明在缓存中读取数据,在这种情况下,第二进程启动数据回写入磁盘的操作,不会影响读性能,同时使得缓存中的数据能够及时回写入磁盘,降低数据丢失概率。Applying the technical solution provided by the embodiment of the present invention, the first process monitors the read operation in the queue, and if the first process monitors the read cache operation, it sends a data write-back start message to the second process, so that the second process starts The operation of writing data back to disk. When there is a read cache operation, it indicates that the data is read in the cache. In this case, the second process starts the operation of writing the data back to the disk, which will not affect the read performance, and at the same time, the data in the cache can be written back in time disk, reducing the probability of data loss.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本发明实施例中基于Linux的IO调度方法的一种实施流程图;Fig. 1 is a kind of implementation flowchart of the IO scheduling method based on Linux in the embodiment of the present invention;
图2为本发明实施例中基于Linux的IO调度方法的另一种实施流程图;Fig. 2 is another implementation flowchart of the IO scheduling method based on Linux in the embodiment of the present invention;
图3为本发明实施例中基于Linux的IO调度过程的示意图;Fig. 3 is the schematic diagram of the IO scheduling process based on Linux in the embodiment of the present invention;
图4为本发明实施例中一种基于Linux的IO调度装置的结构示意图;4 is a schematic structural diagram of a Linux-based IO scheduling device in an embodiment of the present invention;
图5为本发明实施例中一种基于Linux的IO调度设备的结构示意图。FIG. 5 is a schematic structural diagram of a Linux-based IO scheduling device in an embodiment of the present invention.
具体实施方式detailed description
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to enable those skilled in the art 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. Apparently, the described embodiments are only some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.
参见图1所示,为本发明实施例所提供的一种基于Linux的IO调度方法的实施流程图,该方法可以包括以下步骤:Referring to Fig. 1, it is an implementation flowchart of a Linux-based IO scheduling method provided by an embodiment of the present invention, the method may include the following steps:
S110:通过第一进程监听队列中的读操作。S110: Monitor the read operation in the queue by the first process.
在实际应用中,用户或者其他系统可以对Linux系统中的数据进行读写操作。读操作或写操作的请求可以分别存入到各自队列中。在本发明实施例中,可以通过第一进程监听队列中的读操作。In practical applications, users or other systems can read and write data in the Linux system. Requests for read or write operations can be placed in their respective queues. In the embodiment of the present invention, the read operation in the queue may be monitored by the first process.
S120:如果第一进程监听到读缓存操作,则向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。S120: If the first process monitors the read cache operation, send a data write-back start message to the second process, so that the second process starts an operation of writing data back to the disk.
在Linux系统中,如果缓存有待读取的目标数据,则可以从缓存中直接读取目标数据,从缓存中直接读取目标数据的操作可称为读缓存操作。在第一进程监听队列中的读操作的过程中,如果第一进程监听到读缓存操作,则表明当前读操作为从缓存中读取数据的操作,不涉及从磁盘中读取数据的操作,在这种情况下,第一进程可以与第二进程通信,向第二进程发送数据回写启动消息,第二进程接收到数据回写启动消息后,可以启动数据回写入磁盘的操作。In the Linux system, if there is target data to be read in the cache, the target data can be directly read from the cache, and the operation of directly reading the target data from the cache can be called a read cache operation. In the process of the first process monitoring the read operation in the queue, if the first process monitors the read cache operation, it indicates that the current read operation is an operation of reading data from the cache, and does not involve the operation of reading data from the disk. In this case, the first process can communicate with the second process, and send a data write-back start message to the second process, and after receiving the data write-back start message, the second process can start the operation of writing data back to the disk.
因为此时是在缓存中读取数据,在第二进程进行数据回写入磁盘的操作的过程中,不会影响读性能,而且可以使得第二进程可以尽快将缓存中的数据回写入磁盘,降低数据回写时数据丢失的概率。Because the data is read in the cache at this time, the read performance will not be affected when the second process writes the data back to the disk, and the second process can write the data in the cache back to the disk as soon as possible. , to reduce the probability of data loss when data is written back.
应用本发明实施例所提供的方法,通过第一进程监听队列中的读操作,如果第一进程监听到读缓存操作,则向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。当存在读缓存操作时,表明在缓存中读取数据,在这种情况下,第二进程启动数据回写入磁盘的操作,不会影响读性能,同时使得缓存中的数据能够及时回写入磁盘,降低数据丢失概率。Applying the method provided by the embodiment of the present invention, the first process monitors the read operation in the queue, and if the first process monitors the read cache operation, then sends a data write-back start message to the second process, so that the second process starts the data Operations written back to disk. When there is a read cache operation, it indicates that the data is read in the cache. In this case, the second process starts the operation of writing the data back to the disk, which will not affect the read performance, and at the same time, the data in the cache can be written back in time disk, reducing the probability of data loss.
在本发明的一个实施例中,如图2所示,该方法还可以包括以下步骤:In one embodiment of the present invention, as shown in Figure 2, the method may also include the following steps:
S130:如果第一进程监听到读磁盘操作,则向第二进程发送数据回写暂停消息,以使第二进程暂停数据回写入磁盘的操作。S130: If the first process detects a disk read operation, send a data write-back pause message to the second process, so that the second process suspends the operation of writing data back to the disk.
在实际应用中,如果缓存中没有待读取的目标数据,则可以从磁盘中直接读取目标数据,从磁盘中直接读取目标数据的操作可称为读磁盘操作。在第一进程监听队列中的读操作的过程中,如果第一进程监听到读磁盘操作,则表明当前读操作为从磁盘中读取数据的操作,在这种情况下,第一进程可以与第二进程通信,向第二进程发送数据回写暂停消息,第二进程接收到数据回写暂停消息后,可以暂停数据回写入磁盘的操作。In practical applications, if there is no target data to be read in the cache, the target data may be directly read from the disk, and the operation of directly reading the target data from the disk may be called a disk read operation. In the process of the first process listening to the read operation in the queue, if the first process monitors the read disk operation, it indicates that the current read operation is an operation of reading data from the disk. In this case, the first process can communicate with The second process communicates and sends a data write-back suspend message to the second process. After receiving the data write-back suspend message, the second process can suspend the operation of writing data back to the disk.
在磁盘中读取数据的过程中,如果第二进程仍进行数据回写入磁盘的操作,则将会影响读性能和写性能,数据回写时数据丢失的概率也将增大。应用本发明实施例所提供的方法,在第一进程监听到读磁盘操作时,向第二进程发送数据回写暂停消息,第二进程暂停数据回写入磁盘的操作,可以避免影响读性能和写性能,降低数据回写时数据丢失概率。During the process of reading data from the disk, if the second process still performs the operation of writing data back to the disk, the read performance and write performance will be affected, and the probability of data loss during data write-back will also increase. Applying the method provided by the embodiment of the present invention, when the first process monitors the disk read operation, it sends a data write-back pause message to the second process, and the second process suspends the operation of writing data back to the disk, which can avoid affecting the read performance and Write performance, reducing the probability of data loss when data is written back.
在本发明的另一个实施例中,如图2所示,该方法还可以包括以下步骤:In another embodiment of the present invention, as shown in Figure 2, the method may also include the following steps:
S140:如果第一进程未监听到任何读操作,则向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。S140: If the first process does not detect any read operation, send a data write-back start message to the second process, so that the second process starts an operation of writing data back to the disk.
在实际应用中,当前队列中可能没有任何读操作,即既没有读缓存操作也没有读磁盘操作。当第一进程未监听到任何读操作时,第一进程可以与第二进程通信,向第二进程发送数据回写启动消息,第二进程接收到数据回写启动消息后,可以启动数据回写入磁盘的操作。这样可以及时将缓存中数据回写入磁盘,降低数据回写时的数据丢失概率。In practical applications, there may not be any read operations in the current queue, that is, neither read cache operations nor disk read operations. When the first process does not monitor any read operation, the first process can communicate with the second process and send a data write-back start message to the second process, and the second process can start data write-back after receiving the data write-back start message operation to disk. In this way, the data in the cache can be written back to the disk in time, reducing the probability of data loss when the data is written back.
在本发明的一个实施例中,在步骤S110之前,该方法还可以包括以下步骤:In one embodiment of the present invention, before step S110, the method may further include the following steps:
在达到设定的时间间隔时启动第一进程。The first process is started when a set time interval is reached.
在本发明实施例中,可以设定一定的时间间隔,在达到设定的时间间隔时启动第一进程,通过第一进程监听队列中的读操作。In the embodiment of the present invention, a certain time interval may be set, and when the set time interval is reached, the first process is started, and the read operation in the queue is monitored by the first process.
时间间隔可以根据实际情况进行设定和调整,如设定为1秒、1分钟等,本发明实施例对此不做限制。The time interval can be set and adjusted according to actual conditions, for example, set to 1 second, 1 minute, etc., which is not limited in this embodiment of the present invention.
在本发明的一个实施例中,步骤S110可以包括以下步骤:In one embodiment of the present invention, step S110 may include the following steps:
在预设的监听时长内,通过第一进程监听队列中的读操作。Within the preset monitoring duration, the first process monitors the read operations in the queue.
在本发明实施例中,可以设定一定的监听时长。在预设的监听时长内,通过第一进程监听队列中的读操作。In the embodiment of the present invention, a certain listening duration can be set. Within the preset monitoring duration, the first process monitors the read operations in the queue.
监听时长可以根据实际情况或上述时间间隔进行设定和调整,如设定为1毫秒、1秒、1分钟等,本发明实施例对此不做限制。The monitoring duration can be set and adjusted according to the actual situation or the above time interval, for example, 1 millisecond, 1 second, 1 minute, etc., which is not limited in the embodiment of the present invention.
为便于理解,以图3所示的IO调度过程为例对本发明实施例所提供的技术方案进行具体说明。For ease of understanding, the technical solution provided by the embodiment of the present invention will be specifically described by taking the IO scheduling process shown in FIG. 3 as an example.
(1)启动的第一进程P1负责监听T时间点内队列中的读操作,第二进程P2负责数据回写。Tn到Tn+1的时间间隔可根据实际情况进行设定,可以是1毫秒、1秒或1分钟等。n=0、1、2、3、……。(1) The first process P1 started is responsible for monitoring the read operations in the queue at time T, and the second process P2 is responsible for data write-back. The time interval from Tn to Tn+1 can be set according to actual conditions, and can be 1 millisecond, 1 second, or 1 minute. n=0, 1, 2, 3, . . .
(2)当P1监听到读缓存操作时,知会P2进行数据回写入磁盘的操作;当P1监听到读磁盘操作时,知会P2暂停数据回写入磁盘的操作。(2) When P1 listens to the read cache operation, it notifies P2 to write data back to the disk; when P1 listens to the disk read operation, it notifies P2 to suspend the operation of writing data back to the disk.
(3)在T0~T1时间段:P1监听到只进行了读缓存操作,知会P2启动数据回写入磁盘的操作。(3) During the time period T0-T1: P1 detects that only the read cache operation is performed, and notifies P2 to start the operation of writing data back to the disk.
(4)在T1~T2时间段:P1监听到系统进行读缓存和数据回写操作。(4) During the time period T1-T2: P1 detects that the system performs read cache and data write-back operations.
(5)在T2~T3时间段:P1监听到系统进行了读磁盘操作,知会P2暂停数据回写入磁盘的操作。(5) During the time period from T2 to T3: P1 detects that the system has performed a disk read operation, and informs P2 to suspend the operation of writing data back to the disk.
(6)在T3~T4时间段:P1监听到系统未做任何读操作,知会P2启动数据回写入磁盘的操作。(6) During the time period T3-T4: P1 detects that the system does not perform any read operation, and informs P2 to start the operation of writing data back to the disk.
应用本发明实施例所提供的方法,可以提升读性能及写数据的完整性。通过监听读操作,控制数据回写的时间,确保读性能不受影响,同时可以使得数据能够及时回写到磁盘中,降低数据丢失的概率。By applying the method provided by the embodiment of the present invention, the read performance and the integrity of the written data can be improved. By monitoring the read operation, the data write-back time is controlled to ensure that the read performance is not affected, and at the same time, the data can be written back to the disk in time to reduce the probability of data loss.
相应于上面的方法实施例,本发明实施例还提供了一种基于Linux的IO调度装置,下文描述的一种基于Linux的IO调度装置与上文描述的一种基于Linux的IO调度方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present invention also provides a Linux-based IO scheduling device, a Linux-based IO scheduling device described below and a Linux-based IO scheduling method described above can be mutually Corresponding reference.
参见图4所示,该装置可以包括以下模块:Referring to Figure 4, the device can include the following modules:
监听模块410,用于通过第一进程监听队列中的读操作;A monitoring module 410, configured to monitor the read operations in the queue through the first process;
第一消息发送模块420,用于在第一进程监听到读缓存操作时,向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。The first message sending module 420 is configured to send a data write-back start message to the second process when the first process detects the read cache operation, so that the second process starts the operation of writing data back to the disk.
应用本发明实施例所提供的装置,通过第一进程监听队列中的读操作,如果第一进程监听到读缓存操作,则向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。当存在读缓存操作时,表明在缓存中读取数据,在这种情况下,第二进程启动数据回写入磁盘的操作,不会影响读性能,同时使得缓存中的数据能够及时回写入磁盘,降低数据丢失概率。Applying the device provided by the embodiment of the present invention, the first process monitors the read operation in the queue, and if the first process monitors the read cache operation, it sends a data write-back start message to the second process, so that the second process starts the data Operations written back to disk. When there is a read cache operation, it indicates that the data is read in the cache. In this case, the second process starts the operation of writing the data back to the disk, which will not affect the read performance, and at the same time, the data in the cache can be written back in time disk, reducing the probability of data loss.
在本发明的一种具体实施方式中,还包括:In a specific embodiment of the present invention, it also includes:
第二消息发送模块,用于在第一进程监听到读磁盘操作时,向第二进程发送数据回写暂停消息,以使第二进程暂停数据回写入磁盘的操作。The second message sending module is configured to send a data write-back suspension message to the second process when the first process detects a disk read operation, so that the second process suspends the operation of writing data back to the disk.
在本发明的一种具体实施方式中,第一消息发送模块420,还用于:In a specific implementation manner of the present invention, the first message sending module 420 is also used for:
在第一进程未监听到任何读操作时,向第二进程发送数据回写启动消息,以使第二进程启动数据回写入磁盘的操作。When the first process does not monitor any read operation, a data write-back start message is sent to the second process, so that the second process starts an operation of writing data back to the disk.
在本发明的一种具体实施方式中,还包括进程启动模块,用于:In a specific embodiment of the present invention, it also includes a process starting module, which is used for:
在通过第一进程监听队列中的读操作之前,在达到设定的时间间隔时启动第一进程。Before the read operation in the queue is monitored by the first process, the first process is started when a set time interval is reached.
在本发明的一种具体实施方式中,监听模块410,具体用于:In a specific implementation manner of the present invention, the monitoring module 410 is specifically used for:
在预设的监听时长内,通过第一进程监听队列中的读操作。Within the preset monitoring duration, the first process monitors the read operations in the queue.
相应于上面的方法实施例,本发明实施例还提供了一种基于Linux的IO调度设备,下文描述的一种基于Linux的IO调度设备与上文描述的一种基于Linux的IO调度方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present invention also provides a Linux-based IO scheduling device, a Linux-based IO scheduling device described below and a Linux-based IO scheduling method described above can interact with each other Corresponding reference.
参见图5所示,该设备包括:Referring to Figure 5, the device includes:
存储器510,用于存储计算机程序;memory 510, for storing computer programs;
处理器520,用于执行计算机程序时实现上述的基于Linux的IO调度方法的步骤。The processor 520 is configured to implement the steps of the above Linux-based IO scheduling method when executing the computer program.
相应于上面的方法实施例,本发明实施例还提供了一种计算机可读存储介质,下文描述的一种计算机可读存储介质与上文描述的一种基于Linux的IO调度方法可相互对应参照。Corresponding to the above method embodiment, the embodiment of the present invention also provides a computer-readable storage medium, a computer-readable storage medium described below and a Linux-based IO scheduling method described above can be referred to each other .
一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述的基于Linux的IO调度方法的步骤。A computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned Linux-based IO scheduling method are implemented.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same or similar parts of each embodiment can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and for the related part, please refer to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals can further realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software or a combination of the two. In order to clearly illustrate the possible For interchangeability, in the above description, the composition and steps of each example have been generally described according to their functions. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be directly implemented by hardware, software modules executed by a processor, or a combination of both. Software modules can be placed in 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 Any other known storage medium.
本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的技术方案及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。In this paper, specific examples are used to illustrate the principles and implementation methods of the present invention, and the descriptions of the above embodiments are only used to help understand the technical solutions and core ideas of the present invention. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, some improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710884154.5A CN107728939A (en) | 2017-09-26 | 2017-09-26 | I O scheduling method, apparatus, equipment and storage medium based on Linux |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710884154.5A CN107728939A (en) | 2017-09-26 | 2017-09-26 | I O scheduling method, apparatus, equipment and storage medium based on Linux |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN107728939A true CN107728939A (en) | 2018-02-23 |
Family
ID=61207428
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710884154.5A Pending CN107728939A (en) | 2017-09-26 | 2017-09-26 | I O scheduling method, apparatus, equipment and storage medium based on Linux |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN107728939A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110543384A (en) * | 2019-09-05 | 2019-12-06 | Oppo广东移动通信有限公司 | Memory write-back method, device, terminal and storage medium |
| WO2021109703A1 (en) * | 2019-12-05 | 2021-06-10 | 腾讯科技(深圳)有限公司 | Data processing method, chip, apparatus, and storage medium |
Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030233392A1 (en) * | 2002-06-12 | 2003-12-18 | Microsoft Corporation | Method and system for managing the execution of threads and the processing of data |
| CN101122888A (en) * | 2006-08-09 | 2008-02-13 | 国际商业机器公司 | Method and system for writing and reading application data |
| CN101699413B (en) * | 2009-10-30 | 2011-12-07 | 成都市华为赛门铁克科技有限公司 | Hard disk data read-write control method, device and data storage system |
| CN103399856A (en) * | 2013-07-01 | 2013-11-20 | 北京科东电力控制系统有限责任公司 | Explosive type data caching and processing system for SCADA system and method thereof |
| CN103678573A (en) * | 2013-12-09 | 2014-03-26 | 浪潮(北京)电子信息产业有限公司 | Method and system for achieving cache acceleration |
| CN103729313A (en) * | 2012-10-11 | 2014-04-16 | 苏州捷泰科信息技术有限公司 | Method and device for controlling input and output flow of SSD cache |
| CN105183666A (en) * | 2015-09-14 | 2015-12-23 | 浪潮(北京)电子信息产业有限公司 | Scheduling control method, device and system |
| CN105843559A (en) * | 2016-03-28 | 2016-08-10 | 乐视控股(北京)有限公司 | Read-write optimization method and system of disk cache system |
-
2017
- 2017-09-26 CN CN201710884154.5A patent/CN107728939A/en active Pending
Patent Citations (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20030233392A1 (en) * | 2002-06-12 | 2003-12-18 | Microsoft Corporation | Method and system for managing the execution of threads and the processing of data |
| CN101122888A (en) * | 2006-08-09 | 2008-02-13 | 国际商业机器公司 | Method and system for writing and reading application data |
| CN101699413B (en) * | 2009-10-30 | 2011-12-07 | 成都市华为赛门铁克科技有限公司 | Hard disk data read-write control method, device and data storage system |
| CN103729313A (en) * | 2012-10-11 | 2014-04-16 | 苏州捷泰科信息技术有限公司 | Method and device for controlling input and output flow of SSD cache |
| CN103399856A (en) * | 2013-07-01 | 2013-11-20 | 北京科东电力控制系统有限责任公司 | Explosive type data caching and processing system for SCADA system and method thereof |
| CN103678573A (en) * | 2013-12-09 | 2014-03-26 | 浪潮(北京)电子信息产业有限公司 | Method and system for achieving cache acceleration |
| CN105183666A (en) * | 2015-09-14 | 2015-12-23 | 浪潮(北京)电子信息产业有限公司 | Scheduling control method, device and system |
| CN105843559A (en) * | 2016-03-28 | 2016-08-10 | 乐视控股(北京)有限公司 | Read-write optimization method and system of disk cache system |
Non-Patent Citations (3)
| Title |
|---|
| XIAO LING ET AL.: "Efficient Disk I/O Scheduling with Qos Guarantee for Xen-based Hosting Platforms", 《2012 12TH IEEE/ACM INTERNATIONAL SYMPOSIUM ON CLUSTER,CLOUD AND GRID COMPUTING》 * |
| 胡鹏 等: "Linux文件服务器单线程和多线程架构的性能研究", 《微型电脑应用》 * |
| 郝瑞君 等: "一种基于多队列的固态盘I/O调度算法", 《计算机研究与发展》 * |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN110543384A (en) * | 2019-09-05 | 2019-12-06 | Oppo广东移动通信有限公司 | Memory write-back method, device, terminal and storage medium |
| CN110543384B (en) * | 2019-09-05 | 2022-05-17 | Oppo广东移动通信有限公司 | Memory write-back method, device, terminal and storage medium |
| WO2021109703A1 (en) * | 2019-12-05 | 2021-06-10 | 腾讯科技(深圳)有限公司 | Data processing method, chip, apparatus, and storage medium |
| US12174746B2 (en) | 2019-12-05 | 2024-12-24 | Tencent Technology (Shenzhen) Company Limited | Data processing method and chip, device, and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102722233B (en) | Control device and control method | |
| CN110019502B (en) | Synchronization method between primary database and backup database, database system and device | |
| US8433833B2 (en) | Dynamic reassignment for I/O transfers using a completion queue | |
| CN107491355A (en) | Funcall method and device between a kind of process based on shared drive | |
| US20150134925A1 (en) | Granting and revoking supplemental memory allocation requests | |
| CN110764953A (en) | Data recovery method, device and equipment and readable storage medium | |
| CN107678918A (en) | The OSD heartbeat mechanisms method to set up and device of a kind of distributed file system | |
| CN111177032A (en) | Cache space application method, system, device and computer readable storage medium | |
| CN108139955A (en) | For providing the system and method for the Wrong control independently of operating system in computing device | |
| CN111722800A (en) | A ROW snapshot implementation method and related components of a distributed storage system | |
| CN107391050A (en) | A kind of data migration method, system, device and computer-readable recording medium | |
| CN106293523A (en) | A kind of I/O Request response method to non-volatile memories and device | |
| CN107728939A (en) | I O scheduling method, apparatus, equipment and storage medium based on Linux | |
| CN116932194A (en) | Thread execution method, thread execution device, electronic equipment and computer readable storage medium | |
| CN111459634B (en) | Task scheduling method, device, terminal and storage medium | |
| CN107180118A (en) | A kind of file system cache data managing method and device | |
| CN115168052B (en) | Self-adaptive memory reclamation control method, device, terminal and storage medium | |
| CN107391283A (en) | A kind of message treatment method and device | |
| CN111261206A (en) | A kind of reading and writing method, apparatus and electronic equipment and readable storage medium | |
| CN115914127A (en) | Message processing method, computer-readable storage medium, and message processing apparatus | |
| CN108363629B (en) | Method, medium, apparatus and computing device for instant messaging | |
| CN112540880B (en) | A method, device and electronic device for quickly shielding faulty graphics cards in a cluster | |
| WO2025246542A1 (en) | Request processing method and apparatus, device, and storage medium | |
| EP3396553A1 (en) | Method and device for processing data after restart of node | |
| CN107506500A (en) | The control method and relevant apparatus of a kind of Data Migration |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| RJ01 | Rejection of invention patent application after publication | ||
| RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180223 |