Mesos & Omega - Cluster Resource Management
Mesos & Omega - Cluster Resource Management Cheat Sheet
🎯 The Problem: Managing Data Center Resources
Data Center Reality
Modern data centers:
- Built from commodity hardware (standard, off-the-shelf servers)
- Run diverse applications with different needs
- Must share resources efficiently
Analogy: Commodity hardware is like IKEA furniture - standardized, mass-produced, affordable components you can assemble at scale, versus custom-made furniture (specialized servers) that's expensive and hard to replace.
The Challenge
Single framework approach is inefficient:
- ❌ One framework can't efficiently manage all workload types
- ❌ Different applications have different needs
- ❌ Hard to optimize for all use cases simultaneously
The Goal:
- ✅ Run multiple frameworks in a single cluster
- ✅ Maximize utilization - keep resources busy
- ✅ Share data between frameworks - avoid duplication
Analogy: A kitchen (cluster) with multiple chefs (frameworks). Having one chef cook everything is inefficient - a pastry chef wastes time cooking steaks, and a grill master struggles with delicate desserts. Better to let specialists work in the same kitchen, sharing equipment!
🔧 Common Solutions for Cluster Sharing
1. Static Partitioning (Coarse-Grained Sharing)
Approach:
┌──────────────┬──────────────┬──────────────┐
│ Framework 1 │ Framework 2 │ Framework 3 │
│ (Machines │ (Machines │ (Machines │
│ 1-10) │ 11-20) │ 21-30) │
└──────────────┴──────────────┴──────────────┘
Shared Storage (HDFS)
Characteristics:
- Fixed allocation per framework
- No dynamic reallocation
- Rigid boundaries
Disadvantages ❌
-
Low utilization
- Resources allocated but not always used
- No dynamic reallocation
-
Rigid partitioning
- Doesn't match real-time changing demands
- Cannot adapt to workload variations
- Over-provisioning in some, under-provisioning in others
-
Mismatch in granularity
- Static allocation doesn't match framework needs
- Applications need flexible, fine-grained allocation
Real-world Example: Early Hadoop deployments: 30% to production, 40% to analytics, 30% to development. This led to wasted resources when partitions were idle.
🚀 Mesos: Fine-Grained Resource Sharing
Overview
Definition: Apache Mesos is an open-source cluster manager that efficiently manages distributed computing resources across multiple machines.
Key Capability:
- Abstracts CPU, memory, storage, other resources
- Treats cluster as single large resource pool
- Enables fine-grained task-level sharing
Analogy: Mesos is like a hotel concierge managing all rooms (resources). When guests (applications) arrive, the concierge assigns rooms based on availability and needs, rather than each guest finding their own room.
Production Usage:
- Twitter: Services, analytics, ML workloads
- Airbnb: Data infrastructure (Spark, Presto, Chronos)
- Apple: Siri backend services on Mesos
🎯 Mesos Goals & Challenges
Core Goals
| Goal | Description | Benefit |
|---|---|---|
| High Utilization | Maximize resource usage | Minimize idle capacity |
| Support Diverse Frameworks | Different scheduling needs | Reduce cost & time |
| Scalability | 1000s of nodes, 100s of jobs | Handle millions of tasks |
| Reliability | Fault-tolerant & highly available | Critical applications depend on it |
Key Definitions
Fault Tolerance
Definition: Even with partial failures, system continues operating with available resources.
Examples:
- HDFS/GFS replication
- Graceful degradation
- Continue with reduced capacity
Analogy: Having spare tires in a truck - if one tire fails, you can still operate.
High Availability (HA)
Definition: Failover architecture ensures service continuity.
Components:
Active Machine ←→ Backup Machine
↓
Load Balancer
↓
Automatic Failover
Features:
- Active-passive setup
- Automatic failover on primary failure
- Load balancing
Analogy: Having a backup driver ready to immediately take over if the main driver can't continue.
Real-world Examples:
- Amazon RDS: 60-120 second failover
- SQL Server Always On Availability Groups
Failover Cluster Architecture
┌─────────┐ ┌─────────┐
│ Node 1 │ │ Node 2 │
│(Active) │◄────────►│(Standby)│
└────┬────┘ └────┬────┘
│ │
└────────┬───────────┘
│
┌──────▼──────┐
│ Cluster │
│ Storage │
└─────────────┘
│
┌──────▼──────┐
│ Clients │
└─────────────┘
Benefits:
- High availability - reduces unplanned downtime
- High scalability - assign multiple nodes to cluster
- Automatic failover - workload transfers on failure
Operation:
- All nodes aware of shared resources
- Clustering service monitors health
- Automatic workload transfer on failure
🏗️ Mesos Design Elements
1. Fine-Grained Sharing
Concept: Allocation at the level of tasks within a job, not entire machines.
Comparison:
COARSE-GRAINED (Static Partitioning):
┌──────────┬──────────┬──────────┐
│ FW1 │ FW2 │ FW3 │
│ ████ │ ████ │ ████ │
│ ████ │ │ │
└──────────┴──────────┴──────────┘
Wasted Wasted Wasted
FINE-GRAINED (Mesos):
┌──────────┬──────────┬──────────┐
│FW1 FW2 │FW1 FW3 │FW2 FW3 │
│ ██ ██ │ ██ ██ │ ██ ██ │
│ ██ │ ██ │ ██ ██ │
└──────────┴──────────┴──────────┘
Efficient Efficient Efficient
Benefits:
- ✅ Improved utilization (20-30% → 60-80%)
- ✅ Reduced latency (faster scheduling)
- ✅ Better data locality (tasks near data)
Analogy:
- Coarse-grained: Giving each person entire parking lot (wasteful)
- Fine-grained: Parking garage where anyone takes available spot (efficient)
Impact: Can potentially double effective capacity of hardware!
2. Resource Offers
Concept:
- Mesos offers available resources to frameworks
- Frameworks choose which resources to use
- Decentralized decision-making
Advantages:
- ✅ Keeps Mesos simple
- ✅ Expandable to future frameworks
- ✅ Frameworks know their constraints best
- ✅ No need for Mesos to understand every framework
Disadvantages:
- ❌ Decentralized solutions not globally optimal
- ❌ Potential for suboptimal allocation
Resource Offer Process
1. Mesos offers resources
↓
"Framework A, slave1 has 4 CPUs and 4GB available"
2. Framework evaluates offer
↓
Checks if resources match requirements
Considers data locality, constraints
3. Framework responds
↓
ACCEPT and launch tasks
OR
REJECT and wait for better offer
4. Mesos allocates resources
↓
Updates cluster state
Instructs slave to launch tasks
Analogy: Resource offers are like a buffet - the restaurant (Mesos) presents dishes (resources), diners (frameworks) choose what they want. Restaurant doesn't need to know each diner's preferences!
🏛️ Mesos Architecture
Components
┌─────────────────────────────────────────┐
│ Hadoop MPI │
│ Scheduler Scheduler │
│ │ │ │
│ └────┬────┘ │
│ │ │
│ ┌───────▼───────┐ │
│ │ Mesos Master │ │
│ │ (with ZK) │ │
│ └───────┬───────┘ │
│ │ │
│ ┌────────────┼────────────┐ │
│ │ │ │ │
│┌───▼────┐ ┌───▼────┐ ┌───▼────┐ │
││Slave 1 │ │Slave 2 │ │Slave 3 │ │
││Executor│ │Executor│ │Executor│ │
││ ││ │ │ ││ │ │ ││ │ │
││Task Task│ │Task Task│ │Task Task│ │
│└────────┘ └────────┘ └────────┘ │
└─────────────────────────────────────────┘
Component Roles
| Component | Role | Responsibilities |
|---|---|---|
| Mesos Master | Coordinator | Resource offers, allocation policy |
| Standby Masters | HA backup | ZooKeeper leader election |
| Mesos Slave | Resource agent | Report resources, launch tasks |
| Framework Scheduler | App-specific logic | Receive offers, decide tasks |
| Executor | Task runner | Launch & monitor tasks |
Key Interactions
1. ZooKeeper → Leader Election & Service Discovery
↓
Ensures single active master
Maintains cluster configuration
2. Slaves → Master: Resource Availability
↓
Periodic heartbeats
Report: CPU, memory, disk, ports
3. Master → Frameworks: Resource Offers
↓
Based on allocation policy (DRF, priorities)
Can offer to multiple frameworks
4. Scheduler → Master: Task Responses
↓
Task ID, resource requirements, command
Can reject offers
5. Master → Slaves: Task Launch
↓
Instructs slave to launch via executor
Updates cluster state
Mesos Definition
"A thin resource sharing layer that enables fine-grained sharing across diverse cluster computing frameworks, by giving frameworks a common interface for accessing cluster resources."
Key Principle:
"While the Mesos master determines HOW MANY resources to offer to each framework, the frameworks' schedulers select WHICH of the offered resources to use."
- Mesos master: Resource allocation policy (fairness, priorities)
- Framework scheduler: Resource selection strategy (constraints, locality)
Analogy: Master is like a restaurant maître d' who decides serving order and shows customers to tables. Customers decide whether they want that specific table or prefer to wait.
💡 Mesos Resource Offer Example
Step-by-Step Flow
Initial State:
Slave 1: [4 CPU, 4 GB RAM] available
Step 1: Slave Reports
┌──────────────┐
│ Slave 1 │
│ 4 CPU, 4 GB │ ────► Mesos Master
└──────────────┘
Step 2: Master Offers
Mesos Master ────► Framework 1
"Slave 1: 4 CPU, 4 GB available"
Step 3: Framework Responds
Framework 1 ────► Mesos Master
Task 1: 2 CPU, 1 GB
Task 2: 1 CPU, 2 GB
Step 4: Master Instructs Slave
Mesos Master ────► Slave 1
Launch Task 1: 2 CPU, 1 GB
Launch Task 2: 1 CPU, 2 GB
Result:
Slave 1: [1 CPU, 1 GB] remaining
[3 CPU, 3 GB] allocated
Rejection and Filters
Problem:
- Frameworks can reject offers that don't meet constraints
- Framework might wait long time for suitable offer
- Mesos sends unsuitable offers repeatedly
- Time consuming for both
Solution: Filters
Frameworks set filters to specify what they'll reject:
Example Filters:
# Only nodes from specific list
filter = "Only offer nodes from list L"
→ Geographic constraints
→ Hardware requirements
# Minimum resource requirements
filter = "Only offer nodes with ≥8GB RAM"
→ Skip nodes that don't meet minimumBenefits:
- ✅ Reduces master overhead
- ✅ Reduces network traffic
- ✅ Frameworks get relevant offers faster
- ✅ Quick evaluation by master
Analogy: Like telling a real estate agent "don't show me houses under $500k or outside downtown" - saves everyone time by avoiding unsuitable options upfront!
⚙️ Mesos Resource Allocation
Allocation Policies
1. Fair Sharing (DRF)
Dominant Resource Fairness (DRF):
Where:
- = dominant resource share of framework
- = total resources of that type
Concept:
- Equalizes each framework's share of their dominant resource
- Some frameworks CPU-bound, others memory-bound
- Fair across multiple resource types
2. Strict Priorities
Hierarchy:
Production Jobs (Priority 10) ← Highest
↓
Development Jobs (Priority 5)
↓
Testing Jobs (Priority 1) ← Lowest
- Higher priority frameworks get offers first
- Ensures critical workloads get resources
3. Revocation (Task Killing)
When: Greedy framework uses lots of resources for long time
Process:
- Framework gets "greedy period" initially
- After threshold, Mesos can kill tasks
- Prevents indefinite resource hoarding
- Framework can checkpoint and resume
Real-world Example: Give ML training (batch) lower priority than web services (latency-sensitive). If cluster busy, training tasks preempted and restarted later.
Isolation
Implementation:
- Linux Containers (cgroups)
- Each task in isolated container
- Resource limits enforced by kernel
Isolation Guarantees:
| Resource | Isolation |
|---|---|
| CPU | CPU shares, quota enforcement |
| Memory | Hard limits, OOM killer |
| Disk I/O | Bandwidth limits |
| Network | Bandwidth (if configured) |
Modern Equivalent: Essentially Docker containers! Mesos was doing container-based isolation before Docker became popular.
📊 Mesos Performance
Resource Utilization Comparison
STATIC PARTITIONING:
Hadoop: [████░░░░░░] 0-33%
Pregel: [░░░░████░░] 0-33%
MPI: [░░░░░░████] 0-33%
────────────────────────────
Average: ~33%
→ 67% wasted!
MESOS (Dynamic Sharing):
Combined: [████████░░] 50-100%
────────────────────────────
Average: ~90%
→ Much better!
Key Insight:
- Static: ~33% utilization (1/3 of cluster)
- Mesos: ~90% utilization
Cost Impact: Static partitioning needs 3× the hardware to handle same workload! For 1000-node cluster, that's 2000 extra servers!
Experimental Evaluation
Setup:
- Platform: Amazon EC2
- Cluster: 92 Mesos nodes
- Mix of frameworks:
- Hadoop (small + large jobs, Facebook workload)
- Hadoop (large batch jobs)
- Spark (ML jobs, iterative)
- Torque (MPI jobs, tightly-coupled HPC)
Results:
| Metric | Static Partitioning | Mesos |
|---|---|---|
| Avg Utilization | 22% | 60% |
| Job Completion | Baseline | 2.7× faster |
| Framework Starvation | Possible | None observed |
Key Findings:
- ✅ Better utilization without sacrificing performance
- ✅ Jobs complete faster due to elastic scaling
- ✅ No framework starvation - fair sharing works
Business Impact: 2.7× faster completion means analytics results sooner, ML models train faster, more workloads on same hardware!
🌟 Omega: Google's Scheduler
Motivation
Google's Scale:
- Multiple data centers worldwide
- 10,000+ machines per cluster
- Diverse workloads (batch, serving, ML, infrastructure)
- Growing arrival rates (1000s of jobs/minute)
Need: Scalable scheduler to handle massive scale
Real-world: Google processes exabytes of data monthly. Traditional monolithic schedulers become bottlenecks at this scale.
What is Omega?
Definition: Cluster scheduling architecture developed by Google to improve scalability, efficiency, and flexibility in multi-framework environments.
Core Innovation:
- Parallel scheduling with shared state
- Optimistic concurrency control for conflicts
- Independent schedulers for each framework type
Positioning:
- Alternative to monolithic schedulers (Hadoop YARN)
- Alternative to two-level schedulers (Apache Mesos)
- Introduces shared-state, optimistic concurrency
Analogy: Instead of one traffic controller (monolithic) or two-tier system (Mesos), Omega is like multiple air traffic controllers working simultaneously with shared view of all planes, each handling their own airline's flights.
🎯 The Scheduling Problem
Basic Problem
Input: Jobs with Tasks
↓
┌────────────┐
│ Job 1 │
│ Task1,2,3 │
└────────────┘
↓
Resources: 10,000+ Machines
↓
Goal: Efficient Assignment
Constraints:
- Resource requirements (CPU, RAM, disk)
- Data locality preferences
- Anti-affinity rules
- Priority levels
- SLAs and deadlines
Analogy: Tetris at scale - differently shaped pieces (tasks with different needs) falling continuously, fit them efficiently onto playing field (cluster) without gaps or overflows.
The Context
Three Key Challenges:
1. DIVERSE WORKLOADS
○ □ ⬡ △ ← Different shapes/types
2. INCREASING CLUSTER SIZES
Small cluster → LARGE CLUSTER
(10s nodes) (10,000+ nodes)
3. GROWING JOB ARRIVAL RATES
│
│ ╱
│ ╱
│ ╱
└──────────→ Time
1000s jobs/minute
Impact: Even 1ms improvement in scheduling latency = 1000 more jobs/second across fleet!
Why Is This Important?
The Bottleneck:
Arriving Jobs: Scheduler: Cluster:
1000s/minute → 60+ seconds → 10,000s machines
↓ (BOTTLENECK) ↓
Waiting... Serialized logic Idle waiting
Problems with Slow Scheduling:
- Resource underutilization
- Machines idle while waiting
- Wasted capacity
- Increased latency
- Jobs wait in queue
- User experience degraded
- Scalability limits
- Scheduler becomes bottleneck
- Cannot grow cluster further
Cost Impact: 60-second delay on 10,000-node cluster = ~167 machine-hours wasted per cycle. At 16.70 lost every minute!**
The Actual Problem: Complexity
Complexity Factors:
┌─────────────────────────────────┐
│ SCHEDULING COMPLEXITY │
│ │
│ • Multiple workload types │
│ ● ● ● ● (different needs) │
│ │
│ • Complex placement constraints│
│ Affinity, anti-affinity │
│ │
│ • Multiple objectives │
│ Fairness, utilization, │
│ latency, throughput │
│ │
│ • Scale challenges │
│ 10,000+ machines │
│ 100,000+ tasks │
│ Sub-second decisions │
└─────────────────────────────────┘
Analogy: Restaurant manager seating thousands of guests/hour, each with dietary restrictions, seating preferences, group sizes, VIP status - while maximizing table utilization and minimizing wait times!
🔄 Scheduler Architecture Comparison
Three Approaches
┌─────────────────────────────────────────┐
│ 1. MONOLITHIC │
│ ┌─────────────┐ │
│ │ Scheduler │ │
│ └──────┬──────┘ │
│ │ │
│ ┌──────┴──────┐ │
│ │ Machines │ │
│ └─────────────┘ │
│ │
│ ✗ Hard to diversify │
│ ✗ Code growth │
│ ✗ Scalability bottleneck │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ 2. STATIC PARTITIONING │
│ ┌────┐ ┌────┐ ┌────┐ │
│ │ S0 │ │ S1 │ │ S2 │ │
│ └─┬──┘ └─┬──┘ └─┬──┘ │
│ │ │ │ │
│ ┌─▼─┐ ┌─▼─┐ ┌─▼─┐ │
│ │P0 │ │P1 │ │P2 │ │
│ └───┘ └───┘ └───┘ │
│ │
│ ✗ Poor utilization │
│ ✗ Inflexible │
└─────────────────────────────────────────┘
┌─────────────────────────────────────────┐
│ 3. TWO-LEVEL (MESOS) │
│ ┌────┐ ┌────┐ ┌────┐ │
│ │ S0 │ │ S1 │ │ S2 │ │
│ └─┬──┘ └─┬──┘ └─┬──┘ │
│ └──────┬┴──────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Resource Manager│ │
│ └────────┬────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Machines │ │
│ └─────────────────┘ │
│ │
│ ✗ Resource hoarding │
│ ✗ Information hiding │
│ ✗ Offer serialization │
└─────────────────────────────────────────┘
Mesos Limitations (Revisited)
Disadvantages:
1. Pessimistic Concurrency Control
Mesos offers resource to ONE framework at a time
↓
Framework holds "lock" during decision
↓
Other frameworks WAIT
↓
SLOW for complex scheduling logic
- Serialized offers
- Framework locks resources
- Blocks other frameworks
2. Limited Information
Framework sees:
✓ Offered resources
✗ Entire cluster state
✗ Other frameworks' plans
✗ Future availability
Cannot support:
- ❌ Preemption (don't see what to preempt)
- ❌ Gang scheduling (can't verify entire gang fits)
- ❌ Global optimization
When Mesos Works Well vs. Struggles
Works Well:
- ✅ Short-lived tasks
- ✅ Small jobs (vs cluster size)
- ✅ Simple placement constraints
- ✅ Frequent resource relinquishment
Struggles With:
- ❌ Long-running services
- ❌ Gang scheduling (all-or-nothing)
- ❌ Complex global optimization
- ❌ Google's workload characteristics
Example: Try scheduling 1000-task MapReduce job needing all tasks on same rack (gang scheduling). Framework must collect enough simultaneous offers for entire job - could take many offer/reject cycles!
🎨 Omega Solution: Shared-State Scheduling
Architecture
┌─────────────────────────────────────────┐
│ S₀ S₁ S₂ │
│ (Batch) (Service) (ML) │
│ │ │ │ │
│ ├─────────┼─────────┤ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌─────────────────────────┐ │
│ │ Cluster State │ │
│ │ (Shared, Consistent) │ │
│ └───────────┬─────────────┘ │
│ │ │
│ ┌───────▼───────┐ │
│ │ Machines │ │
│ └───────────────┘ │
└─────────────────────────────────────────┘
Components:
- : Independent schedulers
- Each has private local copy
- Makes decisions independently
- Operates in parallel
- Cluster State: Central shared state
- Single source of truth
- Consistent data store
- Optimistic concurrency control
Key Principles
- No centralized scheduler
- Each framework maintains own scheduler
- Schedulers operate in parallel
- Shared state visibility
- Each scheduler has full view of cluster
- Can see all resources and allocations
- Makes informed decisions
- Optimistic concurrency
- Multiple schedulers decide simultaneously
- Conflicts detected at commit time
- Losers retry with updated state
Analogy: Like Google Docs collaborative editing - multiple people (schedulers) edit same document (cluster state) simultaneously. When you save, if someone else changed same paragraph, you get notified and must merge or retry.
📝 Omega Scheduling Example
Step 1: Initial State
Cluster State:
┌───┬───┬───┬───┬───┬───┬───┐
│ │ │ │ │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ │ │ │ R │
├───┼───┼───┼───┼───┼───┼───┤
│ │ │ │ B │ │ │ │
├───┼───┼───┼───┼───┼───┼───┤
│ G │ │ │ │ │ │ │
└───┴───┴───┴───┴───┴───┴───┘
Schedulers:
S₀ (Red): Needs 2 tasks
S₁ (Blue): Needs 2 tasks
Both have current snapshot
Step 2: Parallel Scheduling
S₀ Decision (Red): S₁ Decision (Blue):
Analyzes cluster Analyzes cluster
Chooses cells: Chooses cells:
(3,4), (3,5) (3,5), (3,6)
(2,4), (2,5) (3,7)
↓ ↓
Prepares Prepares
transaction transaction
⚠️ BOTH want cell (3,5)! ⚠️
SIMULTANEOUS work - no coordination!
Step 3: Transaction Commit
Both try to commit:
S₀ Transaction: S₁ Transaction:
Place red tasks at: Place blue tasks at:
(3,4), (3,5) (3,5), (3,6), (3,7)
(2,4), (2,5)
↓ ↓
┌────────────────────────────────┐
│ Cluster State Arbiter │
│ (Optimistic Concurrency) │
└────────────────────────────────┘
↓ ↓
CONFLICT! Same cell (3,5)
↓ ↓
Only ONE succeeds
Step 4: Resolution
RESULT:
S₁ Transaction: ✓ SUCCESS
Blue tasks placed: (3,5), (3,6), (3,7)
Cluster state updated
S₀ Transaction: ✗ FAILURE
Red tasks NOT placed
Must retry
Next Steps for S₀:
1. Resync local copy from shared state
2. See S₁'s new allocations
3. Reschedule avoiding (3,5)
4. Choose different cells: (3,4), (2,4), (2,5)
5. Commit again
Formal Process
Omega Shared-State Scheduling Steps:
1. Framework scheduler makes decision
↓
Based on local cluster state copy
Applies scheduling algorithm
Selects resources for tasks
2. Updates shared state in atomic commit
↓
Transaction submitted
All-or-nothing semantics
Validates resources still available
3. At most ONE commit succeeds
↓
First successful commit wins
Concurrent conflicts rejected
Optimistic concurrency control
4. Rejected scheduler resyncs and retries
↓
Fetch latest cluster state
Re-run scheduling algorithm
Submit new transaction
Repeat until success
Transaction Success Condition
- If any resource changed since snapshot → commit fails
- Prevents double-booking
- Ensures consistency
Analogy: Buying concert tickets online - you see available seats, select some, but when you click "purchase," if someone else just bought one of your seats, your purchase fails and you must choose again with updated availability.
🔑 Omega Key Characteristics
1. Shared-State Scheduling
Architecture:
Each Scheduler:
┌──────────────────────┐
│ Local State Copy │
│ (Full Cluster View) │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ Central State │
│ (Source of Truth) │
└──────────────────────┘
Benefits:
- ✅ Full cluster visibility
- See all machines and state
- See all running tasks
- See all pending allocations
- ✅ Better decisions
- Complete information
- No information hiding (unlike Mesos)
- ✅ Support advanced features
- Preemption (can see what to preempt)
- Gang scheduling (verify entire gang fits)
Impact: With full visibility, batch scheduler can intelligently avoid nodes running latency-sensitive services - difficult with limited offers!
2. Optimistic Concurrency Control
Concept:
- Parallel scheduling by different frameworks
- Conflict detection and resolution
- Multiple schedulers modify simultaneously
Process:
1. READ cluster state (no locks)
↓
2. COMPUTE scheduling decision locally
↓
3. ATTEMPT COMMIT with version check
↓
4. IF CONFLICT → rollback and retry
↓
5. IF SUCCESS → update applied
Formula:
Comparison Table
| Approach | Concurrency | Conflicts | Throughput |
|---|---|---|---|
| Pessimistic (Locks) | Low | None | Low |
| Optimistic (Omega) | High | Some | High |
Why Optimistic Works:
- ✅ Low contention (big cluster, many resources)
- ✅ Cost of conflict < Cost of serialization
- ✅ Fast conflict recovery (just retry)
Analogy: Multiple chefs in large kitchen - mostly work independently, but if two reach for same ingredient, one backs off and grabs something else. Much faster than making all chefs wait in line for "permission to cook" token!
3. Multi-Tenant & Multi-Framework Support
Supports Multiple Workloads:
- Batch jobs: Spark, Hadoop, MapReduce
- Services: Kubernetes, Borg (Google internal)
- ML training: TensorFlow, PyTorch
- Infrastructure: Monitoring, logging
Architecture Benefits:
- Independent evolution
- Each team maintains scheduler
- Deploy updates independently
- No central bottleneck
- Specialized optimization
- Batch: Optimize throughput
- Service: Optimize availability
- ML: Optimize GPU placement
- Fair sharing
- All see same resources
- Allocation policies enforce fairness
- No scheduler starves
Real-world: At Google, different teams (Search, Ads, Gmail, YouTube) each run own Omega scheduler, all sharing same cluster but optimizing for specific needs.
🔄 Omega Scheduling Characteristics
1. Parallel Scheduler Operation
Time →
S₀: ████████████████████
S₁: ████████████████████
S₂: ████████████████████
All work SIMULTANEOUSLY!
No waiting for others
True parallelism
2 Incremental Transactions
Instead of:
❌ Schedule 1000 tasks in one transaction
↓
High conflict probability
All-or-nothing
Do:
✓ Schedule 10 tasks per transaction
↓
100 transactions total
↓
Lower conflict per transaction
If conflict, only lose 10 placements (not 1000)
Benefits:
- Reduces conflict probability
- Avoids starvation
- Progressive scheduling
3. Common Priority Scale
Priority Hierarchy:
Production (P=1000) ← Highest
↓
Batch (P=500)
↓
Test (P=100) ← Lowest
Conflict Resolution:
- Both want same resource
- Higher priority wins
- Lower priority reschedules
4. Performance Viability
Critical Factor:
"Performance determined by:
- Frequency of transaction failures
- Cost of failures"
Key Metrics:
- Conflict rate: % transactions that conflict
- Retry cost: Time to resync and reschedule
- Convergence: Retries until success
Research Findings:
"Optimistic concurrency over shared state is a VIABLE, ATTRACTIVE approach to cluster scheduling."
Why It Works:
- Low conflict rates (1-5% in production)
- Most tasks have flexible placement
- Many available resources
- Conflicts rare when not fully utilized
- Fast retries
- Resync is fast (read shared state)
- Re-scheduling often quick
- Exponential backoff prevents thrashing
- Better than alternatives
- Faster than serialized (monolithic)
- More flexible than static
- More informed than two-level (Mesos)
Validation: Google found 95-99% scheduling decisions succeed on first try. Performance gain from parallelism >> cost of occasional retries!
🆚 Comprehensive Comparison
Omega vs. Mesos vs. Kubernetes
| Feature | Omega | Mesos | Kubernetes |
|---|---|---|---|
| Scheduling Model | Shared-state, optimistic | Two-level | Centralized, declarative |
| Scalability | Very High (parallel) | High (multi-framework) | High (container-focused) |
| Workload Support | All types | All types | Primarily containers |
| Conflict Handling | Optimistic concurrency | Pessimistic offers | Lock-based allocation |
| Container Support | Yes (multiple runtimes) | Yes (Docker, Mesos) | Primarily Docker/CRI-O |
| Global View | Full cluster visibility | Limited (offers only) | Full cluster visibility |
| Decision Speed | Very fast (parallel) | Moderate (serial offers) | Moderate (centralized) |
| Preemption | Yes | Limited | Yes |
| Adoption | Google internal | Legacy deployments | Industry standard |
Scheduling Philosophy
Omega:
- "Give everyone full information"
- "Let them decide in parallel"
- "Trust but verify (optimistic)"
- Global optimization possible
Mesos:
- "Central authority offers resources"
- "Frameworks choose"
- "Conservative (pessimistic)"
- Local optimization by framework
Kubernetes:
- "Central scheduler with declarative state"
- "Reconciliation loops"
- "Constraint satisfaction"
- Active ecosystem
When to Use Each
Use Omega Approach When:
- Need maximum scheduling throughput
- Have diverse workload types
- Want team autonomy
- Can handle occasional conflicts
- (Note: Omega itself is Google-internal)
Use Mesos When:
- Need proven multi-framework support
- Want framework isolation
- Have batch + long-running services
- Don't need ultra-low latency
Use Kubernetes When:
- Primarily containerized workloads
- Want strong ecosystem and tooling
- Need production-ready platform today
- Container orchestration main focus
Industry Trend: Most organizations moved to Kubernetes for maturity, ecosystem, cloud-native focus. Mesos still used in specific legacy cases. Omega's ideas influence modern scheduler designs.
⚠️ Deadlock vs. Starvation (Recap)
Deadlock
Definition: All processes waiting for each other - none execute.
Process A: Holds R1, Needs R2
Process B: Holds R2, Needs R1
↓
DEADLOCK!
Neither can proceed
Characteristics:
- All processes blocked indefinitely
- No progress by anyone
- System stuck
- Circular dependency
Necessary Conditions (all must be true):
- Mutual Exclusion
- Hold and Wait
- No Preemption
- Circular Wait
Also known as: Circular wait
Starvation
Definition: High-priority processes keep executing, low-priority blocked indefinitely.
Priority 10 jobs: ████████████ Always running
Priority 5 jobs: ██░░██░░░░░░ Sometimes running
Priority 1 jobs: ░░░░░░░░░░░░ Never running (STARVED!)
Characteristics:
- High-priority processes execute
- Low-priority never get chance
- System functions but unfairly
- Resources continuously used by high-priority
Cause:
- Strict priority scheduling
- No aging or fairness mechanism
Also known as: Livelock
Comparison Table
| Aspect | Deadlock | Starvation |
|---|---|---|
| Problem | All processes stuck | Low-priority stuck |
| Resources | Locked by processes | Used by high-priority |
| System Progress | None | Some (unfair) |
| Conditions | Mutual Exclusion, Hold & Wait, No Preemption, Circular Wait | Priorities assigned |
| Alternative Name | Circular wait | Livelock |
Prevention in Schedulers
Deadlock Prevention:
Omega:
- No locks during scheduling
- All-or-nothing transactions
- Cannot create circular dependencies
Mesos:
- Resource offers are revocable
- Cannot hold indefinitely
Starvation Prevention:
Omega:
- Incremental transactions
- Forces gradual progress
- Cannot monopolize
Mesos:
- DRF ensures fairness
- Revocation of greedy tasks
Example: Without starvation prevention, production scheduler could monopolize all resources, preventing development teams from testing. DRF and priorities prevent this!
🎓 Key Takeaways
Mesos Contributions
- ✅ Fine-grained sharing - task-level allocation
- ✅ Resource offers - decentralized decisions
- ✅ Framework abstraction - diverse app support
- ✅ Production proven - Twitter, Airbnb, Apple
Omega Contributions
- ✅ Shared-state scheduling - full cluster visibility
- ✅ Optimistic concurrency - parallel decisions
- ✅ Independent schedulers - per-workload optimization
- ✅ Google-scale validated - largest deployments
Industry Evolution
2011: Mesos introduces two-level scheduling
↓
2013: Omega shows shared-state viability
↓
2014+: Kubernetes emerges
↓
Combines best ideas:
• Centralized but extensible (like Omega shared state)
• Declarative (like Omega eventual consistency)
• Practical and production-ready (like Mesos)
Modern Best Practices
Current Adoption:
- Kubernetes: Majority of cloud-native organizations
- Mesos: Some large legacy deployments
- Borg/Omega: Google-internal (not open source)
- Cloud platforms: AWS ECS, Azure Container Instances use similar concepts
Emerging Patterns:
- Multi-scheduler on Kubernetes (Volcano for batch)
- AI/ML-based scheduling predictions
- Multi-cluster federation
- Cost-aware scheduling
Real-world:
- Kubernetes adopted by majority
- Mesos still at scale (Twitter)
- Omega ideas influence new designs
📚 Study Guide
Key Concepts to Master
Mesos:
- Resource offers mechanism
- Two-level scheduling architecture
- DRF (Dominant Resource Fairness)
- Framework abstraction
- Fine-grained vs. coarse-grained sharing
Omega:
- Shared-state architecture
- Optimistic concurrency control
- Conflict resolution
- Parallel scheduling
- Transaction model
Comparison:
- Monolithic vs. Two-level vs. Shared-state
- Pessimistic vs. Optimistic concurrency
- Scalability tradeoffs
- Performance implications
Practice Questions
Q1: Why does static partitioning lead to poor utilization?
- Consider workload variability
- Think about resource fragmentation
- Analyze opportunity cost
Q2: How does Mesos' resource offer mechanism work?
- Flow: slave → master → framework
- Explain filter mechanism
- Discuss rejection handling
Q3: Advantages and disadvantages of resource offers vs. shared state?
- Compare information visibility
- Analyze decision speed
- Consider conflict rates
Q4: How does Omega handle scheduling conflicts?
- Describe transaction model
- Explain optimistic concurrency
- Discuss retry mechanisms
Q5: Why is optimistic concurrency viable for cluster scheduling?
- Consider cluster size vs. scheduling rate
- Think about conflict probability
- Analyze cost of conflicts vs. serialization
🔬 Required Reading
Papers
-
Mesos: A Platform for Fine-Grained Resource Sharing
- NSDI 2011
- Berkeley
- Sections: 1-3.5, 6-6.1.2
-
Omega: Flexible, Scalable Schedulers
- EuroSys 2013
- Sections: 1-3, 8
-
Video:
🏆 Summary
Core Innovations
Mesos:
- Decentralized resource allocation
- Framework flexibility
- Production-proven at scale
Omega:
- Parallel scheduling
- Global visibility
- Validated at Google scale
The Future
Trends:
- AI/ML scheduling predictions
- Serverless integration
- Edge computing distribution
- Multi-cluster federation
- Cost optimization
Final Thought: Understanding Mesos and Omega gives foundation to understand ANY modern cluster scheduler. Core concepts - resource abstraction, fair sharing, conflict resolution - appear everywhere from cloud platforms to edge computing.
Good luck on your exam, Google! 🚀