Skip to content

Commit

Permalink
Adds a new function MaxRate() to the site object (#324)
Browse files Browse the repository at this point in the history
* Adds a new function MaxRate() to the site object

Previously, we assumed that if a site was 1g the max-rate should be one static
thing, and that if it was 10g it should be another static thing. The
introduction of "minimal" sites that only have a single server changes this.

Minimal sites should have the max-rate set higher than "full" sites. The
max-rate values only applies to physical sites, since the number is currently
static for all virtual sites.

* Corrects conditional, removing extra 'if'

* Lowers max-rate for minimal 1g sites to 300Mbits/s
  • Loading branch information
nkinkade authored Mar 7, 2024
1 parent c8d1d97 commit 483dfea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
19 changes: 2 additions & 17 deletions formats/v2/sites/max-rates.json.jsonnet
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
local sites = import 'sites.jsonnet';

/*
The max-rate for the -txcontroller.max-rate flag for ndt-server for 1Gbit/s
sites is set to 150Mbit/s, which should mean that the combined throughput for a
a site should not exceed 450Mbit/s, notwithstanding already running tests which
may significantly exceed this number.
*/
local MaxRate1g = 150000000;

/*
The max-rate for the -txcontroller.max-rate flag for ndt-server for 10Gbit/s
sites is set to 2.5Gbit/s, which should mean that the combined throughput for a
a site should not exceed 7.5Gbit/s, notwithstanding already running tests which
may significantly exceed this number.
*/
local MaxRate10g = 2500000000;

{
[site.name]: if site.transit.uplink == '1g' then MaxRate1g else MaxRate10g
[site.name]: site.MaxRate()
for site in sites
if site.annotations.type == 'physical'
}
24 changes: 24 additions & 0 deletions lib/site.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,30 @@ local version = std.extVar('version');
else if subnet == 28 then 11
else 3
),
// MaxRate returns the appropriate value for the -txcontroller.max-rate flag
// of ndt-server. It only applies to physical machines. The _general_ rule is
// that the value for "minimal" (i.e., single server) sites should be 3x the
// rate for a "full" site. The one exception to this is for 1g sites, where a
// single fast client could exhaust the circuit, in which case we keep the
// value for minimal sites lower.
MaxRate():: (
local subnet = $._net_subnet($.network.ipv4.prefix, 'v4');
local uplink = $.transit.uplink;
if uplink == '1g' then
if subnet == 26 then
// 150Mbits/s
150000000
else
// 300Mbits/s
300000000
else
if subnet == 26 then
// 2.5Gbits/s
2500000000
else
// 7.5Gbits/s
7500000000
),

// Extract the last octet as an integer.
_v4_net_offset(net):: std.parseInt(std.split(std.split(net, '/')[0], '.')[3]),
Expand Down

0 comments on commit 483dfea

Please sign in to comment.