Performance analysis of Linux system (i)

Source: Internet
Author: User
Tags switches


1, the purpose of performance analysis

1) Identify system performance bottlenecks (hardware, software)

2) Provide performance optimization scheme (upgrade hardware, improve system structure)

3) to achieve reasonable hardware and software configuration

4) Maximize the balance of system resource usage.


2. Factors that affect performance

1) CPU

2) Memory

3) hard disk (1, use of RAID technology, RAID0,RAID1,RAID0+1,RAID5.

2, small file read-write bottleneck is the disk addressing (TPS), large file read and write performance bottleneck is the bandwidth

3, Linux can use free memory for file system access to the cache, so the larger the system memory storage system performance is better.

4) Network

RAID Technology Overview

RAID0: All disks are read and written in parallel, so read and write performance is highest (several hard drives, and read and write performance is increased a few times). However, there is no redundancy at all, so fault tolerance is the worst, and any piece of disk is corrupted, the data is completely lost.

RAID1: Mirroring technology, mirror write, parallel read, the highest reliability. The principle is that the data is stored on the primary hard drive and the same data is written on the mirrored drive.

RAID5: A storage solution that combines storage performance, data security, and storage costs. RAID5 requires at least three hard disks, RIAD5 does not backup the stored data, but instead stores the data and the corresponding parity information on each hard disk that makes up the RAID5, and the parity information and the corresponding data are stored on separate disks.

Raid0+1: First strip, then mirror. The disk is divided into two groups, the two groups first to do strip RAID0, and then on the basis of RAID0 to do two sets of RAID0 mirror, so as to get riad0+1.


3. Performance analysis Steps

1) long-term monitoring and data acquisition of resource usage status

2) Use common performance analysis tools (Vmstat iostat free top iftop)

3) Accumulated experience

1. Application design flaws and database queries are the most likely to cause performance problems

2, performance bottlenecks may be due to poor program, low memory, disk bottlenecks, but ultimately the result is CPU exhaustion, high system load, slow response

3, the physical memory is not enough to use swap memory, will bring disk IO and CPU overhead

4, may be caused by CPU bottleneck problem, frequent execution of programs, database query a large number of where clauses, order by ordering

5, can cause memory bottleneck problem, high concurrent user access, system process, Java memory leaks

6, may cause disk IO bottleneck problem, generate cache file, database update frequently, or query large table


4, Vmstat detailed introduction

Vmstat is a comprehensive profiling tool that may observe the system's process state, memory usage, virtual memory usage, disk IO, interrupts, context switches, CPU usage, and so on.

[[Email protected]~]# vmstat 1 5

procs-----------Memory-------------Swap-------io------System-------CPU-----

R b swpd free buff cache si so bi bo in CS us sy ID WA St

0 0 5672332 152760 205424 2271256 10 10 129 14 0 0 1 0 99 0 0

0 0 5672332 166516 205424 2257232 0 0 1792 0 1089 1020 0 0 99 0 0

0 0 5672332 163788 205424 2259540 0 0 2304 0 1152 1035 0 1 99 0 0

0 0 5672332 161060 205424 2262232 0 0 2816 60 1400 1059 0 0 99 0 0

0 0 5672332 159820 205424 2264532 0 0 2176 0 1719 1034 0 0 99 0 0

1) procs

1, the R column represents the number of processes running and waiting for CPU time slices, this value if longer than the number of system CPU, it is insufficient CPU resources, consider increasing the CPU.

2, column B indicates the number of processes waiting on the resource, such as waiting for IO or memory exchange.

2) Memory

1, swpd column represents the amount of memory switched to the memory swap area, if the value of SWPD is not 0 or larger, and the value of Si, so long 0, then this situation does not have to worry about, does not affect system performance.

2. The free column represents the amount of physical memory currently idle.

3, the Buff column represents the buffers memory data, generally to the block device read and write only need to buffer.

4, the cache column represents the page cached memory amount, generally as the file system cached, frequently accesses the file will be cached. If the cached value is larger, the number of cache files is greater. If the bi in IO is small in this case, the file system is more efficient.

3) Swap

1. The SI column indicates the amount of memory that is being transferred from the disk into the memory swap area.

2. The so column indicates the amount of memory that is transferred into the disk, that is, the memory swap area.

3, in general, the value of Si, so is 0, if Si, so value for a long time not 0, it means that the system memory is insufficient, you need to consider increasing memory.

4) IO

1. The bi column represents the total amount of data read from the block device

2. The Bo column represents the total amount of data written to the block device (where the BI Bo reference value is set to 1000, if more than 1000, and the WA value is larger, it represents the system disk IO performance bottleneck)

5) system

1, in column indicates the number of device interrupts per second observed at a certain time interval.

2, the CS column represents the number of context switches produced per second. (The larger of these two values, the more time you'll see the CPU consumed by the kernel.)

6) CPU

1. The US column shows the percentage of CPU time consumed by the user process. When the value of us is higher, it indicates that the user process consumes more CPU time, and if the long term is greater than 50%, the optimizer needs to be considered.

2. The SY column shows the percentage of CPU time consumed by the kernel process. When the value of SY is higher, it indicates that the kernel consumes more CPU time, if US+SYF exceeds 80%, it indicates that there is insufficient CPU resources.

3. The ID column shows the percentage of time that the CPU is idle.

4. The WA column represents the percentage of CPU time that IO waits. The higher the WA value, the more serious the IO waits. If the WA value exceeds 20%, the IO wait is severe.

5, St column is not generally concerned about the percentage of time the virtual machine occupies.

This article is from the "XWB" blog, make sure to keep this source http://xiewb.blog.51cto.com/11091636/1792210

Performance analysis of Linux system (i)

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.