networks - modrpc/info GitHub Wiki

Table of Contents

네트웍 기초

Network protocols in OSI model

Transport Protocol: TCP/UDP

  • TCP: two virtual queue between sender/receiver
    • reliable: ACKs/retransmission
  • UDP:
    • not reliable: no ACKs/retransmission

Routing Protocol: IP

  • sending from one point to another
  • forwarding: packets are moved through intermiediate nodes
  • routing: it's about building forwarding table -- i.e. determines which next node to forward

Special Topics

Wireless Ad Hoc 네트워크

네트웍 프로그래밍

Asynchornous Network Programming

Patterns in Network Architecture

Levels of Abstraction

Model

Service

  • service: abstraction of the interface between layers that is system independent
    • service is independent of protocol
  • service definition: consists of two parts
    • a set of service primitives, which specify the operations to be performed on the service and a set of parameters that are used as arguments to the operations
    • a set of rules that determine the legal sequences in which the service primitives can be invoked

Protocol and Interface

  • protocol: rules and behavior required by any entity participating in the transfer of data
    • protocol specification defines sequences of message exchanges in the transfer of data
    • protocol specifies the minimal state machine that any implementation must conform to.

Implementation

Network Algorithmics

Basics

  • Endnodes: endpoints of the network
    • mostly for (general-purpose) computation
    • two sources of overhead comes from:
      • structure: layered SW structure for protection (e.g. kernel vs user space) -- overhead
      • scale: two many jobs to do (E.g. many web requests to server endnode)
  • Routers: mostly for network interconnection
    • two sources of overhead comes from:
      • scale:
        • bandwidth scaling: optical link gets faster
        • population scaling: more endpoints added (more target destinations)
      • services: new types/categories of network services (ebay, IOT, Amazon, netflix)

Endpoint Bottlenecks

Bottleneck Cause Solutions
Copying Protection, abstration layers Copying many data blocks without OS intervention (e.g. RDMA)
Context switching Complex scheduling User-level protocol implementation, Event-driven servers
System calls Protection, abstration layers Direct channels from applications to drivers (e.g. VIA)
Timers Scaling with number of timers Timing wheel
Demultiplexing Scaling with number of endpoints BPF and Pathfiner
Checksums/CRCs Generality, Scailing with link speeds Multibit computation
Protocol code Generality Header prediction

Router Bottlenecks

Bottleneck Cause Solutions
Exact lookups Link speed scaling Parallel hashing
Prefix lookups Link speed csaling, Prefix database size scaling Compressed multibit tries
Package classification Service differentiation, Link speed and size scaling Decision tree algorithnms, Hardware parallelisms (TCAMs)
Switching Optical-electronic speed gate, Head-of-line blocking Crossbar switches, Virtual output queues
Fair scheduling Service differentiation, Link speed scaling, Memory scaling Weighted fair queueing, Deficit round robin, DiffServ, Core Stateless
Internal bandwidth Scaling of internal bus speeds Reliable striping
Measurement Link speed scaling Juniper's DCU
Security Scaling in number and intensity of attacks Traceback with bloom filters, Extracting worm signatures

Wire Processing Requirements

  • e.g. bad packet detection must happen at the same rate as packet arrival

Timers

  • Why Timers?
    • (Periodic) Failure Detection
      • ping (autonomous) peers to see if it's live
      • detect lack of some action (message acknowledgement) within a specific period -- needed for retransmission for communication
    • Algorithm where time or relative time is integral
      • rate-based flow control: control the production rate of some entities
      • scheduling algorithms: round-robin scheduling over time quantum
  • Timer performance is critical if:
    • timers are implemented with interrupts in a processor and interrupt overhead is large
    • fine-grained timers (e.g. microsec or lower) are required
    • starting or stopping a timer incurs overhead
    • the number of timers are large
      • when there are 2000 live connections and each connection requires 3 timers, 6000 timers are needed
      • BSD TCP implementation: does not use timer per packet -- only use a few timers for the entire networking package
        • e.g. 200-msec timer and 500-msec timer

Timer Model

  • StartTimer(Interval, RequestId, ExpiryAction)
  • StopTimer(RequestId)
  • PerTickBookKeeping: let the granularity of the timer be T units. Then every T units this routine checks whether any outstanding timers have expired
  • ExpiryProcessing: does ExpiryAction specified in the start timer

Timer Schemes

Scheme 1

  • StartTimer: just put "time until expiry" in a memory location -- O(1)
  • PerTickBookKeeping: scan each timer memory location and decrement 'time until expiry" -- O(n)

Scheme 2

  • StartTimer: put "absolute expire time" in a priority queue (ordered according to time) -- O(lg n)
  • PerTickBookKeeping: check if head elements of queue are expired, if yes, process -- O(1)
    • optimization: Let timer wake up on "earliest expire time" -- no need to wake up regularly but depends on whether architecture allows this

Scheme 3 (Timing Wheel)

  • Need circular buffer of size N
  • StartTimer: put timer at "time util expriry" (j) + current time (i) mod N -- O(1)
  • PerTickBookKeeping: check current slot and process each timer in the linked list (if any) -- O(1)

References

Tools

Tor

⚠️ **GitHub.com Fallback** ⚠️