Observe Linux performance and Linux Performance

Source: Internet
Author: User
Tags mrtg

Observe Linux performance and Linux Performance
Analyzing linux performance can help us solve Application Problems, adjust the system architecture, and optimize products. First, let's look at the Linux system structure.




The above user domain is called by the system, and the following is the kernel domain.
The basic performance monitoring tools in Linux are as follows: 1) top or Htop: reads information about the CPU, DRAM, and Virtual Memory to observe the status of each process, mainly the CPU usage. 2) iostat reads Disk, IO controller, block device, and observes Disk IO statistics. 3) mpstat reads CPU information and observes the active thread information. 4) vmstat reads virtual memory and schedulers, system Call and CPU, observe the statistics of virtual memory, dstat is similar to the screen output with a little more color 5) free read DRAM and virtual memory, observe the memory usage

Further, linux performance monitoring tools include: 1) sar Observation of system activities, such as paging read/write, block device statistics, and running queue statistics. It also covers functions such as vmstat and iostat. 2) statistics on various network protocols of netstat 3) pidstat observe process faults 4) strace trace system calls and resources 5) tcpdump listen to network packets and provide file output, wireshark for further analysis 6) blktrace for block device I/O events 7) iotop for every process I/O usage 8) slabtop for slab distributor in kernel 9) sysctl Kernel Parameter Tuning tool 10)/proc Haha, you can directly read the source data
The more powerful inux performance monitoring tool is my favorite performance indicator perf, which reads information such as CPU, memory, I/O bus, and network controllers. It can observe the performance indicators of an executable program, sampling IO, cpu activity data, use it, feel...
How can I check the Linux system?

When using the network, we need to monitor the Linux system: CPU load, memory consumption, disk space in several specified directories, disk I/O, and swap are also the network traffic. Today, Shanghai Express network introduces how to obtain Linux system performance monitoring parameters.

There are actually many performance testing tools in Linux.

Mrtg is a good choice. However, mrtg is required to install sysstat, apache, snmp, perl, and other things. It may take several steps to install the SDK. I also wanted to directly call the commands such as sar and vmstat, And the parse would just calculate the result. Which knows that the results of linux commands of different versions are also different. Since the results of version parse are required, it is better to calculate them directly in the system. So I studied the source code of sysstat and gkrellm and found the data for monitoring performance.

1. CPU

The file "/proc/stat" contains CPU information. Every CPU tick is used in this file. The following numbers indicate user, nice, sys, idle, and iowait. Some versions of kernel do not include iowait. These values indicate where each tick of the CPU is used from the boot to the present.

That is, 256279030 tick is used for user consumption since CPU 0 is started, and 11832528 is used for sys consumption. So if you want to calculate the CPU load per unit time (for example, 1 s), you only need to calculate the difference between the values before and after 1 second by the number of tick per second.

2. memory consumption

The file "/proc/meminfo" contains the memory information and swap information.

3. Disk Space

From the source code of gkrellm, this is a very complex data.

4. Disk I/O

Disk I/O data is also complex. For some versions, see/proc/diskstats, for some versions, see/proc/partitions, and for some versions, I still don't know where to view them ...... However, we can see that the data version is also the same as the CPU, which requires a value every other time. The difference between the two values is the traffic.

5. Network Traffic

Network traffic is also varied, but it can basically be obtained in/proc/net/dev. It also requires two values to take the difference as the traffic value.
Reference: Shanghai Express Network

How to analyze linux performance metrics

LR

Monitoring

UNIX/Linux

System Method

I. preparations:

1.

You can verify whether the server is configured in two ways.

Rstatd

Daemon:

① Use

Rup

Command, which is used to report various computer statistics, including

Rstatd

. Life Cycle

Ling

Rup

10.130.61.203,

Here

10.130.61.203

Yes

Linux/Unix

Server

IP

If this command returns

Statistics. Indicates that it has been configured and activated.

Rstatd

Daemon. If no meaningful statistical information is returned, or if

Error reports, indicating

Rstatd

The daemon has not been configured or has problems.

② Use

Find

Command

# Find/-name rpc. rstatd,

This command is used to find whether the system exists

Rpc. rstatd

File. If not, the system does not

Installed

Rstatd

Daemon.

2

.

Linux

Download required

3

Packages:

(

1

)

Rpc.rstatd-4.0.1.tar.gz

(

2

)

Rsh-0.17-14.i386.rpm

(

3

)

Rsh-server-0.17-14.i386.rpm

3

. Download and install

Rstatd

If the server is not installed

Rstatd

Program (in general

LINUX

Are not installed)

, You need to download a package to have this server

Services

,

Package

Name

Word

Yes

Rpc.rstatd-4.0.1.tar.gz.

This

Yes

I

Items

Source

Code

,

Yes

Yes

Editing

Translation

,

Lower

Load

And

Security

Installation

Rstatd

(

Yes

To

In

Sourceforge.net/projects/rstatd

Download the package at this address. The installation procedure is as follows:

Tar-xzvf rpc.rstatd-4.0.1.tar.gz

Cd rpc, rstatd-4.0.1/

./Configure

-Configuration operations

Make

-Compile

Make install

-Start Installation

Rpc. rstatd

-Start

Rstatd

Process

"

Rpcinfo-p

"Command to check whether the current system has been started

Rstatd

Daemon

Only guaranteed

Linux

There are

Rstatd

And

Xinetd

These two services can be used.

LR

Go to monitor, through the following

You can check whether the instance is started at the following two points:

1

) Check for startup

: Rsh server

Listened

TCP

Yes

514

.

[Root @ mg04 root] # netstat-an | grep 514

Tcp 0 0 0.0.0.0: 514 0.0.0.0: * LISTEN

If you can see

514

Description

Rsh

The server has been started.

2

) Check for startup

: Rstatd

Enter the command

: Rpcinfo-p

If the following information is displayed:

Program version protocol port

100001

5

Udp

937

Rstatd

100001

4

Udp

937

Rstatd

100001 ...... remaining full text>
 

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.