Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

About disk IO in linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

View disk IO load-see which processes are reading and writing to disk

1. Lsof command to view files opened by the process

The full name of lsof is list open files, which lists the files that have been opened in the system. Through the lsof command, you can find the corresponding process information according to the file, and you can also find the file opened by the process according to the process information.

# individual environments need to be installed

Sudo yum install lsof-y

Parameter option

-c displays the file opened by the specified process name

-p displays the file opened by the specified process number

-I display qualified process information by listening to specified protocols, ports, hosts, etc.

-u displays the files used by the specified user

-U displays all socket files

1. Show the processes that occupy the files

About disk IO in linux

Details of the contents:

COMMAND: command, name of the process

PID: process number

USER: the owner of the process

FD: file descriptor that contains the following:

0: standard output

1: standard input

2: standard error

U: the file is opened and in read / write mode

R: the file is opened and is in read-only mode

W: the file is opened and is in write mode

TYPE: file type. REG (regular) is a normal file.

DEVICE: specifies the name of the disk

SIZE/OFF: the size of the file

NODE: index node

NAME: file name

2. Display the files opened by the specified process

About disk IO in linux

3. Display the files opened by the specified process number

About disk IO in linux

4. Monitor the specified protocol, port, host and other information to display the process information that meets the conditions

4.1 View all processes

About disk IO in linux

4.2 display process information for all tcp network connections

About disk IO in linux

4.3 shows the process with port 22 * *

About disk IO in linux

5. Display the files occupied by the specified user

About disk IO in linux

6. Show all socket files

About disk IO in linux

2. Cat / proc/$pid/io directly view the process pid file

If the kernel version is greater than 2.6.20, the io information of the process can be obtained through cat / proc/pid/io.

About disk IO in linux

Pidstat-monitors and calculates data for Linux processes

Pidstat is a command of the sysstat tool, which is used to monitor the utilization of system resources such as cpu, memory, threads, device IO, etc., of all or specified processes. The first time pidstat runs, it displays statistics from the start of the system, and then running pidstat displays statistics since the last time the command was run. Users can obtain the required statistics by specifying the number and time of statistics.

# individual environments need to be installed

RHEL system

Yum install sysstat-y

Ubuntu

Apt-get install sysstat

Parameter option

-u default parameter that displays the CPU usage statistics of each process

-r displays memory usage statistics for each process

-d displays the IO usage of each process

-p specify the process number

-w displays the context switch for each process

-t displays additional information in addition to the statistics of the thread that selected the task

1. Cpu and memory statistics

1. Show that the CPU utilization of all processes is equivalent to pidstat-u-p ALL

About disk IO in linux

1.1 CPU utilization of the specified process

About disk IO in linux

Details of the contents:

PID: process ID

% usr: percentage of cpu occupied by processes in user space

% system: percentage of cpu occupied by processes in kernel space

% guest: CPU usage of tasks spent on virtual machines (running on virtual processors)

% CPU: total CPU usage of the task

CPU: the processor number on which this task is running

Command: the command name for this task

2. Memory usage statistics of all processes

About disk IO in linux

2.1 memory usage statistics for the specified process

About disk IO in linux

Details of the contents:

Minflt/s: the number of minor errors per second when loading data from memory, which do not require memory pages to be loaded from disk

Majflt/s: the number of major errors per second when loading data from memory, which requires loading memory pages from disk

VSZ: virtual address size, virtual memory usage KB

RSS: long-term memory usage, non-swap physical memory usage KB

% MEM: percentage of physical memory used by the process, which is also output by the top command

2. IO statistics of processes 1. Pidstat-d-p 1385 15 outputs a total of five IO statistics with an ID of 1385 every second.

About disk IO in linux

Details of the contents:

KB_rd/s: the amount of data that the process reads from disk per second (in kB)

KB_wr/s: the amount of data that the process writes to disk per second (in kB)

KB_ccwr/s: the rate at which a task's write to disk is canceled (KB); occurs when a task truncates a dirty pagecache.

2. Display additional information in addition to the statistics of the thread that selected the task

About disk IO in linux

Details of the contents:

TGID: identification of the main thread

TID: thread ID

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report