Understanding Distributed Systems Fundamentals

1. Understanding Distributed System Definition

PropertyDefinitionExample
Distributed SystemCollection of independent nodes appearing as single coherent systemKubernetes cluster, Cassandra, Kafka
NodeIndependent computing entity (process, VM, container)Pod, EC2 instance, broker
ClusterGroup of nodes coordinating to provide service3-node etcd cluster
CoordinationMechanisms for nodes to agree on shared stateConsensus, locks, leader election
Shared-NothingEach node has independent CPU/memory/diskCassandra, BigTable

2. Understanding Network Communication

AspectDetailImpact
Message PassingOnly way nodes interactNo shared memory across nodes
LatencyTime for round-trip; ~0.5ms LAN, 50-200ms WANBounds responsiveness
BandwidthThroughput limit per linkConstrains data volume
Packet Loss0.01-1% typical; higher under congestionRequires retries/ACKs
OrderingTCP per-connection only; UDP noneApp must enforce global order
ProtocolsTCP, UDP, QUIC, HTTP/2, HTTP/3, gRPCChoose by latency/reliability

3. Understanding Partial Failures

Failure TypeDescriptionDetection
Crash-StopNode halts permanentlyHeartbeat timeout
Crash-RecoveryNode halts, then resumes (possibly stale)Epoch/term numbers
OmissionMessages lost in transitSequence numbers, ACKs
Network PartitionSubset of nodes unreachableQuorum loss, gossip divergence
ByzantineArbitrary/malicious behaviorCryptographic verification
Gray FailureSlow but not down (degraded)Latency percentiles, anomaly detection
Warning: Cannot distinguish slow node from failed node from a remote vantage point — only timeouts approximate this.

4. Understanding Transparency Goals

TypeHides From UserExample
AccessLocal vs remote resource accessNFS, gRPC stubs
LocationPhysical placementDNS, service discovery
MigrationResource moving between nodesPod rescheduling
ReplicationMultiple copies existS3, DynamoDB
ConcurrencyOther users sharing resourceDB transactions
FailureComponent failures recovered transparentlyRAID, retries, failover
ScalingSystem growth/shrinkageAuto-scaling groups

5. Understanding Fallacies of Distributed Computing

#FallacyReality
1Network is reliablePackets drop, links fail
2Latency is zeroSpeed-of-light bounds; cross-continent ~150ms
3Bandwidth is infiniteCosts and physical limits
4Network is secureAssume hostile; use TLS, mTLS
5Topology doesn't changeNodes join/leave constantly
6One administratorMulti-team, multi-cloud
7Transport cost is zeroEgress/serialization expensive
8Network is homogeneousMixed protocols, MTUs, vendors

6. Understanding Scalability Types

TypeApproachLimit
Vertical (scale up)Bigger CPU/RAM/disk on one nodeHardware ceiling, cost ∝ size²
Horizontal (scale out)Add more nodesCoordination overhead
FunctionalSplit by service/featureService boundaries
Data (sharding)Partition data across nodesCross-shard queries
GeographicDistribute across regionsCross-region consistency

7. Understanding Latency vs Throughput Tradeoffs

MetricDefinitionOptimization
LatencyTime for single request (p50/p95/p99)Caching, fewer hops, faster paths
ThroughputRequests/second handledBatching, parallelism, async
Tail Latencyp99/p999 — outliersHedged requests, tied requests
Little's LawL = λW (concurrency = rate × latency)Bound queue depth
Note: Optimizing throughput (batching) often hurts latency; pick targets per workload.

8. Understanding Reliability vs Availability

MetricFormulaTarget
AvailabilityUptime / (Uptime + Downtime)99.9% = 8.76h/yr down
99.99% (4 nines)52.6 min/yr
99.999% (5 nines)5.26 min/yr
MTBFMean Time Between FailuresHigher = more reliable
MTTRMean Time To RecoverLower = better availability
ReliabilityP(no failure in time T)Function of MTBF

9. Understanding Distributed System Challenges

ChallengeCauseMitigation
Partial FailureSome nodes down, others upReplication, retries, circuit breakers
Network PartitionsSplit connectivityQuorum, partition-tolerant protocols
Clock SkewNo global timeLogical clocks, HLC, NTP
ConcurrencySimultaneous updatesLocks, MVCC, CRDTs
OrderingMessages arrive out-of-orderSequence numbers, vector clocks
ConsensusAgreement under failurePaxos, Raft
DebuggabilityState spread across nodesTracing, structured logs

10. Understanding When to Use Distributed Systems

Use WhenAvoid When
Single node cannot meet load/storageSingle node suffices
HA > 99.9% requiredBest-effort SLA acceptable
Geographic locality neededSingle region OK
Independent team/service deploysMonolith team
Fault isolation between componentsCoupled lifecycles fine
Warning: Distributed systems multiply operational complexity 10×. Start with a monolith; distribute when forced by scale, availability, or org boundaries.