Docsity

Core Challenges in Distributed Systems Design: Concurrency, Latency, and Partial Failure, Summaries of Compiler Construction

Partial preview of the text

Download Core Challenges in Distributed Systems Design: Concurrency, Latency, and Partial Failure and more Summaries Compiler Construction in PDF only on Docsity!

DISTRIBUTED SYSTEMS

Introduction: Part 2

(Distributed Sys. Core Challenges)

Core challenges in distributed systems design

  1. Concurrency
  2. Latency
  3. Partial Failure

Concurrenc y

  • (^) Lots of requests may occur at the same time
  • (^) Need to deal with concurrent requests
    • (^) Need to ensure consistency of all data
    • (^) Understand critical sections & mutual exclusion
    • (^) Beware: mutual exclusion (locking) can affect performance
  • (^) We often replicate data (or cache it) – need to update all replicas
    • (^) Replication adds complexity
    • (^) All operations must appear to occur in the same order on all replicas
      • (^) Need to worry about out-of-order messages, undelivered messages, dead replicas

Latenc

y

Latency & asynchronous networks

  • (^) Asynchronous networks can be a pain
  • (^) Messages may take an unpredictable amount of time
    • (^) We may think a message is lost but it’s really delayed
    • (^) May lead to retransmissions → duplicate messages
    • (^) May lead us to assume a service is dead when it isn’t
    • (^) May mess with our perception of time
    • (^) May cause messages to arrive in a different order … or a different order on different systems

Latency

  • (^) Speed up data access via caching – temporary copies of data
  • (^) Keep data close to where it’s processed to maximize efficiency
    • (^) Memory vs. disk
    • (^) Local disk vs. remote server
    • (^) Remote memory vs. remote disk
    • (^) Cache coherence : cached data can become stale
      • (^) The main version may change → cached data will need to be invalidated or updated
        • (^) Need mechanism for systems to detect that the cached copies are no longer valid
      • (^) System using the cache may change the data → needs to propagate results
        • (^) Write-through cache
        • (^) But updates take time ⇒ meanwhile, access to data leads to inconsistencies ( incoherent views )

You know you have a distributed

system when the crash of a

computer you’ve never heard of

stops you from getting any work

done.

— Leslie

Lamport

Handling failure Failure is a fact of life in distributed systems! In local systems, failure is usually total ( all-or-nothing ) In distributed systems, we get partial failure

  • (^) A component can fail while others continue to work
  • (^) Failure of a network link is indistinguishable from a remote server failure
  • (^) Send a request but don't get a response ⇒ what happened? No global state
  • (^) There is no global state that can be examined to determine errors
  • (^) There is no agent that can determine which components failed and inform everyone else

Increasing availability through redundancy

Redundancy = replicated components

Service can run even if some systems die Reminder:

P (A and B) = P (A) × P (B)

If P (any one system down) = 5% P (two systems down at the same time) = 5% × 5% = 0.25%

Uptime = 1 – downtime = 1 – 0.0025 = 99.75%

We get 99.7% uptime instead of 95% because we need both replicated components to fail instead of just one.

High availability 14

No redundancy = dependence on all components

If we need all systems running to provide a service P (any system down) = 1 - P ( A is up AND B is up ) = 1 - (1-5%) × (1-5%) = 1 - 0.95 × 0.95 = 9.75% ⇒ 39x greater than a single component failure with redundancy!

Uptime = 1 – downtime = 1 – 0.0975 = 90.25%

With a large # of systems, P (any system down) approaches 100%! Requiring a lot of components to be up & running is a losing proposition. With large enough systems, something is always breaking!

System Failure Types

  • (^) Fail-stop
    • (^) Failed component stops functioning
    • (^) Halting = stop without notice
    • (^) Detect failed components via timeouts
      • (^) But you can’t count on timeouts in asynchronous networks
        • And what if the network isn’t reliable?
      • (^) Sometimes we guess
  • (^) Fail-restart
    • (^) Component stops but then restarts
    • (^) Danger: possible stale state — the system didn't get updates when it was dead

Network Failure Types

  • (^) Omission
    • (^) Failure to send or receive messages
      • (^) Due to queue overflow in router, corrupted data, receive buffer overflow
  • (^) Timing
    • (^) Messages take longer than expected
      • (^) We may assume a system is dead when it isn't
      • (^) Unsynchronized clocks can alter process coordination
  • (^) Partition
    • (^) Network breaks into two or more sub-networks that cannot communicate with each other

Redundancy requires synchronized state The state of redundant components has to be kept synchronized with the latest version

State, replicas, and caches

  • (^) State
    • (^) Information about some component that cannot be reconstructed
    • (^) Network connection info, process memory, list of clients with open

files, lists of which clients finished their tasks

  • (^) Replicas
    • (^) Redundant copies of data → used to address fault tolerance
  • (^) Cache
    • (^) Local storage of frequently-accessed data to reduce latency

→ used to address latency