118  SDN APIs and High Availability

In 60 Seconds

SDN controllers expose northbound REST/gRPC APIs for applications and southbound OpenFlow APIs for switches. Controller clustering using Raft consensus achieves sub-second failover – a 3-node cluster tolerates 1 failure; 5-node tolerates 2. Auxiliary connections between switches and controllers provide redundancy, with role-based access (MASTER/SLAVE/EQUAL) determining which controller instance actively manages each switch.

118.1 Learning Objectives

By the end of this chapter, you will be able to:

  • Classify Controller APIs: Distinguish northbound (REST/gRPC) from southbound (OpenFlow) API interactions and map message types to their roles
  • Architect High Availability: Design controller clustering and failover strategies that meet specific uptime requirements for production IoT deployments
  • Evaluate State Synchronization: Compare Raft consensus, eventual consistency, and distributed transactions and select the appropriate consistency model
  • Plan Switch-Controller Redundancy: Configure auxiliary connections and role-based failover behavior for multi-controller deployments

118.2 Prerequisites

Before diving into this chapter, you should be familiar with:

Think of the SDN controller like a restaurant kitchen.

Northbound API = How waiters (applications) communicate with the kitchen - “Table 5 wants the salmon, no nuts” -> “Block IP 10.0.1.50 from the network” - High-level requests, no need to know cooking details

Southbound API = How the head chef (controller) directs line cooks (switches) - “Grill salmon at 400F for 8 minutes” -> “Install flow rule: match src=10.0.1.50, action=DROP” - Precise, technical instructions

Clustering = Having multiple kitchens ready to take over - If the main kitchen catches fire, the backup kitchen continues serving - Customers (network traffic) barely notice the switch - More kitchens = higher reliability, but also more coordination overhead

For IoT specifically:

  • 99.99% uptime requires clustering (only 52 minutes downtime/year)
  • Failover time of 3-5 seconds means brief traffic disruption during controller switchover
  • Most IoT deployments use 3-node clusters (survives 1 failure, manageable overhead)

Deep Dives:

Advanced Topics:

Architecture:

Common Misconception: “More Controllers = Better Performance”

The Myth: Adding more controllers to a cluster always improves network performance and scalability.

The Reality: Controller clustering is about high availability, not raw performance. More controllers can actually decrease performance due to coordination overhead.

Real-World Example:

A smart city deployment tested ONOS controller scaling with 10,000 IoT devices:

  • Single controller: 50,000 flow installations/second, 15ms latency
  • 3-node cluster: 45,000 flow installations/second, 18ms latency (10% slower)
  • 5-node cluster: 38,000 flow installations/second, 25ms latency (24% slower)

Why performance degrades:

  1. State synchronization overhead: Every flow rule must be replicated to all cluster members (3x the network traffic for 3-node cluster)
  2. Consensus protocols: Cluster must agree on state changes (Raft/Paxos adds 5-10ms latency)
  3. Leader election delays: When active controller fails, cluster needs 2-5 seconds to elect new leader

The right approach:

  • Use clustering for reliability (99.99% -> 99.9999% uptime), not performance
  • Deploy 3 controllers (optimal balance: survives 1 failure, minimal overhead)
  • For performance scaling, use controller federation (divide network into domains, each with its own controller)
  • Example: Google’s B4 WAN uses federated controllers (one per datacenter) managing 100,000+ devices, rather than a single massive cluster

Bottom Line: A well-tuned single controller often outperforms a poorly configured cluster. Use clustering when availability requirements exceed 99.9%, not as a default performance optimization.

118.3 Northbound and Southbound APIs

Time: ~12 min | Difficulty: Advanced | Unit: P04.C27.U03

The controller acts as a mediator between applications (northbound) and network devices (southbound).

SDN controller architecture showing northbound REST and gRPC APIs connecting to applications above, and southbound OpenFlow protocol connecting to network switches below, with bidirectional message flow arrows
Figure 118.1: Diagram showing bidirectional API communication

118.4 Northbound APIs

Northbound APIs allow applications to interact with the controller using high-level abstractions.

118.4.1 Common API Types

1. REST API (most common)

  • HTTP-based (GET/POST/PUT/DELETE)
  • JSON payloads
  • Stateless communication

2. gRPC (modern alternative)

  • Protocol Buffers for serialization
  • Bidirectional streaming
  • Lower latency than REST

3. NETCONF (configuration management)

  • XML-based
  • Transactional operations
  • Used for device provisioning

118.4.2 Example REST API Calls

# Get network topology
curl -X GET http://controller:8181/restconf/operational/network-topology:network-topology

# Block traffic from IoT device
curl -X POST http://controller:8181/restconf/operations/firewall:block \
  -H "Content-Type: application/json" \
  -d '{"source-ip": "10.0.1.50", "action": "drop"}'

# Query flow statistics
curl -X GET http://controller:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/flow-statistics

118.4.3 Northbound API Comparison

Protocol Latency Throughput Complexity Best For
REST 5-20ms 10K req/sec Low General apps
gRPC 1-5ms 100K req/sec Medium High-perf apps
NETCONF 10-50ms 1K req/sec High Configuration

118.5 Southbound APIs

Southbound APIs control network devices using standardized protocols.

118.5.1 Primary Protocols

1. OpenFlow (dominant standard)

  • Flow-based forwarding
  • Version 1.3+ most common in IoT
  • Supports meters, groups, multi-table pipelines

2. NETCONF (device configuration)

  • Configure device parameters
  • Firmware updates
  • State retrieval

3. OVSDB (Open vSwitch Database)

  • Manage virtual switches
  • Port configuration
  • Tunnel setup

118.5.2 OpenFlow Message Types

Message Type Direction Purpose Example Use
Packet-In Switch -> Controller No matching flow rule New IoT device sends first packet
Flow-Mod Controller -> Switch Install/modify flow rule “Forward sensor data to analytics server”
Packet-Out Controller -> Switch Send specific packet Controller generates ARP reply
Stats-Request Controller -> Switch Query statistics “How many bytes on port 5?”
Stats-Reply Switch -> Controller Statistics response “Port 5: 1.5 GB, 500K packets”
Barrier-Request Controller -> Switch Synchronization checkpoint “Confirm all previous rules installed”
Barrier-Reply Switch -> Controller Confirmation “All rules committed”

118.5.3 OpenFlow Flow-Mod Example

{
  "flow": {
    "id": "sensor-to-gateway-001",
    "table_id": 0,
    "priority": 100,
    "match": {
      "in-port": 1,
      "eth-type": "0x0800",
      "ipv4-source": "10.0.1.0/24"
    },
    "instructions": {
      "apply-actions": {
        "action": [
          {"output-action": {"output-node-connector": 5}}
        ]
      }
    },
    "hard-timeout": 0,
    "idle-timeout": 300
  }
}

118.6 High Availability and Clustering

Time: ~15 min | Difficulty: Advanced | Unit: P04.C27.U04

Pitfall: Assuming Switches Retain Flow Rules During Controller Failover

The Mistake: Expecting that when the active SDN controller fails and a backup takes over, all existing flow rules on switches remain intact and operational. Teams design failover assuming zero traffic disruption.

Why It Happens: Unlike traditional switches that maintain forwarding tables independently, OpenFlow switches may clear flow tables or mark flows as invalid when controller connection is lost, depending on flow timeout settings and switch implementation. The assumption that “data plane continues while control plane recovers” is only partially true.

The Fix: Configure appropriate flow timeouts: use hard timeouts for security-sensitive flows (force re-authentication), but set idle timeouts for stable traffic patterns (keeps rules while traffic flows). Install critical flows as “permanent” (no timeout) via the controller. Test failover scenarios with production-like traffic to measure actual packet loss. Most importantly, configure switches with multiple controller connections (primary + backup) so they can immediately request new master role from backup controller, reducing failover time from 30+ seconds to under 5 seconds.

For production IoT deployments, controller failure is unacceptable. Clustering provides redundancy.

SDN controller high availability cluster with three controller nodes connected via Raft consensus protocol, showing primary controller managing switches while backup controllers maintain synchronized state for failover
Figure 118.2: Diagram of controller high availability setup with three controller nodes in a cluster

118.7 Clustering Strategies

118.7.1 1. Active-Standby (Simplest)

  • One controller active, others on standby
  • Standby takes over if active fails
  • Failover time: 5-30 seconds (heartbeat detection + state recovery)
  • Advantage: Simple, no state conflicts
  • Disadvantage: Standby resources wasted

118.7.2 2. Active-Active (ONOS approach)

  • All controllers active, network partitioned across controllers
  • Each controller manages subset of switches
  • Failover time: 3-5 seconds (just reassign switches)
  • Advantage: Better resource utilization
  • Disadvantage: Complex state synchronization

118.7.3 3. Distributed Hash Table (ODL approach)

  • Network state distributed across cluster using consistent hashing
  • Each controller owns portion of state space
  • Failover time: 2-5 seconds
  • Advantage: Scales to large clusters
  • Disadvantage: More complex programming model

118.7.4 Clustering Comparison

Strategy Failover Time Resource Efficiency Complexity Best For
Active-Standby 5-30s 50% (standby idle) Low Simple HA
Active-Active 3-5s 90%+ Medium Production
DHT-based 2-5s 85%+ High Large scale

118.8 State Synchronization

Controllers in a cluster must maintain consistent view of network state.

118.8.1 What Needs Synchronization

  • Topology: Which devices are connected, which links are active
  • Flow rules: What forwarding rules are installed on each switch
  • Statistics: Traffic counts, port status
  • Application data: Custom state maintained by applications

118.8.2 Synchronization Mechanisms

1. Raft consensus (ONOS uses this)

  • Leader election ensures one controller makes decisions
  • All state changes replicated to followers
  • Guarantees consistency but adds latency (~5-10ms)

2. Eventual consistency (Cassandra-style)

  • Changes propagate asynchronously
  • Faster but risk of temporary inconsistencies
  • Acceptable for non-critical data (statistics)

3. Distributed transactions (ODL MD-SAL)

  • Two-phase commit for critical operations
  • Strong consistency guarantee
  • Higher latency (~10-20ms)

118.8.3 Consistency vs Performance Tradeoffs

Mechanism Consistency Latency Use Case
Raft Strong +5-10ms Flow rules, topology
Eventual Weak +1-2ms Statistics, counters
2PC Strong +10-20ms Cross-domain operations

118.9 Switch-Controller Connections

Switches can connect to multiple controllers for redundancy.

118.9.1 OpenFlow Auxiliary Connections

Switch configuration:
- Primary controller: 10.0.0.1:6653
- Backup controller: 10.0.0.2:6653
- Backup controller: 10.0.0.3:6653

Behavior:
- Switch connects to all three controllers
- Primary controller is "master" (can modify flow tables)
- Backup controllers are "slave" (read-only access)
- If master fails, switch promotes backup to master

118.9.2 Failover Behavior

  1. Switch detects master failure (TCP connection drops or echo timeout)
  2. Switch sends OFPT_ROLE_REQUEST to backup controller: “Please become master”
  3. Backup controller (now master) sends OFPT_ROLE_REPLY: “I accept”
  4. Switch now accepts Flow-Mod from new master
  5. Total time: 3-10 seconds depending on echo interval

118.9.3 Controller Role Configuration

Role Flow-Mod Stats Packet-In Use Case
Master Yes Yes Yes Primary controller
Slave No Yes Optional Backup, monitoring
Equal Yes Yes Yes Load balancing (rare)

118.10 Selecting a Controller for IoT

Time: ~10 min | Difficulty: Intermediate | Unit: P04.C27.U05

Choosing the right controller depends on your deployment requirements.

118.10.1 Decision Matrix

Requirement Recommended Controller Rationale
Learning/Education Ryu Python, simplest API, best tutorials
Prototype/PoC Ryu or Floodlight Quick setup, good performance
Enterprise deployment OpenDaylight Comprehensive features, multi-protocol
High availability critical ONOS Best clustering, carrier-grade reliability
High performance ONOS or Floodlight 1M+ and 600K flows/sec respectively
Large scale (10K+ devices) ONOS Designed for scalability
Mixed network (IoT + legacy) OpenDaylight Supports most protocols
Cloud-native deployment ONOS Microservices architecture
On-premises/embedded Ryu or Floodlight Lightweight, lower resource usage

118.10.2 Real-World Example: AT&T Domain 2.0 Migration

Background: AT&T’s global network carries 197 petabytes daily across 135,000 route miles serving 340M+ connections. Traditional hardware-based network required 18-36 months to deploy new services.

SDN Migration (2013-2020):

  • Controller Platform: ONOS (Open Network Operating System)
  • Scale: 75% of network traffic virtualized by 2020
  • Switches Managed: 65,000+ virtual and physical switches
  • Control Plane Instances: 500+ ONOS controller clusters (3-5 nodes each)

Results:

  • Service Deployment Time: 18 months -> 90 minutes (99.7% reduction)
  • Network Efficiency: 40-60% cost savings through software-defined routing
  • Reliability: 99.999% uptime (5.26 minutes downtime/year) despite centralized control
  • OPEX Reduction: $2B+ annual savings through automation and dynamic optimization

Key Technical Achievements:

  • Flow Rule Scale: Controllers manage 500K+ flow rules per cluster with <10ms flow setup latency
  • Failover Time: <2 seconds controller cluster failover with zero packet loss
  • Multi-Tenancy: Network slicing supports 50+ business units on shared infrastructure
  • Dynamic Routing: Real-time traffic engineering reroutes around congestion in <5 seconds vs. 15-30 minutes with traditional OSPF

IoT Implications: AT&T’s success demonstrates SDN scales to carrier-grade deployments with millions of endpoints. For IoT, key lessons include: - Proactive Flow Installation: Pre-install rules for known traffic patterns (sensors -> gateway) to avoid PACKET_IN overhead - Controller Clustering: 3-5 node clusters provide high availability without sacrificing performance - Hierarchical Control: Regional controllers manage local switches, report to centralized orchestrator - Policy-Based Management: Define high-level policies (“prioritize emergency services”) rather than per-device rules

Estimate failover time for SDN controller clusters based on heartbeat and consensus parameters.

118.11 Knowledge Check

Test your understanding of SDN APIs and high availability.

Scenario: A 3-node ONOS cluster manages 500 IoT switches for a smart city. Calculate failover time when the active controller fails.

Cluster Configuration:

  • 3 controllers (ONOS): Master, Slave-1, Slave-2
  • Heartbeat interval: 100ms (controller sends “I’m alive” every 100ms)
  • Heartbeat timeout: 3 missed heartbeats = 300ms (declares node dead)
  • Leader election protocol: Raft consensus

Failover Sequence:

Time Event Action Duration
T+0ms Master controller crashes - 0ms
T+100ms Slave-1 expects heartbeat No message received 100ms
T+200ms Slave-1 expects heartbeat No message received 100ms
T+300ms Slave-1 expects heartbeat Timeout triggered (3 missed) 100ms
T+300ms Slave-1 initiates leader election Broadcasts VOTE_REQUEST to Slave-2 5ms
T+305ms Slave-2 responds with VOTE_GRANTED Quorum achieved (2/3 nodes) 5ms
T+310ms Slave-1 elected as new Master Sends LEADER announcement 5ms
T+315ms Switches detect new Master OpenFlow role change (EQUAL → MASTER) 50ms
T+365ms New Master syncs state Loads topology from distributed DB 200ms
T+565ms Failover complete Switches reconnect, resume flow installs Total: 565ms

Breakdown of Delays:

  • Failure detection: 300ms (3 × heartbeat interval)
  • Leader election: 15ms (network RTT + voting)
  • Switch reconnection: 50ms (TCP handshake + OpenFlow HELLO)
  • State synchronization: 200ms (topology database query)
  • Total: 300 + 15 + 50 + 200 = 565ms

Impact on Traffic:

  • Existing flows: Continue forwarding (data plane unaffected)
  • New flows: Delayed 565ms (first packet buffered, installed after failover)
  • Flow modifications: Delayed 565ms (pending updates queued)

Optimization Options:

Optimization Failover Time Trade-off
Baseline (3 heartbeats) 565ms Conservative, reliable
Reduce to 2 heartbeats 365ms Risk of false positives from network jitter
Pre-elect backup (hot standby) 115ms Slave maintains full state (2× memory)
Aggressive timeouts (50ms × 2) 215ms False failures on GC pauses

Production Recommendation: 565ms failover is acceptable for most IoT networks (sensor data tolerates sub-second delays). For critical control systems needing <100ms failover, use pre-elected hot standby despite 2× memory overhead.

API Type Latency Throughput Complexity Best Use Case
REST (HTTP/JSON) 10-50ms 1K requests/sec Low (curl, Python requests) Dashboard apps, manual testing, scripting
gRPC (Protocol Buffers) 2-10ms 50K requests/sec Medium (code generation required) High-performance apps, streaming telemetry
OpenFlow 0.5-5ms 100K flows/sec High (binary protocol, state machine) Switch-controller communication ONLY

When to Use Each:

REST API:

  • Use when: Prototyping, dashboard UIs, manual network configuration, infrequent operations (<100 req/min)
  • Example: curl -X POST http://controller:8181/restconf/operations/firewall:block -d '{"ip":"10.0.1.50"}'
  • Pros: Human-readable, browser-testable, widely supported
  • Cons: JSON parsing overhead, HTTP latency, limited streaming

gRPC API:

  • Use when: High-frequency operations (>1K req/sec), bidirectional streaming, real-time telemetry collection
  • Example: Network monitoring app processing 50K flow stats/sec
  • Pros: 5-10× faster than REST, efficient binary encoding, streaming support
  • Cons: Requires code generation (.proto files), less human-readable

OpenFlow (Southbound Only):

  • Use when: Direct switch control (never for northbound applications!)
  • Example: Controller installing flow rules on switches
  • Pros: Optimized for switch operations, <1ms per flow
  • Cons: Extremely low-level, requires deep protocol knowledge

Decision Tree for Northbound Application:

  1. Are you a human operator testing manually? → Use REST (curl commands)
  2. Is this a dashboard or infrequent automation? → Use REST (simple integration)
  3. Do you need >10K operations/sec OR real-time streaming? → Use gRPC
  4. Are you building the SDN controller itself? → Use OpenFlow (southbound)

Real-World Performance Comparison (ONOS controller, 1000 flow installations):

API Install Time Requests/Sec CPU Load Memory
REST (JSON) 45s 22/sec 35% 800 MB
gRPC (protobuf) 5.5s 182/sec 28% 650 MB
OpenFlow (native) 0.8s 1,250/sec 18% 500 MB

Key Insight: REST APIs are for humans and applications. gRPC is for high-performance applications. OpenFlow is for controllers talking to switches – never use OpenFlow directly from northbound applications.

Common Mistake: Assuming 3-Node Cluster Means 3× Performance

The Error: Deploying 3 ONOS controllers expecting 3× flow installation throughput compared to a single controller.

Measured Reality (production deployment):

Configuration Flow Installs/Sec Flow Install Latency Notes
1 controller (no clustering) 50,000 15ms Baseline
3-node cluster (active-active) 45,000 18ms 10% slower!
5-node cluster (active-active) 38,000 25ms 24% slower!

Why Performance Decreases:

  1. State synchronization overhead: Every flow rule must be replicated to all cluster members
    • 1 controller: 0 bytes sync
    • 3 controllers: 2× replication (send to 2 peers) = 2× network traffic
    • 5 controllers: 4× replication = 4× network traffic
  2. Consensus protocol latency: Raft requires majority agreement before committing
    • 1 controller: 0ms consensus (no voting)
    • 3 controllers: 5-10ms (2/3 quorum vote)
    • 5 controllers: 8-15ms (3/5 quorum vote, more nodes to coordinate)
  3. Distributed lock contention: Multiple controllers modifying topology compete for locks
    • 1 controller: No locks needed
    • 3 controllers: 5-10% of operations wait for locks
    • 5 controllers: 15-20% wait time

Real Example (Google B4 WAN deployment paper, 2013): - Tested 1-7 controller cluster for planetary WAN - Optimal performance: 3-5 controllers (sweet spot) - Beyond 5 controllers: Coordination overhead exceeded benefits - Conclusion: Use clustering for availability, not performance

When Clustering DOES Help:

  • Geographic distribution: Regional controllers reduce RTT to local switches (East/West coasts)
  • Fault tolerance: 3-node cluster survives 1 failure, 5-node survives 2
  • Availability: 99.99% → 99.9999% uptime (52 min/year → 30 sec/year)

Correct Architecture for Scale:

  • 1,000 switches: 1 controller (50K flows/sec sufficient)
  • 1,000-5,000 switches: 3-node cluster (availability + acceptable overhead)
  • 5,000-10,000 switches: Controller federation (divide network, 1 controller per region)
  • 10,000+ switches: Hierarchical (regional controllers + global orchestrator)

Key Lesson: Clustering is for high availability, not performance scaling. If you need more performance, use federation (multiple independent controllers, each managing a subset of the network). If you need fault tolerance, use a 3-node cluster and accept 10-15% performance overhead.

Key Concepts

  • SDN (Software-Defined Networking): An architectural approach separating the network control plane (routing decisions) from the data plane (packet forwarding), centralizing control in a software controller for programmable network management
  • Control Plane: The network intelligence layer making routing and forwarding decisions, centralized in an SDN controller rather than distributed across individual switches as in traditional networking
  • Data Plane: The network forwarding layer physically moving packets based on rules installed by the control plane — in SDN, this is the switch hardware executing OpenFlow flow table entries
  • OpenFlow: The foundational SDN protocol enabling communication between an SDN controller and network switches, allowing the controller to install, modify, and delete flow table entries that govern packet forwarding
  • SDN Controller: The centralized network operating system providing a global view of the network topology and programming switch forwarding behavior through southbound APIs (OpenFlow) and exposing northbound APIs to applications
  • Flow Table: A data structure in an SDN switch containing match-action rules: each entry matches packet headers (source IP, destination MAC, port number) and specifies forwarding action (forward, drop, modify, send-to-controller)
  • Northbound API: The interface between the SDN controller and network applications (analytics, orchestration, load balancing), exposing network services through REST, gRPC, or YANG/NETCONF models
  • Controller Clustering: Distributing the SDN controller across multiple instances with consensus-based state replication (RAFT, Paxos) for high availability — eliminating single-controller failure as a network outage cause
  • RAFT Consensus: A distributed consensus algorithm ensuring all controller cluster members agree on network state before committing changes, providing fault tolerance for (n-1)/2 node failures in an n-node cluster

Common Pitfalls

Operating a single SDN controller as the sole control plane. Any controller restart, upgrade, or crash freezes network programming. Deploy minimum 3-node controller clusters with RAFT consensus to tolerate single-node failures.

Deploying northbound API endpoints without version management (v1/, v2/). When the controller upgrades and changes API responses, all client applications break simultaneously. Version all northbound APIs and maintain backward compatibility for at least one release cycle.

Installing dozens of northbound applications (load balancer, firewall, traffic engineer, analytics) on a single controller, causing CPU contention and unpredictable processing latency for flow installation. Benchmark controller throughput with all intended applications before production deployment.

Deploying a 2-node controller cluster expecting full fault tolerance. Two nodes cannot achieve RAFT consensus if one fails — the remaining node cannot determine whether it or the other is the leader, causing split-brain. Always use odd-numbered clusters (3, 5, 7 nodes) for RAFT consensus.

118.12 Summary

Key Takeaways:

  1. Northbound APIs (REST/gRPC) allow applications to program the network without OpenFlow knowledge
  2. Southbound APIs (OpenFlow/NETCONF) control network devices with standardized protocols
  3. OpenFlow messages (Packet-In, Flow-Mod, Stats-Request) form the control loop between controller and switches
  4. Clustering provides high availability (99.99%+) but at performance cost (10-25% slower)
  5. State synchronization uses Raft consensus for strong consistency or eventual consistency for performance
  6. Switch-controller connections with multiple controllers enable sub-10s failover

Practical Guidelines:

  • Use REST APIs for application integration, not direct OpenFlow manipulation
  • Deploy 3-node clusters for 99.99%+ uptime requirements
  • Configure switches with multiple controller connections (primary + 2 backups)
  • Use proactive flow installation for known IoT traffic patterns
  • Set appropriate flow timeouts: permanent for critical flows, idle-timeout for dynamic traffic

118.14 What’s Next

If you want to… Read this
Study SDN controller basics SDN Controller Basics
Learn OpenFlow protocol details OpenFlow Protocol
Explore SDN architecture fundamentals SDN Architecture Fundamentals
Study SDN production deployment SDN Production Framework
Review SDN IoT applications SDN IoT Applications

118.15 Key Takeaway

SDN high availability requires three coordinated mechanisms: northbound REST/gRPC APIs for application integration, southbound OpenFlow for switch control, and controller clustering with Raft consensus for fault tolerance. A 3-node cluster tolerates 1 failure with sub-5-second failover – this is the optimal balance for most IoT deployments. Remember: clustering is for reliability (99.99% uptime), not performance; adding more controllers actually decreases throughput due to state synchronization overhead.

Clustering Overhead: State Synchronization Cost

A 3-node ONOS cluster managing 5,000 IoT devices performs state synchronization for every flow rule installation. Given:

  • Flow installation rate: 2,000 flows/second (peak)
  • Raft consensus requires majority (2/3 nodes) acknowledgment
  • Network RTT between controller nodes: 5 ms
  • State record size: 512 bytes per flow rule

State synchronization bandwidth required per controller instance:

\[B_{sync} = R_{flow} \times S_{record} \times (N_{nodes} - 1)\]

\[B_{sync} = 2{,}000 \text{ flows/s} \times 512 \text{ bytes} \times 2 \text{ peers} = 2{,}048{,}000 \text{ bytes/s} = 2.05 \text{ MB/s}\]

Total cluster bandwidth: \(3 \times 2.05 = 6.15\) MB/s for state replication alone (excluding data plane traffic).

Latency penalty from consensus protocol:

\[L_{consensus} = RTT + T_{vote} + T_{commit} = 5\text{ ms} + 2\text{ ms} + 3\text{ ms} = 10\text{ ms}\]

This 10 ms penalty applies to EVERY flow installation in clustered mode. For 2,000 flows/sec, this represents:

\[T_{overhead} = 2{,}000 \times 0.01 = 20 \text{ seconds of compute time per second}\]

This exceeds real-time capacity, forcing parallel processing across cluster members. Single controller with no consensus avoids this overhead entirely, achieving 50,000 flows/sec throughput.

118.16 For Kids: Meet the Sensor Squad!

SDN APIs and clustering are like having multiple backup command centers that all speak the same language!

118.16.1 The Sensor Squad Adventure: The Backup Plan

Lila the LED was worried. “What if our SDN Controller – Connie – gets sick? The whole network would stop working!”

Max the Microcontroller had a plan. “We need BACKUP controllers! Like having substitute teachers ready to take over if the teacher is absent.”

So they set up THREE controllers: Connie (the main one), Carlos (backup #1), and Clara (backup #2).

“But how do they all stay on the same page?” asked Sammy the Sensor.

“They use a special agreement system called RAFT!” explained Bella the Battery. “Every time Connie makes a decision – like ‘send Sammy’s data through Path A’ – she tells Carlos and Clara. They all write it down in their notebooks.”

“What if Connie goes offline?” Sammy asked nervously.

“Watch this!” Max pulled Connie’s plug. For just 3 seconds, there was a tiny pause. Then Carlos announced: “I’m the new leader! Everyone, report to me!”

Clara confirmed: “I agree – Carlos is the leader now!” And the network was back to normal in under 5 seconds!

“But wait,” said Lila. “How do the apps talk to the controllers? And how do the controllers talk to the switches?”

Max drew two arrows:

  • NORTHBOUND (Up): Apps talk to controllers using REST API – like sending a letter saying “Please block this bad sensor.” Simple language that any app can understand!
  • SOUTHBOUND (Down): Controllers talk to switches using OpenFlow – like very specific technical instructions: “Match packets from IP 10.0.1.50, action: DROP, priority: 100.”

“It’s like a restaurant!” said Bella. “Customers (apps) order food in plain English (REST API). The head chef (controller) then gives precise cooking instructions (OpenFlow) to the cooks (switches)!”

The Sensor Squad now had a system that was fast, reliable, AND easy to understand. Even if one controller went down, the network kept running!

118.16.2 Key Words for Kids

Word What It Means
API A special language that lets different software programs talk to each other
Clustering Having multiple backup controllers ready to take over if one fails
Failover When the backup automatically takes over – like a substitute teacher
Raft Consensus A voting system where controllers agree on who is the leader
Northbound API How apps send high-level requests to the controller
Southbound API How the controller sends detailed instructions to switches

Hands-on Practice:

  • Configure ONOS 3-node cluster and test failover
  • Write REST API client to query topology and install flows
  • Simulate controller failure with Mininet and measure recovery time