• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

dnsimple / erldns / 20781487450
85%

Build:
DEFAULT BRANCH: main
Ran 07 Jan 2026 12:29PM UTC
Jobs 1
Files 47
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

07 Jan 2026 12:28PM UTC coverage: 85.218% (+0.9%) from 84.332%
20781487450

push

github

web-flow
Implement smarter Congestion Control algorithms for UDP (#302)

## Overview

This PR implements the CUBIC congestion control algorithm (RFC 8312) adapted for UDP acceptors to dynamically control the admission rate based on CPU scheduler utilisation. This prevents CPU saturation during high load by intelligently throttling UDP packet acceptance. It also implements Exponential Moving Average (EMA) to the scheduler utilisation to smoothen sampling (check Nyquist-Shannon Sampling Theorem).

## Problem Statement

Under high UDP traffic, acceptors can saturate the CPU, leading to:
- Degraded performance
- Increased latency
- Potential system instability

A simple static rate limit is insufficient because:
- It doesn't adapt to actual system load
- It can't recover gracefully after congestion
- It doesn't probe for new capacity when conditions improve
- It may suffer from global synchronisation as there are multiple acceptors applying their on limiting mechanism

## Solution

### CUBIC Congestion Control Algorithm in the acceptor

The implementation adapts TCP CUBIC (RFC 8312) to control UDP acceptor admission rate:

1. **Dynamic Rate Limiting**: Rate adjusts batches/second based on system load
2. **Congestion Detection**: Monitors scheduler utilisation via `erldns_sch_mon`; triggers at 90% utilisation
3. **Smooth Recovery**: CUBIC provides graceful recovery without aggressive oscillations
4. **Capacity Probing**: Automatically probes for new capacity when system is healthy
5. **Jitter**: Adds ±7.5% jitter to sleep times to prevent synchronisation effects

- Tuned parameters:
  - `BETA = 0.8` (less aggressive than TCP CUBIC's 0.7)
  - `MAX_RATE = 1950.0` (allows 3 congestion events before engaging 1ms sleep, natural hysteresis)
  - `MIN_RATE = 1.0` (never stops completely)


### Exponential Moving Average (EMA) in the scheduler monitor

Enhanced `erldns_sch_mon` with EMA smoothing (α=0.3) for:
- More stable utilisation readings
- Reduced noise from transient... (continued)

63 of 63 new or added lines in 4 files covered. (100.0%)

1620 of 1901 relevant lines covered (85.22%)

1079.0 hits per line

Jobs
ID Job ID Ran Files Coverage
1 20781487450.1 07 Jan 2026 12:29PM UTC 47
85.22
GitHub Action Run
Source Files on build 20781487450
  • Tree
  • List 47
  • Changed 4
  • Source Changed 3
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #20781487450
  • 5c843412 on github
  • Prev Build on main (#20746037289)
  • Next Build on main (#20787282344)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc