[go: up one dir, main page]

CN106547478A - The I/O throughput monitoring method of process and device - Google Patents

The I/O throughput monitoring method of process and device Download PDF

Info

Publication number
CN106547478A
CN106547478A CN201510614361.XA CN201510614361A CN106547478A CN 106547478 A CN106547478 A CN 106547478A CN 201510614361 A CN201510614361 A CN 201510614361A CN 106547478 A CN106547478 A CN 106547478A
Authority
CN
China
Prior art keywords
throughput
total
moment
time
real
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
Application number
CN201510614361.XA
Other languages
Chinese (zh)
Inventor
刘臻
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510614361.XA priority Critical patent/CN106547478A/en
Publication of CN106547478A publication Critical patent/CN106547478A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种进程的IO吞吐量监控方法和装置,涉及计算机领域。所述方法包括:获取各目标服务的进程标识;根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。本发明可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况。

The invention discloses a process IO throughput monitoring method and device, and relates to the field of computers. The method includes: obtaining the process identification of each target service; according to each process identification, obtaining the total IO throughput from the IO instance file corresponding to each process identification in the system kernel file every predetermined time; according to the current corresponding to each target service The total IO throughput corresponding to the acquisition time and the total IO throughput of at least one acquisition time before the current acquisition time are calculated to calculate the real-time IO throughput of each target service. The invention can monitor the access situation of each target service to the disk, and can flexibly monitor the respective access situations of the target service for reading and writing to the disk.

Description

进程的IO吞吐量监控方法和装置Process IO throughput monitoring method and device

技术领域technical field

本发明涉及计算机领域,具体涉及一种进程的IO吞吐量监控方法和装置。The invention relates to the field of computers, in particular to a process IO throughput monitoring method and device.

背景技术Background technique

IOPS(Input/Output Per Second,每秒的输入输出量),是衡量磁盘性能的主要指标之一。IOPS是指单位时间内系统能处理的I/O请求数量,一般以每秒处理的I/O请求数量为单位,I/O请求通常为读或写数据操作请求,IOPS可以理解为IO的吞吐量。IOPS (Input/Output Per Second, input and output per second) is one of the main indicators to measure disk performance. IOPS refers to the number of I/O requests that the system can process per unit time. Generally, the number of I/O requests processed per second is taken as the unit. I/O requests are usually read or write data operation requests. IOPS can be understood as IO throughput quantity.

目前,对于IOPS的监控都是针对磁盘的整体的IO吞吐量进行监控,其包括了所有进程对磁盘的读写操作所产生的IO吞吐量。比如iostat命令获取的磁盘的IO吞吐量,就为该磁盘的IO吞吐量,其无法知晓具体哪个服务的IO吞吐量情况,无法对目标服务进行监控。At present, the monitoring of IOPS is all about monitoring the overall IO throughput of the disk, which includes the IO throughput generated by all processes reading and writing to the disk. For example, the IO throughput of the disk obtained by the iostat command is the IO throughput of the disk. It cannot know the IO throughput of the specific service and cannot monitor the target service.

发明内容Contents of the invention

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的进程的IO吞吐量监控装置和相应的进程的IO吞吐量监控方法。In view of the above problems, the present invention is proposed to provide a process IO throughput monitoring device and a corresponding process IO throughput monitoring method that overcome the above problems or at least partially solve the above problems.

依据本发明的一个方面,提供了一种进程的IO吞吐量监控方法,包括:According to one aspect of the present invention, a method for monitoring IO throughput of a process is provided, including:

获取各目标服务的进程标识;Obtain the process identification of each target service;

根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;According to each process identification, the total IO throughput is obtained from the IO instance file corresponding to each process identification in the system kernel file every predetermined time;

根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。The real-time IO throughput of each target service is calculated according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time.

优选地,所述根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量,包括:Preferably, according to each process identification, the IO total throughput is obtained from the IO instance file corresponding to each process identification in the system kernel file every predetermined time, including:

每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识;Obtain the IO instance file corresponding to each process identifier from the system kernel file path /proc/$pid/io every predetermined time; wherein the pid is the process identifier;

从所述IO实例文件中,提取相应时刻的IO总吞吐量。From the IO instance file, the total IO throughput at the corresponding moment is extracted.

优选地,所述根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,包括:Preferably, the calculation of the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition moment corresponding to each target service, and the total IO throughput of at least one acquisition moment before the current acquisition moment includes:

针对各个目标服务,将当前获取时刻对应的IO总吞吐量,减去当前获取时刻的前一个获取时刻的IO总吞吐量,以获得各个目标服务的实时IO吞吐量。For each target service, the total IO throughput corresponding to the current acquisition time is subtracted from the total IO throughput of the previous acquisition time at the current acquisition time to obtain the real-time IO throughput of each target service.

优选地,所述根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,包括:Preferably, the calculation of the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition moment corresponding to each target service, and the total IO throughput of at least one acquisition moment before the current acquisition moment includes:

针对各个目标服务,对于每个获取时刻,将所述获取时刻对应的IO总吞吐量,减去所述获取时刻前一个获取时刻的IO总吞吐量,得到第一IO吞吐量;For each target service, for each acquisition moment, the IO total throughput corresponding to the acquisition moment is subtracted from the IO total throughput at the previous acquisition moment to obtain the first IO throughput;

对于当前获取时刻,将从当前获取时刻起,最近的至少两个第一IO吞吐量进行加权计算,以获得各个目标服务的实时IO吞吐量。For the current acquisition moment, at least two recent first IO throughputs from the current acquisition moment are weighted to obtain the real-time IO throughput of each target service.

优选地,从所述IO实例文件中,提取相应时刻的IO总吞吐量,包括:Preferably, from the IO instance file, the total IO throughput at the corresponding moment is extracted, including:

从所述IO实例文件的syscr字段中提取总的IO读次数,和/或从所述IO实例文件的syscw字段中提取总的IO写次数;Extract the total IO read times from the syscr field of the IO instance file, and/or extract the total IO write times from the syscw field of the IO instance file;

将所述IO读次数作为IO总吞吐量,或者将所述IO写次数作为IO总吞吐量,或者将所述IO读次数与IO写次数之和作为IO总吞吐量。The number of IO reads is taken as the total IO throughput, or the number of IO writes is taken as the total IO throughput, or the sum of the number of IO reads and the number of IO writes is taken as the total IO throughput.

优选地,在根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量之后,还包括:Preferably, after calculating the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition moment corresponding to each target service, and the total IO throughput of at least one acquisition moment before the current acquisition moment, it also includes:

将各个目标服务按照实时IO吞吐量大小进行排序。Sort each target service according to the real-time IO throughput.

优选地,在根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量之后,还包括:Preferably, after calculating the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition moment corresponding to each target service, and the total IO throughput of at least one acquisition moment before the current acquisition moment, it also includes:

针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值;如果所述IO吞吐量超过阈值,则调用报警接口对所述目标服务进行报警。For the real-time IO throughput of each target service, it is judged whether the IO throughput exceeds the threshold; if the IO throughput exceeds the threshold, an alarm interface is called to alarm the target service.

依据本发明的另外一个方面,本发明还公开了一种进程的IO吞吐量监控装置,包括:According to another aspect of the present invention, the present invention also discloses a process IO throughput monitoring device, including:

进程标识获取模块,适于获取各目标服务的进程标识;A process identification acquisition module, adapted to obtain the process identification of each target service;

IO总吞吐量获取模块,适于根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;The IO total throughput acquisition module is adapted to obtain the IO total throughput from the IO instance file corresponding to each process identification in the system kernel file at predetermined intervals according to each process identification;

实时IO吞吐量计算模块,适于根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。The real-time IO throughput calculation module is adapted to calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time .

优选地,所述IO总吞吐量获取模块,包括:Preferably, the IO total throughput acquisition module includes:

IO实例文件获取子模块,适于每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识;The IO instance file acquisition submodule is adapted to obtain the IO instance file corresponding to each process identifier from the system kernel file path /proc/$pid/io at predetermined intervals; wherein the pid is the process identifier;

IO总吞吐量获取子模块,适于从所述IO实例文件中,提取相应时刻的IO总吞吐量。The total IO throughput acquisition sub-module is adapted to extract the total IO throughput at a corresponding moment from the IO instance file.

优选地,所述实时IO吞吐量计算模块,包括:Preferably, the real-time IO throughput calculation module includes:

第一实时IO吞吐量计算子模块,适于针对各个目标服务,将当前获取时刻对应的IO总吞吐量,减去当前获取时刻的前一个获取时刻的IO总吞吐量,以获得各个目标服务的实时IO吞吐量。The first real-time IO throughput calculation submodule is adapted to subtract the IO total throughput corresponding to the current acquisition moment from the IO total throughput at the previous acquisition moment of the current acquisition moment for each target service to obtain the IO throughput of each target service Real-time IO throughput.

优选地,所述实时IO吞吐量计算模块,包括:Preferably, the real-time IO throughput calculation module includes:

独立IO吞吐量计算子模块,适于针对各个目标服务,对于每个获取时刻,将所述获取时刻对应的IO总吞吐量,减去所述获取时刻前一个获取时刻的IO总吞吐量,得到第一IO吞吐量;The independent IO throughput calculation sub-module is suitable for each target service. For each acquisition moment, the total IO throughput corresponding to the acquisition moment is subtracted from the IO total throughput of the acquisition moment before the acquisition moment to obtain The first IO throughput;

第二实时IO吞吐量计算子模块,适于对于当前获取时刻,将从当前获取时刻起,最近的至少两个第一IO吞吐量进行加权计算,以获得各个目标服务的实时IO吞吐量。The second real-time IO throughput calculation sub-module is adapted to perform weighted calculation on at least two recent first IO throughputs from the current acquisition moment to obtain the real-time IO throughput of each target service.

优选地,所述IO总吞吐量获取子模块,包括:Preferably, the IO total throughput acquisition submodule includes:

次数提取模块,适于从所述IO实例文件的syscr字段中提取总的IO读次数,和/或从所述IO实例文件的syscw字段中提取总的IO写次数;The times extraction module is adapted to extract the total IO read times from the syscr field of the IO instance file, and/or extract the total IO write times from the syscw field of the IO instance file;

吞吐量确认模块,适于将所述IO读次数作为IO总吞吐量,或者将所述IO写次数作为IO总吞吐量,或者将所述IO读次数与IO写次数之和作为IO总吞吐量。The throughput confirmation module is adapted to use the IO read times as the total IO throughput, or use the IO write times as the IO total throughput, or use the sum of the IO read times and the IO write times as the IO total throughput .

优选地,在实时IO吞吐量计算模块之后,还包括:Preferably, after the real-time IO throughput calculation module, it also includes:

排序模块,适于将各个目标服务按照实时IO吞吐量大小进行排序。The sorting module is adapted to sort each target service according to the real-time IO throughput.

优选地,在实时IO吞吐量计算模块之后,还包括:Preferably, after the real-time IO throughput calculation module, it also includes:

报警模块,适于针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值;如果所述IO吞吐量超过阈值,则调用报警接口对所述目标服务进行报警。The alarm module is adapted to judge whether the IO throughput exceeds a threshold for the real-time IO throughput of each target service; if the IO throughput exceeds the threshold, call an alarm interface to alarm the target service.

根据本发明的进程的IO吞吐量监控方法和装置,可获取各目标服务的进程标识,根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量,然后根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,比如对于服务A,当前获取时刻的总IO吞吐量为10000次读,前一获取时刻的总IO吞吐量为9500次读,那么对应当前获取时刻的实时的IO吞吐量就可以为10000-9500=500次,由此解决了在先技术无法针对具体的某个目标服务,无法监控该服务的实时IO吞吐量的问题,取得了可以对具体的目标服务,监控其实时IO吞吐量,方便后续对该目标服务进行管控的有益效果。According to the IO throughput monitoring method and device of the process of the present invention, the process identification of each target service can be obtained, and according to each process identification, every predetermined time, the IO total is obtained from the IO instance file corresponding to each process identification in the system kernel file. Throughput, and then calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time, for example, for service A , the total IO throughput at the current acquisition time is 10000 reads, and the total IO throughput at the previous acquisition time is 9500 reads, then the real-time IO throughput corresponding to the current acquisition time can be 10000-9500=500 times, by This solves the problem that the prior technology cannot target a specific target service and monitor the real-time IO throughput of the service, and achieves the ability to monitor the real-time IO throughput of a specific target service to facilitate subsequent monitoring of the target service. Beneficial effects of control.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same parts. In the attached picture:

图1示出了根据本发明一个实施例的一种进程的IO吞吐量监控方法的流程示意图;FIG. 1 shows a schematic flow diagram of a process IO throughput monitoring method according to an embodiment of the present invention;

图2示出了根据本发明另一个实施例的一种进程的IO吞吐量监控方法的流程示意图;FIG. 2 shows a schematic flow diagram of a process IO throughput monitoring method according to another embodiment of the present invention;

图3示出了根据本发明另一个实施例的一种进程的IO吞吐量监控方法的流程示意图;FIG. 3 shows a schematic flow diagram of a process IO throughput monitoring method according to another embodiment of the present invention;

图4示出了根据本发明另一个实施例的一种进程的IO吞吐量监控方法的流程示意图;FIG. 4 shows a schematic flow diagram of a process IO throughput monitoring method according to another embodiment of the present invention;

图5示出了根据本发明一个实施例的一种进程的IO吞吐量监控装置的结构示意图;FIG. 5 shows a schematic structural diagram of an apparatus for monitoring IO throughput of a process according to an embodiment of the present invention;

图6示出了根据本发明另一个实施例的一种进程的IO吞吐量监控装置的结构示意图;FIG. 6 shows a schematic structural diagram of an apparatus for monitoring IO throughput of a process according to another embodiment of the present invention;

图7示出了根据本发明另一个实施例的一种进程的IO吞吐量监控装置的结构示意图;FIG. 7 shows a schematic structural diagram of an apparatus for monitoring IO throughput of a process according to another embodiment of the present invention;

图8示出了根据本发明另一个实施例的一种进程的IO吞吐量监控装置的结构示意图。Fig. 8 shows a schematic structural diagram of an apparatus for monitoring IO throughput of a process according to another embodiment of the present invention.

具体实施方式detailed description

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

实施例一Embodiment one

参照图1,其示出了一种进程的IO吞吐量监控方法的流程示意图,具体可以包括:Referring to FIG. 1 , it shows a schematic flow diagram of a process IO throughput monitoring method, which may specifically include:

步骤110,获取各目标服务的进程标识。Step 110, obtain the process identification of each target service.

对于计算机系统而言,服务本身即是一个进程。而本发明实施例在一个服务器中可能会设置多个服务,以处理不同应用的请求,为不同的业务提供支持,可以理解为本发明的服务器为一个单机多实体的服务器,每个实体是一个服务。For a computer system, a service itself is a process. However, in the embodiment of the present invention, multiple services may be set in one server to handle requests from different applications and provide support for different businesses. It can be understood that the server of the present invention is a single-machine multi-entity server, and each entity is a Serve.

在本发明实施例中,可以获取服务器中启动的各个目标服务的进程标识,在实际应用中该进程标识为pid。In the embodiment of the present invention, the process identification of each target service started in the server can be obtained, and the process identification is pid in practical application.

步骤120,根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量。Step 120, according to each process ID, obtain the total IO throughput from the IO instance file corresponding to each process ID in the system kernel file every predetermined time.

在实际应用中,linux系统等系统对于磁盘的IO吞吐量,从进程启动时,随着时间的推移,可在其系统内核文件中的IO实例文件一直以累计的方式记录该进程读/写的IO吞吐量。比如对于目标服务A,其启动时刻为12:00:00,那么即每执行一次磁盘读操作或写操作,其次数均会累计到相应的IO实例文件中。In practical applications, for the IO throughput of the disk in systems such as the Linux system, from the time the process starts, as time goes by, the IO instance file in the system kernel file can always record the read/write data of the process in a cumulative manner. I/O throughput. For example, for the target service A, its startup time is 12:00:00, then every time a disk read or write operation is performed, the number of times will be accumulated in the corresponding IO instance file.

上述系统内核文件如/proc文件系统,在该文件系统中有记录各个目标服务的IO吞吐量相关信息的IO实例文件。/proc文件系统是一种内核和内核模块用来向进程(process)发送信息的机制。该伪文件系统让应用可以和内核内部数据结构进行交互,获取有关进程的有用信息,在运行中(on the fly)改变设置(通过改变内核参数)。与其他文件系统不同,/proc存在于内存之中而不是硬盘上。/proc由内核控制,没有承载/proc的设备。因为/proc主要存放由内核控制的状态信息,所以大部分这些信息的逻辑位置位于内核控制的内存。The aforementioned system kernel files are such as the /proc file system, in which there are IO instance files that record information related to the IO throughput of each target service. The /proc filesystem is a mechanism used by the kernel and kernel modules to send information to processes. This pseudo-filesystem allows applications to interact with kernel internal data structures, obtain useful information about processes, and change settings (by changing kernel parameters) on the fly. Unlike other file systems, /proc exists in memory rather than on the hard disk. /proc is controlled by the kernel, there is no device hosting /proc. Because /proc mainly stores state information controlled by the kernel, the logical location of most of this information is in kernel-controlled memory.

当然,在本发明实施例中,可以每隔预定时间,比如每秒,就从上述系统内核文件中,根据对应各目标服务的进程标识的IO实例文件。当然该间隔的预定时间可以设定为其他值,比如2秒等,本发明不对其加以限制。Of course, in the embodiment of the present invention, the IO instance file identified by the process corresponding to each target service may be selected from the above-mentioned system kernel file at predetermined intervals, such as every second. Of course, the predetermined time of the interval can be set to other values, such as 2 seconds, etc., which is not limited by the present invention.

当然,本发明实施例中,在步骤110之前首先需要获取到系统的root权限,该root权限可以访问系统的任意文件系统。因为系统内核文件对于普通权限的用户来说是透明的,用户无法操作这些文件,从而也无法从内存中读取这些文件,获取到信息。以linux系统为例,可以采用su命令获取系统权限,比如Of course, in the embodiment of the present invention, before step 110, the root authority of the system needs to be obtained first, and the root authority can access any file system of the system. Because the system kernel files are transparent to users with ordinary permissions, users cannot operate these files, and thus cannot read these files from the memory and obtain information. Taking the linux system as an example, you can use the su command to obtain system permissions, such as

[beinan@localhost~]$su[beinan@localhost~]$su

Password:Password:

[root@localhost beinan]#pwd[root@localhost beinan]#pwd

/home/beinan/home/beinan

该伪代码表示表示默认切换到root用户,并且改变到root用户的环境。The pseudo-code indicates that it switches to the root user by default, and changes to the root user's environment.

步骤130,根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。Step 130: Calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time of each target service and the total IO throughput of at least one acquisition time before the current acquisition time.

可以理解,上述每秒就可以理解为获取时刻。比如从本发明的进程的IO吞吐量监控步骤执行开始后,在10:00:00第一次获取了各进程标识的IO实例文件中获取IO总吞吐量,在10:00:01秒第二次获取了各进程标识的IO实例文件中获取IO总吞吐量,在10:00:02第三次获取了各进程标识的IO实例文件中获取IO总吞吐量等,那么上述每隔1秒所在时刻即为获取时刻,该获取时刻可以理解为监控时刻。It can be understood that the above-mentioned every second can be understood as an acquisition time. For example, after the IO throughput monitoring step of the process of the present invention is executed, obtain the total IO throughput in the IO instance file of each process identification at 10:00:00 for the first time, and obtain the total IO throughput at 10:00:01 second The total IO throughput is obtained from the IO instance file for which each process ID is obtained for the first time, and the total IO throughput is obtained from the IO instance file for which each process ID is obtained for the third time at 10:00:02, then the above-mentioned interval of 1 second is The moment is the acquisition moment, which can be understood as the monitoring moment.

当然,第一次获取到各进程标识的IO实例文件中获取IO总吞吐量,此时步骤130还不计算各个目标服务的实时IO吞吐量。当从第二次获取到各进程标识的IO实例文件中获取IO总吞吐量后,步骤130就可以计算各个目标服务的实时IO吞吐量。Certainly, the total IO throughput is obtained from the IO instance file of each process identifier obtained for the first time, and step 130 does not yet calculate the real-time IO throughput of each target service at this time. After the total IO throughput is obtained from the IO instance file of each process identifier obtained for the second time, step 130 can calculate the real-time IO throughput of each target service.

对于进程的监控来说,为了保证其实时性,本发明实施例是以最新的一次获取的IO实例文件中的IO总吞吐量为基础,结合最近一次或者最近的多次前述IO总吞吐量,计算当前获取时刻对应的实时IO总吞吐量。在本发明实施例中IO总吞吐量可以理解为目标服务对磁盘的读和写的总次数,或者也可以理解为目标服务对磁盘的读的总次数,或者也可以理解为目标服务对磁盘的写的总次数。For the monitoring of the process, in order to ensure its real-time performance, the embodiment of the present invention is based on the IO total throughput in the latest acquired IO instance file, combined with the latest or recent multiple aforementioned IO total throughput, Calculate the total real-time IO throughput corresponding to the current acquisition moment. In the embodiment of the present invention, the total IO throughput can be understood as the total number of times the target service reads and writes the disk, or it can also be understood as the total number of times the target service reads the disk, or it can also be understood as the number of times the target service reads the disk. The total number of writes.

比如前述例子中,10:00:00时获取的目标服务A,记录的其读的总次数为100,而10:00:01,获取目标服务A的读的总次数为200。假设,以当前获取时刻和最近一次获取时刻为计算对象,那么对于10:00:01,对应目标服务A的实时读次数为200-100=100。进一步的,10:00:02获取目标服务A的读的总次数为400,那么对应的目标服务A的实时读次数为400-200=200次。For example, in the foregoing example, the total number of readings of the target service A obtained at 10:00:00 is 100, and the total number of readings of the target service A obtained at 10:00:01 is 200. Assuming that the current acquisition time and the latest acquisition time are used as calculation objects, then for 10:00:01, the number of real-time reads corresponding to the target service A is 200-100=100. Further, the total number of reads of the target service A obtained at 10:00:02 is 400, and the corresponding real-time reads of the target service A are 400-200=200 times.

假设以当前获取时刻和其之前的多次,则可以按序后一个总IO吞吐量减前一个总IO吞吐量,得到多个值,然后基于这些值计算均值作为当前时刻的实时IO吞吐量。比如前述,10:00:01的总IO吞吐量减去10:00:00的总IO吞吐量,得到100;10:00:02的总IO吞吐量减去10:00:01的总IO吞吐量,得到200,则10:00:02对应的实时IO吞吐量为(100+200)/2=150次。Assuming the current acquisition time and multiple times before it, you can subtract the previous total IO throughput from the next total IO throughput in order to get multiple values, and then calculate the average based on these values as the real-time IO throughput at the current moment. For example, the total IO throughput at 10:00:01 minus the total IO throughput at 10:00:00 is 100; the total IO throughput at 10:00:02 minus the total IO throughput at 10:00:01 The amount is 200, then the real-time IO throughput corresponding to 10:00:02 is (100+200)/2=150 times.

由此解决了在先技术无法针对具体的某个目标服务,无法监控该服务的实时IO吞吐量的问题,取得了可以对具体的目标服务,监控其实时IO吞吐量,方便后续对该目标服务进行管控的有益效果。This solves the problem that the prior technology cannot target a specific target service and cannot monitor the real-time IO throughput of the service, and achieves the ability to monitor the real-time IO throughput of a specific target service to facilitate subsequent services to the target Beneficial effects of control.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,避免了在先技术中只能以磁盘为主体监控外界对磁盘的总的访问情况的问题。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. Therefore, the access status of each target service to the disk can be monitored, avoiding the problem in the prior art that only the disk can be used as the main body to monitor the overall access status of the disk from the outside world.

实施例二Embodiment two

参照图2,其示出了一种进程的IO吞吐量监控方法的流程示意图,具体可以包括:Referring to FIG. 2, it shows a schematic flow diagram of a process IO throughput monitoring method, which may specifically include:

步骤210,获取各目标服务的进程标识;Step 210, obtaining the process identification of each target service;

在本发明实施例中可以通过proc/$pid/cmdline获取目标服务的进程标识。本发明可以遍历proc文件系统中,根目录为proc/$pid/cmdline的文件中记录的进程相关信息,其中pid为进程标识,在proc/$pid/cmdline文件中记录了该pid的进程的相关信息,比如是否为子进程,如果为子进程,其父进程的进程标识,该pid对应的进程句柄等进程相关信息。然后将获取到的进程信息与目标服务进行比对,即可确认目标服务进程的进程标识pid。In the embodiment of the present invention, the process identifier of the target service can be obtained through proc/$pid/cmdline. The present invention can traverse the process-related information recorded in the file of proc/$pid/cmdline whose root directory is proc/$pid/cmdline in the proc file system, wherein pid is the process identifier, and the process related information of the pid is recorded in the proc/$pid/cmdline file Information, such as whether it is a child process, if it is a child process, the process ID of its parent process, the process handle corresponding to the pid, and other process-related information. Then compare the obtained process information with the target service to confirm the process identifier pid of the target service process.

步骤220,每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识。Step 220: Obtain the IO instance file corresponding to each process ID from the system kernel file path /proc/$pid/io every predetermined time; wherein the pid is the process ID.

在本发明实施例中,系统内核文件,即/proc文件系统中根据其根目录/proc/$pid/io可以访问到记录各个目标服务的IO实例文件。比如目标服务的pid为719116688,那么其IO实例文件的路径为/proc/$19573/io。In the embodiment of the present invention, the system kernel file, that is, the IO instance file recording each target service can be accessed according to its root directory /proc/$pid/io in the /proc file system. For example, if the pid of the target service is 719116688, then the path of its IO instance file is /proc/$19573/io.

当然,在实际应用中,/proc之前还有系统的根目录,比如linux系统,其完整的路径可为“根目录/proc/$19573/io”,根目录的具体形式根据系统情况而定。那么即可从“根目录/proc/$19573/io”路径下,读取到19573的IO实例文件。Of course, in practical applications, there is a root directory of the system before /proc, such as a Linux system, its complete path can be "root directory/proc/$19573/io", and the specific form of the root directory depends on the system situation. Then you can read the IO instance file of 19573 from the "root directory/proc/$19573/io" path.

步骤230,从所述IO实例文件中,提取相应时刻的IO总吞吐量。Step 230, extract the total IO throughput at the corresponding moment from the IO instance file.

在本发明实施例中,系统内核文件的IO实例文件中,是对进程访问磁盘的次数进行累计,得到的是各目标服务在其获取时刻的IO总吞吐量。In the embodiment of the present invention, in the IO instance file of the system kernel file, the number of times the process accesses the disk is accumulated to obtain the total IO throughput of each target service at the time of its acquisition.

优选地,从所述IO实例文件中,提取相应时刻的IO总吞吐量,包括:Preferably, from the IO instance file, the total IO throughput at the corresponding moment is extracted, including:

子步骤231,从所述IO实例文件的syscr字段中提取总的IO读次数.和/或从所述IO实例文件的syscw字段中提取总的IO写次数;Substep 231, extracting the total IO read times from the syscr field of the IO instance file. And/or extracting the total IO write times from the syscw field of the IO instance file;

子步骤232,将所述IO读次数作为IO总吞吐量,或者将所述IO写次数作为IO总吞吐量,或者将所述IO读次数与IO写次数之和作为IO总吞吐量。In sub-step 232, the number of IO reads is taken as the total IO throughput, or the number of IO writes is taken as the total IO throughput, or the sum of the number of IO reads and the number of IO writes is taken as the total IO throughput.

在实际应用中,/proc/19573/io对应的实例文件,其内容如下:In practical applications, the content of the instance file corresponding to /proc/19573/io is as follows:

rchar:867994155rchar:867994155

wchar:2352795453wchar:2352795453

syscr:243617syscr:243617

syscw:1299355syscw:1299355

read_bytes:171048960read_bytes: 171048960

write_bytes:2199875584write_bytes: 2199875584

cancelled_write_bytes:51793920canceled_write_bytes: 51793920

其中,rchar为从磁盘读出的总字节数,read或者pread中的长度参数总和,其为pagecache(页面缓存)中统计而来,不代表实际磁盘的读出;wchar为向磁盘写入的总字节数,write或者pwrite中的长度参数总和;syscr为对磁盘的读的总次数;syscr为对磁盘的写的总次数;read_bytes为实际从磁盘中读取的字节总数;write_bytes为实际写入到磁盘中的字节总数;cancelled_write_bytes为由于截断pagecache导致应该发生而没有发生的写入字节数。Among them, rchar is the total number of bytes read from the disk, the sum of the length parameters in read or pread, which is calculated from the pagecache (page cache), and does not represent the actual disk read; wchar is written to the disk The total number of bytes, the sum of the length parameters in write or pwrite; syscr is the total number of reads to the disk; syscr is the total number of writes to the disk; read_bytes is the total number of bytes actually read from the disk; write_bytes is the actual The total number of bytes written to disk; canceled_write_bytes is the number of bytes written that should have occurred but did not occur due to truncated pagecache.

那么本发明为了统计IO总吞吐量,可以将对磁盘的读和/或写作为其IO总吞吐量。如上述例子,则可以从从所述IO实例文件的syscr字段中提取总的IO读次数243617,和/或从所述IO实例文件的syscw字段中提取总的IO写次数1299355。那么可以1299355+243617作为对应目标服务的总IO吞吐量,也可以将243617单独作为对应目标服务的IO吞吐量,也可以将1299355单独作为对应目标服务的IO吞吐量。使本发明可以更灵活的监控目标服务对磁盘的读和写的次数。Then, in order to count the total IO throughput, the present invention can take the reading and/or writing of the disk as its total IO throughput. As in the above example, the total IO read count 243617 can be extracted from the syscr field of the IO instance file, and/or the total IO write count 1299355 can be extracted from the syscw field of the IO instance file. Then 1299355+243617 can be used as the total IO throughput of the corresponding target service, or 243617 can be used alone as the IO throughput of the corresponding target service, or 1299355 can be used alone as the IO throughput of the corresponding target service. This enables the present invention to more flexibly monitor the number of reads and writes to the disk by the target service.

步骤240,针对各个目标服务,将当前获取时刻对应的IO总吞吐量,减去当前获取时刻的前一个获取时刻的IO总吞吐量,以获得各个目标服务的实时IO吞吐量。Step 240, for each target service, subtract the total IO throughput at the previous acquisition time from the total IO throughput corresponding to the current acquisition time to obtain the real-time IO throughput of each target service.

比如前述19573的IO实例文件,其是在10:00:00时刻得到的,从中提取了syscr:243617,syscw:1299355。而在10:00:01时刻再次获取了该19573的前述实例文件,从中提取了syscr:243700,syscw:1299800。那么对应10:00:01时刻,19573的目标服务的实时读次数为(243700-243617)=83,实时写的次数为(1299800-1299355)=445,实时读+写的次数为528。For example, the aforementioned IO instance file of 19573 was obtained at 10:00:00, from which syscr:243617 and syscw:1299355 were extracted. At 10:00:01, the aforementioned instance file of 19573 was obtained again, and syscr:243700 and syscw:1299800 were extracted from it. Then corresponding to the time 10:00:01, the number of real-time reads of the target service of 19573 is (243700-243617)=83, the number of real-time writes is (1299800-1299355)=445, and the number of real-time read+writes is 528.

当然,在本发明实施例中如果间隔的预定时间大于1秒,则可以将上述相减得到的结果除以预定时间,得到每秒的实时IO吞吐量。Of course, in the embodiment of the present invention, if the predetermined time interval is greater than 1 second, the result of the above subtraction can be divided by the predetermined time to obtain the real-time IO throughput per second.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. Therefore, the access status of each target service to the disk can be monitored, and the respective access status of the target service to the disk for reading and writing can be flexibly monitored.

实施例三Embodiment Three

参照图3,其示出了一种进程的IO吞吐量监控方法的流程示意图,具体可以包括:Referring to FIG. 3 , it shows a schematic flow diagram of a process IO throughput monitoring method, which may specifically include:

步骤310,获取各目标服务的进程标识;Step 310, obtaining the process identification of each target service;

步骤320,每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识。Step 320, at predetermined intervals, obtain the IO instance file corresponding to each process ID from the system kernel file path /proc/$pid/io; wherein the pid is the process ID.

步骤330,从所述IO实例文件中,提取相应时刻的IO总吞吐量。Step 330, extract the total IO throughput at the corresponding moment from the IO instance file.

步骤340,针对各个目标服务,对于每个获取时刻,将所述获取时刻对应的IO总吞吐量,减去所述获取时刻前一个获取时刻的IO总吞吐量,得到第一IO吞吐量;Step 340, for each target service, for each acquisition time, subtract the total IO throughput at the acquisition time preceding the acquisition time from the total IO throughput corresponding to the acquisition time, to obtain the first IO throughput;

步骤350,对于当前获取时刻,将从当前获取时刻起,最近的至少两个第一IO吞吐量进行加权计算,以获得各个目标服务的实时IO吞吐量。Step 350 , for the current acquisition moment, perform weighted calculation on at least two recent first IO throughputs from the current acquisition moment, so as to obtain the real-time IO throughput of each target service.

比如前述19573的IO实例文件,其是在10:00:00时刻得到的,从中提取了syscr:243617,syscw:1299355。而在10:00:01时刻再次获取了该19573的前述实例文件,从中提取了syscr:243700,syscw:1299800。而在10:00:02时刻再次获取了该19573的前述实例文件,从中提取了syscr:243800,syscw:1299900。For example, the aforementioned IO instance file of 19573 was obtained at 10:00:00, from which syscr:243617 and syscw:1299355 were extracted. At 10:00:01, the aforementioned instance file of 19573 was obtained again, and syscr:243700 and syscw:1299800 were extracted from it. At 10:00:02, the aforementioned instance file of 19573 was obtained again, from which syscr:243800 and syscw:1299900 were extracted.

那么由10:00:01时刻减去10:00:00的数据有:19573的目标服务的读次数为(243700-243617)=83,写的次数为(1299800-1299355)=445,读+写的次数为528。Then the data subtracting 10:00:00 from 10:00:01 is: the number of reads of the target service of 19573 is (243700-243617) = 83, the number of writes is (1299800-1299355) = 445, read + write The number of times is 528.

那么由10:00:02时刻减去10:00:01的数据有:19573的目标服务的读次数为(243800-243700)=100,写次数为(1299900-1299800)=100,读+写的次数为200。Then the data minus 10:00:01 from 10:00:02 is: the number of reads of the target service of 19573 is (243800-243700) = 100, the number of writes is (1299900-1299800) = 100, read + write The number of times is 200.

那么对于当前获取时刻10:00:02,对于实时读次数可为(100+83)/2,实时写次数可为(100+445)/2,实时读+写的次数为(200+528)/2。Then for the current acquisition time 10:00:02, the number of real-time reads can be (100+83)/2, the number of real-time writes can be (100+445)/2, and the number of real-time read+writes can be (200+528) /2.

当然,离当前获取时刻越近的记录,其权重可以设置为越高。比如由10:00:02时刻减去10:00:01的数据权重设置为0.7,由10:00:01时刻减去10:00:00的数据的权重设置为0.3,那么以实时读+写的次数为例,其为200*0.7+528*0.3。Of course, the closer the record is to the current acquisition time, the higher its weight can be set. For example, the weight of the data subtracted from 10:00:02 by 10:00:01 is set to 0.7, and the weight of the data subtracted from 10:00:01 by 10:00:00 is set to 0.3, then real-time read + write For example, the number of times is 200*0.7+528*0.3.

当然,在本发明实施例中如果间隔的预定时间大于1秒,则可以将上述相减得到的结果除以预定时间,得到每秒的实时IO吞吐量。Of course, in the embodiment of the present invention, if the predetermined time interval is greater than 1 second, the result of the above subtraction can be divided by the predetermined time to obtain the real-time IO throughput per second.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况,另外,可以通过多次的记录,平滑当前时刻的实时IO吞吐量的数据,使其异常性更低。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. In this way, the access status of each target service to the disk can be monitored, and the access status of the target service to the disk for reading and writing can be flexibly monitored. In addition, the real-time IO throughput at the current moment can be smoothed through multiple records data, making it less abnormal.

实施例四Embodiment Four

参照图4,其示出了一种进程的IO吞吐量监控方法的流程示意图,具体可以包括:Referring to FIG. 4 , it shows a schematic flow chart of a process IO throughput monitoring method, which may specifically include:

步骤410,获取各目标服务的进程标识。Step 410, obtain the process identification of each target service.

步骤420,根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量。Step 420, according to each process ID, obtain the total IO throughput from the IO instance file corresponding to each process ID in the system kernel file every predetermined time.

步骤430,根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。Step 430: Calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time of each target service and the total IO throughput of at least one acquisition time before the current acquisition time.

步骤440,将各个目标服务按照实时IO吞吐量大小进行排序。Step 440, sort each target service according to the real-time IO throughput.

在本发明实施例中,对于各个目标服务,在同一个获取时刻,可以将其按照其实时的IO吞吐量大小进行排序,从而可以方便的判断哪一些可能超过阈值,而哪一些没有。In the embodiment of the present invention, for each target service, at the same acquisition moment, they can be sorted according to their real-time IO throughput, so that it is convenient to judge which ones may exceed the threshold and which ones do not.

步骤450,针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值;如果所述IO吞吐量超过阈值,则调用报警接口对所述目标服务进行报警。Step 450, for the real-time IO throughput of each target service, judge whether the IO throughput exceeds a threshold; if the IO throughput exceeds the threshold, call an alarm interface to give an alarm to the target service.

在本发明实施例中,对于目标服务的磁盘访问次数进行监控后,为了方便技术人员及时处理可能影响服务器性能的服务,则会预先设置一个针对实时IO吞吐量的阈值,并且预置一个报警接口,该报警接口可以向技术人员发送警报信息,比如给技术人员邮箱发送报警邮件,给技术人员的手机发送短信等。在每个获取时刻,将得到的各个目标服务的实时IO吞吐量与该阈值进行比较,如果超过,这说明该目标服务可能出现问题,占用了太多资源,需要进行报警,该报警信息可以包括该目标进程的对磁盘的历史访问数据,以及本发明得到的各个获取时刻的实时IO吞吐量。In the embodiment of the present invention, after monitoring the number of disk accesses of the target service, a threshold for real-time IO throughput and an alarm interface will be preset in order to facilitate technicians to handle services that may affect server performance in a timely manner , the alarm interface can send alarm information to technicians, such as sending alarm emails to technician mailboxes, sending text messages to technicians’ mobile phones, etc. At each acquisition moment, compare the obtained real-time IO throughput of each target service with the threshold. If it exceeds, this indicates that the target service may have a problem and occupy too many resources, and an alarm needs to be issued. The alarm information can include The historical access data of the target process to the disk, and the real-time IO throughput at each acquisition time obtained by the present invention.

当然,在报警的同时,还继续监控。Of course, while calling the police, the monitoring is also continued.

如果未超出阈值,则不报警,继续监控。If the threshold is not exceeded, no alarm will be issued and monitoring will continue.

当然,本发明实施例中,针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值后,还可以暂时降低目标服务对请求的处理量等操作。本发明不对其加以限制。Of course, in the embodiment of the present invention, after judging whether the IO throughput exceeds a threshold for the real-time IO throughput of each target service, operations such as temporarily reducing the processing volume of the target service for requests can also be performed. The present invention is not limited thereto.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况;另外,可以通过多次的记录,平滑当前时刻的实时IO吞吐量的数据,使其异常性更低;再者,可以将实时IO吞吐量超过阈值的目标服务,对其生成报警信息告知技术人员,使技术人员可以及时知晓具体哪一个目标服务占用IO特别多,从而可以针对性的去进行处理。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. In this way, the access status of each target service to the disk can be monitored, and the access status of the target service to the disk for reading and writing can be flexibly monitored; in addition, the real-time IO throughput at the current moment can be smoothed through multiple records The data makes it less abnormal; moreover, the target service whose real-time IO throughput exceeds the threshold can generate an alarm message to notify the technician, so that the technician can know in time which target service occupies a particularly large IO. So that it can be dealt with in a targeted manner.

实施例五Embodiment five

参照图5,其示出了一种进程的IO吞吐量监控装置的结构示意图,具体可以包括:Referring to FIG. 5, it shows a schematic structural diagram of a process IO throughput monitoring device, which may specifically include:

进程标识获取模块510,适于获取各目标服务的进程标识;The process identification obtaining module 510 is adapted to obtain the process identification of each target service;

IO总吞吐量获取模块520,适于根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;The IO total throughput acquisition module 520 is adapted to obtain the IO total throughput from the IO instance file corresponding to each process identification in the system kernel file at regular intervals according to each process identification;

实时IO吞吐量计算模块530,适于根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。The real-time IO throughput calculation module 530 is adapted to calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time quantity.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,避免了在先技术中只能以磁盘为主体监控外界对磁盘的总的访问情况的问题。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. Therefore, the access status of each target service to the disk can be monitored, avoiding the problem in the prior art that only the disk can be used as the main body to monitor the overall access status of the disk from the outside world.

实施例六Embodiment six

参照图6,其示出了一种进程的IO吞吐量监控装置的结构示意图,具体可以包括:Referring to FIG. 6, it shows a schematic structural diagram of a process IO throughput monitoring device, which may specifically include:

进程标识获取模块610,适于获取各目标服务的进程标识;The process identification obtaining module 610 is adapted to obtain the process identification of each target service;

IO总吞吐量获取模块620,适于根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量,具体包括:The IO total throughput acquisition module 620 is adapted to obtain the IO total throughput from the IO instance file corresponding to each process identification in the system kernel file at regular intervals according to each process identification, specifically including:

IO实例文件获取子模块621,适于每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识。The IO instance file acquisition sub-module 621 is adapted to acquire the IO instance file corresponding to each process ID from the system kernel file path /proc/$pid/io every predetermined time; wherein the pid is the process ID.

IO总吞吐量获取子模块622,适于从所述IO实例文件中,提取相应时刻的IO总吞吐量。The total IO throughput acquisition sub-module 622 is adapted to extract the total IO throughput at a corresponding moment from the IO instance file.

实时IO吞吐量计算模块630,适于根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,具体包括:The real-time IO throughput calculation module 630 is adapted to calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time amount, including:

第一实时IO吞吐量计算子模块631,适于针对各个目标服务,将当前获取时刻对应的IO总吞吐量,减去当前获取时刻的前一个获取时刻的IO总吞吐量,以获得各个目标服务的实时IO吞吐量。The first real-time IO throughput calculation sub-module 631 is adapted to subtract the total IO throughput at the previous acquisition moment from the total IO throughput at the current acquisition moment for each target service to obtain each target service real-time IO throughput.

优选地,所述IO总吞吐量获取子模块,包括:Preferably, the IO total throughput acquisition submodule includes:

次数提取模块,适于从所述IO实例文件的syscr字段中提取总的IO读次数,和/或从所述IO实例文件的syscw字段中提取总的IO写次数;The times extraction module is adapted to extract the total IO read times from the syscr field of the IO instance file, and/or extract the total IO write times from the syscw field of the IO instance file;

吞吐量确认模块,适于将所述IO读次数作为IO总吞吐量,或者将所述IO写次数作为IO总吞吐量,或者将所述IO读次数与IO写次数之和作为IO总吞吐量。The throughput confirmation module is adapted to use the IO read times as the total IO throughput, or use the IO write times as the IO total throughput, or use the sum of the IO read times and the IO write times as the IO total throughput .

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. Therefore, the access status of each target service to the disk can be monitored, and the respective access status of the target service to the disk for reading and writing can be flexibly monitored.

实施例七Embodiment seven

参照图7,其示出了一种进程的IO吞吐量监控装置的结构示意图,具体可以包括:Referring to FIG. 7 , it shows a schematic structural diagram of a process IO throughput monitoring device, which may specifically include:

进程标识获取模块710,适于获取各目标服务的进程标识;The process identification obtaining module 710 is adapted to obtain the process identification of each target service;

IO总吞吐量获取模块720,适于根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量,具体包括:The IO total throughput acquisition module 720 is adapted to obtain the IO total throughput from the IO instance file corresponding to each process identification in the system kernel file at regular intervals according to each process identification, specifically including:

IO实例文件获取子模块721,适于每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识。The IO instance file acquisition sub-module 721 is adapted to acquire the IO instance file corresponding to each process ID from the system kernel file path /proc/$pid/io at predetermined intervals; wherein the pid is the process ID.

IO总吞吐量获取子模块722,适于从所述IO实例文件中,提取相应时刻的IO总吞吐量。The total IO throughput acquisition sub-module 722 is adapted to extract the total IO throughput at a corresponding moment from the IO instance file.

实时IO吞吐量计算模块730,适于根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,具体包括:The real-time IO throughput calculation module 730 is adapted to calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time amount, including:

独立IO吞吐量计算子模块731,适于针对各个目标服务,对于每个获取时刻,将所述获取时刻对应的IO总吞吐量,减去所述获取时刻前一个获取时刻的IO总吞吐量,得到第一IO吞吐量;The independent IO throughput calculation sub-module 731 is suitable for each target service, and for each acquisition moment, subtracting the total IO throughput corresponding to the acquisition moment from the total IO throughput at the acquisition moment before the acquisition moment, Get the first IO throughput;

第二实时IO吞吐量计算子模块732,适于对于当前获取时刻,将从当前获取时刻起,最近的至少两个第一IO吞吐量进行加权计算,以获得各个目标服务的实时IO吞吐量。The second real-time IO throughput calculation sub-module 732 is adapted to perform weighted calculation on at least two recent first IO throughputs from the current acquisition moment to obtain the real-time IO throughput of each target service.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况,另外,可以通过多次的记录,平滑当前时刻的实时IO吞吐量的数据,使其异常性更低。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. In this way, the access status of each target service to the disk can be monitored, and the access status of the target service to the disk for reading and writing can be flexibly monitored. In addition, the real-time IO throughput at the current moment can be smoothed through multiple records data, making it less abnormal.

实施例八Embodiment eight

参照图8,其示出了一种进程的IO吞吐量监控装置的结构示意图,具体可以包括:Referring to FIG. 8 , it shows a schematic structural diagram of a process IO throughput monitoring device, which may specifically include:

进程标识获取模块810,适于获取各目标服务的进程标识;A process identification obtaining module 810, adapted to obtain the process identification of each target service;

IO总吞吐量获取模块820,适于根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;IO total throughput acquisition module 820 is adapted to obtain the total IO throughput from the IO instance file corresponding to each process identification in the system kernel file at regular intervals according to each process identification;

实时IO吞吐量计算模块830,适于根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。The real-time IO throughput calculation module 830 is adapted to calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time quantity.

排序模块840,适于将各个目标服务按照实时IO吞吐量大小进行排序。The sorting module 840 is adapted to sort each target service according to the real-time IO throughput.

报警模块850,适于针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值;如果所述IO吞吐量超过阈值,则调用报警接口对所述目标服务进行报警。The alarm module 850 is adapted to judge whether the IO throughput exceeds a threshold for the real-time IO throughput of each target service; if the IO throughput exceeds the threshold, call an alarm interface to alarm the target service.

在本发明实施例中,技术人员发现了系统内核文件能以累计的形式记录所有进程在访问磁盘过程的访问次数,那么本发明实施例则可以先找到目标服务的进程标识,然后以进程标识去系统内核文件中查找对应各进程标识的IO实例文件,以从中获取IO总吞吐量,进而在每次获取到上述IO总吞吐量之后,可以结合前一次的记录,计算各目标服务的实时IO吞吐量。从而可以对各个目标服务对磁盘的访问情况进行监控,并且,可以灵活的监控目标服务对磁盘的读和写各自的访问情况;另外,可以通过多次的记录,平滑当前时刻的实时IO吞吐量的数据,使其异常性更低;再者,可以将实时IO吞吐量超过阈值的目标服务,对其生成报警信息告知技术人员,使技术人员可以及时知晓具体哪一个目标服务占用IO特别多,从而可以针对性的去进行处理。In the embodiment of the present invention, technicians have discovered that the system kernel file can record the number of accesses of all processes in the process of accessing the disk in a cumulative form, so the embodiment of the present invention can first find the process ID of the target service, and then use the process ID to Find the IO instance file corresponding to each process ID in the system kernel file to obtain the total IO throughput, and then after obtaining the above total IO throughput each time, you can combine the previous record to calculate the real-time IO throughput of each target service quantity. In this way, the access status of each target service to the disk can be monitored, and the access status of the target service to the disk for reading and writing can be flexibly monitored; in addition, the real-time IO throughput at the current moment can be smoothed through multiple records The data makes it less abnormal; moreover, the target service whose real-time IO throughput exceeds the threshold can generate an alarm message to notify the technician, so that the technician can know in time which target service occupies a particularly large IO. So that it can be dealt with in a targeted manner.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the content of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的进程的IO吞吐量监控设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) can be used in practice to realize some or all functions of some or all of the components in the IO throughput monitoring device of the process according to the embodiment of the present invention . The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

本发明公开了A1、一种进程的IO吞吐量监控方法,包括:The invention discloses A1, a process IO throughput monitoring method, comprising:

获取各目标服务的进程标识;Obtain the process identification of each target service;

根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;According to each process identification, the total IO throughput is obtained from the IO instance file corresponding to each process identification in the system kernel file every predetermined time;

根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。The real-time IO throughput of each target service is calculated according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time.

A2、根据A1所述的方法,所述根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量,包括:A2, according to the method described in A1, described according to each process identification, every predetermined time, obtains IO total throughput from the IO instance file corresponding to each process identification in the system kernel file, including:

每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识;Obtain the IO instance file corresponding to each process identifier from the system kernel file path /proc/$pid/io every predetermined time; wherein the pid is the process identifier;

从所述IO实例文件中,提取相应时刻的IO总吞吐量。From the IO instance file, the total IO throughput at the corresponding moment is extracted.

A3、根据A1或A2所述的方法,所述根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,包括:A3. According to the method described in A1 or A2, according to the total IO throughput corresponding to the current acquisition moment corresponding to each target service, and the total IO throughput of at least one acquisition moment before the current acquisition moment, calculate the IO throughput of each target service Real-time IO throughput, including:

针对各个目标服务,将当前获取时刻对应的IO总吞吐量,减去当前获取时刻的前一个获取时刻的IO总吞吐量,以获得各个目标服务的实时IO吞吐量。For each target service, the total IO throughput corresponding to the current acquisition time is subtracted from the total IO throughput of the previous acquisition time at the current acquisition time to obtain the real-time IO throughput of each target service.

A4、根据A1或A2所述的方法,所述根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量,包括:A4. According to the method described in A1 or A2, according to the total IO throughput corresponding to the current acquisition moment corresponding to each target service, and the total IO throughput of at least one acquisition moment before the current acquisition moment, calculate the IO throughput of each target service Real-time IO throughput, including:

针对各个目标服务,对于每个获取时刻,将所述获取时刻对应的IO总吞吐量,减去所述获取时刻前一个获取时刻的IO总吞吐量,得到第一IO吞吐量;For each target service, for each acquisition moment, the IO total throughput corresponding to the acquisition moment is subtracted from the IO total throughput at the previous acquisition moment to obtain the first IO throughput;

对于当前获取时刻,将从当前获取时刻起,最近的至少两个第一IO吞吐量进行加权计算,以获得各个目标服务的实时IO吞吐量。For the current acquisition moment, at least two recent first IO throughputs from the current acquisition moment are weighted to obtain the real-time IO throughput of each target service.

A5、根据A2所述的方法,从所述IO实例文件中,提取相应时刻的IO总吞吐量,包括:A5. According to the method described in A2, from the IO instance file, extract the total IO throughput at the corresponding moment, including:

从所述IO实例文件的syscr字段中提取总的IO读次数,和/或从所述IO实例文件的syscw字段中提取总的IO写次数;Extract the total IO read times from the syscr field of the IO instance file, and/or extract the total IO write times from the syscw field of the IO instance file;

将所述IO读次数作为IO总吞吐量,或者将所述IO写次数作为IO总吞吐量,或者将所述IO读次数与IO写次数之和作为IO总吞吐量。The number of IO reads is taken as the total IO throughput, or the number of IO writes is taken as the total IO throughput, or the sum of the number of IO reads and the number of IO writes is taken as the total IO throughput.

A6、根据A1所述的方法,在根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量之后,还包括:A6. According to the method described in A1, the real-time IO throughput of each target service is calculated according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time After the amount, also include:

将各个目标服务按照实时IO吞吐量大小进行排序。Sort each target service according to the real-time IO throughput.

A7、根据A1所述的方法,在根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量之后,还包括:A7. According to the method described in A1, calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time After the amount, also include:

针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值;如果所述IO吞吐量超过阈值,则调用报警接口对所述目标服务进行报警。For the real-time IO throughput of each target service, it is judged whether the IO throughput exceeds the threshold; if the IO throughput exceeds the threshold, an alarm interface is called to alarm the target service.

本发明还公开了B8、一种进程的IO吞吐量监控装置,包括:The present invention also discloses B8, a process IO throughput monitoring device, comprising:

进程标识获取模块,适于获取各目标服务的进程标识;A process identification acquisition module, adapted to obtain the process identification of each target service;

IO总吞吐量获取模块,适于根据各进程标识,每隔预定时间,从系统内核文件中对应各进程标识的IO实例文件中获取IO总吞吐量;The IO total throughput acquisition module is adapted to obtain the IO total throughput from the IO instance file corresponding to each process identification in the system kernel file at predetermined intervals according to each process identification;

实时IO吞吐量计算模块,适于根据对应各个目标服务的当前获取时刻对应的IO总吞吐量,以及当前获取时刻之前的至少一个获取时刻的IO总吞吐量,计算各个目标服务的实时IO吞吐量。The real-time IO throughput calculation module is adapted to calculate the real-time IO throughput of each target service according to the total IO throughput corresponding to the current acquisition time corresponding to each target service, and the total IO throughput of at least one acquisition time before the current acquisition time .

B9、根据B8所述的装置,所述IO总吞吐量获取模块,包括:B9, according to the device described in B8, the IO total throughput acquisition module includes:

IO实例文件获取子模块,适于每隔预定时间,从系统内核文件路径/proc/$pid/io中获取对应各进程标识对应的IO实例文件;其中所述pid为进程标识;The IO instance file acquisition submodule is adapted to obtain the IO instance file corresponding to each process identifier from the system kernel file path /proc/$pid/io at predetermined intervals; wherein the pid is the process identifier;

IO总吞吐量获取子模块,适于从所述IO实例文件中,提取相应时刻的IO总吞吐量。The total IO throughput acquisition sub-module is adapted to extract the total IO throughput at a corresponding moment from the IO instance file.

B10、根据B8或B9所述的装置,所述实时IO吞吐量计算模块,包括:B10, according to the device described in B8 or B9, the real-time IO throughput calculation module includes:

第一实时IO吞吐量计算子模块,适于针对各个目标服务,将当前获取时刻对应的IO总吞吐量,减去当前获取时刻的前一个获取时刻的IO总吞吐量,以获得各个目标服务的实时IO吞吐量。The first real-time IO throughput calculation submodule is adapted to subtract the IO total throughput corresponding to the current acquisition moment from the IO total throughput at the previous acquisition moment of the current acquisition moment for each target service to obtain the IO throughput of each target service Real-time IO throughput.

B11、根据B8或B9所述的装置,所述实时IO吞吐量计算模块,包括:B11, according to the device described in B8 or B9, the real-time IO throughput calculation module includes:

独立IO吞吐量计算子模块,适于针对各个目标服务,对于每个获取时刻,将所述获取时刻对应的IO总吞吐量,减去所述获取时刻前一个获取时刻的IO总吞吐量,得到第一IO吞吐量;The independent IO throughput calculation sub-module is suitable for each target service. For each acquisition moment, the total IO throughput corresponding to the acquisition moment is subtracted from the IO total throughput of the acquisition moment before the acquisition moment to obtain The first IO throughput;

第二实时IO吞吐量计算子模块,适于对于当前获取时刻,将从当前获取时刻起,最近的至少两个第一IO吞吐量进行加权计算,以获得各个目标服务的实时IO吞吐量。The second real-time IO throughput calculation sub-module is adapted to perform weighted calculation on at least two recent first IO throughputs from the current acquisition moment to obtain the real-time IO throughput of each target service.

B12、根据B9所述的装置,所述IO总吞吐量获取子模块,包括:B12, according to the device described in B9, the IO total throughput acquisition submodule includes:

次数提取模块,适于从所述IO实例文件的syscr字段中提取总的IO读次数,和/或从所述IO实例文件的syscw字段中提取总的IO写次数;The times extraction module is adapted to extract the total IO read times from the syscr field of the IO instance file, and/or extract the total IO write times from the syscw field of the IO instance file;

吞吐量确认模块,适于将所述IO读次数作为IO总吞吐量,或者将所述IO写次数作为IO总吞吐量,或者将所述IO读次数与IO写次数之和作为IO总吞吐量。The throughput confirmation module is adapted to use the IO read times as the total IO throughput, or use the IO write times as the IO total throughput, or use the sum of the IO read times and the IO write times as the IO total throughput .

B13、根据B8所述的装置,在实时IO吞吐量计算模块之后,还包括:B13, according to the device described in B8, after the real-time IO throughput calculation module, it also includes:

排序模块,适于将各个目标服务按照实时IO吞吐量大小进行排序。The sorting module is adapted to sort each target service according to the real-time IO throughput.

B14、根据B8所述的装置,在实时IO吞吐量计算模块之后,还包括:B14, according to the device described in B8, after the real-time IO throughput calculation module, it also includes:

报警模块,适于针对每个目标服务的实时IO吞吐量,判断所述IO吞吐量是否超过阈值;如果所述IO吞吐量超过阈值,则调用报警接口对所述目标服务进行报警。The alarm module is adapted to judge whether the IO throughput exceeds a threshold for the real-time IO throughput of each target service; if the IO throughput exceeds the threshold, call an alarm interface to alarm the target service.

Claims (10)

1. the I/O throughput monitoring method of a kind of process, including:
Obtain the process identification (PID) of each destination service;
According to each process identification (PID), at predetermined time intervals, each process identification (PID) of correspondence from system kernel file IO total throughouts are obtained in IO instance documents;
According to the corresponding IO total throughouts of current acquisition moment for corresponding to each destination service, and currently The IO total throughouts at least one acquisition moment before the moment are obtained, the reality of each destination service is calculated When I/O throughput.
2. method according to claim 1, it is characterised in that described according to each process identification (PID), At predetermined time intervals, IO is obtained in the IO instance documents of each process identification (PID) of correspondence from system kernel file Total throughout, including:
At predetermined time intervals, each process mark of acquisition correspondence from system kernel file path/proc/ $ pid/io Know corresponding IO instance documents;Wherein described pid is process identification (PID);
From the IO instance documents, the IO total throughouts at corresponding moment are extracted.
3. method according to claim 1 and 2, it is characterised in that it is described according to correspondence each Before the corresponding IO total throughouts of current acquisition moment of destination service, and current acquisition moment extremely The IO total throughouts at a few acquisition moment, calculate the real-time I/O throughput of each destination service, including:
For each destination service, moment corresponding IO total throughouts will be currently obtained, is deducted and is currently obtained The IO total throughouts at the previous acquisition moment at moment are taken, is gulped down with the real-time IO for obtaining each destination service The amount of telling.
4. method according to claim 1 and 2, the working as according to each destination service of correspondence It is front to obtain moment corresponding IO total throughouts, and when currently obtaining at least one acquisition before the moment The IO total throughouts at quarter, calculate the real-time I/O throughput of each destination service, including:
For each destination service, for each acquisition moment, will be corresponding at acquisition moment IO total Handling capacity, deducts the IO total throughouts for obtaining the previous acquisition moment at moment, obtains an IO and gulp down The amount of telling;
The moment is obtained for current, will be from the current acquisition moment, at least two the oneth nearest IO are gulped down The amount of telling is weighted, to obtain the real-time I/O throughput of each destination service.
5. method according to claim 2, it is characterised in that from the IO instance documents, The IO total throughouts at corresponding moment are extracted, including:
Total IO is extracted from the syscr fields of the IO instance documents and reads number of times, and/or from the IO Total IO is extracted in the syscw fields of instance document and writes number of times;
The IO is read number of times as IO total throughouts, or the IO is write number of times always to gulp down as IO The amount of telling, or IO reading number of times is write into number of times sum as IO total throughouts with IO.
6. method according to claim 1, it is characterised in that take in each target according to correspondence Before the corresponding IO total throughouts of current acquisition moment of business, and current acquisition moment at least one The IO total throughouts at moment are obtained, after calculating the real-time I/O throughput of each destination service, is also included:
Each destination service is ranked up according to real-time I/O throughput size.
7. method according to claim 1, it is characterised in that take in each target according to correspondence Before the corresponding IO total throughouts of current acquisition moment of business, and current acquisition moment at least one The IO total throughouts at moment are obtained, after calculating the real-time I/O throughput of each destination service, is also included:
For the real-time I/O throughput of each destination service, judge whether the I/O throughput exceedes threshold value; If the I/O throughput exceedes threshold value, remote alarm interface is called to report to the police the destination service.
8. the I/O throughput supervising device of a kind of process, including:
Process identification (PID) acquisition module, is suitable to obtain the process identification (PID) of each destination service;
IO total throughout acquisition modules, are suitable to according to each process identification (PID), at predetermined time intervals, from system IO total throughouts are obtained in the IO instance documents of each process identification (PID) of correspondence in kernel file;
I/O throughput computing module, is suitable to the current acquisition moment according to each destination service of correspondence in real time The IO at least one acquisition moment before corresponding IO total throughouts, and current acquisition moment is always gulped down The amount of telling, calculates the real-time I/O throughput of each destination service.
9. device according to claim 8, it is characterised in that the IO total throughouts obtain mould Block, including:
IO instance document acquisition submodules, are suitable at predetermined time intervals, from system kernel file path The corresponding IO instance documents of each process identification (PID) of correspondence are obtained in/proc/ $ pid/io;Wherein described pid be into Journey is identified;
IO total throughout acquisition submodules, are suitable to from the IO instance documents, extract the corresponding moment IO total throughouts.
10. device according to claim 8 or claim 9, it is characterised in that the real-time IO handles up Amount computing module, including:
First real-time I/O throughput calculating sub module, is suitable to, for each destination service, currently to obtain Moment corresponding IO total throughouts, the IO for deducting the current previous acquisition moment for obtaining the moment are always handled up Amount, to obtain the real-time I/O throughput of each destination service.
CN201510614361.XA 2015-09-23 2015-09-23 The I/O throughput monitoring method of process and device Pending CN106547478A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510614361.XA CN106547478A (en) 2015-09-23 2015-09-23 The I/O throughput monitoring method of process and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510614361.XA CN106547478A (en) 2015-09-23 2015-09-23 The I/O throughput monitoring method of process and device

Publications (1)

Publication Number Publication Date
CN106547478A true CN106547478A (en) 2017-03-29

Family

ID=58365671

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510614361.XA Pending CN106547478A (en) 2015-09-23 2015-09-23 The I/O throughput monitoring method of process and device

Country Status (1)

Country Link
CN (1) CN106547478A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019000626A1 (en) * 2017-06-28 2019-01-03 上海壹账通金融科技有限公司 Interface invoking method, system, electronic device and computer readable storage medium
CN110069338A (en) * 2018-01-24 2019-07-30 中兴通讯股份有限公司 Resource control method, device and equipment, computer readable storage medium
CN110119431A (en) * 2019-05-14 2019-08-13 深信服科技股份有限公司 A kind of the operation regulation method and relevant device of data synchronous task
CN111447113A (en) * 2020-03-25 2020-07-24 中国建设银行股份有限公司 System monitoring method and device

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070064329A1 (en) * 2005-09-21 2007-03-22 Fujitsu Limited Storage apparatus, storage apparatus control method, and computer product
CN101201801A (en) * 2006-12-11 2008-06-18 南京理工大学 Hierarchical storage management method for video on demand system
CN101866312A (en) * 2010-06-18 2010-10-20 北京北大众志微系统科技有限责任公司 Hardware fault detection system and method based on dynamic I/O value invariant
CN102314391A (en) * 2011-05-27 2012-01-11 运软网络科技(上海)有限公司 Architecture and method for monitoring performance of virtualization system based on hardware basis tools
CN103207827A (en) * 2013-04-19 2013-07-17 北京百度网讯科技有限公司 Method and device for detecting IO (input output) hotspots based on Linux system
CN103327079A (en) * 2013-05-31 2013-09-25 青岛海信传媒网络技术有限公司 Multimedia resource caching method and device
CN103366017A (en) * 2013-08-02 2013-10-23 人民搜索网络股份公司 Microblog information capturing method and device
CN104091295A (en) * 2014-07-07 2014-10-08 东南大学 Canteen service quality evaluation system and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070064329A1 (en) * 2005-09-21 2007-03-22 Fujitsu Limited Storage apparatus, storage apparatus control method, and computer product
CN101201801A (en) * 2006-12-11 2008-06-18 南京理工大学 Hierarchical storage management method for video on demand system
CN101866312A (en) * 2010-06-18 2010-10-20 北京北大众志微系统科技有限责任公司 Hardware fault detection system and method based on dynamic I/O value invariant
CN102314391A (en) * 2011-05-27 2012-01-11 运软网络科技(上海)有限公司 Architecture and method for monitoring performance of virtualization system based on hardware basis tools
CN103207827A (en) * 2013-04-19 2013-07-17 北京百度网讯科技有限公司 Method and device for detecting IO (input output) hotspots based on Linux system
CN103327079A (en) * 2013-05-31 2013-09-25 青岛海信传媒网络技术有限公司 Multimedia resource caching method and device
CN103366017A (en) * 2013-08-02 2013-10-23 人民搜索网络股份公司 Microblog information capturing method and device
CN104091295A (en) * 2014-07-07 2014-10-08 东南大学 Canteen service quality evaluation system and method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019000626A1 (en) * 2017-06-28 2019-01-03 上海壹账通金融科技有限公司 Interface invoking method, system, electronic device and computer readable storage medium
CN110069338A (en) * 2018-01-24 2019-07-30 中兴通讯股份有限公司 Resource control method, device and equipment, computer readable storage medium
CN110069338B (en) * 2018-01-24 2024-03-19 中兴通讯股份有限公司 Resource control method, device and equipment and computer readable storage medium
CN110119431A (en) * 2019-05-14 2019-08-13 深信服科技股份有限公司 A kind of the operation regulation method and relevant device of data synchronous task
CN111447113A (en) * 2020-03-25 2020-07-24 中国建设银行股份有限公司 System monitoring method and device

Similar Documents

Publication Publication Date Title
US11681785B2 (en) Detecting and tracking virtual containers
JP6888019B2 (en) Memory access command transfer descriptor
CN110598138A (en) Cache-based processing method and device
US9720824B2 (en) Garbage collection handler to update object pointers
CN106547478A (en) The I/O throughput monitoring method of process and device
CN104503887A (en) Method and device for showing state of computing equipment
CN106897141A (en) The processing method and processing device of information
US10176017B2 (en) Configuration management for a shared pool of configurable computing resources
US20170004074A1 (en) Garbage collection absent use of special instructions
WO2019041707A1 (en) Method and system for exporting mass service data
CN104392132B (en) A medical data storage system based on cloud computing
CN102819717B (en) Method and device for carrying out protection processing on file
US9424546B2 (en) Prioritising event processing based on system workload
US10146783B2 (en) Using file element accesses to select file elements in a file system to defragment
CN108153891A (en) Active time statistical method of surfing the Internet and device
WO2019091202A1 (en) Contact management method and device, and storage medium
CN106657358A (en) Service proxy method and device for Android applications
US10356015B2 (en) Execution traces
CN116450287A (en) Method, device, equipment and readable medium for managing storage capacity of service container
CN112181662A (en) Task scheduling method and device, electronic equipment and storage medium
CN110019045A (en) Method and device is landed in log
US20150095568A1 (en) Storage system and storage device configuration reporting
CN111026945A (en) Multi-platform crawler scheduling method and device and storage medium
CN105426758B (en) A kind of means of defence and device of virtual machine escape
CN111914252B (en) File security detection method, device and electronic device

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

Application publication date: 20170329

RJ01 Rejection of invention patent application after publication