Document 7566918

Download Report

Transcript Document 7566918

Traceroute – roundtrip times from
source to the given hop
traceroute to www.rsu.ru (195.208.252.130), 30 hops max, 38 byte packets
1 128.4.73.100 (128.4.73.100) 3.587 ms 1.083 ms 1.150 ms
2 128.175.137.1 (128.175.137.1) 3.506 ms 0.993 ms 10.980 ms
3 chp-br1-ge-0-1-0.nss.udel.edu (128.175.111.12) 1.201 ms 1.127 ms 0.814 ms
4 chp-br2-ge-0-1-0.nss.udel.edu (128.175.111.13) 0.911 ms 1.326 ms 1.436 ms
5 local.udel1.magpi.net (216.27.98.37) 2.453 ms 2.219 ms 2.948 ms
6 phl-02-08.backbone.magpi.net (198.32.42.197) 2.244 ms 2.487 ms 2.211 ms
7 phl-09-02.backbone.magpi.net (216.27.100.230) 2.712 ms 3.135 ms 2.772 ms
8 remote.oc48.abilene.magpi.net (216.27.100.22) 4.759 ms 4.441 ms 4.470 ms
9 chinng-nycmng.abilene.ucaid.edu (198.32.8.82) 42.381 ms 24.898 ms 24.852 ms
10 Chicago-RBNet-1.rbnet.ru (195.209.4.253) 24.728 ms 24.936 ms 25.186 ms
11 Amsterdam-RBNet-1.rbnet.ru (195.209.14.250) 128.863 ms 128.911 ms 129.394 ms
12 MSK-M9-RBNet-7.RBNet.ru (195.209.14.181) 173.397 ms 173.286 ms 174.054 ms
13 RND-TTC-RBNet-1.RBNet.ru (195.209.14.22) 196.466 ms 195.995 ms 196.342 ms
14 gw-kttk-fa-0-1-1.r61.net (195.208.248.77) 214.186 ms 355.452 ms 364.510 ms
15 gw-cc-fa-0-0-1.r61.net (195.208.248.241) 200.495 ms 197.055 ms 197.875 ms
16 web.rsu.ru (195.208.252.130) 198.378 ms 199.002 ms 198.420 ms
2: Application Layer
1
HTTP connections
HTTP runs over TCP:
Client initiates TCP connection (creates socket)
to server, port 80
Server accepts TCP connection from client
HTTP messages (application-layer protocol messages)
exchanged between browser (HTTP client) and
Web server (HTTP server)
TCP connection closed
HTTP is “stateless”
Server maintains no information about past client requests
2: Application Layer
2
HTTP connections
Nonpersistent HTTP
At most one object is
sent over a TCP
connection.
HTTP/1.0 uses
nonpersistent HTTP
Persistent HTTP
Multiple objects can
be sent over single
TCP connection
between client and
server
HTTP/1.1 uses
persistent connections
in default mode
2: Application Layer
3
(contains text,
references to 10
jpeg images)
Nonpersistent HTTP
User enters URL www.someSchool.edu/index.html
1a. HTTP client initiates TCP
connection to HTTP server at
www.someSchool.edu on port 80
time
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection
socket. Message indicates
that client wants object
someDepartment/home.index
5. HTTP client receives response
message containing html file,
displays html. Parsing html
file, finds 10 referenced jpeg
objects
1b. HTTP server at host
www.someSchool.edu waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
3. HTTP server receives request
message, forms response
message containing requested
object, and sends message
into its socket
4. HTTP server closes TCP
connection.
6. Steps 1-5 repeated for each
of 10 jpeg objects
2: Application Layer
4
(contains text,
references to 10
jpeg images)
Persistent HTTP
User enters URL www.someSchool.edu/index.html
1a. HTTP client initiates TCP
connection to HTTP server at
www.someSchool.edu on port 80
time
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection
socket. Message indicates
that client wants object
someDepartment/home.index
5. HTTP client receives response
message containing html file,
displays html. Parsing html
file, finds 10 referenced jpeg
objects
1b. HTTP server at host
www.someSchool.edu waiting
for TCP connection at port 80.
“accepts” connection, notifying
client
3. HTTP server receives request
message, forms response
message containing requested
object, and sends message
into its socket
7. HTTP server closes TCP
connection after it has been
idle for a while.
6. Steps 2-5 repeated for each
of 10 jpeg objects
2: Application Layer
5
Response time modeling
Definition of round trip time (RTT):
time to send a small packet to travel
from client to server and back.
Response time:
client
One RTT to initiate
TCP connection
One RTT for HTTP request
and first few bytes of HTTP
response to return
File transmission time
server
initiate TCP
connection
RTT
request
file
Total = 2RTT+ file transmit time
time to
transmit
file
RTT
file
received
time
time
2: Application Layer
6
Persistent vs. Nonpersistent HTTP
Nonpersistent HTTP:
Requires 2 RTTs per
object
OS overhead for each
TCP connection
Browsers often open
parallel TCP connections
to fetch referenced
objects
Persistent HTTP:
Server leaves connection open
after sending response
Subsequent HTTP messages
between same client/server sent
over this open connection
Persistent without pipelining:
Client issues new request only
when previous response has been
received
One RTT for each object
Persistent with pipelining
Default in HTTP/1.1
Client sends requests as soon as
it encounters an reference
As little as one RTT for all the
referenced objects
2: Application Layer
7
User-server state: cookies
Many major Web sites use cookies to store user-related
information at user’s computer and retrieve it when
needed
Four components:
1) Server to client: cookie header line of HTTP response
message – set cookie
2) Later, client to server: cookie header line in HTTP request
message – send cookie
3) Cookie file is kept on user’s host, managed by user’s browser
4) Server looks up a back-end database at Web site
Example:
Susan access Internet always from same PC
She visits a specific e-commerce site for first time
When initial HTTP requests arrives at site, site creates
a unique ID and creates an entry in backend database for ID
2: Application Layer
8
Cookies: keeping “state”
client
Cookie file
server
usual http request msg
usual http response +
ebay: 8734
Cookie file
amazon: 1678
ebay: 8734
Set-cookie: 1678
usual http request msg
cookie: 1678
usual http response msg
one week later:
Cookie file
amazon: 1678
ebay: 8734
usual http request msg
cookie: 1678
usual http response msg
server
creates ID
1678 for user
cookiespecific
action
cookiespectific
action
2: Application Layer
9
Cookies: Pros and Cons
What cookies can bring:
Authorization
Shopping carts
Recommendations
User session state (Web e-mail)
Cookies and privacy:
Cookies permit sites to learn a lot about you
You may supply name and e-mail to sites
Search engines use redirection & cookies to learn yet more
Advertising companies obtain info across sites
2: Application Layer
10
Web caches (proxy servers)
Goal: satisfy client request without involving origin server
User sets browser: Web accesses via cache
Browser sends all HTTP requests to cache
Object in cache: cache returns object
Else cache requests object from origin server, then
returns object to client
client
client
Proxy
server
origin
server
2: Application Layer
11
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
Internet dense with caches enables “poor”
content providers to effectively deliver content
2: Application Layer
12
Caching example
origin
servers
Assumptions
Average object size = 100,000 bits
Avg. request rate from institution’s
public
Internet
browsers to origin servers = 15/sec
Delay from institutional router to any origin
server and back to router = 2 sec
Without caching
1.5 Mbps
access link
LAN utilization = 15%
institutional
(100Kb*15/10Mbps)
network
10 Mbps LAN
Access link utilization = 100%
Delay per request = 2 sec +
milliseconds
institutional
cache
2: Application Layer
13
origin
servers
Caching example
Possible solution
Increase bandwidth of access link to,
say, 10 Mbps
With increased bandwith, no caching
LAN utilization = 15%
(100Kb*15/10Mbps)
Access link utilization = 15%
Delay per request = 2 sec +
milliseconds
Often a costly upgrade
public
Internet
10 Mbps
access link
institutional
network
10 Mbps LAN
institutional
cache
2: Application Layer
14
Caching example
Possible solution
suppose hit rate is 40%
With caching
40% requests will be satisfied
almost immediately
60% requests satisfied by origin
server
Access link utilization = 60%
(60%*100Kb*15/10Mbps)
Delay = 60%*(2sec+milliseconds)
40%*milliseconds ~ 1.2 secs
origin
servers
public
Internet
1.5 Mbps
access link
institutional
network
10 Mbps LAN
institutional
cache
2: Application Layer
15
HTTP Conditional GET
Goal: cache asks the server cache
not to send object if it
HTTP request msg
wasn’t modified since last
If-modified-since:
time this cache has
<date>
requested this object
Cache: specify date of
HTTP response
cached copy in HTTP request
HTTP/1.0
If-modified-since:
<date>
Server: response contains no
object if cached copy is upto-date:
HTTP/1.0 304 Not
Modified
server
object
not
modified
304 Not Modified
HTTP request msg
If-modified-since:
<date>
HTTP response
object
modified
HTTP/1.0 200 OK
<data>
2: Application Layer
16
FTP: the file transfer protocol
user
at host
FTP
FTP
user
client
interface
file transfer
local file
system
FTP
server
remote file
system
Transfer file to/from remote host
Client/server model
client: side that initiates transfer
server: remote host
FTP: RFC 959
FTP server: port 21
2: Application Layer
17
Separate control, data connections
FTP client contacts FTP
server at port 21,
specifying TCP as
transport protocol
Client logs on over
control connection
Client browses remote
directory over control
connection.
When server receives a
command for a file
transfer, it opens a TCP
data connection to client
TCP control connection
port 21
FTP
client
TCP data connection
port 20
FTP
server
After transferring one
file, server closes
connection.
Server opens a second TCP
data connection to
transfer another file.
FTP server maintains
“state”: current directory,
earlier authentication
2: Application Layer
18
FTP commands, responses
Sample commands:
Sent as ASCII text
over control channel
USER username
PASS password
LIST return list of file
in current directory
RETR filename
retrieves (gets) file
STOR filename
stores (puts) file onto
remote host
Sample return codes
Status code and
phrase (as in HTTP)
331 Username OK,
password required
125 data
connection
already open;
transfer starting
425 Can’t open
data connection
452 Error writing
file
2: Application Layer
19
Electronic Mail
outgoing
message queue
user mailbox
user
agent
Three major components:
User agents
Mail servers
Simple mail transfer
protocol: SMTP
User Agent
Composing, editing, reading
mail messages
e.g., Eudora, Outlook, elm,
Netscape Messenger
Outgoing, incoming messages
stored on server
mail
server
SMTP
SMTP
mail
server
user
agent
SMTP
user
agent
mail
server
user
agent
user
agent
user
agent
2: Application Layer
20
Mail servers
Mailbox contains incoming messages for user
Message queue of outgoing (to be sent) mail
messages
SMTP protocol between mail servers to send
email messages
client: sending mail server
“server”: receiving mail server
2: Application Layer
21
SMTP Protocol [RFC 2821]
Uses TCP to reliably transfer email message
from client to server, port 25
Direct transfer:
sending server to receiving server
Three phases of transfer
Handshaking (greeting)
Transfer of messages
Closure
Command/response interaction
commands: ASCII text
response: status code and phrase
Messages must be in 7-bit ASCII
2: Application Layer
22
Alice sends message to Bob
1) Alice uses user agent (UA)
to compose message for
[email protected]
2) Alice’s UA sends message
to her mail server; message
placed in message queue
3) Client side of SMTP opens
TCP connection with Bob’s
mail server
1
user
agent
2
mail
server
3
4) SMTP client sends Alice’s
message over the TCP
connection
5) Bob’s mail server places the
message in Bob’s mailbox
6) Bob invokes his user agent
to read message
mail
server
4
5
6
user
agent
2: Application Layer
23
Sample SMTP interaction
S:
C:
S:
C:
S:
C:
S:
C:
S:
C:
C:
C:
S:
C:
S:
220 hamburger.edu
HELO crepes.fr
250 Hello crepes.fr, pleased to meet you
MAIL FROM: <[email protected]>
250 [email protected]... Sender ok
RCPT TO: <[email protected]>
250 [email protected] ... Recipient ok
DATA
354 Enter mail, end with "." on a line by itself
Do you like ketchup?
How about pickles?
.
250 Message accepted for delivery
QUIT
221 hamburger.edu closing connection
2: Application Layer
24
Try SMTP interaction for yourself:
telnet mail.cis.udel.edu 25
see 220 reply from server
enter HELO, MAIL FROM, RCPT TO, DATA, QUIT
commands
above lets you send email without using email client
(reader)
2: Application Layer
25
SMTP: final words
SMTP uses persistent
connections
SMTP requires
message (header &
body) to be in 7-bit
ASCII
SMTP server uses
CRLF.CRLF to
determine end of
message
Comparison with
HTTP:
HTTP: pull
SMTP: push
Both have ASCII
command/response
interaction, status
codes
2: Application Layer
26
Mail message format
Header lines, e.g.,
To:
From:
Subject:
different from SMTP
commands!
header
blank
line
body
Body
the “message”, ASCII
characters only
2: Application Layer
27
Multimedia extensions
MIME: multimedia mail extension, RFC 2045, 2056
Additional lines in msg header declare MIME content
type
MIME version
method used
to encode data
multimedia data
type, subtype,
parameter declaration
encoded data
From: [email protected]
To: [email protected]
Subject: Picture of yummy crepe.
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Type: image/jpeg
base64 encoded data .....
.........................
......base64 encoded data
2: Application Layer
28
Mail access protocols
user
agent
SMTP
SMTP
sender’s mail
server
access
protocol
user
agent
receiver’s mail
server
SMTP: delivery/storage to receiver’s server
Mail access protocol: retrieval from server
POP: Post Office Protocol [RFC 1939]
 Authorization (agent <-->server) and download
IMAP: Internet Mail Access Protocol [RFC 1730]
 More features (more complex)
 Manipulation of stored msgs on server
HTTP: Hotmail , Yahoo! Mail, etc.
2: Application Layer
29
POP3 protocol
authorization phase
client commands:
user: declare username
pass: password
server responses
+OK
-ERR
transaction phase, client:
list: list message numbers
retr: retrieve message by
number
dele: delete
quit
S:
C:
S:
C:
S:
+OK POP3 server ready
user bob
+OK
pass hungry
+OK user successfully logged
C:
S:
S:
S:
C:
S:
S:
C:
C:
S:
S:
C:
C:
S:
list
1 498
2 912
.
retr 1
<message 1 contents>
.
dele 1
retr 2
<message 1 contents>
.
dele 2
quit
+OK POP3 server signing off
2: Application Layer
on
30
POP3 vs IMAP
POP3
Previous example uses
“download and delete”
mode.
Bob cannot re-read email if he changes
client
“Download-and-keep”:
copies of messages on
different clients
POP3 is stateless
across sessions
IMAP
Keep all messages in
one place: the server
Allows user to
organize messages in
folders
IMAP keeps user state
across sessions:
Names of folders and
mappings between
message IDs and folder
name
2: Application Layer
31