KyoMel / Yogyakarta, Indonesia

Term 078078 / 344

Delta Encoding

Month
October 2025
Day
1
Source
2025/october-term.md

Definition:

Delta Encoding is a data compression technique that stores only the differences (deltas) between consecutive values instead of storing the absolute values. This is highly effective when data changes gradually or has patterns, as differences are typically smaller numbers that require less storage space.

Key Properties:

  • Space efficient: Differences are usually smaller than original values
  • Pattern exploitation: Works best with sequential or time-series data
  • Simple concept: Store first value + sequence of changes
  • Reversible: Can reconstruct original data perfectly

How It Works:

  • Store the first value as-is (base value)
  • For each subsequent value, store the difference from the previous value
  • To decode: start with base value and apply deltas sequentially

Example:

Stock Prices

Original prices: [$100.50, $100.75, $100.60, $101.10, $100.90]
Delta encoded:   [$100.50, +$0.25, -$0.15, +$0.50, -$0.20]

Benefits:
- Smaller numbers to store/transmit
- Easier to spot trends (mostly small changes)
- Better compression when combined with other techniques

Chubby

Definition:

Chubby is a distributed lock service developed by Google that provides coarse-grained locking and reliable small-file storage for loosely-coupled distributed systems. It’s designed to help coordinate activities across thousands of machines in a cluster, primarily for leader election, configuration storage, and naming services.

Key Properties:

  • Coarse-grained locking: Held for hours/days, not seconds
  • High availability: Designed for 99.95% uptime
  • Small file storage: Acts like a simple file system for config data
  • Advisory locks: Applications cooperate voluntarily
  • Paxos-based: Uses Paxos consensus algorithm for consistency

Architecture:

  • Chubby cell: Typically 5 replicas (servers)
  • Master replica: One elected leader handles all requests
  • Client library: Applications use simple API
  • Lock delay: Prevents split-brain scenarios

Example:

Web service with multiple servers needs to elect a leader for background tasks

Initial state:
┌─────────────────────────────────┐
│         Chubby Cell             │
│  [Replica1] [Replica2*]         │  * = Master
│  [Replica3] [Replica4]          │
│  [Replica5]                     │
└─────────────────────────────────┘

Application Servers:
[WebServer1] [WebServer2] [WebServer3]

Keep reading