15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application...

45
15-744: Computer Networking L-20 Applications
  • date post

    20-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    2

Transcript of 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application...

Page 1: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

15-744: Computer Networking

L-20 Applications

Page 2: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 2

Application Networking

• HTTP• APIs• Assigned reading

• [BSR99] An Integrated Congestion Management Architecture for Internet Hosts

• [PM95] Improving HTTP Latency

Page 3: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 3

Overview

• Congestion Manager • HTTP Basics• HTTP Fixes

Page 4: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 4

Socket API

• Connection establishment• Connect – active connect• Bind, listen, accept – passive connect

• Transmission/reception• Send & sendto• Recv & recvfrom• Pass large buffer to protocol stack • Protocol transmits at either congestion controlled or line rate

• Configuration/status• E.g advertised window, nagle, multicast membership, etc.• Setsockopt, getsockopt• Very little information really passed to/controlled by application

Page 5: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 5

CM Requirements

• Determining correct rate of transmission = congestion control

• What is wrong with congestion control today? • “Multimedia Transmissions Drive Net

Toward Gridlock”

New York Times8/23/99

• Tightly integrated with TCP• Congestion control is vital to network stability

Page 6: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 6

Problems with Concurrent Flows

• Compete for resources• N “slow starts” = aggressive• No shared learning = inefficient

f(n)f(n)

f2f2

f1f1

ServerClient

Abstract all congestion-related information into one location

Abstract all congestion-related information into one location

Internet

Page 7: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 7

Problems Adapting to Network State

• TCP hides network state• New applications may not use TCP

• Often do not adapt to congestion

Need system that helps applications learn and adapt to congestion

Need system that helps applications learn and adapt to congestion

f1f1

Server Client

?Internet

Page 8: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 8

API

High Level View

IPIP

HTTP Video1

TCP2 UDP

Audio Video2

All congestion management tasks performed in CMApplications learn and adapt using API

All congestion management tasks performed in CMApplications learn and adapt using API

CongestionManager

Per-macroflow statistics

(cwnd, rtt, etc.)TCP1

Page 9: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 9

Design Requirements

• How does CM control when and whose transmissions occur?• Keep application in control of what to send

• How does CM discover network state?• What information is shared?• What is the granularity of sharing?

Key issues: API and information sharingKey issues: API and information sharing

Page 10: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 10

The CM Architecture

Transmitting Application(TCP, conferencing app, etc)

Prober

CongestionController

Scheduler

Responder

Congestion Detector

Sender Receiver

CM Protocol

API

ReceivingApplicationApplication

Protocol

Page 11: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 11

Congestion Controller

• Responsible for deciding when to send a packet

• Window-based AIMD with traffic shaping• Exponential aging when feedback low

• Halve window every RTT (minimum)

• Plug in other algorithms• Selected on a “macro-flow” granularity

Page 12: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 12

Scheduler

• Responsible for deciding who should send a packet

• Hierarchical round robin• Hints from application or receiver

• Used to prioritize flows

• Plug in other algorithms• Selected on a “macro-flow” granularity• Prioritization interface may be different

Page 13: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 13

Transmission API

• Buffered send• cm_send(data, length)

• Request/callback-based send

cm_request( )cmapp_send( )

App

CM

IP

send( )

cm_notify(nsent)

Page 14: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 14

Transmission API (cont.)

• Request API: asynchronous sourceswait for (some_events) {

get_data( );send( );

}

• Synchronous sourcesdo_every_t_ms {

get_data( );send( );

}

• Solution: cmapp_update(rate, srtt) callback

Page 15: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 15

Feedback about Network State

• Monitoring successes and losses• Application hints• Probing system

• Notification API (application hints)• Application calls cm_update(nsent, nrecd,

congestion indicator, rtt)

Page 16: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 16

Probing System

• Receiver modifications necessary• Support for separate CM header• Uses sequence number to detect losses• Sender can request count of packets received

• Receiver modifications detected/negotiated via handshake• Enables incremental deployment

IP payload CM Header

IP Header

IP Payload

Page 17: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 17

How will applications use CM?

• TCP• Asynchronous API

• Congestion controlled UDP• Buffered API

• Conferencing applications• Synchronous API for real-time streams• Combination of others for other streams

Page 18: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 18

TCP/CM

TCP/CMCM

Application

IP

2. cm_open1. connect 3. write

4. cm_request

6. transmit

5. cmapp_send

8. recv ACK7. cm_notify

7. cm_request

9. cm_update

11. cm_close

10. close

Page 19: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 19

CM Web Performance

With CM

TCP Newreno

Time

Seq

uenc

e nu

mbe

r

CM greatly improvespredictability and

consistency

CM greatly improvespredictability and

consistency

Page 20: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 21

Layered Streaming Audio

Time

Seq

uenc

e nu

mbe

r

Competing TCP

TCP/CM

Audio/CM

Audio adapts to available bandwidthCombination of flows compete equally with

normal TCP

Audio adapts to available bandwidthCombination of flows compete equally with

normal TCP

Page 21: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 22

CM Summary

• Enables proper and stable congestion behavior

• Provides simple API that enables application to learn and adapt to network state

• Improves consistency and predictability of network transfers

• Provides benefit even when deployed at senders alone

Page 22: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 23

Overview

• Congestion Manager • HTTP Basics• HTTP Fixes

Page 23: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 24

HTTP Basics

• HTTP layered over bidirectional byte stream• Almost always TCP

• Interaction• Client sends request to server, followed by response from

server to client• Requests/responses are encoded in text

• How to mark end of message?• Size of message Content-Length

• Must know size of transfer in advance• Delimiter MIME style Content-Type

• Server must “byte-stuff”• Close connection

• Only server can do this

Page 24: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 25

HTTP Request

• Request line• Method

• GET – return URI• HEAD – return headers only of GET response• POST – send data to the server (forms, etc.)

• URI• E.g. http://www.seshan.org/index.html with a proxy• E.g. /index.html if no proxy

• HTTP version

Page 25: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 26

HTTP Request

• Request headers• Authorization – authentication info• Acceptable document types/encodings• From – user email• If-Modified-Since• Referer – what caused this page to be

requested• User-Agent – client software

• Blank-line• Body

Page 26: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 27

HTTP Request Example

GET / HTTP/1.1

Accept: */*

Accept-Language: en-us

Accept-Encoding: gzip, deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

Host: www.seshan.org

Connection: Keep-Alive

Page 27: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 28

HTTP Response

• Status-line• HTTP version• 3 digit response code

• 1XX – informational• 2XX – success• 3XX – redirection• 4XX – client error• 5XX – server error

• Reason phrase

Page 28: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 29

HTTP Response

• Headers• Location – for redirection• Server – server software• WWW-Authenticate – request for authentication• Allow – list of methods supported (get, head, etc)• Content-Encoding – E.g x-gzip• Content-Length• Content-Type• Expires• Last-Modified

• Blank-line• Body

Page 29: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 30

HTTP Response Example

HTTP/1.1 200 OKDate: Tue, 27 Mar 2001 03:49:38 GMTServer: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1

OpenSSL/0.9.5a DAV/1.0.2 PHP/4.0.1pl2 mod_perl/1.24Last-Modified: Mon, 29 Jan 2001 17:54:18 GMTETag: "7a11f-10ed-3a75ae4a"Accept-Ranges: bytesContent-Length: 4333Keep-Alive: timeout=15, max=100Connection: Keep-AliveContent-Type: text/html…..

Page 30: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 31

Typical Workload

• Multiple (typically small) objects per page • Request sizes

• In this paper Median 1946 bytes, mean 13767 bytes• Why such a difference? Heavy-tailed distribution

• Pareto – p(x) = akax-(a+1)

• File sizes• Why different than request sizes?• Also heavy-tailed

• Pareto distribution for tail• Lognormal for body of distribution

Page 31: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 32

Typical Workload

• Popularity• Zipf distribution (P = kr-1)• Surprisingly common

• Embedded references• Number of embedded objects = pareto

• Temporal locality• Modeled as distance into push-down stack• Lognormal distribution of stack distances

• Request interarrival• Bursty request patterns

Page 32: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 33

HTTP Caching

• Clients often cache documents• Challenge: update of documents• If-Modified-Since requests to check

• HTTP 0.9/1.0 used just date• HTTP 1.1 has file signature as well

• When/how often should the original be checked for changes?• Check every time?• Check each session? Day? Etc?• Use Expires header

• If no Expires, often use Last-Modified as estimate

Page 33: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 34

Example Cache Check Request

GET / HTTP/1.1Accept: */*Accept-Language: en-usAccept-Encoding: gzip, deflateIf-Modified-Since: Mon, 29 Jan 2001 17:54:18 GMTIf-None-Match: "7a11f-10ed-3a75ae4a"User-Agent: Mozilla/4.0 (compatible; MSIE 5.5;

Windows NT 5.0)Host: www.seshan.orgConnection: Keep-Alive

Page 34: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 35

Example Cache Check Response

HTTP/1.1 304 Not Modified

Date: Tue, 27 Mar 2001 03:50:51 GMT

Server: Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1 OpenSSL/0.9.5a DAV/1.0.2 PHP/4.0.1pl2 mod_perl/1.24

Connection: Keep-Alive

Keep-Alive: timeout=15, max=100

ETag: "7a11f-10ed-3a75ae4a"

Page 35: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 36

HTTP 0.9/1.0

• One request/response per TCP connection• Simple to implement

• Disadvantages• Multiple connection setups three-way

handshake each time• Several extra round trips added to transfer

• Multiple slow starts

Page 36: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 37

Single Transfer Example

Client ServerSYN

SYN

SYN

SYN

ACK

ACK

ACK

ACK

ACK

DAT

DAT

DAT

DAT

FIN

ACK

0 RTT

1 RTT

2 RTT

3 RTT

4 RTT

Server reads from disk

FIN

Server reads from disk

Client opens TCP connection

Client sends HTTP request for HTML

Client parses HTMLClient opens TCP connection

Client sends HTTP request for image

Image begins to arrive

Page 37: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 38

More Problems

• Short transfers are hard on TCP• Stuck in slow start• Loss recovery is poor when windows are small

• Lots of extra connections• Increases server state/processing

• Server also forced to keep TIME_WAIT connection state• Why must server keep these?• Tends to be an order of magnitude greater than

#of active connections, why?

Page 38: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 39

Overview

• Congestion Manager • HTTP Basics• HTTP Fixes

Page 39: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 40

Netscape Solution

• Use multiple concurrent connections to improve response time• Different parts of Web page arrive

independently• Can grab more of the network bandwidth than

other users

• Doesn’t necessarily improve response time• TCP loss recovery ends up being timeout

dominated because windows are small

Page 40: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 41

Persistent Connection Solution

• Multiplex multiple transfers onto one TCP connection• Serialize transfers client makes next request only

after previous response• How to demultiplex requests/responses

• Content-length and delimiter same problems as before

• Block-based transmission – send in multiple length delimited blocks

• Store-and-forward – wait for entire response and then use content-length

• PM95 solution – use existing methods and close connection otherwise

Page 41: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 42

Persistent Connection Example

Client Server

ACK

ACK

DAT

DAT

ACK

0 RTT

1 RTT

2 RTT

Server reads from diskClient sends HTTP request for HTML

Client parses HTMLClient sends HTTP request for image

Image begins to arrive

DAT

Server reads from disk

DAT

Page 42: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 43

Persistent Connection Solution

• Serialized requests do not improve response time• Pipelining requests

• Getall – request HTML document and all embeds• Requires server to parse HTML files• Doesn’t consider client cached documents

• Getlist – request a set of documents• Implemented as a simple set of GETs

• Prefetching• Must carefully balance impact of unused data transfers• Not widely used due to poor hit rates

Page 43: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 44

Persistent Connection Performance

• Benefits greatest for small objects• Up to 2x improvement in response time

• Server resource utilization reduce due to fewer connection establishments and fewer active connections

• TCP behavior improved• Longer connections help adaptation to

available bandwidth• Larger congestion window improves loss

recovery

Page 44: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 45

Remaining Problems

• Application specific solution to transport protocol problems

• Stall in transfer of one object prevents delivery of others

• Serialized transmission• Much of the useful information in first few bytes• Can “packetize” transfer over TCP

• HTTP 1.1 recommends using range requests • MUX protocol provides similar generic solution

• Solve the problem at the transport layer• Tcp-Int/CM/TCP control block interdependence

Page 45: 15-744: Computer Networking L-20 Applications. L -20; 4-2-01© Srinivasan Seshan, 20012 Application Networking HTTP APIs Assigned reading [BSR99] An Integrated.

L -20; 4-2-01© Srinivasan Seshan, 2001 46

Next Lecture: Caching & CDN’s

• HTTP• APIs• Assigned reading

• [FCAB98] Summary Cache: A Scalable Wide-Area Cache Sharing Protocol

• [Cla00] Freenet: A Distributed Anonymous Information Storage and Retrieval System