Application Layerطبقة التطبيقات

الشريحة 1 من 23

مقدمة الفصل

تفاصيل المصدرالفصل 2 · الشرائح ⁦2–3⁩
المصدر
الفصل 2 · الشرائح ⁦2–3⁩
ملاحظات حول المصدر (1)
  • لا توجد شرائح عن برمجة المقابس، وعن P2P شريحة واحدة فقط (56).

Creating a network appإنشاء تطبيق شبكي

Application architectures

Some network apps (slide 4)

  • e-mail
  • web
  • text messaging
  • remote login
  • P2P file sharing
  • multi-user network games
  • streaming stored video (YouTube, Hulu, Netflix)
  • voice over IP (e.g., Skype)
  • real-time video conferencing
  • social networking
  • search
  • Write programs that run on (different) end systems and communicate over network — e.g., web server software communicates with browser software.
  • No need to write software for network-core devices: network-core devices do not run user applications.
  • Applications on end systems allows for rapid app development, propagation.
تفاصيل المصدرالفصل 2 · الشرائح ⁦4–5⁩
المصدر
الفصل 2 · الشرائح ⁦4–5⁩

Client-server vs P2Pعميل/خادم مقابل P2P

Application architectures

Client-serverP2P
Always-on server?Yes: always-on host with permanent IP addressNo always-on server
Who communicates?
  • Clients communicate with server
  • clients do not communicate directly with each other
Arbitrary end systems directly communicate
ScalingData centers for scalingSelf scalability: new peers bring new service capacity and new service demands
AddressesClients may have dynamic IP addressesPeers intermittently connected and change IP addresses
Managementلا تذكر الشرائح شيئًا هنا.Complex management

من الشرائح

  • Pure P2P (slide 56): file distribution (BitTorrent), streaming (KanKan), VoIP (Skype).

A multiplayer game company runs its match servers on always-on hosts with permanent IP addresses in data centers, and players' devices never talk to each other directly. Which architecture is this?

تفاصيل المصدرالفصل 2 · الشرائح ⁦6, 7, 8, 56⁩
المصدر
الفصل 2 · الشرائح ⁦6, 7, 8, 56⁩

Processes and socketsالعمليات والمقابس

Processes, sockets and addressing

Processالعملية
Program running within a host.
Client processعملية العميل
Process that initiates communication.
Server processعملية الخادم
Process that waits to be contacted.
Socketالمقبس
Process sends/receives messages to/from its socket; socket analogous to door.
  • Same host: inter-process communication (defined by OS). Different hosts: exchanging messages.
  • Sending process shoves message out door and relies on transport infrastructure on other side of door to deliver it to the socket at the receiving process.
  • Above the socket: controlled by app developer; below it: controlled by OS.
  • Applications with P2P architectures have client processes & server processes.
تفاصيل المصدرالفصل 2 · الشرائح ⁦9–10⁩
المصدر
الفصل 2 · الشرائح ⁦9–10⁩

Addressing processesعنونة العمليات

Processes, sockets and addressing

To receive messages, a process must have an identifier. A host device has a unique 32-bit IP address — but many processes can be running on the same host.

Process identifier
Includes both IP address and port numbers associated with process on host.

من الشرائح

  • Example port numbers: HTTP server: 80; mail server: 25.
  • To send an HTTP message to the gaia.cs.umass.edu web server: IP address 128.119.245.12, port number 80.
تفاصيل المصدرالفصل 2 · الشريحة ⁦11⁩
المصدر
الفصل 2 · الشريحة ⁦11⁩

What an app-layer protocol definesما يحدده بروتوكول التطبيق

App-layer protocols and transport needs

  1. Types of messages exchanged
  2. Message syntax
  3. Message semantics
  4. Rules

Open protocolsبروتوكولات مفتوحة

  • Defined in RFCs
  • Allows for interoperability
  • e.g., HTTP, SMTP

Proprietary protocolsبروتوكولات مملوكة

  • e.g., Skype
تفاصيل المصدرالفصل 2 · الشريحة ⁦12⁩
المصدر
الفصل 2 · الشريحة ⁦12⁩

What transport service does an app need?احتياجات التطبيق من النقل

App-layer protocols and transport needs

Data integrity
Some apps (e.g., file transfer, web transactions) require 100% reliable data transfer; other apps (e.g., audio) can tolerate some loss.
Timing
Some apps (e.g., Internet telephony, interactive games) require low delay to be "effective".
Throughput
Some apps (e.g., multimedia) require minimum amount of throughput to be "effective"; other apps ("elastic apps") make use of whatever throughput they get.
Security
Encryption, data integrity, …
Transport service requirements: common apps (slide 14)
ApplicationData lossThroughputTime sensitive
file transferno losselasticno
e-mailno losselasticno
Web documentsno losselasticno
real-time audio/videoloss-tolerant
  • audio: 5kbps-1Mbps
  • video: 10kbps-5Mbps
yes, 100's msec
stored audio/videoloss-tolerantsame as aboveyes, few secs
interactive gamesloss-tolerantfew kbps upyes, 100's msec
text messagingno losselasticyes and no

Which of these applications is loss-tolerant?

تفاصيل المصدرالفصل 2 · الشرائح ⁦13–14⁩
المصدر
الفصل 2 · الشرائح ⁦13–14⁩
ملاحظات حول المصدر (1)
  • عمود «حساس للزمن» في الشريحة 14 مطبوع غير محاذٍ لصفوفه (القيمة «yes, few secs» على صف الألعاب، ولا قيمة بجانب الصوت/الفيديو المخزّن)؛ والجدول هنا يوزع القيم السبع على التطبيقات بترتيبها، ولا يعتمد عليه أي سؤال. عمودا فقد البيانات والإنتاجية محاذيان.

TCP and UDP servicesخدمات TCP وUDP

Internet transport services; securing TCP

TCP service

  • Reliable transport between sending and receiving process
  • Flow control: sender won't overwhelm receiver
  • Congestion control: throttle sender when network overloaded
  • Connection-oriented: setup required between client and server processes
  • Does not provide: timing, minimum throughput guarantee, security

UDP service

  • Unreliable data transfer between sending and receiving process
  • Does not provide: reliability, flow control, congestion control, timing, throughput guarantee, security, or connection setup
Internet apps: application, transport protocols (slide 16)
ApplicationApp-layer protocolUnderlying transport
e-mailSMTP [RFC 2821]TCP
remote terminal accessTelnet [RFC 854]TCP
WebHTTP [RFC 2616]TCP
file transferFTP [RFC 959]TCP
streaming multimediaHTTP (e.g., YouTube), RTP [RFC 1889]TCP or UDP
Internet telephonySIP, RTP, proprietary (e.g., Skype)TCP or UDP

Which of the following does TCP NOT provide?

تفاصيل المصدرالفصل 2 · الشرائح ⁦15–16⁩
المصدر
الفصل 2 · الشرائح ⁦15–16⁩

Securing TCP: SSLتأمين TCP: SSL

Internet transport services; securing TCP

TCP & UDP

  • No encryption
  • Cleartext passwds sent into socket traverse Internet in cleartext

SSL

  • Provides encrypted TCP connection
  • Data integrity
  • End-point authentication
  • Cleartext passwds sent into socket traverse Internet encrypted
Where SSL sits
SSL is at app layer: apps use SSL libraries, which "talk" to TCP (SSL socket API).
تفاصيل المصدرالفصل 2 · الشريحة ⁦17⁩
المصدر
الفصل 2 · الشريحة ⁦17⁩

Web and HTTPالويب وHTTP

Web pages

  • Web page consists of objects: HTML file, JPEG image, Java applet, audio file, …
  • Web page consists of a base HTML-file which includes several referenced objects.
  • Each object is addressable by a URL, e.g., www.someschool.edu/someDept/pic.gif — host name www.someschool.edu, path name /someDept/pic.gif.
HTTP: hypertext transfer protocol
Web's application layer protocol; client/server model. Client: browser that requests, receives (using HTTP) and "displays" Web objects. Server: Web server sends (using HTTP) objects in response to requests.

HTTP uses TCP

  1. 1

    Client initiates TCP connection (creates socket) to server, port 80.

  2. 2

    Server accepts TCP connection from client.

  3. 3

    HTTP messages exchanged between browser (HTTP client) and Web server (HTTP server).

  4. 4

    TCP connection closed.

HTTP is "stateless"
Server maintains no information about past client requests. (Protocols that maintain "state" are complex: past history must be maintained; if server/client crashes, their views of "state" may be inconsistent and must be reconciled.)
تفاصيل المصدرالفصل 2 · الشرائح ⁦19–21⁩
المصدر
الفصل 2 · الشرائح ⁦19–21⁩

Non-persistent vs persistent HTTPغير الدائم والدائم

Non-persistent and persistent HTTP

Non-persistent HTTP

  • At most one object sent over TCP connection
  • Connection then closed
  • Downloading multiple objects required multiple connections

Persistent HTTP

  • Multiple objects can be sent over single TCP connection between client, server

Non-persistent HTTP: user enters www.someSchool.edu/someDepartment/home.index (text + references to 10 jpeg images)

  1. 1a

    HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80.

  2. 1b

    HTTP server at host www.someSchool.edu waiting for TCP connection at port 80 "accepts" connection, notifying client.

  3. 2

    HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index.

  4. 3

    HTTP server receives request message, forms response message containing requested object, and sends message into its socket.

  5. 4

    HTTP server closes TCP connection.

  6. 5

    HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects.

  7. 6

    Steps 1–5 repeated for each of 10 jpeg objects.

تفاصيل المصدرالفصل 2 · الشرائح ⁦22–24⁩
المصدر
الفصل 2 · الشرائح ⁦22–24⁩

HTTP response timeزمن استجابة HTTP

Non-persistent and persistent HTTP

RTT (definition)
Time for a small packet to travel from client to server and back.

المسألة

Non-persistent HTTP response time (one object)

الصيغة

response time = 2RTT + file transmission time

خطوات الحل

  1. One RTT to initiate TCP connection.
  2. One RTT for HTTP request and first few bytes of HTTP response to return.
  3. File transmission time.

النتيجة

Non-persistent HTTP response time = 2RTT + file transmission time.

Non-persistent HTTP issues

  • 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 open connection
  • Client sends requests as soon as it encounters a referenced object
  • As little as one RTT for all the referenced objects

RTT between a client and a server is 50 ms, and transmitting a small file takes 10 ms. With non-persistent HTTP, what is the response time for this file?

تفاصيل المصدرالفصل 2 · الشرائح ⁦25–26⁩
المصدر
الفصل 2 · الشرائح ⁦25–26⁩

Cookies: keeping "state"الكعكات

User-server state: cookies

  1. 1Cookie header line of HTTP response message
  2. 2Cookie header line in next HTTP request message
  3. 3Cookie file kept on user's host, managed by user's browser
  4. 4Back-end database at Web site

Example (slides 27–28)

  1. 1

    Susan visits a specific e-commerce site for the first time.

  2. 2

    When the initial HTTP request arrives, the site creates a unique ID (1678) and an entry in backend database for the ID.

  3. 3

    The HTTP response carries set-cookie: 1678; the browser adds "amazon 1678" to its cookie file.

  4. 4

    Later requests (even one week later) carry cookie: 1678; the server takes cookie-specific action.

  • Uses: authorization, shopping carts, recommendations, user session state (Web e-mail).
  • Keeping "state": protocol endpoints maintain state at sender/receiver over multiple transactions; cookies: http messages carry state.
  • Cookies and privacy: cookies permit sites to learn a lot about you; you may supply name and e-mail to sites.
تفاصيل المصدرالفصل 2 · الشرائح ⁦27–29⁩
المصدر
الفصل 2 · الشرائح ⁦27–29⁩

Web caches (proxy server)الذاكرة المؤقتة للويب

Goal
Satisfy client request without involving origin server.
  1. 1

    User sets browser: Web accesses via cache; browser sends all HTTP requests to cache.

  2. 2

    Object in cache: cache returns object.

  3. 3

    Else cache requests object from origin server, then returns object to client.

  • Cache acts as both client and server: server for original requesting client; client to origin 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 (so too does P2P file sharing).

When a university's Web cache does not have a requested object and fetches it from the origin server, what role does the cache play toward the origin server?

تفاصيل المصدرالفصل 2 · الشرائح ⁦30–31⁩
المصدر
الفصل 2 · الشرائح ⁦30–31⁩

Caching exampleمثال الذاكرة المؤقتة

Web caches (proxy server)

Assumptions

  • Avg object size: 100K bits; avg request rate from browsers to origin servers: 15/sec; avg data rate to browsers: 1.50 Mbps
  • RTT from institutional router to any origin server: 2 sec; access link rate: 1.54 Mbps; 1 Gbps LAN

المسألة

No cache (slide 32)

الصيغة

total delay = Internet delay + access delay + LAN delay

خطوات الحل

  1. LAN utilization: 15%
  2. Access link utilization = 99% — problem!

النتيجة

= 2 sec + minutes + usecs

المسألة

Fatter access link: 154 Mbps (slide 33)

خطوات الحل

  1. Access link utilization = 9.9%

النتيجة

Total delay = 2 sec + msecs + usecs. Cost: increased access link speed (not cheap!).

المسألة

Install local cache, hit rate 0.4 (slide 35)

المعطيات

At cache
40% of requests
At origin
60% of requests
تفاصيل المصدرالفصل 2 · الشرائح ⁦32–35⁩
المصدر
الفصل 2 · الشرائح ⁦32–35⁩

FTP: separate control and data connectionsFTP

FTP: the file transfer protocol

FTP
Transfer file to/from remote host; client/server model — client: side that initiates transfer (either to/from remote); server: remote host. ftp: RFC 959; ftp server: port 21.

Control connection (TCP, server port 21)

  • FTP client contacts FTP server at port 21, using TCP
  • Client authorized over control connection
  • Client browses remote directory, sends commands
  • Control connection: "out of band"

Data connection (TCP, server port 20)

  • When server receives file transfer command, server opens 2nd TCP data connection (for file) to client
  • After transferring one file, server closes data connection
  • Server opens another TCP data connection to transfer another file
تفاصيل المصدرالفصل 2 · الشرائح ⁦37–38⁩
المصدر
الفصل 2 · الشرائح ⁦37–38⁩

Electronic mail: three major componentsمكونات البريد

Electronic mail and SMTP

User agentوكيل المستخدم
a.k.a. "mail reader": composing, editing, reading mail messages; e.g., Outlook, Thunderbird, iPhone mail client; outgoing, incoming messages stored on server.
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 · الشرائح ⁦40–41⁩
المصدر
الفصل 2 · الشرائح ⁦40–41⁩

SMTP and the Alice-to-Bob scenarioSMTP: من أليس إلى بوب

Electronic mail and SMTP

SMTP [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.

Scenario: Alice sends message to Bob

  1. 1

    Alice uses UA to compose message "to" bob@someschool.edu.

  2. 2

    Alice's UA sends message to her mail server; message placed in message queue.

  3. 3

    Client side of SMTP opens TCP connection with Bob's mail server.

  4. 4

    SMTP client sends Alice's message over the TCP connection.

  5. 5

    Bob's mail server places the message in Bob's mailbox.

  6. 6

    Bob invokes his user agent to read message.

In the Alice-to-Bob scenario, which step comes right after Alice's message is placed in the message queue of her mail server?

تفاصيل المصدرالفصل 2 · الشرائح ⁦42–43⁩
المصدر
الفصل 2 · الشرائح ⁦42–43⁩

Mail access protocols: POP3 vs IMAPPOP3 وIMAP

Mail access protocols: POP3 and IMAP

SMTP

  • Delivery/storage to receiver's server

Mail access protocol

  • Retrieval from server
  • POP: Post Office Protocol [RFC 1939]: authorization, download
  • IMAP: Internet Mail Access Protocol [RFC 1730]: more features, including manipulation of stored msgs on server
  • HTTP: gmail, Hotmail, Yahoo! Mail, etc.
POP3IMAP
Where messages liveDownloaded to the client ("download and delete" or "download-and-keep")Kept all in one place: at server
State across sessionsStateless across sessionsKeeps user state: folder names, message-ID ↔ folder mappings
FeaturesAuthorization, download
  • More features, incl. manipulation of stored msgs on server
  • folders
تفاصيل المصدرالفصل 2 · الشرائح ⁦44–45⁩
المصدر
الفصل 2 · الشرائح ⁦44–45⁩

DNS: services and why not centralizeخدمات DNS

DNS: domain name system

Domain Name System
Distributed database implemented in hierarchy of many name servers; application-layer protocol: hosts, name servers communicate to resolve names (address/name translation). Core Internet function, implemented as application-layer protocol — complexity at network's "edge".

DNS services

  • Hostname to IP address translation
  • Host aliasing: canonical, alias names
  • Mail server aliasing
  • Load distribution: replicated Web servers — many IP addresses correspond to one name

Why not centralize DNS?

  • Single point of failure
  • Traffic volume
  • Distant centralized database
  • Maintenance
  • A: doesn't scale!
تفاصيل المصدرالفصل 2 · الشرائح ⁦47–48⁩
المصدر
الفصل 2 · الشرائح ⁦47–48⁩

DNS hierarchy and server typesتسلسل خوادم DNS

DNS: domain name system

Client wants IP for www.amazon.com; 1st approx. (slide 49)

  1. 1

    Client queries root server to find com DNS server.

  2. 2

    Client queries .com DNS server to get amazon.com DNS server.

  3. 3

    Client queries amazon.com DNS server to get IP address for www.amazon.com.

DNS server typeRole on the slides
Root
  • Contacted by a local name server that can not resolve a name
  • contacts authoritative server if mapping not known
  • 13 root name "servers" worldwide
TLDResponsible for com, org, net, edu, aero, jobs, museums, and all top-level country domains
AuthoritativeOrganization's own DNS server(s): authoritative hostname-to-IP mappings for its named hosts
Local (default)
  • Each ISP has one
  • receives the host's query
  • local cache (may be out of date)
  • acts as proxy into the hierarchy
  • TLD examples: Network Solutions maintains servers for .com TLD; Educause for .edu TLD.
  • Authoritative servers can be maintained by organization or service provider.
  • Local DNS server: does not strictly belong to hierarchy; also called "default name server"; its cache of recent translations may be out of date.
تفاصيل المصدرالفصل 2 · الشرائح ⁦49–52⁩
المصدر
الفصل 2 · الشرائح ⁦49–52⁩

DNS name resolution: iterated vs recursiveالاستعلام التكراري والعودي

DNS: domain name system

Example: host at cis.poly.edu wants the IP address for gaia.cs.umass.edu. Its local DNS server is dns.poly.edu; the authoritative DNS server is dns.cs.umass.edu.

Iterated query (slide 53)

  • Contacted server replies with name of server to contact
  • "I don't know this name, but ask this server"
  • The local DNS server asks root, then TLD, then authoritative server in turn

Recursive query (slide 54)

  • Puts burden of name resolution on contacted name server
  • Each server forwards the query down the chain and returns the answer
  • Heavy load at upper levels of hierarchy?

A TLD server answers a query with: "I don't know this name, but ask this server." Which kind of query is being used?

تفاصيل المصدرالفصل 2 · الشرائح ⁦53–54⁩
المصدر
الفصل 2 · الشرائح ⁦53–54⁩

الخلاصة

تفاصيل المصدر
المصدر
الفصل 2

خريطة الفصل

    1. 1مقدمة الفصل
  1. Application architecturesمعماريات التطبيقات

    1. 2Creating a network appإنشاء تطبيق شبكي
    2. 3Client-server vs P2Pعميل/خادم مقابل P2P
  2. Processes, sockets and addressingالعمليات والمقابس والعنونة

    1. 4Processes and socketsالعمليات والمقابس
    2. 5Addressing processesعنونة العمليات
  3. App-layer protocols and transport needsبروتوكولات التطبيقات واحتياجات النقل

    1. 6What an app-layer protocol definesما يحدده بروتوكول التطبيق
    2. 7What transport service does an app need?احتياجات التطبيق من النقل
  4. Internet transport services; securing TCPخدمات النقل في الإنترنت وتأمين TCP

    1. 8TCP and UDP servicesخدمات TCP وUDP
    2. 9Securing TCP: SSLتأمين TCP: SSL
  5. Web and HTTP overviewالويب وHTTP

    1. 10Web and HTTPالويب وHTTP
  6. Non-persistent and persistent HTTPHTTP غير الدائم والدائم

    1. 11Non-persistent vs persistent HTTPغير الدائم والدائم
    2. 12HTTP response timeزمن استجابة HTTP
  7. User-server state: cookiesالكعكات (Cookies)

    1. 13Cookies: keeping "state"الكعكات
  8. Web caches (proxy server)ذاكرة الويب المؤقتة (الخادم الوكيل)

    1. 14Web caches (proxy server)الذاكرة المؤقتة للويب
    2. 15Caching exampleمثال الذاكرة المؤقتة
  9. FTP: the file transfer protocolبروتوكول نقل الملفات FTP

    1. 16FTP: separate control and data connectionsFTP
  10. Electronic mail and SMTPالبريد الإلكتروني وSMTP

    1. 17Electronic mail: three major componentsمكونات البريد
    2. 18SMTP and the Alice-to-Bob scenarioSMTP: من أليس إلى بوب
  11. Mail access protocols: POP3 and IMAPبروتوكولات الوصول إلى البريد: POP3 وIMAP

    1. 19Mail access protocols: POP3 vs IMAPPOP3 وIMAP
  12. DNS: domain name systemنظام أسماء النطاقات DNS

    1. 20DNS: services and why not centralizeخدمات DNS
    2. 21DNS hierarchy and server typesتسلسل خوادم DNS
    3. 22DNS name resolution: iterated vs recursiveالاستعلام التكراري والعودي
    1. 23الخلاصة