Computer performance
Computer performance is the amount of useful work a computer does in a given time, compared with the resources it uses, such as energy and money. It is usually measured as response time, how long one task takes, or throughput, how many tasks finish per unit of time, such as transactions per hour.[1] Engineers compare machines by running standard test programs called benchmarks.[2]
No single number fully describes performance. Speed depends on the algorithm (the set of steps used to solve a problem), the programming language, the compiler, the processor, the memory, and the input and output (I/O) system.[1]
Response time and throughput
Response time and throughput can change separately. Adding more parts, such as more disks, memory modules, or processors, multiplies bandwidth (the rate at which work or data moves) without making any single task finish sooner.[3] A faster part, by contrast, can shorten each task and also raise the total rate.
Comparing two computers
Performance is defined as the inverse of execution time, so a shorter time means higher performance.[1] Saying "X is times faster than Y" means:
For example, if a program takes 10 seconds on computer A and 15 seconds on computer B, then A is times faster than B.[1]
Wall-clock time and CPU time
Two kinds of time are used to measure a job.[1] CPU time is split further into user CPU time and system CPU time.[1]
| Measure | Includes | Leaves out |
|---|---|---|
| Elapsed time (wall-clock time) | All response time: processing, I/O, operating system overhead, and idle time | Nothing |
| CPU time | Only the time the processor spends on the given job | I/O waits and time given to other jobs |
Common metrics
Different parts of a system are rated with different metrics. The table lists several of them.
| Metric | What it measures | Typical unit |
|---|---|---|
| Execution time | Time to finish one task | seconds |
| Throughput | Work finished per unit of time[2] | jobs per hour, requests per second |
| Latency | Delay before one operation completes, such as a memory access | seconds |
| Bandwidth | Data moved per unit of time, as in memory bandwidth and network throughput | bytes per second |
| Instructions per second | Machine instructions run per second | MIPS (millions of instructions per second) |
| FLOPS | Floating-point arithmetic operations per second | GFLOP/s (billions of floating-point operations per second) |
| IOPS | Storage read and write operations completed per second[4] | operations per second |
| CPI and IPC | Average clock cycles per instruction, or instructions per cycle | cycles per instruction, or instructions per cycle |
| Cycles per byte | Clock cycles spent per byte of data processed, often used for cryptographic code[5] | cycles per byte |
| Performance per watt | Work done per unit of power | operations per second per watt |
| Memory footprint | Physical memory a program uses or references while it runs[6] | bytes |
The processor performance equation
The time a processor needs to run a program is the product of three factors.[7] This is often called the iron law of processor performance:
- (instruction count) is the number of machine instructions the program executes.
- (cycles per instruction) is the average number of clock cycles each instruction takes.
- is the clock cycle time, the length of one clock tick.
- is the clock rate. A 2 GHz processor has a cycle time of 0.5 nanoseconds.[7]
What affects each factor
Each layer of the system changes one or more of the three factors.[1]
| Layer | Instruction count | CPI | Clock cycle time |
|---|---|---|---|
| Algorithm | yes | possibly | |
| Programming language | yes | yes | |
| Compiler | yes | yes | |
| Instruction set architecture | yes | yes | yes |
| Processor hardware | yes | yes |
The average CPI is set by the processor hardware, and it depends on the mix of instructions a program uses.[1]
Hardware designers often have to trade clock rate against the number of cycles.[1]
Worked example
Two computers run the same instruction set, so a program has the same instruction count on both.[1] Times are given in picoseconds (ps), or trillionths of a second.
- Computer A has a cycle time of 250 ps and a CPI of 2.0. Its CPU time is .
- Computer B has a cycle time of 500 ps and a CPI of 1.2. Its CPU time is .
Computer A is faster by times, even though B needs fewer cycles per instruction.
Why clock rate and MIPS mislead
Clock rate alone does not set speed, because the equation also depends on instruction count and CPI. MIPS (millions of instructions per second) has a similar flaw:[1]
MIPS ignores differences between instruction sets and differences in how much work each instruction does. CPI also varies between programs on the same processor, so one MIPS rating does not hold for all programs.[1]
IPC (instructions per cycle) is the inverse of CPI. The Linux perf stat tool reports it directly, for example as "1.36 insn per cycle" for a software build.[8]
Amdahl's law
Amdahl's law says that the overall gain from speeding up one part of a job is limited by the share of time that part takes. If a fraction of a computation is sped up by a factor , the overall speedup is:[9]
- is the fraction of the original execution time that the enhancement affects, with .
- is how many times faster the enhanced part runs.
As grows without limit, the speedup can never exceed . The unimproved part sets the limit.[9]
Example
Suppose a program runs for 100 seconds, and multiplication takes 80 of them.[1] Making multiplication times faster gives a new time of seconds.
A fivefold overall speedup would need a total of 20 seconds. That would require multiplication to take no time at all, so it cannot be done.[1]
The general lesson, often stated as "make the common case fast", is that optimizations have little effect when is small.[1][9]
Parallel processors
Gene Amdahl made his argument in 1967 about using many processors at once.[9] He assumed a fraction of the time could be split across processors with no overhead and the rest ran in sequence. He did not write an equation, but his argument gives the formula above with .[9]
The result limits parallel computing and multicore chips. If 10% of a task is serial, the most parallelism can give is a speedup of 10, no matter how many cores the chip has.[10]
The serial part also costs energy. Each active core uses power whether or not it helps, so cores that wait on serial code waste energy.[11]
Scaled speedup
John Gustafson argued that Amdahl's formula assumes a fixed problem size, which is rarely how parallel machines are used.[12] In practice, users grow the problem to fit the larger machine, so the run time stays about constant instead.
He gave an alternative suggested by E. Barsis at Sandia National Laboratories, now known as Gustafson's law:[12]
- is the number of processors.
- is the fraction of time the parallel system spends on serial work.
On a 1024-processor machine, Gustafson's group reported speedups of 1021, 1020, and 1016 for three applications whose serial fraction was 0.4 to 0.8 percent.[12]
Latency, queues, and tails
Latency lags bandwidth
Across processors, memory, networks, and disks, bandwidth has improved much faster than latency since 1980.[3] David Patterson summed up the trend as a rule of thumb. In the time that bandwidth doubles, latency improves by no more than a factor of 1.2 to 1.4.[3]
Caching, replication (keeping copies of data or services on several machines), and prediction help systems cope with this gap.[3] Latency still matters for interactive use, where a quick and predictable response is key to productivity.[3]
Little's law
Little's law, a theorem of queueing theory, links throughput and latency. John Little published a proof in 1961.[13]
- is the average number of requests in process.
- is the average arrival rate of requests, in requests per second.
- is the average response time per request, in seconds.
The law holds when these long-run averages exist and are finite, and it does not depend on the order in which requests are served.[13] For example, a server that receives 1,000 requests per second, each taking 0.05 seconds, has on average requests in progress.
Tail latency
Tail latency is the response time of the slowest requests, usually stated as a high percentile. The 99th-percentile latency is the time within which 99% of requests finish.
In large services, rare slow responses become common. In The Tail at Scale (2013), Jeffrey Dean and Luiz André Barroso described a server that usually responds in 10 ms but has a 99th-percentile latency of one second.[14] One request in 100 to that server is slow.
If a user request must wait for responses from 100 such servers in parallel, 63% of user requests take more than one second.[14] This follows from . Even if only one in 10,000 requests is slow on each server, a service using 2,000 servers sees almost one in five user requests take more than one second.[14]
Real measurements show the same effect. In one Google service, the 99th-percentile latency for one random request was 10 ms, but for all requests to finish it was 140 ms. Waiting for the slowest 5% of requests made up half of that total.[14]
Memory limits
A processor can compute no faster than it can get data. Two ideas describe this limit.
The memory wall
The memory wall is the point where memory speed, not processor speed, sets system performance. William Wulf and Sally McKee described it in 1995.[15]
They assumed DRAM performance would keep improving at 7% per year and projected processor speed growing at either 50% or 100% per year.[15] About 20% to 40% of instructions reference memory. Taking the lower figure, they reasoned that once the average memory access takes more than 5 instruction times, a faster processor no longer shortens run time.[15]
CPU caches delay this point but, in their predictions, do not remove it.[15]
The roofline model
The roofline model is a graph that shows the highest performance a program kernel (the main computation a program performs) can reach on a given machine. Samuel Williams, Andrew Waterman, and David Patterson introduced it in 2009.[16]
The model uses operational intensity, the number of operations per byte of traffic to main memory, after the caches have filtered it.[16]
The authors chose this over arithmetic intensity, which they describe as measuring traffic between the processor and cache.[16]
On a log-log plot (a graph with logarithmic scales on both axes), this gives a slanted line (memory bound) that meets a flat line (compute bound). The meeting point is the ridge point, the lowest operational intensity at which a kernel can reach the machine's peak.[16]
The ridge point shows how hard a machine is to use well. In the original study, two x86 computers had ridge points of 4.4 and 6.7, but the tested kernels had operational intensities of only 0.25 to 1.64.[16]
Benchmarks
A benchmark is a fixed workload run to measure performance. SPEC lists the traits of a useful benchmark:[2]
- It specifies a workload, a strictly defined set of operations.
- It produces at least one metric, such as time or throughput.
- It is reproducible, portable to many systems, and comparable across them.
- It checks that the work was done correctly.
- It has run rules that say which hardware, software, and tuning are allowed.
SPEC
The Standard Performance Evaluation Corporation (SPEC) is a major benchmarking organization. It became a corporation on November 14, 1988.[17]
Its first CPU suite, SPECmark (later called SPEC CPU89), came out in 1989 with 10 programs and a VAX 11/780 as the reference machine.[17] SPEC CPU2017 has 43 benchmarks in four suites.[17]
How SPEC CPU scores are computed
SPEC CPU2017 reports two kinds of score.[2]
| SPECspeed | SPECrate | |
|---|---|---|
| Measures | Time | Throughput |
| Copies run | One of each benchmark | As many as the tester picks |
| Ratio per benchmark | reference time / measured time | copies × (reference time / measured time) |
| Higher score means | Less time needed | More work per unit of time |
The ratios are combined with the geometric mean:[2]
Here is the ratio for benchmark and is the number of benchmarks. Because of this math, two systems keep the same ratio to each other no matter which reference machine is used.[2] For example, a reference machine ran one benchmark in 1,775 seconds and a test system took about 354 seconds, giving a ratio of about 5.[2]
Load testing
Servers are often measured by load testing, which sends many simulated user requests and records throughput and response times. Locust is one open-source tool for this. It tests HTTP and other protocols, and users write test scenarios in Python.[18]
Finding bottlenecks
Profiling and hardware counters
Profiling finds where a program spends its time, often by sampling what the processor is running at timed intervals.[19]
Hardware performance counters are registers in the processor that count low-level events. Examples are CPU cycles, instructions retired, memory stall cycles, and cache misses.[19] Thousands of events exist, but only a few can be counted at once because the counters are a limited set of registers.[19]
Counters support top-down analysis. On supported processors, perf stat --topdown splits cycles into four groups:[8]
- Frontend bound: the processor cannot fetch and decode instructions fast enough.
- Backend bound: computation or memory access is the bottleneck.
- Bad speculation: cycles wasted on branch mispredictions (when the processor guesses the wrong path of code to run next) and similar issues.
- Retiring: useful work with no clear bottleneck.
The USE method
The USE method, from performance engineer Brendan Gregg, is a checklist for whole systems. For every resource, such as CPUs, disks, and buses, check three things:[20]
- Utilization: the average time the resource was busy doing work.
- Saturation: how much extra work the resource cannot yet serve, often seen as a queue.
- Errors: the count of error events.
Low average utilization does not rule out saturation. Utilization measured over seconds or minutes can hide short bursts at 100%.[20]
Energy and cost
Performance is often judged per unit of power or per unit of money, not only per unit of time.
Performance per watt
SPECpower_ssj2008, released in 2007, was the first industry-standard benchmark to measure power use alongside performance for servers.[17] It runs a server at load levels from 0% to 100% in 10% steps and divides the total operations per second by the total power across all levels.[1]
Servers often waste power when lightly loaded. One AMD Opteron X4 server drew 295 W at full load and 180 W at 10% load, about 61% as much.[1] Google data centers mostly run at 10% to 50% load, so this idle power matters.[1]
Koomey's law
Koomey's law describes the long-term rise in computing's energy efficiency. A 2011 study led by Jonathan Koomey found that computations per unit of electricity doubled about every 1.57 years, a trend running back to the first computers.[21]
Grosch's law and Pollack's rule
Two older rules link performance to cost and chip size.
- Grosch's law, stated by H. R. J. Grosch in 1953, says performance equals a constant times price squared. It was roughly true then and led to the idea that large computers cost less per operation. Large-scale integration (LSI), which puts many electronic components onto one chip, later made the law almost entirely stop holding.[22]
- Pollack's rule, from Intel engineer Fred Pollack, says processor performance is roughly proportional to the square root of its area. Parts such as issue logic (the hardware that chooses and sends instructions to be run) and caches do not scale linearly with area, and wiring takes a growing share of the chip.[23]
Historical growth
Single-processor performance grew at very different rates in different eras. Hennessy and Patterson measured it with the SPEC integer benchmarks, relative to the VAX 11/780.[10]
| Period | Growth per year | Main cause |
|---|---|---|
| Before mid-1980s | about 22% | Mostly better technology |
| 1986 to 2003 | about 52% | New architecture ideas, best shown by RISC (reduced instruction set computing, processor designs based on a simpler set of instructions) |
| 2003 to 2011 | 23% | Power limits and limits on instruction-level parallelism (a processor running more than one instruction at a time) |
| 2011 to 2015 | under 12% | Partly the limits of Amdahl's law |
| Since 2015 | 3.5% | End of Moore's law |
Two trends drove the fast years.
- Moore's law began as Gordon Moore's 1965 prediction that transistors per chip would double every year. The prediction was changed in 1975 to every two years.[10]
- Dennard scaling said power per transistor would fall as transistors shrank, so power per area stayed about constant.[11]
Sources date the end of Dennard scaling differently. Hennessy and Patterson's textbook places it around 2004, when Intel canceled its high-performance single-core projects and turned to multiple cores per chip.[10] Their 2019 article, based on their Turing Award lecture, says Dennard scaling began to slow sharply in 2007 and faded to almost nothing by 2012.[11]
With these trends gone, they argue that faster gains will need new architectures that use chips more efficiently.[11] For a sense of scale across machines, see computer performance by orders of magnitude.
References
- CS161 Design and Architecture of Computer Systems: Performance Evaluation, University of California, Riverside, 2016.
- SPEC CPU2017 Overview, Standard Performance Evaluation Corporation, 2017.
- Latency Lags Bandwidth, David A. Patterson, Communications of the ACM, 2004.
- What is IOPS?, Micron Technology.
- BLAKE2: simpler, smaller, fast as MD5, Jean-Philippe Aumasson et al., Cryptology ePrint Archive, 2013.
- Results for the Memory Footprint assessment, Microsoft Learn.
- Basic performance metrics: CPU time, CPI, MIPS, University of Vermont.
- perf-stat(1) Linux manual page, man7.org.
- Amdahl's Law in the Multicore Era, Mark D. Hill and Michael R. Marty, IEEE Computer, 2008.
- Computer Architecture: A Quantitative Approach, 6th edition, John L. Hennessy and David A. Patterson, Morgan Kaufmann, 2019.
- A New Golden Age for Computer Architecture, John L. Hennessy and David A. Patterson, Communications of the ACM, 2019.
- Reevaluating Amdahl's Law, John L. Gustafson, Communications of the ACM, 1988.
- Little's Law as Viewed on Its 50th Anniversary, John D. C. Little, Operations Research (reprint), 2011.
- The Tail at Scale, Jeffrey Dean and Luiz André Barroso, Communications of the ACM, 2013.
- Hitting the Memory Wall: Implications of the Obvious, Wm. A. Wulf and Sally A. McKee, ACM SIGARCH Computer Architecture News, 1995.
- Roofline: An Insightful Visual Performance Model for Multicore Architectures, Samuel Williams, Andrew Waterman, and David Patterson, Communications of the ACM, 2009.
- The SPEC 30th anniversary: SPEC 30-year time line, Standard Performance Evaluation Corporation, 2018.
- Locust, locustio, GitHub.
- Linux perf Examples, Brendan Gregg.
- The USE Method, Brendan Gregg.
- New 'Koomey's Law' of power efficiency parallels Moore's Law, Phys.org, 2011.
- Grosch's law, A Dictionary of Computing, Oxford University Press.
- Trends in Processor Architecture, Antonio González, Universitat Politècnica de Catalunya.
