17 - university of california, berkeley

21
Copyright 1999, University of California 4-Aug-99 1 Understanding Networked Applications: A First Course Chapter 17 by David G. Messerschmitt Understanding Networked Applications A First Course 2 Summary Performance and quality • Concurrency • Scalability Operating systems

Upload: others

Post on 23-Apr-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

1

Understanding Networked Applications:A First Course

Chapter 17

by

David G. Messerschmitt

Understanding Networked Applications A First Course2

Summary

• Performance and quality

• Concurrency

• Scalability

• Operating systems

Page 2: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

2

Understanding Networked Applications A First Course3

What is performance

• Characterizing non-functional applicationattributes

• Quantitative metrics– Latency, speed, etc

– Parameterized by load, users, etc

• Performance of application as a wholeusually not meaningful– Subdivide into tasks

Understanding Networked Applications A First Course4

Tasks

• Collection of actions that are not meaningfullyseparated– Only completed task is of interest; partial results not

useful

– How does this relate to atomicity in transactions?

• For repetitive tasks, users or operators often careabout– Task completion time (sec)

– Task throughput (tasks/sec)

Page 3: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

3

Understanding Networked Applications A First Course5

Important questions

• For any application

• What are the tasks?– Which is important: completion time,

throughput, or both, or something else?

– What are the quantitative objectives?

Understanding Networked Applications A First Course6

Example: Web surfing

• Task:– User: Click on URL, retrieve page, display

– Server: HTTP request received, HTML pageformed as a message, message transmitted

• What performance metric(s) are importantto:– User?

– Server?

Page 4: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

4

Understanding Networked Applications A First Course7

Examples

• What are the tasks and their appropriateperformance metrics for the followingapplications:– Schwab stock trading system?

– Stock ticker?

– ATM system?

– Travel reservation system?

– Remote conferencing?

Understanding Networked Applications A First Course8

Typical components of taskcompletion time

Client Server

Formulaterequest

Message latency

Message latency

Processing time toformulate response

Interpretresponse

Page 5: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

5

Understanding Networked Applications A First Course9

Time

Large completion timeand high throughput

Small completion timeand low throughput

Concurrency

Completion time and throughputare unrelated

Understanding Networked Applications A First Course10

Concurrency

• Two tasks are concurrent if they overlap intime

• Four cases:

Time

Page 6: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

6

Understanding Networked Applications A First Course11

Concurrency may be….• …a way to satisfy intrinsic application

requrements– e.g. a number of users may generate concurrent tasks

• …a way to improve fairness

• …a way to increase task throughput– e.g. assign tasks to different hosts to get more done

• …a way to reduce task completion time– e.g. divide a task into subtasks and assign those

subtasks to different hosts

Understanding Networked Applications A First Course12

Time

Tasks not concurrentScheduling delay

Tasks concurrent

Short task completes sooner

Concurrency for fairness

Page 7: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

7

Understanding Networked Applications A First Course13

Time

Tasks not concurrentScheduling delay

Tasks concurrent

Even though each task takes longer,short task still completes sooner

Concurrency may contribute tofairness on a single host

Understanding Networked Applications A First Course14

User view Reality

Time slice

Context switch

Concurrency on a single host

Why do this?

What is effect oncompletion time ofeach task?

Page 8: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

8

Understanding Networked Applications A First Course15

Messages arrive at a communication linksimultaneously

Transmitting one message at a time

Transmitting messages concurrently

Message arrivesearlier

Divide each message into packets

Why networks use packets

Understanding Networked Applications A First Course16

Transaction_1

Transaction_2

Shared resources

Transaction_1Transaction_2

Transaction_1 Transaction_2

Two concurrenttransactions

Give the sameresult as:

Or:

Isolation of transactions

Page 9: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

9

Understanding Networked Applications A First Course17

Queue

Concurrency

Messages among active objects

An active objectdelegates a task toanother active object,which retrieves fromqueue when ready

Task

Task

Understanding Networked Applications:A First Course

Scalability

by

David G. Messerschmitt

Page 10: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

10

Understanding Networked Applications A First Course19

Definition

• An application is scalable if its performanceparameters can be improved as necessary– Adding but not replacing equipment is

acceptable

– Re-configuration but not re-programming isacceptable

– Normally equipment cost should increase nomore than linearly with performance

Understanding Networked Applications A First Course20

Basic technique

• Concurrent tasks are a key to scalability

• Some obstacles:– Concurrent tasks aren’t there

– Dependency among tasks

– Communication overhead

– Variations in task loads result in congestion

Page 11: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

11

Understanding Networked Applications A First Course21

Some problems to try to avoid

• Blocking– Processing blocked waiting for external events

– Make sure processor can work on somethingelse

• Duplication– In creating concurrent tasks, duplication of

effort is created

Understanding Networked Applications A First Course22

Problems to avoid (con’t)

• Load balancing– Workload not equal among processors

– Some processors not fully utilized

– More difficult if concurrent tasks are dependent

• Congestion– Workload fluctuates

– Makes load balancing more difficult becauseutilization can’t be predicted

Page 12: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

12

Understanding Networked Applications A First Course23

Mux&

queue

Irregulararrival oftasks

Irregulartaskcompletiontimes

Server

Source of congestion

Understanding Networked Applications A First Course24

Congestion model

Queue

1. Tasks arrive atrandom times 2. Tasks wait in

queue waitingfor processing

3. Taskservice timeis random

Page 13: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

13

Understanding Networked Applications A First Course25

Statistical waiting timeWaiting time

0

5

10

15

20

25

30

0.1 0.3 0.5 0.7 0.9

Utilization

Series1

A specific statisticalmodel for arrivaltimes and servicetimes is assumed

Tradeoff between taskcompletion time (waitingtime) and task throughput(utilization)

Understanding Networked Applications A First Course26

Example: Web server

How do users know the server is reachingfull utilization?

When a single Web server/processor isexhausted, what do we do?

Page 14: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

14

Understanding Networked Applications:A First Course

Operating systems

Understanding Networked Applications A First Course28

Some OS goals

• Abstraction: hide hardware details

• Manage concurrency– Multitasking (time-slicing) concurrency

– Process and thread

– Inter-process communicaton

• Manage resources– Memory, storage, processing, network access

Page 15: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

15

Understanding Networked Applications A First Course29

Processor cache

Main memory

Online (non-volatile) external storage

Archive storage

Off-line

Size

Speed

Memory/storage hierarchy

Understanding Networked Applications A First Course30

Processor

Sharedmemory

Processor Processor

Networkinterface

Processor

Privatememory

Processor ProcessorNetworkinterface

Privatememory

Privatememory

High-speed communication bus

Page 16: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

16

Understanding Networked Applications A First Course31

OS kernel

Network Storage Memory

Process

Mem

ory

Process

Mem

ory

Userlevel

Kernellevel

Resources

Understanding Networked Applications A First Course32

Process

Kernel performsservice, then returns

KernelKernelmodemode

UserUsermodemode

TimeTime

write_file(),send_message(),etc.

Page 17: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

17

Understanding Networked Applications A First Course33

Thread n Thread n+1Request toHTTP serverto returnhomepage

Page returned

Another request

Sharedrepositoryof WWWlinks

Another return

Threads

Understanding Networked Applications:A First Course

Supplements

By

David G. Messerschmitt

Page 18: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

18

Understanding Networked Applications A First Course35

Execution models for objects

• Active object– Independent center of activity

– Works without methods being called

• Passive object– Works only in response to method invocations

Understanding Networked Applications A First Course36

Two observations

• For anything to get done, there has to be at leastone active object!

• Natural for each active object to work on one taskat a time– If so there must be at least two active objects for

concurrency

– (although in principle an active object could time sliceamong tasks, this is much more complicated and not agood idea)

Page 19: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

19

Understanding Networked Applications A First Course37

Active object Passive objects

Executing

Time

One object is executingat a time

Natural for each active object towork on one task

Task

Understanding Networked Applications A First Course38

Activeobject

ActiveobjectPassive objects

Concurrency with two activeobjects

Page 20: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

20

Understanding Networked Applications A First Course39

Concurrency

Activeobject

ActiveobjectPassive objects

Potential resourceconflict

A possible problem

Understanding Networked Applications A First Course40

Stage1 Stage2 Stage3

Partially completedpiece of work

Task

Without pipelining

Page 21: 17 - University of California, Berkeley

Copyright 1999, University of California 4-Aug-99

21

Understanding Networked Applications A First Course41

Stage1 Stage2 Stage3 Task_completeTask_start

Repetitivetasks

With pipelining