Difference between revisions of "Tools for Performance Evaluation in Linux"
Line 1: | Line 1: | ||
Intro to evaluation here... | Intro to evaluation here... | ||
+ | |||
+ | ''vmstat''' (virtual memory statistics) is a monitoring utility, which also provides information about block IO and CPU activity in addition to memory. | ||
+ | |||
+ | ==vmstat Basics== | ||
+ | vmstat provides a number of values and will typically be called using two numerical parameters. | ||
+ | *Example: <code>vmstat 1 5</code> | ||
+ | ** 1 -> the values will be re-measured and reported every second | ||
+ | ** 5 -> the values will be reported five times and then the program will stop | ||
+ | |||
+ | The first line of the report will contain the average values since the last time the computer was rebooted. All other lines in the report will represent their respective current values. Vmstat does not need any special user rights. It can run as a normal user. | ||
+ | |||
+ | <pre> | ||
+ | [ec2-user@ip-172-30-0-240 ~]$ 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 | ||
+ | 1 0 0 1869728 11612 112776 0 0 16 2 8 19 0 0 99 0 0 | ||
+ | 0 0 0 1869756 11612 112776 0 0 0 0 13 22 1 0 99 0 0 | ||
+ | 0 0 0 1869752 11612 112776 0 0 0 0 9 11 0 0 100 0 0 | ||
+ | 0 0 0 1869748 11612 112776 0 0 0 0 12 18 0 0 100 0 0 | ||
+ | 1 0 0 1869748 11612 112776 0 0 0 0 9 8 0 0 100 0 0 | ||
+ | [ec2-user@ip-172-30-0-240 ~]$ | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | ===Explanation of Individual Values=== | ||
+ | (Source <code>man vmstat</code>): | ||
+ | * Procs | ||
+ | ** r: The number of processes waiting for run time. | ||
+ | ** b: The number of processes in uninterruptible sleep. | ||
+ | * Memory | ||
+ | ** swpd: the amount of virtual memory used. | ||
+ | ** free: the amount of idle memory. | ||
+ | ** buff: the amount of memory used as buffers. | ||
+ | ** cache: the amount of memory used as cache. | ||
+ | ** inact: the amount of inactive memory. (-a option) | ||
+ | ** active: the amount of active memory. (-a option) | ||
+ | * Swap | ||
+ | ** si: Amount of memory swapped in from disk (/s). | ||
+ | ** so: Amount of memory swapped to disk (/s). | ||
+ | * IO | ||
+ | ** bi: Blocks received from a block device (blocks/s). | ||
+ | ** bo: Blocks sent to a block device (blocks/s). | ||
+ | * System | ||
+ | ** in: The number of interrupts per second, including the clock. | ||
+ | ** cs: The number of context switches per second. | ||
+ | * CPU | ||
+ | ** These are percentages of total CPU time. | ||
+ | ** us: Time spent running non-kernel code. (user time, including nice time) | ||
+ | ** sy: Time spent running kernel code. (system time) | ||
+ | ** id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time. | ||
+ | ** wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle. | ||
+ | ** st: Time stolen from a virtual machine. | ||
Revision as of 18:27, 7 November 2015
Intro to evaluation here...
vmstat' (virtual memory statistics) is a monitoring utility, which also provides information about block IO and CPU activity in addition to memory.
Contents
vmstat Basics
vmstat provides a number of values and will typically be called using two numerical parameters.
- Example:
vmstat 1 5
- 1 -> the values will be re-measured and reported every second
- 5 -> the values will be reported five times and then the program will stop
The first line of the report will contain the average values since the last time the computer was rebooted. All other lines in the report will represent their respective current values. Vmstat does not need any special user rights. It can run as a normal user.
[ec2-user@ip-172-30-0-240 ~]$ 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 1 0 0 1869728 11612 112776 0 0 16 2 8 19 0 0 99 0 0 0 0 0 1869756 11612 112776 0 0 0 0 13 22 1 0 99 0 0 0 0 0 1869752 11612 112776 0 0 0 0 9 11 0 0 100 0 0 0 0 0 1869748 11612 112776 0 0 0 0 12 18 0 0 100 0 0 1 0 0 1869748 11612 112776 0 0 0 0 9 8 0 0 100 0 0 [ec2-user@ip-172-30-0-240 ~]$
Explanation of Individual Values
(Source man vmstat
):
- Procs
- r: The number of processes waiting for run time.
- b: The number of processes in uninterruptible sleep.
- Memory
- swpd: the amount of virtual memory used.
- free: the amount of idle memory.
- buff: the amount of memory used as buffers.
- cache: the amount of memory used as cache.
- inact: the amount of inactive memory. (-a option)
- active: the amount of active memory. (-a option)
- Swap
- si: Amount of memory swapped in from disk (/s).
- so: Amount of memory swapped to disk (/s).
- IO
- bi: Blocks received from a block device (blocks/s).
- bo: Blocks sent to a block device (blocks/s).
- System
- in: The number of interrupts per second, including the clock.
- cs: The number of context switches per second.
- CPU
- These are percentages of total CPU time.
- us: Time spent running non-kernel code. (user time, including nice time)
- sy: Time spent running kernel code. (system time)
- id: Time spent idle. Prior to Linux 2.5.41, this includes IO-wait time.
- wa: Time spent waiting for IO. Prior to Linux 2.5.41, included in idle.
- st: Time stolen from a virtual machine.
Tools for performance evaluation
Performance Evaluation Resources
Linux Performance Measurements using vmstat
Apache Benchmark Tool
The Apache Benchmark ab [1] provides a convenient way to stress test your web server. The tool is included with the default installation of Apache.
An example of using ab to send 1000 requests, 10 at a time to the URL http://example.com/ is shown below:
$ ab -c 10 –n 1000 http://example.com/
The output of the tool will look similar to this:
Document Path: /
Document Length: 25951 bytes
Concurrency Level: 10
Time taken for tests: 11.072 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 26253056 bytes
HTML transferred: 25995542 bytes
Requests per second: 90.32 [#/sec] (mean)
Time per request: 110.722 [ms] (mean)
Time per request: 11.072 [ms] (mean, across all concurrent requests)
Transfer rate: 2315.51 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 32 33 0.4 33 39
Processing: 67 77 22.5 68 141
Waiting: 34 35 0.9 35 44
Total: 100 110 22.4 101 174