86
Using Control Theory in Performance Management Joseph L. Hellerstein eScience Institute Computer Science & Engineering November 14, 2018

Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

Using Control Theory in Performance Management

Joseph L. HellersteineScience InstituteComputer Science & Engineering

November 14, 2018

Page 2: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

2

Example: Control of the IBM Lotus Domino ServerArchitecture

RIS = RPCs in System(users in active state)

Actual RIS

DesiredRIS

RPCsMaxUsers

Server

ControllerAdmin

Block Diagram

Controller Server

MaxUsersDesiredRIS

ActualRIS

-

+r(k)

e(k)u(k) y(k)

Page 3: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

3

Lab 1

Block Diagram

Controller Server

MaxUsersReferenceRIS

ActualRIS

-

+r*

e(k)u(k) y(k)

Control error: e(k)=r*-y(k)

Normalized MaxUsers: u(k)=KP*e(k)

System model: y(k)=(0.43)y(k-1)+(0.47)u(k-1)

¢ Spreadsheet file CTShortClass, tab 1 (P Control).v Proportional controller: MaxUsers(k+1) = KP*(r*-y(k))v What is the effect of K on

Ø Accuracy: (want r*=y(k)=200)Ø StabilityØ Convergence rate (settling time)Ø Overshoot

ARX* Models

*ARX is autoregressive with an external input

Page 4: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

4

Application of CT to a DBMSDatabase Server

Agents

Buffer Pools, Sorts, Package Cache, etc.

Disks

StatisticsCollector

MemoryTuner

Without Controller

TS=26,342

With Controller

TS=10,680

59% Reductionin Total RT

Page 5: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

5

•Stabililty •Accuracy •Settling time •Overshoot

Unstable SystemWhy Control Theory?

Page 6: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

Optimizing Throughput in the Microsoft .NET ThreadPool

¢ Current ThreadPoolv Objective: Maximize CPU utilization and thread completion ratesv Inputs: ThreadPool events, CPU utilizationv Techniques

Ø Thresholds on inter-dequeue times, rate of increasing workers, change in rate of increasing workers

Ø States: Starvation, RateIncrease, RateDecrease, LowCPU, PauseInjection

¢ New approachv Objective: Maximize thread completion ratev Inputs: ThreadPool eventsv Technique: Hill climbing6

Controller ThreadPool

QueueUserWorkItem()

Completion Rate (throughput)ConcurrencyLevel

SIGMETRICS 2008: Introduction to Control Theory. Abdelzaher, Diao, Hellerstein, Yu, and Zhu.

Page 7: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

Hill Climbing Controller

0 10 20 30 40 5040

60

80

100

120

140

160

#Threads

Throughput

(50 work items:100ms with 10%CPU, 90% wait. 2.2GHz dual core X86.)

Discrete Derivative

CurrentConcurrencyLevel

CurrentHistory

NewConcurrencyLevelfor small ControlGain

Large ControlGain

NewConcourrencyLevel for large ControlGain

LastConcurrencyLevel = History mean

LastHistory

Small ControlGain

Want large gain so move quickly, but not overshoot.Making good moves depends on•throughput variance•shape of curve

Page 8: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

Hybrid Control State Diagram

State 1 - Initializing LastHistory.LastHistory.Add(data)

State 2 – Looking for move.CurrentHistory.Add(data)

CompletedInitializingIsStableHistory(LastHistory):

LastControlSetting = CurrentControlSettingCurrentControlSetting = ExploreMove()

ChangePointWhileInitializingIsChangePoint(LastHistory):

LastHistory = data CurrentControlSetting= ExploreMove()

ReverseBadMoveCurrentHistory.Count > MinimumHistory& LastHistory.Mean() > CurrentHistory.Mean():

Swap(CurrentControlSetting, LastControlSetting)

DirectedMoveIsSignificantDifference(CurrentHistory, LastHistory):

LastControlSetting = CurrentControlSettingCurrentControlSetting = DirectedMove()LastHistory = CurrentHistoryCurrentHistory = null

ChangePointWhileLookingForMoveSame as ChangePointWhileInitializing

StuckInStateIsStableHistory(CurrentHistory) & CurrentHistory.Count > SufficientlyLargeHistory:LastControlSetting = CurrentControlSettingCurrentControlSetting = ExploreMove() LastHistory = CurrentHistoryCurrentHistory = null

State 1a – InTransition.

WaitForSteadyStateIsInTransition()

ChangePointInQueueWaitingIsChangePoint(QueueOfWaiting)

State 2a – InTransitionCurrentHistory.Add(data)

Page 9: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

9

Goals

¢ Control theory “boot camp” for software designers with no background in control theory or linear systems theory

v Be able to formulate and solve basic control problemsv Know references so can solve more complex problems

¢ Covers about 50% of the material presented in a semester class at Columbia University

¢ Excludesv Modeling: System identification, multiple input multiple output (MIMO) models, non-linear modelsv Control: control design, MIMO control, empirical tuning, adaptive control, stochastic controlv Tools: MATLABv Running examples: Apache HTTP server, M/M/1/K queueing system, streaming, load balancing

¢ Referencev “Feedback Control of Computing Systems”, Hellerstein, Diao, Parekh, Tilbury. Wiley,

2004

Page 10: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

10

Agenda¢ Introduction:

v Control system architecture, goals, and metrics.

¢ Theory: Part 1

v Signals, Z-Transforms

¢ Theory: Part 2

v Transfer functions

v Analyzing composed systems

v Q&A / Buffer

¢ Control Analysis

v Basic controllers, precompensation, filters

v Structured as a design exercise

¢ Real world applications (Various publications)

v DB2 Utilities throttling and self-tuning memory management

Page 11: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

11

M1 - Introduction

Reference: “Feedback Control of Computer Systems”, Chapter 1.

Page 12: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

12

ComponentsTarget system: what is controlledController: exercises controlTransducer: translates measured outputs

DataReference input: objectiveControl error: reference input minus measured outputControl input: manipulated to affect outputDisturbance input: other factors that affect the target systemTransduced output: result of manipulation

Given target system, transducerControl theory finds controller

that adjusts control inputto achieve measuredoutput in the presence of disturbances.

Elements of a Control System

Controller TargetSystem

Transducer

ReferenceInput

ControlInput

MeasuredOutput

TransducedOutput

Disturbance InputControlError

-

+

Page 13: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

13

The Yawning Control System

¢ Description of systemv Room full of peoplev Assumptions

Ø People yawn because they need more oxygenØ Yawning consumes more oxygen than regular breathingØ Can open windows to increase oxygen flow, but it’s winter

¢ Control objectivev Constrain yawning while maximizing temperature

¢ Questionsv What are the main components of the system? A block diagram?v What control policies can achieve the objective?v What does it mean for this system to be unstable? What would make it unstable?

Page 14: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

14

openwindow air

Operation of the Yawn System: Open Window

Page 15: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

15

closedwindow

air

Operation of the Yawn System: Closed Window

Page 16: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

16

Feedback For Yawning System

ControllerTarget

System

Disturbance input

+

-

Reference

Input

Control

InputMeasured

Output

What is the¢ Target System

¢ Controller

¢ Reference input

¢ Control input

¢ Disturbance input

¢ Measured output

Answers¢ Windows + Students

¢ Who/what determines the height of the windows

¢ Maximum tolerable yawn rate

¢ Height of the window

¢ Add/remove people, opening door, …

¢ Observed yawn rate

Page 17: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

17

Architecture MaxUsers

Client

ClientServer Server

Log

RPCs RPCRecords

Administrative TasksIBM Lotus Domino Server

MeasuredRISServer

MaxUsers

Sensor

Target SystemActualRIS

Administrative Tasks

Block Diagram

Page 18: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

18

§Adapts§Simple system model

Closed Loop vs. Open Loop

MeasuredRISClosed Loop

Controller Server

MaxUsersReferenceRIS

Sensor

Target SystemActualRIS

Administrative Tasks

-

+

Closed Loop System

§Stable§Fast settling

MeasuredRISOpen Loop

Controller Server

MaxUsersReferenceRIS

Sensor

Target SystemActualRIS

Administrative Tasks

Open Loop System

Page 19: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

19

Regulatory Control

§Manage to a reference value§Ex: Service differentiation, resource management, constrained optimization

Types of ControlMeasuredRIS

Controller Server

MaxUsersReferenceRIS

Sensor

Target System

-

+

§Eliminate effect of a disturbance§Ex: Service level management, resource management, constrained optimization

Disturbance Rejection

MeasuredRIS

Controller Server

MaxUsersReferenceRIS

Sensor

Target System

Administrative Tasks

-

+

§Achieve the “best” value of outputs§Ex: Minimize Apache response times

Optimization

MeasuredRIS

Controller Server

MaxUsers

Sensor

Target System

Administrative Tasks

Page 20: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

20

Unstable SystemStability Accuracy Short Settling Small Overshoot

The SASO Properties of Control Systems

Page 21: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

21

M2 - Theory

Page 22: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

22

Motivating Example

( )e kController Server Sensor

-

+( 1) ( ) ( 1)Iu k u k K e k+ = + + ( 1) (0.43) ( ) (0.47) ( )w k w k u k+ = + ( 1) 0.8 ( ) 0.72 ( ) 0.66 ( 1)y k y k w k w k+ = + - -

( )r k ( )y k( )u k ( )w k

( ) ( ) ( )e k r k y k= -

The problemWant to find y(k) in terms of KI so can design control system that is stable, accurate,

settles quickly, and has small overshoot.

a. Signalsb. Transfer functionsc. Composition of components – end-to-end system

Page 23: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

23

M2a – TheorySignals

Reference: “Feedback Control of Computer Systems”, Chapter 3.

( )e kController Server Sensor

-

+

( )r k ( )y k( )u k ( )w k

( ) ( ) ( )e k r k y k= -

Page 24: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

24

Signals

Issue: Time domain analysis is cumbersome in studying complicated control systems

Controller Server Sensor-

+

( )r k ( )y k( )u k ( )w k

( ) ( ) ( )e k r k y k= -

0 1 2 3 40

1

2

3

4

5

6

Time domain representationy(0)=1y(1)=3y(2)=2y(3)=5y(4)=6

y(k)

k

A signal is a real-valued function of time.

Page 25: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

25

Z-Transform of a Signal

0 1 2 3 40

1

2

3

4

5

6

Time domain representationy(0)=1y(1)=3y(2)=2y(3)=5y(4)=6

y(k)

z domain representation1z0 +3z -1 +2z -2 +5z -3 +6z -4

0

1

2

1: 0 (current time): 1 (one time unit in the future): 2 (two time units in the future)

z kz kz k

-

-

= =

=

=

z is time shift; z -1 is time delay

k

å¥

=-=

=

0)()( is

Transform- its then signal, a is ),....1(),0()}({ If

kkzkyzY

zyyky

Page 26: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

0 1 2 3 4-1

0

1

2

3

4

5

k

v(k

)

26

Signal Shifts and Delays

0 1 2 3 4 5-2

-1

0

1

2

3

4

5

k

u(k

)

4321 542)( ---- +-++-= zzzzzU(Drop exponents >0.)

32154)()( --- +-+== zzzzzUzV

0 1 2 3 4 5-2

-1

0

1

2

3

4

5

13211 1542)()( ----- -++== zzzzzUzzV

{y(k)} {y(k+1)}Shift

{y(k-1)}Delay

Page 27: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

27

0 1 2 3

1

time (k)

Impulse 0,0)(;1)0( >== kkyyy(k)

1 ...001)( 210

=+++= -- zzzzY

Common Signals: Impulse

4321 542)( ---- +-++-= zzzzzU

This can be viewed as a sum of impulses at time 0, 1, 2, 3, and 4.

0 1 2 3 4 5-2

-1

0

1

2

3

4

5

k

u(k

)

Page 28: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

28

0 1 2 3

1Step

time (k)

y(k)

0 1 2

1

( ) 1 1 1 ...1

1

1

Y z z z z

zzz

- -

-

= + + +

=-

=-

0,1)( ³= kky

Common Signals: Step

Page 29: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

29

Common Signals: Geometric

azz

zaazzY

-=

+++= -- ...1)( 221

kaky =)( :Geometric

0 5 10 15 200

0.2

0.4

0.6

0.8

1

a=0.8

8.0

...64.08.01)( 21

-=

+++= --

zz

zzzY

Page 30: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

30

Properties of Z-Transforms of Signals

0 1 2

0 1 2

1 0 1

0 1

1 2 3

Signals: ( ) (0) (1) (2) ... ( ) (0) (1) (2) ...Shift: ( ) (0) (1) (2) ... (1) (2) ...Delay: ( ) / (0) (1) (2) ..

U z u z u z u zV z v z v z v z

zU z u z u z u zu z u z

U z z u z u z u z

- -

- -

-

-

- - -

= + + +

= + + +

= + + +

= + +

= + + +0 1 2

0 1 2 0 1 2

.Scaling: ( ) (0) (1) (2) ... -Transform of { ( )}Sum of signals: (0) (1) (2) ... (0) (1) (2) ...

aU z au z au z au zz au k

u z u z u z v z v z v z

- -

- - - -

= + + +=

+ + + + + + +0 1 2 ( (0) (0)) ( (1) (1)) ( (2) (2)) ...

( ) ( )u v z u v z u v zU z V z

- -= + + + + + += +

Page 31: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

31

Poles of a Z-TransformDefinition: Values of z for which the denominator is 0

Easy to find the poles of a geometric:azzzV-

=)(

8.08.167)( 2

2

+--

=zzzzzYWhat are the poles of the following Z-Transform?

5 2( )1 0.8z zY z

z z= +

- -Easy if sum of geometrics

Poles determine key behaviors of signals

Pole is a.azzzV-

=)(

Page 32: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

32

Effect of Pole on the Signal

-5

0

5a=0.4

-5

0

5a=0.9

-5

0

5a=1.2

0 5 10-5

0

5a=-0.4

0 5 10-5

0

5a=-0.9

0 5 10-5

0

5a=-1.2

azzaky k

-Û=)(

¢ What happens when¢|a| is larger?¢|a|>1?¢a<0?

¢ |a|>1¢Does not converge

¢ Larger |a|¢Slower convergence

¢ a<0¢Oscillates

,...),,1(...1

Why?2221 aazaaz

azz

Û+++=-

--

Page 33: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

33

M2b – TheoryTransfer Functions

Reference: “Feedback Control of Computer Systems”, Chapter 3.

Controller Server Sensor-

+

Page 34: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

34

Motivation and Definition

The picture can't be displayed.

0. are conditions initial assuming)()()(or

)()(

SignalInput SignalOutput )(

zUzGzYzUzYzG

=

==

Motivation:ARX model relates u(k) to y(k)(ARX is autoregressive with external input.)

y(k) = (a)y(k-1)+(b)u(k-1) y(k)u(k)

A transfer function is specified in terms of its input and output.

Y(z)U(z)

Transfer function expresses this relationship in the z domainazb-

Page 35: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

35

Constant Transfer Function

azUzYzG

zaUzY

==

=

)()()(

)()(

aY(z)U(z)

y(k) = au(k)y(k)u(k)

0 50

1

2

3

4

5

k

u(k

)

0 50

0.5

1

1.5

2

2.5

3

k

y(k

)

3

0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

3

Page 36: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

36

1-Step Time-Delay Transfer Function

1

1

)()()(

)()(-

-

==

=

zzUzYzG

zUzzY

z-1 Y(z)U(z)

y(k) = u(k-1)y(k)u(k)

0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

z-1

0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

z-1

Page 37: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

37

n-Step Time-Delay Transfer Function

n

n

zzUzYzG

zUzzY

-

-

==

=

)()()(

)()(

z-n Y(z)U(z)

y(k) = u(k-n)y(k)u(k)

0 2 40

0.2

0.4

0.6

0.8

1

k

u(k

)

0 2 40

0.2

0.4

0.6

0.8

1

k

y(k

)

z-2

0 2 40

0.2

0.4

0.6

0.8

1

k

u(k

)

0 2 40

0.2

0.4

0.6

0.8

1

k

y(k

)

z-2

Page 38: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

38

Combining Simple Transfer Functions

1

1

)()()(

)()(-

-

==

=

azzUzYzG

zUazzY

az-1 Y(z)U(z)

y(k) = au(k-1)y(k)u(k)

0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

3z-1

0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

3z-1

Page 39: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

39

Additional Terms in T.F.

21

21

)()()(

)()()(--

--

+==

+=

bzazzUzYzG

zUbzazzY 0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

az-1+bz-2 Y(z)U(z)

y(k) = au(k-1)+bu(k-2)y(k)u(k)

0 2 40

1

2

3

4

5

k

u(k

)0 2 40

1

2

3

4

5

k

y(k

)

3z-1+2z-2U(z) Y(z)

Page 40: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

40

Geometric Sum of T.F.

azzzaaz

zUzYzG

-=+++== -- ...1

)()()( 221

0 2 40

0.5

1

1.5

2

k

u(k

)

0 2 40

0.5

1

1.5

2

k

y(k

)

0 2 40

0.5

1

1.5

2

k

u(k

)

0 2 40

0.5

1

1.5

2

k

y(k

)

1 + az-1 + a2z-2 + … Y(z)U(z)

y(k) = u(k)+au(k-1)+a2u(k-2)+…= ay(k-1) + u(k) y(k)u(k)

z/(z-0.5)U(z) Y(z)

z/(z-a)Y(z)U(z)

...)1()()()( 221 +++== -- zaazzUzYzG

Page 41: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

41

Complicated Transfer Functions

...05.01.0...04.02.01...09.03.01

2.03.0

06.05.01.0)(

21

2121

2

++=

+---+++=-

--

=

+-=

--

----

zzzzzz

zz

zz

zzzzG

Decompose into a sum of geometrics

0 2 40

0.5

1

1.5

2

k

u(k

)

0 2 40

0.1

0.2

0.3

0.4

0.5

k

y(k

)06.05.0

1.02 +- zz

z Y(z)U(z)

¢ Partial fraction expansion allows rational polynomials to be decomposed into a sum of geometrics

¢ Poles of the original polynomial are the poles of the geometrics

Page 42: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

42

Interpreting Transfer Functions: I

)()1)(()()()()()()(

zGzGzUzGzYzUzYzG

===

=

Signal generated by an impulse input

0 2 40

1

2

3

4

5

k

u(k

)

0 2 40

1

2

3

4

5

k

y(k

)

Example:

3z-1+2z-2U(z) Y(z)

Page 43: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

43

Interpreting Transfer Functions: II

)()(5.0)(or )()5.0)(( So,5.0)(

)()(

zzUzYzzYzzUzzYzz

zUzYzG

+==--

==

)1()()()(+Û

ÛkyzzYkayzaY

Specifies an ARX model

Given atransfer function:

Recall that:

)()1(5.0)( toequivalent is which )1()(5.0)1(

kukykykukyky

+-=++=+Which gives us:

This means that transfer functions are trivial to simulate!

Page 44: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

Constructing Transfer Functions

¢ Given a ARX model, how do we construct its transfer function?

¢ Method: Term by term conversion from time domain to z Domain: (1)

substitute for z expressions and (2) factor to obtain the ratio of output to

z-Transforms.

¢ Example

44

43.0)47.0(

)()( :Factor

)()47.0()()43.0((z) :Substitute)()(

)()1()()(

)()47.0()1()43.0()(Given

1

1

-=

+=

ÛÛ-

Û+-=

-

-

zz

zUzY

zUzYzYzUku

zYzkyzYky

kukyky

Page 45: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

A Pop Quiz

45

)()1( :Hint)1()66.0()()72.0()()8.0()1(

for function transfer theisWhat

zzYkykwkwkyky

Û+--+=+

)()66.0()()72.0()()8.0()( Substitute :1 Step

1 zWzzWzYzzY --+=

zzz

zWzY

)8.0(66.0)72.0(

)()(

Factor :2 Step

2 --

=

Page 46: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

Test Your Knowledge Again

46

? that beit must Why ......(z)function transfer Given the

01

1

01

1

mnazazabzbzbG n

nn

n

mm

mm

³++++++

= --

--

0101 ...)1()(...)1()( :model ARX theWrite

bmkubmkubankyankya mmnn ++-+++=++-+++ --

0101 ...)1()(...)1()( that so eAdjust tim

bnmkubnmkubakyakyaknk

mmnn ++--++-+=++-+®+

--

future! in the )( moreor one offunction a is )( then , If nmkukynm -+>

Psychic System!

Page 47: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

47

Poles of a Transfer Function

...1)( 33221 ++++=-

= --- zazaazazzzG

Poles: Values of z for which the denominator is 0.

Example:

Poles: 0.3, 0.2

Poles ¢Determine stability¢Major effect on settling time, overshoot¢Dominant pole – pole that determines the transient response

2.03.006.05.01.0)( 2 -

--

=+-

=zz

zz

zzzzH

¢ |a|>1¢Does not converge

¢ |a|<1 but large¢Slower convergence

¢ a<0¢Oscillates

Page 48: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

48

Almost All You’ll Ever Need to Know About Poles

...1)( 33221 ++++=-

= --- zazaazazzzG

Page 49: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

49

Settling Time (ks) of a SystemDefinition and result: Time until an input signal is within 2% of its steady state value

G(z)Y(z)z/(z-1)

(unit step)

0 10 20 300

0.5

1

1.5

2

k

u(k

)

0 10 20 300

0.1

0.2

0.3

0.4

0.5

k

y(k

)

8.0 ,43.0 ,0 :poles

,34.023.1

31.034.0)( 23 zzzzzG

+--

= 188.0ln4

»-

»Sk

5.0)(

-=zzzG

Examples:6

5.0ln4

»-

»Sk

0 5 100

0.5

1

1.5

2

k

u(k

)

0 5 100

0.5

1

1.5

2

k

y(k

)

, of polelargest theis || where,||ln

4 G(z)aa

kS-

»

...1)(for equality with 33221 ++++=-

= --- zazaazazzzG

Page 50: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

50

Steady State Gain (ssg) of a Transfer FunctionSteady state gain is the steady state output in response to a step input.

G(z)Y(z)U(z) )1(

)()( G

uy

=¥¥

ssg of G(z) is

)1(212

)()( G

uy

===¥¥

0 2 40

0.5

1

1.5

2

k

u(k

)

0 2 40

0.5

1

1.5

2

k

y(k

)

1)( =¥u 2)( =¥y5.0)(

-=zzzG

Example:

The picture can't be displayed.

where U(z) is a step input.

Page 51: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

51

M2c – TheoryComposition of Systems

Reference: “Feedback Control of Computer Systems”, Chapter 4.

Controller Server Sensor-

+

system system system

System of systems

Page 52: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

52

Transfer Functions In Series

)()()()(

)()(

)()( zHzG

zWzY

zUzW

zUzY

==

G(z)W(z)U(z)

H(z)Y(z) G(z)H(z)

Y(z)U(z)Û

( )y k( )u k

( 1) (0.43) ( ) (0.47) ( )w k w k u k+ = +

( 1) 0.8 ( ) 0.72 ( ) 0.66 ( 1)y k y k w k w k+ = + - -

( )w kÛ

?

( )y ku(k)

T.F. provide an easy way to analyze the behavior of complex structures.

Page 53: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

53

Canonical Feedback Loop

K(z) G(z)-

+

Controller Target System+

+

D(z)

T(z)R(z) E(z) U(z) V(z)

H(z)

Transducer

W(z)

+

+

N(z)

Y(z)

MeasuredOutput

NoiseInputDisturbance

InputReference

Input

Want to analyze characteristics of the entire system: its stability, settling time, and accuracy (ability to achieve the reference input).

It’s all done with transfer functions!

Permitted operationsSumming signalsCascading systems

Page 54: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

54

K(z) G(z)-

+

Controller Target System+

+

D(z)=0

T(z)R(z) E(z) U(z) V(z)

H(z)

TransducerW(z)

+

+

N(z)=0

Y(z)

MeasuredOutput

ReferenceInput

)()()(zRzTzFR =

View the dark rectangle as a large transfer function FR(z) with input R(z) and output T(z).¢ System is stable if the largest pole of FR(z) has an absolute value that is less than 1¢ System is accurate if t(n)=r(n) for large n, or FR(1)=1¢ System settling time is short if the poles of FR(z) have a small absolute value¢ System has oscillations if there are poles of FR(z) that are negative or imaginary

Page 55: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

55

Canonical Feedback Loop Has Many T.F.

)(zFR

K(z) G(z)-

+

Controller Target System+

+

D(z)

T(z)R(z) E(z) U(z) V(z)

H(z)

Transducer

W(z)

Transfer function from the reference input to the measured output

Transfer function from the disturbance input to the measured output

)(zFD

+

+

N(z)

Y(z)

MeasuredOutput

NoiseInputDisturbance

InputReference

Input

Transfer function from the noise input to the measured output

)(zFN

Page 56: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

56

Computing FR(z)

K(z) G(z)-

+ T(z)R(z) E(z) U(z)

H(z)W(z)

A set of equations relates R(z) to T(z) based on our previous results

Simplified block diagram since D(z)=0=N(z)

W(z) = H(z)T(z) by the definition of a transfer function.E(z) = R(z)-W(z) since this is an addition of signals.T(z) = E(z)K(z)G(z) since K(z) and G(z) are in series.T(z) = (R(z)-H(z)T(z))K(z)G(z) by substitution.

)()()(1)()(

)()()(

zHzGzKzGzK

zRzTzFR +==

The only non-zero input is R(z).

Page 57: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

57

K(z) G(z)-

+ +

+

D(z)

T(z)R(z) E(z) U(z) V(z)

H(z)W(z)

+

+

N(z)

Y(z)

Properties of Canonical Loop

)()()(1)(

)()()(

zHzGzKzG

zDzTzFD +==

)()()(11

)()()(

zHzGzKzNzTzFN +==

)()()(1)()(

)()()(

zHzGzKzGzK

zRzTzFR +==

Reference to Output Disturbance to Output Noise to Output

What can we say about the stability and settling times of these three transfer functions?

When is the system accurate in the sense that T(z)=R(z)? FR(1)=1

When is the system robust to disturbances and noise? FD(1)=0= FN(1)

They are the same!

Page 58: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

58

Lab 3: Effect of a Disturbance (Try this later on)

( )r k ( )y k

( )e kController Notes

ServerNotesSensor-

+

( 1) (0.43) ( ) (0.47) ( )w k w k u k+ = +

( 1) 0.8 ( ) 0.72 ( ) 0.66 ( 1)y k y k w k w k+ = + - -

( )w k

( ) ( ) ( )e k r k y k= -

d(k)

++

( )u kv(k)

¢ Model is in file CTShortClass, tab 3 (Notes + Sensor + Disturbance)

Page 59: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

59

Summary of Results

)1()()( G

uy

=¥¥

Steady state gain of G(z) is

Stable system if |a|<1, where a is the largest pole of G(z)

0 10 20 300

0.5

1

1.5

2

k

u(k

)

0 10 20 300

0.1

0.2

0.3

0.4

0.5

k

y(k

)

G(z)Y(z)U(z)

+A(z)

C(z)+

B(z)

Adding signals:

G(z) W(z)U(z)H(z) Y(z)

G(z)H(z) Y(z)U(z)is equivalent to

Transfer functions in series

)()()(1)()(

)()()(

zGzKzHzGzK

zRzTzFR +==

)( of polelargest theis || where,||ln

4 timeSettling zGaa

{c(k)=a(k)+b(k)} has Z-Transform A(z)+B(z).

Transfer function of a feedback loop

K(z) G(z)-

+ ControllerTarget System T(z)R(z)

H(z)Transducer

Transfer Function of System

Output Signal

InputSignal

Page 60: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

60

M3 –Control Analysis

Reference: “Feedback Control of Computer Systems”, Chapters 8,9.

Page 61: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

61

Motivating Example

( )r k ( )y k

( )e kController Notes

ServerNotesSensor-

+

( )u k

( 1) (0.43) ( ) (0.47) ( )w k w k u k+ = + ( 1) 0.8 ( ) 0.72 ( ) 0.66 ( 1)y k y k w k w k+ = + - -

( )w k

( ) ( ) ( )e k r k y k= -

The problemDesign a control system that is stable, accurate, settles quickly, and has small

overshoot.

Take a holistic approachDesign a control system, not just a controller

Page 62: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

62

Basic Controllers

( ) ( )( )( )( )

P

P

u k K e kU zK z KE z

=

= =

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)

Proportional (P) Control Integral (I) Control

KP and KI are called control gains.

1)(

)()()()1()()1(

-=

+=++=+

zzKzK

zzEKzUzzUkeKkuku

I

I

I

Page 63: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

64

eP(k) = r(k)-yP(k)

uP(k)=KP*eP(k)

yP(k+1)=y_coef(1)*yP(k)+y_coef(2)*uP(k)

k r(k) eP(k) uP(k) yP(k) KP

0 200 200 160 0 0.8

1 200 124.8 99.84 75.2

0

10

20

30

40

50

60

70

80

90

0 10 20 30 40 50

Time (k)

yP (o

utpu

t)

eI(k) = r(k)-yI(k)

uI(k)=uI(k-1)+KI*eI(k)yI(k+1)=y_coef(1)*yI(k)+y_coef(2)*uI(k)

eI(k) uI(k) yI(k) KI

200 80 0 0.4

162.4 144.96 37.60

50

100

150

200

250

0 10 20 30 40 50

Time (k)

yI (o

utpu

t)

Proportional (P) Control

Integral (I) Control

PKzK =)(

1)(

-=zzKzK I

Summary of Lab 2: P vs. I Control

Page 64: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

65

Analysis

272.1)43.147.0(47.043.1

43.0)43.147.0(47.0

47.0)43.0)(1(47.0

43.047.0

11

43.047.0

1)()()(

47.043.0

47.043.043.047.0143.047.0

)()()(

2

2

--±-=

+-+=

+--=

--+

--==

-=

+-=

-+

-==

III

I

I

I

I

I

IIR

PP

P

P

P

PPR

KKp

zKzzK

zKzzzKzz

zKzz

zK

zRzYzF

Kp

KzK

zKz

K

zRzYzF

)()(1)()(

)()()(

zGzKzGzK

zRzYzFR +==

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)

Ctrl Gain P I

0.1 5, 0.076 43, 1

0.4 3, 0.25 10, 1

3.0 198, 0.71 10, 1

Settling Times, Steady State Gains

Page 65: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

66

Conclusions from P vs. I Comparison

0

50

100

150

200

250

0 10 20 30 40 50

Time (k)

yP (o

utpu

t)

0

50

100

150

200

250

0 10 20 30 40 50

Time (k)

yI (o

utpu

t)

KP=2.3 KI=0.8

r(k)=200

Conclusions:P is fastI is accurate and has less overshoot.

Design challenge:Make P accurate.Reduce P’s overshoot.

Page 66: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

67

Making P Control Accurate

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)P(z)

Precompensation: Adjusts the reference input so that the right output is obtained.

Lab 4: Precompensation¢ Modify P control to include pre-compensation¢ Find a value for the precompensator that makes P control accurate

v Trial and errorv Adjust based on ratio between reference and output

¢ What happens if the reference input changes? What if the control gain changes?¢ What is the general rule for the value of the precompensator?

Page 67: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

68

Computing Value of Precompensator K(z)

-

+ Y(z)R(z) E(z) U(z)G(z)P(z)

53.1)( then 200;2.3,Consider 47.0

47.043.01)1(

1)1( So

)1()1()1(1Want

===

+-==

=

zPR(z)KK

KF

P

RF)PR(

P

P

P

R

R

Try on spreadsheet. See if it works for other reference inputs.

Page 68: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

69

Reducing P’s Overshoot

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)P(z)

0

50

100

150

200

250

0 10 20 30 40 50Time (k)

yP (o

utpu

t)

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)P(z)

Filter: Smooths values over time.

H(z)T(z)

t(k+1)=ct(k)+y(k+1)c – Weight past history (make it smoother)

Lab 5: Precompensation + Filter¢ Add a filter to precompensated P control¢ What values of c produce smooth t(k)?¢ What are the other effects of the filter?

Page 69: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

70

Results of Filter Design

w/o filterwith filter: c = 0.75

r(k)=200

The good news about the filter: Can eliminate overshootThe bad news: Inaccurate and slower.

Why inaccurate?

0

200

400

600

800

1000

0 10 20 30 40 50Time (k)

yP (o

utpu

t)

0

50

100

150

200

250

300

350

0 10 20 30 40 50Time (k)

Page 70: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

71

Analysis of the Filter

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)P(z) H(z)

T(z)t(k+1)=ct(k)+y(k+1)

cH

czz

zYzTzH

zzYzcTzzTkykctkt

HFPzPHFP

R

R

-=

-==

+=++=+

¹==

11)1(

)()()(

)()()()1()()1(

.1)1( that bemust it So, .1)1()1( that so )( designed have We1)1()1()1(Want

Analysis 1: Why does H(z) cause the system to be inaccurate?

Check the spreadsheet.

Page 71: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

72

Designing a Normalized Filter

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)P(z) H(z)

T(z)t(k+1)=ct(k)+y(k+1)

)1()1()()1(have wemodel, series timea into thisConverting

)1()( use is,That

.1by gmultiplyinby dividingby thisdoCan 1)1(Want

+-+=+

--

=

-=

kyckctkt

czczzH

cH

Check the spreadsheet: Lab 6.

Page 72: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

73

Analysis of the Filter

K(z)-

+ Y(z)R(z) E(z) U(z)G(z)P(z) H(z)

T(z)t(k+1)=ct(k)+(1-c)y(k+1)

0.75.at pole a is e then ther,75.0 If

1)()()(

65.01.1)( ,3.2 If

47.043.047.0)(

poles no has )()}(),(),({maxLet

?)()()( of poles theareWhat

=--

==

-==

+-=

=

cczc

zYzTzH

zzFK

KzKzF

zPzHzFzPpzHzFzP

RP

P

PR

Rpoles

R

Analysis 2: Why does H(z) cause the system to be slower?

Check the spreadsheet.

So, the filter adds a closed loop pole at c.

Page 73: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

74

PI Control

Lab 7: PI Control)1()()()1()(1)(1

)()()()()(

)()()(

--++-=-

-+=

-+=

+==

+=

keKkeKKkukuz

KzKKzzKK

zKzKzEzUzK

kukuku

PIP

PIP

IP

IP

IP

Page 74: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

75

M4 – Applications¢ DB2 Utilities Throttling (DB2 v8.1)

v http://www.databasejournal.com/features/db2/article.php/3339041v "Throttling Utilities in the IBM DB2 Universal Database Server," Sujay Parekh, Kevin Rose, Yixin

Diao, Victor Chang, Joseph L. Hellerstein, Sam Lightstone, Matthew Huras. American Control Conference, 2004.

¢ Self-tuning memory managementv "Using MIMO Linear Control for Load Balancing in Computing Systems," Yixin Diao, Joseph L.

Hellerstein, Adam Storm, Maheswaran Surendra, Sam Lightstone, Sujay Parekh, and Christian Garcia-Arellano. American Control Conference, 2004.

v “Incorporating Cost of Control Into the Design of a Load Balancing Controller,” Yixin Diao, Joseph L. Hellerstein, Adam Storm, Maheswaran Surendra, Sam Lightstone, Sujay Parekh, and Christian Garcia-Arellano. Real-Time and Embedded Technology and Application Systems Symposium, 2004.

Page 75: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

76

The Utilities Throttling Problem

Utilities have a big impact on production performance.

DB2

DBA

BACKUPRUNSTATSREBALANCE

Administrative policyThere should be no more than an x% performance degradation of

production work as a result of executing administrative utilities

0 500 1000 15000

2

4

6

8

10

12

Thru

put (

tx/s

ec)

Time (sec)

w/o Utilitywith UtilityUtility

Started

Performance Degrades

Page 76: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

77

Effector: Priority vs Self-Induced Sleep (SIS)

2000 500 1000 1500 2000 2500

Sleep mechanism

00 200 400 600 800 1000 1200 1400 1600 18000

1

2

3

4

5 CPU Priority

Thro

ughp

ut

0 200 400 600 800 1000 1200 1400 1600 1800 20000

0.2

0.4

0.6

0.8

1

0Nor

mal

ized

Con

trol

Time (sec)500 1000 1500 2000 2500

Time (sec)

CPU Priority

is ineffective for

controllin

g BACKUP

Page 77: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

78

DBA

ComputeDegradation

ModelEstimation

Controller DB2R U

Y

S E

Y

BaselineEstimation

Y*qM

WL

+-

Block Diagram

Controller SaUtility

bWorkload

U aUb

YE

MREYYYM

Y),

*

*

*

-=

-=

+=

(=

babaq

R: Impact Limit

E: Error

U: Sleep %

Y: Pageometer(pages/sec)

q: Model parameters

Y*: Baseline perf

y

u 1

Assume linear effect of throttling on Y

Online Modeling to translate from Pages/sec (Y) to % Impact (M)

% Impact

% Impact Pages/sec

Page 78: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

79

Controller Evaluation

Page 79: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

80

Disks

Parallel, PageWrite Requests

Clients

UDB Server

Prefetchers

Page Cleaners

Log

DeadlockDetector

Logger

CoordinatorAgent

Subagents

ShrMem+Sem, TCPIP, Named Pipes, NetBIOS, SNA, IPX/SPX

Buffer Pool(s)

Write Log RequestsVictim Notifications

Async IO Prefetch Requests

Parallel, Big-block,Read RequestsScatter/Gather I/Os

UDB Client LibraryClient Application

Log Buffer

System Description: DB/2 UDB – Self-Tuning Memory

Page 80: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

81

Database Memory Management

Memory management is key to database performance.

Optimize performance by equalizing loads across the memory pools.

DB2 UDB Server

Agents

Memory pools

Disks

DB2Clients

Challenges1. Hand tuning is difficult2. Memory is constrained 3. Many memory pools4. Workload varies

Page 81: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

82

MIMO Controller Design: Linear Quadratic Regulation

d1(k)

-+++

Load

- ++

Resource1N,1N

dN(k)

y1(k)

yN(k)

e1(k)

eN(k) uN(k)

u1(k)

I

I

w(k)

++

++

d1(k)O

dN(k)O

w1(k)

wN(k)

BalancerResourceConsumer N

The picture can't be displayed.

2 2 2,

1 1 1 1 1 1( ) ( ) ( )

N N N

i I i ik i k i k i

J q e k q e k r u k¥ ¥ ¥

= = = = = =

= + +åå åå ååmin

Cost of load imbalance Cost of control

Page 82: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

83

Measured Benefit of Load Balancing

¢ Decision support workloadv Long running transactionsv Resource requirements vary over time

¢ Study effect on total query response time (TS) in TPC-H.

Static Pool Sizes

TS=26,342

Dynamic Pool Sizes

TS=10,680

59% Reduction

in Total RT

Page 83: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

84

Summary

¢ Control systems consists of elementsv Controller, target system, transducer, filter, adapter, …

¢ Control objectives for computing systems focus onv SASO: Stability, accuracy, settling time, overshoot

¢ Classical control theory builds on linear system theoryv Signals, transfer functions, composition of systems, use of z-transform to encode

time related information¢ Control analysis involves

v Constructing ARX models for componentsv Translating these models into the z-domain (transfer functions)v Using composition of systems to find the end-to-end transfer functions of interestv Analyzing the SASO properties of these systems

¢ These simple models and analyses have had significant practical at IBMv Regulating the execution of administrative utilitiesv Self-tuning memory management

Page 84: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

85

Summary of Results

)1()()( G

uy

=¥¥

Steady state gain of G(z) is

Stable system if |a|<1, where a is the largest pole of G(z)

0 10 20 300

0.5

1

1.5

2

k

u(k

)

0 10 20 300

0.1

0.2

0.3

0.4

0.5

k

y(k

)

G(z)Y(z)U(z)

+A(z)

C(z)+

B(z)

Adding signals:

G(z) W(z)U(z)H(z) Y(z)

G(z)H(z) Y(z)U(z)is equivalent to

Transfer functions in series

)()()(1)()(

)()()(

zGzKzHzGzK

zRzTzFR +==

)( of polelargest theis || where,||ln

4 timeSettling zGaa

{c(k)=a(k)+b(k)} has Z-Transform A(z)+B(z).

Transfer function of a feedback loop

K(z) G(z)-

+ ControllerTarget System T(z)R(z)

H(z)Transducer

Transfer Function of System

Output Signal

InputSignal

Page 85: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

86

Bibliography – Control Theory Textbooks

¢ Modern Control Engineering, K Ogata, Prentice Hall, 1996.¢ Feedback Control of Dynamic Systems, GF Franklin, JD Powell, and A Emami-

Naeini, 1993.¢ Discrete-Time Control Systems, K Ogata, Prentice Hall, 1995.¢ Adaptive Control, KJ Astrom and B Wittenmark, Addison Wesley, 1995.¢ Applied Nonlinear Control, JJE Slotine and W Li, Prentice Hall, 1991.¢ Robust Adaptive Control, PA Ioannou and J Sun, Prentice Hall, 1996.¢ Introduction to Stochastic Control Theory, KJ Astrom, Academic Press, 1970.¢ Fuzzy Control, KM Passino and S Yurkovich, Addison Wesley Longman, 1998.¢ Feedback Control of Computing Systems, JL Hellerstein, Y Diao, S Parekh, and

DM Tilbury, Wiley, 2004.

Page 86: Control Theory for Performance Management€¦ · ¢ Theory: Part 1 v Signals, Z-Transforms ¢Theory: Part 2 v Transfer functions v Analyzing composed systems v Q&A / Buffer ¢ Control

87

Bibliography – Starter Set of Articles

¢ CV Hollot, V Misra, D Towsley, and WB Gong. A control theoretic analysis of RED. IEEE

INFOCOM’01, 2001.

¢ Y Lu, A Saxena, and TF Abdelzaher. Differentiated caching services: a control-theoretic

approach. ICDS, 2001.

¢ S Parekh, N Gandhi, J Hellerstein, D Tilbury, J Bigus, and TS Jayram. Using control

theory to achieve service level objectives in performance management. Real-Time

Systems Journal, 23:127-141, 2002.

¢ A Robertsson, B Wittenmark, and M Kihl. Analysis and design of admission control in

Web-server systems. American Control Conference, 2003.

¢ L Sha, X Liu, Y Lu, and T Abdelzaher. Queueing model based network server

performance control. IEEE RealTime Systems Symposium, 2002.

¢ CE Rohrs, RA Berry, and SJ O’Halek. A control engineer’s look at ATM congestion

avoidance. GLOBECOM, 1995.

¢ Yixin Diao, Joseph L. Hellerstein, Adam Storm, Maheswaran Surendra, Sam Lightstone,

Sujay Parekh, and Christian Garcia-Arellano. Incorporating cost of control into the design

of a load balancing controller. Invited paper, Real-Time and Embedded Technology and

Application Systems Symposium, 2004.

¢ Sujay Parekh, Kevin Rose, Yixin Diao, Victor Chang, Joseph L. Hellerstein, Sam

Lightstone, Matthew Huras. Throttling utilities in the IBM DB2 Universal Database Server.

American Control Conference, 2004.