profile: configure the peers and report the kernel's change counts
The full-table profiling script took its peers as unconfigured ones under the permissive policy, which is not how a router is set up. Now it writes a peer block for each of them, with `expected_routes` set to the table's size, so that the default import policy and anything that sizes itself by the expected routes are in the measurement. The few bogon prefixes in the synthetic table are refused by that policy, as the output says. After the table is in, the script also prints `bgp_kernel_route_changes_total`, so that a run shows how many installs and removals the kernel was asked for and not only how many routes it ended up with. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
1bc71aaac5
commit
5915c8e562
1 file changed
+16
-5
@@ -78,14 +78,27 @@ peer ping -c 1 -W 2 192.0.2.254 > /dev/null || fail "the namespaces do not reach
|
|||||||
|
|
||||||
# An AS number that is in none of the synthetic paths: a route with the
|
# An AS number that is in none of the synthetic paths: a route with the
|
||||||
# daemon's own AS in its path is refused as a loop.
|
# daemon's own AS in its path is refused as a loop.
|
||||||
|
prefixes=$(( 1000000 / scale + 230000 / scale ))
|
||||||
|
routes=$(( prefixes * peers ))
|
||||||
cat > "$out/daemon.textpb" <<CONFIG
|
cat > "$out/daemon.textpb" <<CONFIG
|
||||||
router_id: "192.0.2.254"
|
router_id: "192.0.2.254"
|
||||||
local_asn: 4200000000
|
local_asn: 4200000000
|
||||||
listen_endpoints { address: "192.0.2.254" port: 1790 }
|
listen_endpoints { address: "192.0.2.254" port: 1790 }
|
||||||
http_endpoint { address: "127.0.0.1" port: 8080 }
|
http_endpoint { address: "127.0.0.1" port: 8080 }
|
||||||
# The synthetic peers are not configured; they connect from 192.0.2.N.
|
|
||||||
accept_unconfigured_peers: true
|
|
||||||
CONFIG
|
CONFIG
|
||||||
|
# The peers are configured as a router's would be, with how many routes
|
||||||
|
# to expect of each; the synthetic table has a few bogons, which the
|
||||||
|
# default import policy refuses.
|
||||||
|
for n in $(seq "$peers"); do
|
||||||
|
cat >> "$out/daemon.textpb" <<CONFIG
|
||||||
|
peers {
|
||||||
|
name: "peer$n"
|
||||||
|
endpoint { address: "192.0.2.$n" port: 179 }
|
||||||
|
remote_asn: $(( 64512 + n ))
|
||||||
|
expected_routes: $prefixes
|
||||||
|
}
|
||||||
|
CONFIG
|
||||||
|
done
|
||||||
if [ "$kernel" = 1 ]; then
|
if [ "$kernel" = 1 ]; then
|
||||||
echo 'kernel { stale_seconds: 0 }' >> "$out/daemon.textpb"
|
echo 'kernel { stale_seconds: 0 }' >> "$out/daemon.textpb"
|
||||||
fi
|
fi
|
||||||
@@ -100,9 +113,6 @@ status() { run curl -sf "http://127.0.0.1:8080/api/$1" | jq -r "$2"; }
|
|||||||
now() { date +%s.%N; }
|
now() { date +%s.%N; }
|
||||||
since() { echo "$(now) - $1" | bc; }
|
since() { echo "$(now) - $1" | bc; }
|
||||||
|
|
||||||
prefixes=$(( 1000000 / scale + 230000 / scale ))
|
|
||||||
routes=$(( prefixes * peers ))
|
|
||||||
|
|
||||||
sudo perf record -F "$freq" -g -o "$out/perf.data" -p "$daemon_pid" > "$out/perf.log" 2>&1 &
|
sudo perf record -F "$freq" -g -o "$out/perf.data" -p "$daemon_pid" > "$out/perf.log" 2>&1 &
|
||||||
perf_pid=$!
|
perf_pid=$!
|
||||||
sleep 1
|
sleep 1
|
||||||
@@ -136,6 +146,7 @@ if [ "$kernel" = 1 ]; then
|
|||||||
fi
|
fi
|
||||||
rss=$(awk '/VmRSS/ { printf "%.0f", $2 / 1024 }' "/proc/$daemon_pid/status")
|
rss=$(awk '/VmRSS/ { printf "%.0f", $2 / 1024 }' "/proc/$daemon_pid/status")
|
||||||
echo "daemon: $rss MiB resident with the table in"
|
echo "daemon: $rss MiB resident with the table in"
|
||||||
|
run curl -sf http://127.0.0.1:8080/metrics | grep '^bgp_kernel_route_changes_total' | sed 's/^/kernel: /'
|
||||||
sleep 1
|
sleep 1
|
||||||
sudo kill -INT "$perf_pid"
|
sudo kill -INT "$perf_pid"
|
||||||
wait "$perf_pid" || true
|
wait "$perf_pid" || true
|
||||||
|
|||||||
Reference in new issue
Block a user