The three metrics that the stress test measures the CPU: CPU utilization, Load average, and context Switch rate

Source: Internet
Author: User

Category: 4. Software Design/Architecture/testing 2010-01-12 19:58 34241 people read reviews (4) favorite reports Test Loadrunnerlinux Server Firebugthread

on how to use LoadRunner to monitor the performance of Linux, but a few indicators of the CPU is not clear, the following detailed said.

CPU Utilization good understanding, that is, CPU utilization, more than 75% is relatively high (also has the argument is 80% or higher). In addition to this indicator, combined with load average and context Switch rate, it is possible that the high CPU is due to the latter two high indicators.

Load Average , this is hard to measure. Search the Internet a circle, have not seen a few reasonable explanations. I have 100 concurrent user tests to these two values are: 77.534%,6.108,CPU utilization ratio is high, Load average also seems a bit high. The following two blog posts were discovered: Understanding load Average for stress testing, "load Average is the load of the CPU , it contains information that is not CPU usage status, but the CPU in a period of time Statistics about the sum of processes that are being processed and waiting for the CPU to process , that is, the length of the CPU usage queue. ", basically explains the principle of the Multi-process,multi-thread program. Understanding the load mean (translation) of a Linux processor is simply a word:

Load Average < CPU * Number of cores *0.7

For example, 1 1-Core Cpu,load Average < 1 * 1 * 0.7; 1 4-core cpu,load Average must be < 1 * 4 * 0.7 = 2.8.

View CPU Information: grep ' model name '/proc/cpuinfo

Context Switch rate. is the process (Thread) switch, if the switch too much, will let the CPU busy switching, also can affect the throughput. The 2nd section of the article, "High-performance server architecture," is the question. How much is appropriate? Google has a big circle, without a definitive explanation. Context switch is largely composed of two parts: interrupts and processes (including thread) switching, one interrupt (Interrupt) causes a switchover, and the creation, activation, and so on, of the process (thread) can also cause a switchover. The value of CS is also related to TPS (Transaction per Second), assuming that each call will cause N CS, then you can derive

Context Switch rate = Interrupt rate + tps* N

The CSR minus the IR, is the process/thread switching, if the main process receives the request to the thread processing, the thread processing finished to return to the main process, here is 2 times the switchover. You can also use the values of CSR, IR, and TPS in the formula to derive the number of transitions that result from each thing. Therefore, in order to reduce the CSR, we must work on the switch caused by each TPS, only the value of n down, the CSR can be reduced, ideally n=0, but in any case N >= 4, you have to check carefully. In addition to the online csr<5000, I think the standard should not be so single.

Additional Information:

These three indicators can be monitored in loadrunner, and in Linux, you can also use Vmstat to view R (Load arerage), in (Interrupt), and CS (Context Switch)

#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
0 0 244644 29156 415720 2336484 0 0 1 49 2 1 1 0 98 0
0 0 244644 29140 415720 2336484 0 0 0 28 9 115 0 0 99 1
0 0 244644 29140 415720 2336484 0 0 0 24 62 256 0 0 100 0
0 0 244644 29140 415720 2336484 0 0 0 0 5 93 0 0 100 0
0 0 244644 29140 415720 2336484 0 0 0 0 58 255 0 0 100 0

Interrupt rate includes the kernel due to the time slice interruption of the process. (In Linux 2.6, the system clock interrupts the clock frequency every 1 milliseconds, expressed as a HZ macro, defined as 1000, which interrupts 1000 times per second.) System is different, the kernel is not the same configuration 100, 250 have. )

The clock frequency of the kernel can be known by the following command

cat/boot/config-' Uname-r ' | grep ' ^config_hz= '

config_hz=100

The total number of clock interrupts per second is = number of CPUs * Number of cores * config_hz

Cat/proc/interrupts

CPU0 CPU1 CPU2 CPU3
loc:97574747 52361843 105207680 69447653 Local timer interrupts
res:107368 257510 98635 186294 rescheduling interrupts
cal:14174 14206 14164 194 function call interrupts
tlb:1007949 853117 992546 591410 TLB shootdowns

You can see the type and number of interrupts

Postscript:

Found a Linux performance monitoring article, special posted here for reference

Http://blog.csdn.net/tianlesoftware/archive/2011/02/21/6198780.aspx

The three metrics that the stress test measures the CPU: CPU utilization, Load average, and context Switch rate

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.