Run vmstat to view linux servers

Source: Internet
Author: User
Run vmstat to view the linux Server-Linux Enterprise Application-Linux server application information. For more information, see. Introduction to vmstat
Server information is collected through STATSPACK, and VMSTAT information is collected to display the server status. The VMSTAT tool is the most common UNIX monitoring tool that displays the status values of servers at a given interval.

Generally, the VMSTAT tool is used by two numeric parameters. The first parameter is the number of sampling intervals, in seconds, and the second parameter is the number of sampling times. For example:

[Oracle @ localhost oracle] $ vmstat 2
Procs ----------- memory ---------- --- swap -- ----- io ---- system -- ---- cpu ----
R B swpd free buff cache si so bi bo in cs us sy id wa
0 0 195804 3812 40616 0 0 0 1598656 0 0 1024 0 66976 0
0 0 195804 3812 40616 1598656 0 0 12 1048 0 0 66961 0
0 0 195804 3812 40616 1598656 0 0 28 1054 67067 0 100 0
0 0 195804 3812 40616 0 0 0 1598656 0 0 1020 0 66988 0

(Note: At present, the system is almost idle, and the output content of VMSTAT varies with operating systems)

Currently, the following measures are useful for server monitoring:

R (running Queue)

Pi (page import)

Us (User CPU)

Sy (system CPU)

Id (idle)
(If r is often greater than 4 and the id is often less than 40, the cpu load is heavy .)

(If bi and bo are not equal to 0 for a long time, the memory is insufficient)

Use VMSTAT to identify CPU bottlenecks
R (run Queue) shows the number of tasks being executed and waiting for CPU resources. When this value exceeds the number of CPUs, a CPU bottleneck will occur.

Command for obtaining the number of CPUs (in LINUX ):
Cat/proc/cpuinfo | grep processor | wc-l

When the R value exceeds the number of CPUs, there will be a CPU bottleneck. There are several solutions:
1. The simplest thing is to increase the number of CPUs.
2. Adjust the task execution time. If a large task is executed when the system is not busy, the system tasks are balanced.
3. Adjust the priority of an existing Task

Use VMSTAT to identify CPU usage
The first thing to declare is that the CPU metric in vmstat is the percentage. When the value of us + sy is close to 100, it indicates that the CPU is working close to full capacity. However, when the CPU is fully loaded, UNIX always tries to keep the CPU as busy as possible to maximize the task throughput. The only value that can determine the CPU bottleneck is the r (running Queue) value.

Use VMSTAT to identify RAM bottlenecks
Database servers only have limited RAM, and memory contention is a common problem in Oracle.

First, check the number of RAM instances. The command is as follows (in LINUX ):
[Oracle @ oracle-db02 ~] $ Free
Total used free shared buffers cached
Mem: 2074924 2071112 3812 0 40616 1598656
-/+ Buffers/cache: 431840 1643084
Swap: 3068404 195804 2872600

Of course, you can use other commands such as top to display RAM.
When the memory requirement is greater than the number of RAM, the server starts the virtual memory mechanism. Through the virtual memory, you can move the RAM segment to the special DISK segment of the swap disk, this will result in page export and page import of virtual memory. Page export does not indicate the RAM bottleneck. The virtual memory system often exports pages of memory segments, however, the page import operation indicates that the server requires more memory. The page import operation needs to copy the memory segment back to RAM from the swap disk, which slows down the server speed.

There are several solutions:
1. Increase the RAM
2. Modify SGA to reduce RAM requirements
3. Reduce RAM requirements (for example, reduce PGA)
Related Article

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.