ECE/CS 372 introduction to computer networks Lecture 4 Announcements: HW1 is due next Tuesday, April 16 th Extra credit due next Thursday, April 18 th h=p://wps.aw.com/ aw_kurose_network_3/21/5493/1406348.cw/index.html Acknowledgement: slides drawn heavily from Kurose & Ross Chapter 2, slide: 1
Web and HTTP: Review QuesPon A HTTP request consists of: 1 basic html object 2 referenced JPEG objects Each object is of size = 10 6 bits RTT = 1 second Transmission rate = 1Mbps Consider transmission delay of objects only QuesPon: how long it takes to receive the enpre page: a) Non- persistent connecpon b) Persistent without pipelining c) Persistent with pipelining inipate TCP connecpon RTT request file RTT file received time time Pme to transmit file Chapter 2, slide: 2
A HTTP request consists of: 1 basic html object 2 referenced JPEG objects Each object is of size = 10 6 bits RTT = 1 second Transmission rate = 1Mbps Consider transmission delay of objects only Web and HTTP: Review QuesPon Answer: (transmit Pme = 1 sec) a) 3+3+3=9 sec (inipate + request + transmit) for each of all 3 b) 1+2+2+2=7 sec inipate TCP connecpon RTT request file RTT file received time inipate + (request + transmit) for each of all 3 c) 1+2+3=6 sec inipate + (request + transmit for basic) + (one request for 2 + two transmits, one for each of the 2 objects) time Pme to transmit file Chapter 2, slide: 3
Web caches (or proxy server) Goal: sapsfy client request without involving origin server If page is needed, browser requests it from the Web cache Q: what if object not in cache?? cache requests object from origin server, then returns object to client client client Proxy server origin server origin server Chapter 2, slide: 4
More about Web caching Cache acts as both client and server Typically cache is installed by ISP (university, company, residential ISP) Why Web caching? reduce response time for client request reduce traffic on an institution s access link. Chapter 2, slide: 5
Caching example Assumptions avg. object size = 0.1x10 6 bits avg. request rate from institution to origin servers = 10/sec Internet delay = 2 sec Consequences utilization on LAN = 10% (LAN: local area network) utilization on access link = 100% total delay = Internet delay + access delay + LAN delay = 2 sec + 1 sec +.1 sec =3.1 sec unacceptable delay! institutional network public Internet 1 Mbps access link 10 Mbps LAN origin servers institutional cache Chapter 2, slide: 6
Caching example (cont) possible solution increase bandwidth of access link to, say, 10 Mbps public Internet origin servers consequence utilization on LAN = 10% utilization on access link = 10% Total delay = Internet delay + access delay + LAN delay = 2 sec +.1 sec +.1 sec = 2.2 sec often a costly upgrade total delay still dominated by Internet delay institutional network 10 Mbps access link 10 Mbps LAN institutional cache Chapter 2, slide: 7
Caching example (cont) origin servers 2 nd possible sol: web cache suppose hit rate is 0.4 (typically, between 0.3 & 0.7) consequence 40% requests will be sapsfied almost immediately and 60% requests sapsfied by origin server public Internet 1 Mbps access link uplizapon of access link reduced by 40%, giving an access delay in the order of milliseconds institutional network 10 Mbps LAN q Total delay = 0.4x(0.1) (LAN) + 0.6x(0.1+1+2) (LAN + access + Internet) = 1.9 sec total average delay reduced by about 40% institutional cache Chapter 2, slide: 8
Web cache (cont) Advantages are obvious: Reduce response time Reduce internet traffic Any problems with caches?? Local cache copies of web pages may not be up- to- date?? What do we do then? SoluPon Upon receiving a web request, a cache must consult origin server to check whether the requested page is up- to- date CondiPonal GET method v What: Sent by cache to origin server: check page status v When: For each new request: client checks with cache Chapter 2, slide: 9
Conditional GET Goal: don t send object if cache has up-to-date version How: cache specifies date of cached copy in HTTP request If-modified-since: <date> Server: response contains no object if cached copy is up-todate: HTTP/1.0 304 Not Modified cache HTTP request msg If-modifiedsince: <date> HTTP response HTTP/1.0 304 Not Modified HTTP request msg If-modifiedsince: <date> HTTP response HTTP/1.0 200 OK <data> server object not modified object modified Chapter 2, slide: 10
Chapter 2: Application layer Principles of network applications app architectures app requirements Web and HTTP P2P file sharing Chapter 2, slide: 11
File sharing approaches There are 2 approaches server Bob peers Centralized: Client-server architecture Distributed: P2P architecture (e.g., BitTorrent) server obtain list of peers trading chunks Alice peer Chapter 2, slide: 12
File sharing: P2P vs. client-server architectures Client-Server P2P Robustness to failure Scalability Security Performance Single point of failure Not scalable More secure Bottleneck Fault-tolerant Scalable Less secure Better Chapter 2, slide: 13
Comparing Client-Server, P2P architectures Question : What is the file distribution time: from one server to N hosts? File, size F Server u 1 d 1 u 2 u d 2 s u s : server upload bandwidth u i : client/peer i upload bandwidth d i : client/peer i download bandwidth d N u N Network (with abundant bandwidth) Chapter 2, slide: 14
Client-server: file distribution time server sequenpally sends N copies: F Server u u 2 1 d 1 u d s 2 time to send one copy: F/u s time to send N copies: NF/u s client i takes F/d i Pme to download QuesPon: What happens if client download rate is less than server s upload rate? d N u N Network (with abundant bandwidth) Time to distribute F to N clients using client/server approach = d cs = max { NF/u s, F/min(d i ) } increases linearly in N (for large N) Chapter 2, slide: 15
P2P: file distribution time server seed must send one copy: F/u s Pme client i takes F/d i Pme to download clients as aggregate must download NF bits - NF bits must be uploaded - max upload rate (limiting max download rate) is u s + Σu i F Server d N u N u u 2 1 d 1 u d s 2 Network (with abundant bandwidth) d P2P = max { F/u s, F/min(d i ), NF/(u s + Σu i) } i=1,n Chapter 2, slide: 16
Comparing Client-server, P2P architectures Server- client networks tend to perform slower when large number of users connect to server at the same Pme server must handle all user requests; performance is sacrificed P2P file sharing networks perform be=er with a large amount of users performance increases when number of users increases every client can be a server as well, when number of users increases, the number of providers also increases Minimum Distribution Time 3.5 3 2.5 2 1.5 1 0.5 0 P2P Client-Server 0 5 10 15 20 25 30 35 N Chapter 2, slide: 17
Chapter 2: Summary We covered general concepts, like: application architectures client-server, P2P application service requirements: reliability, bandwidth, delay Web and HTTP Non-Persistent, persistent, web cache Distribution time Client-server, P2P Chapter 2, slide: 18