From 148e1c7a926307d791b72bf7ad8eddcd4c7a23b1 Mon Sep 17 00:00:00 2001 From: Kaloyan Tanev <24719519+KaloyanTanev@users.noreply.github.com> Date: Tue, 11 Jun 2024 18:13:56 +0200 Subject: [PATCH] cmd: new thresholds for test command (#3132) Revise thresholds for pinging and BN peers. category: misc ticket: none --- cmd/testbeacon.go | 10 ++++++---- cmd/testpeers.go | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cmd/testbeacon.go b/cmd/testbeacon.go index e68b4d9cd..5d509d308 100644 --- a/cmd/testbeacon.go +++ b/cmd/testbeacon.go @@ -29,8 +29,10 @@ type testBeaconConfig struct { type testCaseBeacon func(context.Context, *testBeaconConfig, string) testResult const ( - thresholdBeaconPeersAvg = 20 - thresholdBeaconPeersBad = 5 + thresholdBeaconMeasureAvg = 40 * time.Millisecond + thresholdBeaconMeasureBad = 100 * time.Millisecond + thresholdBeaconPeersAvg = 50 + thresholdBeaconPeersBad = 20 ) func newTestBeaconCmd(runFunc func(context.Context, io.Writer, testBeaconConfig) error) *cobra.Command { @@ -256,9 +258,9 @@ func beaconPingMeasureTest(ctx context.Context, _ *testBeaconConfig, target stri return failedTestResult(testRes, errors.New("status code %v", z.Int("status_code", resp.StatusCode))) } - if firstByte > thresholdMeasureBad { + if firstByte > thresholdBeaconMeasureBad { testRes.Verdict = testVerdictBad - } else if firstByte > thresholdMeasureAvg { + } else if firstByte > thresholdBeaconMeasureAvg { testRes.Verdict = testVerdictAvg } else { testRes.Verdict = testVerdictGood diff --git a/cmd/testpeers.go b/cmd/testpeers.go index 55e4b15bf..12e2897f3 100644 --- a/cmd/testpeers.go +++ b/cmd/testpeers.go @@ -47,10 +47,14 @@ type testPeersConfig struct { type testCasePeer func(context.Context, *testPeersConfig, host.Host, p2p.Peer) testResult const ( - thresholdMeasureAvg = 200 * time.Millisecond - thresholdMeasureBad = 500 * time.Millisecond - thresholdLoadAvg = 200 * time.Millisecond - thresholdLoadBad = 500 * time.Millisecond + thresholdMeasureAvg = 50 * time.Millisecond + thresholdMeasureBad = 240 * time.Millisecond + thresholdLoadAvg = 50 * time.Millisecond + thresholdLoadBad = 240 * time.Millisecond + thresholdPeersMeasureAvg = 50 * time.Millisecond + thresholdPeersMeasureBad = 240 * time.Millisecond + thresholdPeersLoadAvg = 50 * time.Millisecond + thresholdPeersLoadBad = 240 * time.Millisecond ) func newTestPeersCmd(runFunc func(context.Context, io.Writer, testPeersConfig) error) *cobra.Command { @@ -502,9 +506,9 @@ func peerPingMeasureTest(ctx context.Context, _ *testPeersConfig, tcpNode host.H return failedTestResult(testRes, result.Error) } - if result.RTT > thresholdMeasureBad { + if result.RTT > thresholdPeersMeasureBad { testRes.Verdict = testVerdictBad - } else if result.RTT > thresholdMeasureAvg { + } else if result.RTT > thresholdPeersMeasureAvg { testRes.Verdict = testVerdictAvg } else { testRes.Verdict = testVerdictGood @@ -549,9 +553,9 @@ func peerPingLoadTest(ctx context.Context, conf *testPeersConfig, tcpNode host.H highestRTT = val.RTT } } - if highestRTT > thresholdLoadBad { + if highestRTT > thresholdPeersLoadBad { testRes.Verdict = testVerdictBad - } else if highestRTT > thresholdLoadAvg { + } else if highestRTT > thresholdPeersLoadAvg { testRes.Verdict = testVerdictAvg } else { testRes.Verdict = testVerdictGood