Skip to content

Commit

Permalink
cmd: new thresholds for test command (#3132)
Browse files Browse the repository at this point in the history
Revise thresholds for pinging and BN peers.

category: misc
ticket: none
  • Loading branch information
KaloyanTanev authored Jun 11, 2024
1 parent 13f5f31 commit 148e1c7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
10 changes: 6 additions & 4 deletions cmd/testbeacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down
20 changes: 12 additions & 8 deletions cmd/testpeers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 148e1c7

Please sign in to comment.