1
CS 501: Software Engineering
Lecture 19
Performance of Computer Systems
CS 501 Spring 2002
2
Administration
Quiz 3
Collect after class.
Final presentations
Sign up now.
Available time slots are on the web site.
CS 501 Spring 2002
3
Performance of Computer Systems
In most computer systems
The cost of people is much greater than the cost of hardware
Yet performance is important
Future loads may be much greater than predicted
A single bottleneck can slow down an entire system
CS 501 Spring 2002
4
Moore's Law
Original version:
The density of transistors in an integrated circuit will double every year. (Gordon Moore, Intel, 1965)
Current version:
Cost/performance of silicon chips doubles every 18 months.
CS 501 Spring 2002
Moore's Law and System Design
5
Design system:
Production use:
Withdrawn from production:
Processor speeds:
Memory sizes:
Disk capacity:
System cost:
2002
1
1
1
1
2005
1.9
1.9
2.2
0.4
2015
28
28
51
0.01
CS 501 Spring 2002
6
Moore's Law: Rules of Thumb
Planning assumptions:
Every year: cost/performance of silicon chips improves 25% cost/performance of magnetic media improves 30%
10 years = 100:1
20 years = 10,000:1
CS 501 Spring 2002
Parkinson's Law
7
Original: Work expands to fill the time available. (C.
Northcote Parkinson)
Planning assumptions:
(a) Demand will expand to use all the hardware available.
(b) Low prices will create new demands.
(c) Your software will be used on equipment that you have not envisioned.
CS 501 Spring 2002
False Assumptions
8
Unix file system will never exceed 2 Gbytes (2 32 bytes).
AppleTalk networks will never have more than 256 hosts (2 8 bits).
GPS software will not last 1024 weeks.
Nobody at Dartmouth will ever earn more than $10,000 per month.
etc., etc., .....
CS 501 Spring 2002
What level?
Moore's Law and the Long Term
Within your working life?
9
1965 2000?
When?
CS 501 Spring 2002
10
Predicting System Performance
• Mathematical models
• Simulation
• Direct measurement
• Rules of thumb
All require detailed understanding of the interaction between software and systems.
CS 501 Spring 2002
Understand the Interactions between
Hardware and Software
:Thread run run
:Toolkit :ComponentPeer callbackLoop target:HelloWorld handleExpose paint
11
CS 501 Spring 2002
Understand Interactions between
Hardware and Software start state fork
Stream video
12 join stop state
Decompress
Stream audio
CS 501 Spring 2002
13
Look for Bottlenecks
Possible areas of congestion
Network load
Database access how many joins to build a record?
Locks and sequential processing
CPU performance is rarely a factor, except in mathematical algorithms. More likely bottlenecks are:
Reading data from disk
Moving data from memory to CPU.
CS 501 Spring 2002
Look for Bottlenecks: Utilization
14 utilization = mean service time mean inter-arrival time
When the utilization of any hardware component exceeds 30%, be prepared for congestion.
CS 501 Spring 2002
15
Techniques for Eliminating Bottlenecks
Serial and Parallel Processing
Single thread v. multi-thread e.g., Unix fork
Granularity of locks on data e.g., record locking
Network congestion e.g., back-off algorithms
CS 501 Spring 2002
16
Mathematical Models: Queues arrive wait in line service depart
Single server queue
CS 501 Spring 2002
17 arrive
Queues wait in line service depart
Multi-server queue
CS 501 Spring 2002
18
Mathematical Models
Queueing theory
Good estimates of congestion can be made for singleserver queues with:
• arrivals that are independent, random events
(Poisson process)
• service times that follow families of distributions
(e.g., negative exponential, gamma)
Many of the results can be extended to multi-server queues.
CS 501 Spring 2002
Behavior of Queues: Utilization mean delay
19
0 1 utilization
CS 501 Spring 2002
20
Simulation
Model the system as set of states and events advance simulated time determine which events occurred update state and event list repeat
Discrete time simulation: Time is advanced in fixed steps
(e.g., 1 millisecond)
Next event simulation: Time is advanced to next event
Events can be simulated by random variables (e.g., arrival of next customer, completion of disk latency)
CS 501 Spring 2002
Timescale
21
CPU instruction:
Disk latency: read:
Network LAN: dial-up modem:
Operations per second
400,000,000
60
25,000,000 bytes
10,000,000 bytes
6,000 bytes
CS 501 Spring 2002
22
Measurements on Operational Systems
• Benchmarks: Run system on standard problem sets, sample inputs, or a simulated load on the system.
• Instrumentation: Clock specific events.
If you have any doubt about the performance of part of a system, experiment with a simulated load.
CS 501 Spring 2002
Example: Performance of Disk Array
23
Each transaction must: wait for specific disk platter wait for I/O channel signal to move heads on disk platter wait for I/O channel pause for disk rotation read data
Close agreement between: results from queuing theory, simulation, and direct measurement (within 15%).
CS 501 Spring 2002
Discussion of Pfleeger, Chapter 7
Format:
State a question.
Ask a member of the class to answer.
(Sorry if I pronounce your name wrongly.)
Provide opportunity for others to comment.
24
When answering:
Stand up.
Give your name or NetID. Make sure the TA hears it.
Speak clearly so that all the class can hear.
CS 501 Spring 2002
25
Question 1: Documentation Standards
(a) What is the purpose of standard documentation?
(b) Who should create the documentation standards?
(c) What documentation standards are you following in your project? (Be honest!)
CS 501 Spring 2002
Question 2: Good Programming
26
You are judging a Good Programmer Competition .
(a) Give four criteria for what constitutes good programming style.
(b) Give four additional criteria for what constitutes a good programmer.
(c) What is the most flattering thing that you can say about a programmer?
CS 501 Spring 2002
27
Question 3: Maintenance
Most production programs are maintained by people other than the programmers who originally wrote them.
(a) What factors make a program easy for somebody else to maintain?
(b) What factors make a program hard for somebody else to maintain?
CS 501 Spring 2002
28
Question 4: Documentation Standards
(a) What is the purpose of standard documentation?
(b) Who should create the documentation standards?
(c) What documentation standards are you following in your project? (Be honest!)
CS 501 Spring 2002
Question 5: Data Structures
29
(a) How should you decide what data structures to use in a program?
(b) What can you do in designing data structures to help the people who will maintain your programs?
(c) What should you do about the performance of algorithms that create and work on your data structures?
CS 501 Spring 2002
30
Question 6: Risks
(a) What are the main risks in writing programs?
(b) How can you minimize these risks?
CS 501 Spring 2002