Article Title: Analysis of Linux operating system running slowly. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
The default parameter of iostat is tdc (terminal, disk, and CPU ). If any other option is specified, this default parameter will be completely replaced. For example, iostat-d will only reflect the disk statistics.
Syntax: Basic Syntax: iostat interval count
Option-allows you to specify the device with the required information, such as disk, cpu, or terminal (-d,-c,-t or-tdc ). The x option provides the complete statistical result (gives the extended
Statistic ).
Interval-the time (in seconds) between two samples ).
Count-count
Example: $ Iostat-xtc 5 2
Extended disk statistics tty cpu
Disk r/s w/s Kr/s Kw/s wait actv svc_t % w % B tin tout us sy wt id
Sd0 2.6 3.0 20.7 22.7 0.1 0.2 6 19 0 84 3 85 11 0
Sd1 4.2 1.0 33.5 8.0 0.0 0.2 47.2 2 23
Sd2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0
Sd3 10.2 1.6 51.4 12.8 0.1 0.3 31.2 3 31
The fields have the following meanings:
Disk name of the disk
R/s reads per second
W/s writes per second
Kr/s kilobytes read per second
Kw/s kilobytes written per second
Wait average number of transactions waiting for service (Q length)
Actv average number of transactions actively
Being serviced (removed from
Queue but not yet
Completed)
% W percent of time there are transactions waiting
For service (queue non-empty)
% B percent of time the disk is busy (transactions
In progress)
Results and Solutions:
Values to be aware of in iostat output results:
Reads/writes per second (r/s, w/s)
Percentage busy (% B)
Service time (svc_t)
If the disk shows high reads/writes for a long time, and the disk's percentage busy (% B) is much larger than 5%, the average service time (svc_t) is also much larger than 30
Milliseconds:
1) Adjust the application to make it more efficient to use disk I/o. You can modify the disk queue and use the cache of the application server.
2) Distribute the file system to two or more disks and use the Strip feature of volume manager/disksuite.
3) add system parameter values, such as inode cache and ufs_ninode. Increase the system parameter values for inode cache, ufs_ninode, which
Is Number of inodes to be held in memory. Inodes are cached globally (for UFS), not on a per-file system basis
4) Move the file system to a faster Disk/controller, or use a better device instead.
Vmstat-vmstat indicates the virtual memory, virtual memory, disk, and trap of the process ??) And cpu Activity
In a multi-cpu system, vmstat average the number of CPUs in the output results. For per-process statistics. If no option is available, vmstat displays a summary of a row of virtual memory activity
The result starts when the system is started.
Syntax: Vmstat interval count
Option-let you specify the required information types, such as paging-p, cache-c,. interrupt-I etc.
If no option is specified, the process, memory, page, disk, interrupt, and cpu information will be displayed.
Interval-same as iostat
Count-same as iostat
Example
The following command displays a summary of what the system
Is doing every five seconds.
Example % vmstat 5
Procs memory page disk faults cpu
R B w swap free re mf pi p fr de sr s0 s1 s2 s3 in sy cs us sy id
0 0 0 11456 4120 1 41 19 1 3 0 2 0 4 0 0 48 112 4 14 82
0 0 1 10132 4280 0 44 0 0 0 0 23 0 0 211 230 3 35 62
0 0 1 10132 4616 0 0 0 0 0 0 19 0 0 150 172 146 3 33 64
0 0 1 10132 5292 0 9 0 0 0 0 21 0 0 165 105 130 1 21 78
The fields of vmstat's display are
Procs
R in run queue
B blocked for resources I/O, paging etc.
W swapped
Memory (in Kbytes)
Swap-amount of swap space currently available
Free-size of the free list
Page (in units per second ).
Re page reclaims-see-S option for how this field is modified.
Mf minor faults-see-S option for how this field is modified.
Pi kilobytes paged in
Po kilobytes paged out
Fr kilobytes freed
De anticipated short-term memory shortfall (Kbytes)
Sr pages scanned by clock algorithm
Disk (operations per second)
There are slots for up to four disks, labeled with a single letter and number.
The letter indicates the type of disk (s = SCSI, I = IPI, etc). The number is
The logical unit number.
Faults
In (non clock) device interrupts
Sy system CILS
Cs CPU context switches
Cpu-breakdown of percentage usage of CPU time. On multiprocessors this is an
Verage processing SS all processors.
Us user time
Sy system time
Id idle time
Results and solutions: A. CPU issues:
The following columns need to be viewed to check whether the cpu is faulty.
Processes in the run queue (procs r)
User time (cpu us)
System time (cpu sy)
Idle time (cpu id)
Procs cpu
R B w us sy id
0 0 0 4 14 82
0 0 1 3 35 62
0 0 1 3 33 64
0 0 1 1 21 78
Problem: 1) if the number of processes in run queue (procs r) is greater than the number of CPUs in the system, the system will be slow.
2) If the number is 4 times the number of CPUs, it indicates that the system is facing a shortage of cpu capabilities, which will greatly reduce the system running speed.
3.) If the idle time of the cpu is usually 0, or the system usage time (cpu sy) is the user usage time (cpu us), the system faces a lack of cpu resources
Solution: To solve these problems, it involves adjusting the application so that it can use the cpu more effectively and increase the cpu capability or quantity.
B. Memory Issues:
The memory bottleneck depends on scan rate (sr ). Scan rate is the page scan per second (he scan rate is the pages scanned by the clock algorithm per
Second.) If the scan rate (sr) is always greater than 200 pages per second, this is the reality of memory shortage.
Solution: 1. Adjust applications and servers to make better use of memory and cache
2. Increase system memory
Dmidecode is similar to the AIX lsdev, which can be seen by all devices.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.