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
| Benefit | Why it matters | Typical quantitative impact |
|---|---|---|
| Reduced per‑device connection overhead | SSH/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 queues | Many 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 efficiency | Human 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 windows | Batches 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
- Device commit queues become saturated – if the batch arrival rate exceeds the device’s commit service rate, queues grow and latency spikes.
- SSH fan‑out limits – opening many simultaneous SSH connections can exhaust client‑side file descriptors, SSH daemon
MaxStartups, or network NIC queues. - Operator review latency – human approval steps do not scale linearly; large batches may stall waiting for a single reviewer, negating parallelism gains.
- Failure propagation – a faulty change in a large batch can affect many devices before detection, increasing blast‑radius.
- Tooling overhead – orchestration frameworks (Ansible, Salt, custom scripts) add their own serialization points (e.g., playbook strategy
linearvsfree).
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).
- Juniper JunOS –
commitoperations are dispatched to thecommitddaemon; each commit acquires a mutex, writes candidate config to the internal DB, then runs validation and activation steps before releasing the lock. - Cisco IOS XR – the
commitcommand enters thesysdbtransaction queue; a singlesysdbworker processes transactions in FIFO order. - Arista EOS – the
ConfigSyncservice uses astd::queueprotected by astd::mutex; each batch entry triggers aConfigApplytransaction.
The service rate (μ) is determined by the slowest stage (usually validation + hardware reprogramming). Typical μ values:
| Device class | Approx. μ (commits/sec) | Notes |
|---|---|---|
| Low‑end L2 switch | 5‑10 | Limited ASIC reprogramming bandwidth |
| Mid‑range router | 20‑40 | CPU‑bound validation |
| High‑end carrier‑grade | 80‑150 | Hardware offload for validation, but still serialized lock |
Queue Limitations
- Finite depth – many devices expose a configurable maximum queue length (e.g.,
set system commit queue-depth 100). Exceeding this drops new commits withcommit failed: queue full. - Head‑of‑line blocking – a slow commit (e.g., a large ACL rewrite) blocks all subsequent commits regardless of their size.
- Priority inversion – some platforms allow “commit confirm” or “commit check” to bypass the queue, but these are not suitable for production changes.
- Measurement latency – the time a commit spends waiting in queue (
Wq) is not exposed via standard CLI; it must be inferred from timestamps or internal counters.
SSH Fan‑out
SSH Fan‑out Architecture
Parallel SSH execution is typically achieved via one of three patterns:
- Process‑per‑host – tools like
pssh,mssh, oransiblewithstrategy: freespawn an OS process (or thread) per target. Each process opens its own TCP socket to port 22 and performs the SSH handshake independently. - 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. - Connection pooling daemons –
sshdwithMaxSessionsandMaxStartupstuned, or external proxies likehaproxyin TCP mode, distribute incoming SSH SYNs across a pool of backendsshdworkers.
Key parameters that affect fan‑out performance:
| Parameter | Typical default | Effect when increased |
|---|---|---|
MaxStartups (sshd) | 10:30:60 | Allows more concurrent unauthenticated connections before dropping; too high can exhaust listener backlog. |
MaxSessions (sshd) | 10 | Limits number of multiplexed sessions per TCP connection; raising reduces per‑host overhead but increases memory per master conn. |
Client file‑descriptor limit (ulimit -n) | 1024 | caps number of concurrent SSH processes; must be raised for large batches. |
TCP backlog (net.core.somaxconn) | 128 | limits pending SYN queue; overflow leads to connection refusals. |
| NIC TX/RX ring size | 256‑1024 | small rings cause packet drops under bursty SSH fan‑out. |
SSH Fan‑out Limitations
- Connection establishment overhead – each new SSH session incurs a full key exchange (typically Curve25519‑SHA256) and authentication (password/pubkey). This dominates latency for batches < 20 devices.
- Server‑side resource exhaustion –
sshdforks a child process per session (unlessUsePrivilegeSeparation=noandPermitTunnel=no). High fork rates can causefork: Cannot allocate memoryerrors. - Network congestion – the SYN‑ACK exchange for dozens of connections can saturate the NIC’s interrupt moderation or cause TCP retransmits if the server’s listen backlog is exceeded.
- Session multiplexing limits – reusing a master connection reduces handshake cost but serializes payloads over a single encrypted channel; large command outputs can cause head‑of‑line blocking inside the SSH channel itself.
Operator Review Latency
Review Process Overview
In many organizations a change must pass through a human gate before execution:
- Change request creation – operator fills a ticket (Jira, ServiceNow) with description, CI/CD pipeline link, and rollback plan.
- Peer review – one or more engineers examine the diff, run static checks (e.g.,
batfish,cisco‑parser), and leave comments. - Approval – a designated approver (often a network architect) signs off, sometimes requiring a second‑level approval for high‑risk changes.
- 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
| Factor | Typical magnitude | Influence on batch size |
|---|---|---|
| Ticket creation & description | 30‑90 s | Fixed overhead; amortized over batch. |
| Peer review (manual diff inspection) | 2‑5 min per reviewer | Scales 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 min | Fixed; becomes the dominant limiter when batch size > ~10‑20 devices. |
| Communication latency (Slack/email) | 5‑30 s per exchange | Fixed; can be reduced with async notifications. |
| Scheduled window alignment | up to several hours | External; 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
| Metric | Definition | How 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
| Tool | What it measures | Deployment notes |
|---|---|---|
| Prometheus + node_exporter | System‑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 Loki | Aggregated 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 tracer | Latency 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"}'
-o BatchMode=yesdisables password prompts; fails fast if auth requires interaction.- Output:
real 0.27→ 270 ms handshake + auth.
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
- Check queue depth:
# Juniper show system commit queue # Cisco IOS XR show