+ All Categories
Home > Documents > Lecture 3: The)Applica;on)Layer - documents.epfl.ch · Computer)Networks,)Fall)2015...

Lecture 3: The)Applica;on)Layer - documents.epfl.ch · Computer)Networks,)Fall)2015...

Date post: 08-Jul-2018
Category:
Upload: dangcong
View: 213 times
Download: 0 times
Share this document with a friend
80
Computer Networks, Fall 2015 The Applica;on Layer Lecture 3: Katerina Argyraki, EPFL
Transcript

Computer)Networks,)Fall)2015

The)Applica;on)LayerLecture 3:

Katerina(Argyraki,(EPFL

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 2

instant&messaging

instant&messaging

facebook&server

firefox&accessing&

facebook

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 3

while((...)({((((message(=(...;((((send(((message,(...();(}

while((...)({((((message(=(receive(((...();(}

Alice

BobApplica7on&

Programming&

Interface

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 4

while((...)({((((message(=(...;((((send(((message,(...();(}

while((...)({((((message(=(receive(((...();(}

Alice

Bob

processes =)pieces)of)code)that)belong)))))to)the)applica;on)layer

IP address

process)address:)128.156.17.23,)80

port number

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Design)an)applica;on)=

6

‣ Design)the)architecture)A which(process(does(what?(

‣ Design)the)communica;on)protocol(s))A what(sequences(of(messages(can(be(exchanged?(

‣ Choose)the)transport)service)A what(delivery(guarantees(are(needed?(

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Design)the)architecture)=

‣ How)is)the)func;onality)of)the)applica;on)distributed)over)the)processes?)

7

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 8

client

server

a)process)that)is)always)running

reachable)at)a)fixed,)known)process)address

answers)requests)for)service

a)process)that)requests)service

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 9

client

client

client

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Client@server)architecture

‣ Clear)separa;on)of)roles)- a client process makes requests for service

- a server process answers (or denies) the requests

10

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 11

client

client

client

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 12

client

client

client

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Client@server)architecture

‣ Server)runs)on)dedicated)infrastructure)- could be one machine

- more likely a data-center

13

‣ Clear)separa;on)of)roles)A a(client(makes(requests(for(service(A a(server(answers((or(denies)(the(requests

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 14

peer

peer

a)process)that)may)both)make)and)answer)requests

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 15

peer

peer

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Peer@to@peer)architecture

16

‣ A)peer)may)act)both)as)client)and)server)A a(peer(may(request(service(from(another(peer(A or(provide(service(to(another(peer(

‣ Peer)runs)on)personally)owned)end@system))A PC,(laptop,(smartphone(A no(dedicated(infrastructure

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Two)architecture)choices

‣ Client@server)architecture)- clear separation of roles

- server runs on dedicated infrastructure

‣ Peer@to@peer)architecture)- peers act both as servers and clients

- peer runs on personally owned end-system

17

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Which(one(to(choose?

‣ Consider)- performance: but which one?

- scalability- reliability or predictability

- security

18

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Design)an)applica;on)=

‣ Design)the)architecture)- which process does what?

‣ Design)the)communica;on)protocol(s))- what sequences of messages can be exchanged?

‣ Choose)the)transport)service)- what delivery guarantees are needed?

19

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Design)the)protocol)=

‣ What)are)the)possible)message)exchanges)between)client)&)server)or)peers?)

20

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Protocol)⊂)Applica;on

‣ Applica;on)=)communica;on)protocol)))))))))))))))))))))))))

))))))))))))))))))))))))+)client)&)server)(or)peer))processes))))))))))))))))))))

))))))))))))))))))))))))+)...)

‣ Web)=)HTTP)communica;on)protocol))

))))))))))))+)web)browser)&)server)processes))

))))))))))))+)HTML)language

21

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Design)an)applica;on)=

‣ Design)the)architecture)- which process does what?

‣ Design)the)communica;on)protocol)- what sequences of messages can be exchanged?

‣ Choose)the)transport)service)- what delivery guarantees are needed?

22

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Choose)the)transport)service)=

‣ When)a)process)delivers)or)receives)))))))))))))a)message)to/from)the)transport)layer,)))))what)should)it)expect?)

23

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

1.)Reliable)message)delivery

‣ The)transport)delivers)the)message)to)the)des;na;on)process)or)signals)failure)

- web pages, file transfer, email, ...

- loss-sensitive (not loss-tolerant) applications

24

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

2.)Guaranteed)performance)

‣ Minimum)throughput)- voice: a few Kbps, video: a few Mbps

- throughput-sensitive applications

‣ Maximum)end@to@end)packet)delay)- voice & video: 100 msec

- delay-sensitive applications

25

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

3.)Guaranteed)security

‣ Confiden;ality)- message is revealed only to the destination

‣ Data)integrity)- message is not changed along the way

‣ Authen;city)- message indeed came from claimed source

26

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Internet)transport)services

‣ TCP)- reliable message delivery

‣ UDP)- no expectations

27

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 28

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 29

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 31

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 32

TCP)code)at)the)server)machine)keeps)a)record)with)informa;on)about)each)ac;ve)client)process

TCP)code)at)the)client)machine)keeps)a)record)with)informa;on)about)the)server)process

client

server

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Connec;on)=)memory

‣ TCP)is)“connec;on@oriented”)or)“stateful”)

)=))TCP)maintains)state)on))

)))))communica;ng)processes

33

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Internet)transport)services

‣ UDP)- Only the address of the client/server is stored- Doesn’t keep any state about the packets- Lost packets are not retransmitted- Used in time-critical applications

- Voice transmission- Video chat

34

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Internet)transport)services

‣ TCP)- reliable message delivery

- “connection-oriented” or “stateful”

‣ UDP)- no expectations

- “connection-less” or “stateless”

35

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Transport@layer)services

‣ Reliable)message)delivery)- provided by TCP

‣ Performance)guarantees)- not provided by any transport-layer technology

‣ Security)guarantees)- it’s complicated

36

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

applica7on

transport

network

link

physical

37

HTTP((web)SMTP((mail)

FTP((file(transfer)

TCP UDP

Secure(Sockets(Layer(or(SSL

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Design)an)applica;on)=

‣ Design)the)architecture)- client-server or peer-to-peer?

‣ Design)the)communica;on)protocol(s))- what sequences of messages can be exchanged?

‣ Choose)the)transport)service)- TCP or UDP? SSL?

38

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

What)transport)to)use

‣ Web)pages)- TCP or SSL

‣ File)download)- TCP

‣ Torrent@like)peer@to@peer)- UDP

‣ IP@Telephony)- UDP

39

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Example)1:)The)web

40

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server or peer-to-peer?

‣ Design)the)communica;on)protocol(s))- what sequences of messages can be exchanged?

‣ Choose)the)transport)service)- TCP or UDP? SSL?

41

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 43

a)process)that)is)always)running

reachable)at)a)fixed,)known)process)address

answers)requests)for)service

web&client =&web&browser

web&server

a)process)that)requests)service

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 44

)serves)web&pages

web)page)=)set)of)files

URL)=)address)for)))))))))))))Internet)resources

each)with)its)own)URL

web&client =&web&browser

web&server

a)process)that)requests)service

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Web)basics

‣ Processes:)web)server)&)

))))))))))))))))))))web)browser)(client))

‣ Web)server)=)process)that)serves)web)pages)

‣ Web)page)=)base)file)+)objects)- pictures, videos, scripts, etc

45

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture

‣ Design)the)communica;on)protocol)- what sequences of messages can be exchanged?

‣ Choose)the)transport)service)- TCP or UDP? SSL?

46

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture

‣ Design)the)communica;on)protocol(s))- what sequences of messages can be exchanged?

‣ Choose)the)transport)service)- TCP or UDP? SSL?

47

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 48

)serves)web&pages

web)page)=)set)of)files

URL)=)address)for)))))))))))))Internet)resources

each)with)its)own)URL

web&client =&web&browser

web&server

a)process)that)requests)service

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

=&web&browser

49

web&client web&server

GET base file

base file

GET picture 1

picture 1

;me

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

HTTP)request)types

‣ GET:)client)requests)to)download)a)file)

‣ POST:)client)provides)informa;on)

‣ PUT:)client)requests)to)upload)a)file)

‣ DELETE:)client)requests)to)delete)a)file

50

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

HTTP)response)types

‣ OK)

‣ Not)found)

‣ Moved)permanently)

‣ Bad)request)

‣ ...

51

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

hhp://www.epfl.ch/index.fr.html

52

GET)/index.fr.html)HTTP/1.1)Host:)www.epfl.ch)User@agent:)Mozilla/5.0)Accept@language:)fr

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 53

HTTP/1.1)200)OK)Date:)Thu,)04)Oct)2012)13:22:07)GMT)Server:)Apache/2.2.3)(Red)Hat))Content@Loca;on:)index.fr.html)Last@Modified:)Wed,)03)Oct)2012)11:06:11)GMT)Content@Length:)27836)Content@Type:)text/html;)charset=UTF@8)Content@Language:)fr)

(data)data)data))

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)applica;on)Web

‣ What)is)in)a)Web)page?)

‣ How)many)GET@requests)for)one)page?)

‣ What)if)the)server)wants)to)contact)the)client?)

- And if he wants to anyway?

54

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 55

=&web&browserweb&client web&server

GET base file X

base file

GET picture 1

picture 1

;me

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 56

=&web&browserweb&client web&server

GET cnn.com

base file + cookie #95

POST “Katerina” + cookie #95

;me

cookie)#95)

Katerina)

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 57

=&web&browserweb&client web&server

GET cnn.com + cookie #95

“welcome, Katerina!”

POST “I’m Greek” + cookie #95

;me

cookie)#95)Katerina)

Greek)

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 58

=&web&browserweb&client web&server

GET cnn.com + cookie #95

“welcome, Katerina! Here

are some news from

Greece.”

;me

cookie)#95)Katerina)

Greek)

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Cookies

‣ Cookie)=)state)kept)by)the)server)

‣ It)links)subsequent)HTTP)requests))))))))to)the)same)web)client

59

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Example)of)GET)request

60

GET)/index.fr.html)HTTP/1.1)Host:)www.epfl.ch)User@agent:)Mozilla/5.0)Accept@language:)fr)Cookie:&1976

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture

‣ Design)the)communica;on)protocol(s))- HTTP requests & responses

‣ Choose)the)transport)service)- TCP or UDP? SSL?

61

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Anything(wrong(with(cookies?

‣ User@tracking)

‣ Privacy@loss)

‣ EU)has)a)direc;ve)for)everybody)to)click)‘OK’)

- What does that change?

62

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture

‣ Design)the)communica;on)protocol(s))- HTTP requests & responses

‣ Choose)the)transport)service)- TCP or UDP? SSL?

63

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 64

applica7on

transport

GET)...

Ht

Delay)to)receive)file:

1)RTT =)round@trip);me))=);me)for)a)small)packet)to)go)and)return

+)delay)for)request)packet)to)go)to)server

+)delay)for)response)packet(s))to)go)to)client

1&RTT

OK)...

Ht

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

How)to)use)TCP?

‣ Persistent)vs.)non@persistent)connec;ons)- create new TCP connection per HTTP request?

‣ One)vs.)mul;ple)connec;ons)- how many parallel TCP connections to create?

65

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 66

applica7on

transport

GET)...

Ht

Non@persistent)connec;on)

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 68

applica7on

transport

GET)...

Ht

Persistent)connec;on)

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

GET)...

Mul;ple)connec;ons)

GET)...

69

applica7on

transportHt

Ht

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Non@persistent)TCP

‣ Typically)only)used)by)older)web)clients)&)servers)

‣ Adds)overhead)by)connec;ng)for)each)request)

‣ If)the)server)has)a)limited)number)of)parallel)connec;ons,)it)can)be)a)beher)use)of)the)resources)

‣ Mobile@based)applica;on)that)contacts)rarely)the)server

70

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Persistent)TCP

‣ Less)delay)experienced)by)the)client)- He doesn’t have to wait for the setup of each

connection

‣ Web@browser)

‣ Chat@applica;on)with)‘push@simula;on’

71

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Mul;ple)TCP)connec;ons

‣ Server)can)handle)less)clients)simultaneously)

- There is a limit on the number of connections- Instantaneous bandwidth increases

‣ Faster)fetching)of)mul;ple)content)

‣ Most)modern)web@browsers)use)it)

‣ Download@helpers)use)it

72

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Example)of)GET)request

73

GET)/index.fr.html)HTTP/1.1)Host:)www.epfl.ch)User@agent:)Mozilla/5.0)Accept@language:)fr)Connec7on:&close

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture

‣ Design)the)communica;on)protocol(s))- HTTP requests & responses

‣ Choose)the)transport)service)- TCP (typically with persistent TCP connections)

74

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture

‣ Design)the)communica;on)protocol(s))- HTTP requests & responses

‣ Choose)the)transport)service)- TCP (with or without persistent TCP connections)

75

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 76

www.epfl.ch

EPFLGET)/)Host:)www.epfl.ch

web&clients

Silicon)Valley

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 77

web&clients

Silicon)Valley

GET)/)Host:)www.epfl.ch

proxy&web&server&

=&web&cache

GET)/)Host:)www.epfl.ch

origin&&

web&server

www.epfl.ch

EPFL

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Web)caching

‣ Web)cache)or)proxy)web)server)- caches copies of other web-server files

- acts as a web server to nearby web clients

‣ Lowers)used)bandwidth)

‣ Allows)for)easy)control

78

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Web)@)transport

‣ What)applica;on)could)do)well)with)non@persistent)TCP@connec;ons?)

‣ Why)would)a)server)want)to)disallow)mul;ple)TCP@connec;ons?))

‣ Could)the)cache)serve)stale)(old))data?))- what if cached copy is out of date?

79

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer 80

web&clients

Silicon)Valley

GET)/)Host:)www.epfl.ch

proxy&web&server&

=&web&cache

GET)/)Host:)www.epfl.ch)If@modified@since:)...

origin&&

web&server

EPFL

Not)modified

www.epfl.ch

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Example)of)GET)request

81

GET)/)HTTP/1.1)Host:)www.epfl.ch)IfJmodifiedJsince:&Fri,&3&Oct&2014&10:00:00

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Web)caching

‣ Web)cache)or)proxy)web)server)- caches copies of other web-server files

- acts as a web server to nearby web clients

‣ Web)cache)ensures)served)file)is)fresh))- sends “conditional GET” request to origin server

82

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

The)design)of)the)web

‣ Design)the)architecture)- client-server architecture (with caching)

‣ Design)the)communica;on)protocol)- HTTP requests & responses

‣ Choose)the)transport)service)- TCP (typically with persistent TCP connections)

83

Computer)Networks,)Fall)2015 Lecture)3)@)The)applica;on)layer

Comparison)of)applica;ons

87

Web Mail Skype Bittorrent

Architecture Client / server

Client / server Peer-to-peer Peer-to-peer

Communication protocol HTTP

SMTP POP3 IMAP

Proprietary Encoded Bittorrent

Transport service TCP TCP UDP UDP


Recommended