Skip to content
LinkState
Go back

Jumbo batches starve commit queues and humans

Introduction to Rollout Batching

Definition of Rollout Batching

Rollout batching groups configuration or software changes into discrete sets (batches) that are applied to a fleet of devices in a coordinated manner. Instead of pushing a change to every host sequentially, operators send the same change to N devices concurrently, wait for the batch to finish (or reach a success threshold), then proceed to the next batch. The goal is to amortize fixed overhead—such as connection setup, transaction logging, and human review—while limiting the blast‑radius of a faulty change.

Benefits of Rollout Batching

BenefitWhy it mattersTypical quantitative impact
Reduced per‑device connection overheadSSH/TLS handshakes, authentication, and channel setup dominate latency for small batches.Handshake ≈ 150‑300 ms per SSH connection; batching 10 devices saves ~1.2‑3 s of pure handshake time.
Improved utilization of commit queuesMany network devices expose a single‑threaded commit pipeline (e.g., Juniper’s commit, Cisco’s write memory). Batching aligns the arrival rate with the service rate, reducing idle time.Utilization can rise from 30 % (serial) to 70‑90 % when batch size ≈ service‑rate × RTT.
Operator efficiencyHuman review, approval, and post‑change validation are amortized across the batch.Review time per device drops from ~2 min (serial) to ~12 s for a 10‑device batch if the reviewer can assess the batch as a unit.
Predictable change windowsBatches create natural checkpoints for rollback or pause.Enables sub‑minute decision loops rather than waiting for hundreds of serial completions.

Common Challenges in Rollout Batching

  1. Device commit queues become saturated – if the batch arrival rate exceeds the device’s commit service rate, queues grow and latency spikes.
  2. SSH fan‑out limits – opening many simultaneous SSH connections can exhaust client‑side file descriptors, SSH daemon MaxStartups, or network NIC queues.
  3. Operator review latency – human approval steps do not scale linearly; large batches may stall waiting for a single reviewer, negating parallelism gains.
  4. Failure propagation – a faulty change in a large batch can affect many devices before detection, increasing blast‑radius.
  5. Tooling overhead – orchestration frameworks (Ansible, Salt, custom scripts) add their own serialization points (e.g., playbook strategy linear vs free).

Understanding Bottlenecks in Rollout Batching

Device Commit Queues

Queue Architecture

Most network operating systems expose a commit queue that serializes configuration transactions to guarantee atomicity and consistency. Internally this is often implemented as a single‑threaded workqueue backed by a kernel FIFO (e.g., Linux kfifo or a proprietary ring buffer).

The service rate (μ) is determined by the slowest stage (usually validation + hardware reprogramming). Typical μ values:

Device classApprox. μ (commits/sec)Notes
Low‑end L2 switch5‑10Limited ASIC reprogramming bandwidth
Mid‑range router20‑40CPU‑bound validation
High‑end carrier‑grade80‑150Hardware offload for validation, but still serialized lock

Queue Limitations

SSH Fan‑out

SSH Fan‑out Architecture

Parallel SSH execution is typically achieved via one of three patterns:

  1. Process‑per‑host – tools like pssh, mssh, or ansible with strategy: free spawn an OS process (or thread) per target. Each process opens its own TCP socket to port 22 and performs the SSH handshake independently.
  2. Multiplexed connections – ssh -M -S <control-path> creates a master connection; subsequent sessions reuse the same TCP channel, reducing handshake overhead but sharing a single SSH channel’s window flow control.
  3. Connection pooling daemons – sshd with MaxSessions and MaxStartups tuned, or external proxies like haproxy in TCP mode, distribute incoming SSH SYNs across a pool of backend sshd workers.

Key parameters that affect fan‑out performance:

ParameterTypical defaultEffect when increased
MaxStartups (sshd)10:30:60Allows more concurrent unauthenticated connections before dropping; too high can exhaust listener backlog.
MaxSessions (sshd)10Limits number of multiplexed sessions per TCP connection; raising reduces per‑host overhead but increases memory per master conn.
Client file‑descriptor limit (ulimit -n)1024caps number of concurrent SSH processes; must be raised for large batches.
TCP backlog (net.core.somaxconn)128limits pending SYN queue; overflow leads to connection refusals.
NIC TX/RX ring size256‑1024small rings cause packet drops under bursty SSH fan‑out.

SSH Fan‑out Limitations

Operator Review Latency

Review Process Overview

In many organizations a change must pass through a human gate before execution:

  1. Change request creation – operator fills a ticket (Jira, ServiceNow) with description, CI/CD pipeline link, and rollback plan.
  2. Peer review – one or more engineers examine the diff, run static checks (e.g., batfish, cisco‑parser), and leave comments.
  3. Approval – a designated approver (often a network architect) signs off, sometimes requiring a second‑level approval for high‑risk changes.
  4. Scheduled window – the change is queued for a maintenance window; the batch is only released when the window opens.

Each step introduces latency that is largely independent of batch size (except for the time to collate the diff).

Latency Factors

FactorTypical magnitudeInfluence on batch size
Ticket creation & description30‑90 sFixed overhead; amortized over batch.
Peer review (manual diff inspection)2‑5 min per reviewerScales with number of reviewers, not batch size.
Automated validation (CI)10‑30 s (depends on test suite)Fixed; can be parallelized across batches.
Approval sign‑off (human)1‑5 minFixed; becomes the dominant limiter when batch size > ~10‑20 devices.
Communication latency (Slack/email)5‑30 s per exchangeFixed; can be reduced with async notifications.
Scheduled window alignmentup to several hoursExternal; batch size does not affect wait for window start.

When the operator review latency (T_review) exceeds the time saved by parallelizing device commits (T_save), increasing batch size yields diminishing or negative returns.


Identifying the Point of Diminishing Returns

Metrics for Evaluation

MetricDefinitionHow to capture
Queue Wait Time (Wq)Average time a commit spends waiting in the device commit queue before being serviced.Timestamp diff between commit start (as seen in device logs) and commit enqueue (or use internal counters if exposed).
SSH Connection Time (T_ssh)Wall‑clock time from socket connect() to successful authentication and channel readiness.Measure with time ssh -o BatchMode=yes -o ConnectTimeout=5 user@host true or via ssh -vvv timestamps.
Operator Review Time (T_review)Elapsed time from change request submission to final approval.Extract from ticketing system timestamps (e.g., Jira created → resolved when status = Approved).
Batch Completion Time (T_batch)Total wall‑clock time to apply a batch to all devices, including retries.time ./run_batch.sh batch_size=N.
Effective Throughput (λ_eff)Number of successfully committed devices per second.λ_eff = (N * success_rate) / T_batch.
Utilization (ρ)Ratio of arrival rate to service rate for the commit queue.ρ = λ_arrival / μ (where λ_arrival = N / T_batch).

The point of diminishing returns occurs when ∂T_batch/∂N ≈ 0 or when T_review dominates T_batch such that increasing N no longer reduces T_batch appreciably.

Data Collection Methods

Logging and Monitoring Tools

ToolWhat it measuresDeployment notes
Prometheus + node_exporterSystem‑level CPU, memory, network stats on the orchestration host.Scrape /metrics from sshd (via ssh_exporter) and from custom exporters that read device commit queue counters via SNMP or REST.
Grafana LokiAggregated logs from devices (syslog, JunOS show log messages) and orchestration host (ansible logs).Enables correlation of commit timestamps with queue depth spikes.
Elastic Stack (ELK)Full‑text search of SSH session logs (/var/log/auth.log, sshd audit).Useful for measuring per‑connection handshake latency via ssh -vvv logs.
Custom eBPF tracerLatency of connect() and accept() syscalls on the orchestration host; can also trace commit ioctl if the device exposes a netlink interface.Example: tracepoint:syscalls:sys_enter_connect + tracepoint:syscalls:sys_exit_connect.
Ticketing API (Jira/ServiceNow)Timestamps for change request lifecycle.Pull via REST API; compute T_review.

CLI Commands for Data Collection

Measuring SSH Connection Time

# Single shot measurement (average of 10 runs)
for i in {1..10}; do
    /usr/bin/time -p ssh -o BatchMode=yes -o ConnectTimeout=3 user@router01 true 2>&1 | grep real
done | awk '{sum+=$2} END{print "avg ssh connect:", sum/NR, "s"}'

Capturing Device Commit Queue Wait (Juniper example)

# Enable commit logging (if not already)
set system syslog file commit_log any info
commit and-quit

# After a batch, extract timestamps:
show log commit_log | match "commit started" | display timestamp
show log commit_log | match "commit completed" | display timestamp

Compute Wq = commit_start - commit_enqueue where commit_enqueue can be approximated by the time the orchestration host sent the RPC (logged by the automation tool).

Measuring Batch Completion Time with Ansible

# batch_playbook.yml
- hosts: all
  serial: "{{ batch_size | int }}"   # controls batch size
  tasks:
    - name: Apply config template
      template:
        src: templates/router.j2
        dest: /etc/router.conf
      notify: reload router

  handlers:
    - name: reload router
      ios_config:
        src: /etc/router.conf
        commit: yes

Run with:

ANSIBLE_FORCE_COLOR=1 ansible-playbook -i inventory.ini batch_playbook.yml -e "batch_size=20" \
  | tee run_20.log

Extract timing:

grep "PLAY RECAP" run_20.log | awk -F' ' '{for(i=1;i<=NF;i++) if($i ~ /ok=/) print $i}'

Or use callback_plugin: profile_tasks to get per‑task timing.

Pulling Review Time from Jira (bash + jq)

JIRA_URL="https://jira.example.com/rest/api/2/search"
JQL='project = NET AND status = Approved AND updated >= -7d'
curl -s -u "$JIRA_USER:$JIRA_TOKEN" -H "Content-Type: application/json" \
     -d "{\"jql\":\"$JQL\",\"fields\":[\"created\",\"resolved\"]}" "$JIRA_URL" |
jq -r '.issues[] | .fields.created, .fields.resolved' |
awk '
  NR%2{created=$1; next}
  {cmd="date -d \""created"\" +%s"; cmd | getline start; close(cmd)
   cmd="date -d \""$1"\" +%s"; cmd | getline end; close(cmd)
   print end-start}
' | awk '{sum+=$1; count++} END{print "avg review time (s):", sum/count}'

Troubleshooting Common Issues

Device Commit Queue Issues

Queue Overflow

Symptom: commit failed: queue full appears in device logs; orchestration logs show many retries.

Diagnosis

  1. Check queue depth:
    # Juniper
    show system commit queue
    # Cisco IOS XR
    show

Share this post on:

Previous Post
One packet through a healthy leaf and a sick spine
Next Post
TI-LFA promised protection, the packet still died