Query system Load Information Linux command detailed

Source: Internet
Author: User
Tags switches nfsd

The Linux uptime command is primarily used to obtain information such as host uptime and query Linux system load. The uptime command used to show only how long the system was running. Now, you can show how long the system has been running, the information is displayed in order: The current time, how long the system has been running, how many users are currently logged in, the average load of the system in the past 1 minutes, 5 minutes, and 15 minutes.

The uptime command is simple to use: direct input

# uptime

Can.

Input Sample:

18:02:41 up, 23:42, 1 user, Load average:0.00, 0.00, 0.00

1 can be considered as the optimal load value. The load will vary with the system. Single CPU system 1-3 and SMP system 6-10 are all possible to accept.

There is also a parameter-V, which is used to query the version. (Note that the letter V is uppercase)

[Linux @ localhost]$ uptime-v

Procps version 3.2.7

[Linux @ localhost]$ uptime

The results shown are:

10:19:04 up 257 days, 18:56, users, load average:2.10, 2.10,2.09

Display Content Description:

10:19:04//System Current time

Up 257 days, 18:56//host has run time, the greater the time, the more stable your machine.

Number of users//user connections, which is the total number of connections, not the number of users

Load average//System average load, statistics last 1, 5, 15 minutes of system average load

So what is the average system load? The average system load is the average number of processes running in a queue during a specific time interval.

If the current number of active processes per CPU core is not greater than 3, then the performance of the system is good. If the number of tasks per CPU core is greater than 5, then there is a serious problem with the performance of this machine.

If your Linux host is 1 dual-core CPUs, when load Average is 6, it means that the machine is fully used.

View CPU Load

#vmstat
procs-----------Memory-------------Swap-------io------System-------CPU------
R b swpd free buff cache si so bi bo in CS us sy ID WA St
1 4 329796 26040 4528 3379824 1 1 2 3 0procs
The R column represents the number of processes running and waiting for the CPU time slice, if the long-term is greater than 1, indicating that the CPU is low.
Column B indicates the number of processes waiting on the resource, such as waiting for I/O, or memory swapping.
CPU indicates usage status of CPU
The US column shows the percentage of CPU time that is spent in user mode. When the value of us is higher, the user process consumes more CPU time, but if the long-term is greater than 50%, you need to consider optimizing the user's program.
The SY column shows the percentage of CPU time that the kernel process spends. Here US + SY reference value is 80%, if us+sy greater than 80% indicates that there may be insufficient CPU.
The WA column shows the percentage of CPU time consumed by IO waits. Here WA has a reference value of 30%, if WA is more than 30%, it indicates that the IO wait is serious, this may be caused by a lot of random access to disk, or the bandwidth bottleneck of disk or disk access controller (mainly block operation).
The ID column shows the percentage of time that the CPU is in idle state
System shows the number of interrupts that occurred during the acquisition interval
The in column represents the number of device interrupts per second observed in a time interval.
The CS column represents the number of context switches produced per second, such as when CS is much higher than disk I/O and network packet rates, and should be investigated further.
Memory
SWPD The amount of memory to switch to the memory Swap area (k). If the value of SWPD is not 0, or larger, for example, more than 100m, as long as SI, so the value of long-term 0, system performance or normal
The amount of memory in the free current list of available pages (k)
Buff as the amount of memory in buffer cache, generally read and write to the block device requires buffering.
Cache: As the number of memory page cache, generally as the file system cache, if the cache is large, indicating that the file with the cache is more, if at this time bi is relatively small in Io, the file system efficiency is better.
Swap
Si the number of memory-swap areas entered by the RAM.
So the memory swap area enters the amount of memory.
Io
The total amount of data that bi reads from the block device (read disk) (KB per second).
The total amount of data written by the BO block device (write disk) (KB per second)
Here we set the Bi+bo reference value of 1000, if more than 1000, and the large WA value should consider balancing the disk load, can be combined with the Iostat output to analyze.View system resources and load, and performance monitoring under Linux

1. View Disk

Df-h

2. View memory Size

Free

Free [-m|g] Press MB,GB to display memory

Vmstat

3. View CPU

Cat/proc/cpuinfo

Just look at the number of CPUs grep "model name"/proc/cpuinfo | Wc-l

4. View system memory

Cat/proc/meminfo

5. View the status of each process

Cat/proc/5346/status 5347 is PID

6. View Load

W

Uptime

7. View the overall status of the system

Top

The final explanation of some output information:

Load average:0.09, 0.05, 0.01

The three numbers represent the average system load for different time periods (one minute, five minutes, and 15 minutes), and the number of them is, of course, the smaller the better. "How many cores are the number of loads" rule: in multicore processing, your system's average value should not be higher than the total number of processor cores

The memory used by the process can be top, with 3 columns Virt RES SHR, indicating the memory used by the process, Virt identifies the total amount of memory that the process can use, including the memory that the process is using, the mapped file, and the memory shared by other processes. Res identifies the size of this process that really consumes memory. The SHR identifies the memory and library sizes that can be shared with other processes.

8, performance monitoring SAR command

The Sar-u output displays the CPU information. The-u option is the default option for SAR. The output shows the CPU usage as a percentage

Cpu

CPU number

%user

The time it took to run the process in user mode

%nice

The time it takes to run a normal process

%system

The time it took to run the process in kernel mode (System)

%iowait

The time that the processor waits for I/O to complete when no process is executing on the CPU

%idle

The time that no process is executing on the CPU

SAR 5 SAR obtains 10 samples at 5 second intervals

Sar-u-P All 5 5-minute cup display

sar-n {DEV | Edev | NFS | NFSD | SOCK | All}

The SAR provides six different syntax options to display network information. The-N option uses 6 different switches: DEV | Edev | NFS | NFSD | SOCK | All. The dev Displays the network interface information, Edev displays statistics about network errors, NFS Statistics active NFS Client information, NFSD statistics Server for NFS, sock displays socket information, all shows all 5 switches. They can be used alone or together.

Sar-n DEV each parameter meaning

IFACE

LAN interface

rxpck/s

Packets Received per second

txpck/s

Packets Sent per second

rxbyt/s

Number of bytes received per second

txbyt/s

Number of bytes sent per second

rxcmp/s

Compressed packets received per second

txcmp/s

Compressed packets sent per second

rxmcst/s

Multicast packets received per second

9. View the command history (with timestamps)

Export histtimeformat= '%F%T '; history| More

10. View folder and file size

Du-h--max-depth=0 DM view DM directory Size

Du-h--max-depth=1 DM View DM directory size, and DM file folder size

Du-h--max-depth=0 View the current folder size

Query system Load Information Linux command detailed

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.