Chapter 2: COMMUNICATION BASICS Flashcards

1
Q

ISO‘s OSI model NN

A
  • Open Systems Interconnection model
  • Basis for standards development on systems interconnection.
  • Reference model for networking standards development
  • ISO/IEC7498-1
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

OSI model

A
  • Application
    • HTTP
  • Presentation
  • Session
  • Transport
    • TCP / UDP
  • Network
    • IP and Routing
  • Data Link
  • Physical
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

IP

A
  • Two versions
    • IPv4, e.g., 131.159.52.25
    • IPv6, e.g., fe80::3e97:eff:fe41:2d
  • Characteristics
    • Relays datagrams accross networks
    • Routing enables internetworking
    • Deliver packet from source to host address
    • Foundation for TCP/UDP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

IP Routing

A
  • Example: We want to reach the chairs website from home.
    • Which route should the packets go?
  • Requires routing protocol
    • Many (open, proprietary) routing protocols available,
    • Protocol used in the internet is BGP
  • BGP routing
    • Border Gateway Protocol
    • Routing between AS (Autonomous systems)
    • AS is typical a provider or bigger organization
    • Exchanges routing and reachability information between AS (Autonomous System
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

TCP

A
  • Transmission control protocol
  • Characteristics
    • Connection oriented protocol, session is initiated
    • Provides reliability through ACK
    • Provides ordering, sequencing
    • Flow control, sender connot overflow receiver
  • Slow compared to UDP
    • But provides reliability
  • Usage
    • HTTP, RPC, …
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

UDP

A
  • User Datagram Protocol
  • Characteristics
    • Connectionless, no session
    • Best-effort
    • No guaranteed delivery
    • No ordering guarantees
    • Point-to-point and point-to-multipoint
  • Faster than TCP
    • But application is responsible to fullfill guarantees
  • Usages
    • DNS, Video, Voice, …
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Ports

A
  • Example: Computer with a given IP address handles Mail, IM, Torrent, and Web browsing
    • How should the OS differentiate among these networked applications, if packets arrive?
  • A port is a 16 bit number to locally (per host) identify the connection
    • Separate for UDP and TCP
  • Numbers (vary by OS)
    • 0-1023 “reserved”, must be root to use
    • 1024 – 65535 are available to regular user
  • Well-known, reserved services
    • http80/tcp
    • ftp 21/tcp
    • ssh22/tcp
    • Others: telnet 23/tcp; finger 79/tcp; snmp 161/udp
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Application layer protocols

A
  • Example: A browser wants to retreive a web page
    • Typically HTTP 1.1 over TCP is used
  • Presentedprotocols
    • HTTP
  • Other protocols
    • FTP
    • SMTP
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Protocols

A
  • Set of rules that specifies data transfer between computing end-points, often including
    • Connection establishment & tear-down
    • Communication
    • Data representation
  • Often based on standards, de facto standards, open specifications, …
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Common application layer protocols

A
  • DHCP (Dynamic Host Configuration Protocol)

HTTP (Hypertext Transfer Protocol)

FTP (File Transfer Protocol)

Telnet (Telnet Remote Protocol)

SSH (Secure Shell Remote Protocol)

SIP(SessionInitiationProtocol)

POP3(PostOfficeProtocol3)

SMTP(SimpleMailTransferProtocol)

IMAP (Internet Message Access Protocol)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

HTTP/1.1

A

Definition

  • HyperText Transfer Protocol
  • Request/Response protocol for client-server communication
  • Normally used on top of TCP

Usagescenarios – Browser

  • RESTFUL API‘s
  • SOAP over HTTP
  • NoSQL databases, e.g., CouchDB
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

HTTP/1.1 methods

A
  • Get – retrieve information
  • Head – similar to get but must not return body message
  • Post – post form
  • Put – update
  • delete
  • trace – diagnostics
  • connect – initialize secure connection
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

HTTP/2.0

A
  • Standard Proposed in May 2015 as RFC7540
  • Supported already by all major browser
  • Main difference to HTTP/1.1
    • Better utilization of available network capacity
    • Headers are also compressed
    • On a single connection requests and response are interleaved
    • Prioritization of requests
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The Hourglass Evolution of the Internet Protocol Stack

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Socket: Problem description

A
  • Move data from Application I on Host A to Application K on Host B
  • Send a message from Application I on Host A to Application K on Host B
  • Invoke an operation/service from Application I on Host A on Application K on Host B and return a result (or failure)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A Client/Server world

A
  • Client
    • Issues requests to server(e.g.,send&receive)
  • Server
    • Starts up and listens for connections, requests, and sends/receives
  • Client/Server examples
    • telnet/telnetd
    • ftp/ftpd(sftp/sftpd)
    • Firefox/Apache
  • Client and server are roles, our following discussion also applies in peer-to-peer contexts
    • Same application may play both roles
17
Q

Protocol design considerations

A
  • How are API calls (e.g., get / set) sent from the client to the server?
    • May they have given us any hints in the code?
  • What parts of a call need to be conveyed to the server?
    • E.g., int storage_get(*table, *key, *record, *conn);
  • What’s the simplest possible way of sending this information?
  • What else needs to be represented in the protocol between the client library and the storage server?
18
Q

Simple protocol design

A
  • Simplicity
    • Simple encoding of client requests
    • Simple encoding of server response
    • Need to worry about error conditions
    • Don’t worry about saving a bit of bandwidth or computation
    • Consider debugging your communication
  • Interoperability
    • We can not assume client and server run on the same hardware / OS
  • Portability
    • We restrict ourselves to IPv4
19
Q

K/V-store server API NN

A
  • Telnet-based
    • \r\n as line delimiter
    • A „ „ space as delimiter between arguments • Values should be base64 encode
    • ISO-8859-1 encoding
    • Works with plain telnet or plain sockets
  • Example interactions
    • PUT tablename key value\r\n
      • OK if stored successfull
    • GET tablename key
      • Value is returned
20
Q

Using the “network” / Abstracting the network NN

A

Sockets are network programming abstractions.

  • User interface Business Layer
  • Internal API
  • Serialization/Protocol
  • Connection and error handling
  • Networking API
  • Protocols (TCP, …)
21
Q

Communication end-points & sockets

A
  • Identify the application that sends and receives data and the host the application runs on
    • Multiple applications running on the same machine
  • End-points are programmatically represented by sockets (#include )
  • Create the end-points
  • Connect the end-points
  • Listen and accept connections on end-points
  • Transmit messages via sending and receiving
  • Diligently handle errors!
22
Q

Sockets are file descriptors

A
  • Socket is a programming abstraction for communicating among processes (applications) based on (Unix) file descriptors
  • A file descriptor is an integer representing an open file managed by the OS
    • In Unix any I/O is done by reading/writing from/to file descriptors
    • For sockets, also called socket descriptor
23
Q

Socket types

A
  • Internetsockets…
  • Types of Sockets
    • SOCK_STREAM
      • TCP based
      • Ordering guaranteed
      • Error-free
    • SOCK_DGRAM
      • UDP based
  • IPv4 & IPv6
24
Q

SOCK_STREAM Sockets

A
  • Are reliable, two-way connected communication streams
    • Output two items into the socket in the order“1, 2”, they arrive in the order “1, 2” at the opposite end (“… if they arrive at all” )
    • Transmission is error-free (i.e., messages are not corrupted)
25
Q

Stream sockets in practice

A
  • Telnet uses stream sockets
  • Web browsers & HTTP use stream sockets to fetch pages
  • Stream sockets are based on the Transmission Control Protocol (TCP)
  • TCP ensures that data arrives sequentially and error-free (given no failures)
  • When is this kind of reliability not required?
    • What kind of reliability for live video streaming?
    • What kind of socket for e-mail?
    • For calling your darling over the internet?
26
Q

Two end-points determine a connection

A
  • End-point is determined by
    • IP address (host address); e.g., 192.168.100.100
    • Port number, e.g., 8888
27
Q

“Error binding socket”

A
  • Port is used by another process
    • ps aux | grep server
  • Kill it, if it is your own
    • Still an error? Wait a few seconds till the OS cleans it
  • Use a different port number, if it is someone else’s who might be logged in to the machine via ssh
28
Q

Byte Order

A
  • The order bytes are represented by a computer architecture in memory, on the wire, …
  • E.g., 0x A3F1 as two bytes // 0x HEX number
    • Stored as A3 F1 // Big-Endian (“Big end first”)
      • Motorola 6800, 68k, PowerPC (Intel), …
      • Network byte order
    • Stored as F1 A3 // Little-Endian (“Little end first”)
      • Intel or Intel-compatible processors
      • x86, 6502, Z80, VAX, PDP-11
29
Q

Setting up & using sockets !!

A
30
Q

Java NIO

A
  • Nonblocking sockets introduced with Java 1.4
  • JDK7 comes with NIO.2 API
    • Asynchronous I/O on network and files
    • Multicasting using DatagramChannel
  • Needs operating system support
    • Linux:epoll
    • FreeBSD/MacOS-X:kqueue
    • Windows/Solaris: IOCP
  • Requires different kind of application architecture
    • Keywords: Reactive Programming, Event Loops
    • More about that in the Application Servers Lecture
31
Q

Asynchronous vs. Synchronous

A
  • Syncronous
    • A thread enters into action and waits until I/O is completed
    • Limited in scalability, one thread per I/O connection
      • Overhead, context switching
  • Asyncronous
    • Passes the request immediatly to the kernel and continous with other tasks
32
Q

Synchronous I/O

A
33
Q

Asyncronous I/O

A
34
Q

The “Latency is Zero” fallacy

A
  • In the context of remote calls a fatal misconception
  • Latency is the time it takes to move data from client to storage server vs amount of data transferred (bandwidth)
  • Typical WAN round trip times are 30ms+
  • Transfer as much data with as few calls as possible vs. many fine grained calls