Fix broken latency measurements with more conservative optimizations
- Increased ping interval to 500ms (was too aggressive at 200ms) - Set reasonable timeouts: 2s for liveness, 5s for latency - Reduced workers to 40/60 (from 50/100) to avoid overwhelming network - Kept reduction from 5 to 3 pings for modest speed improvement The previous 200ms interval was causing the ping library to return 0 latency for all measurements, making results meaningless.
This commit is contained in:
parent
df3c6c6a0e
commit
463a0a6cd5
@ -91,8 +91,8 @@ func CollectRelayLatencies(relays []Relay) []RelayLatency {
|
||||
livenessResults := make(chan RelayLatency, len(relays))
|
||||
bar := progressbar.Default(int64(len(relays)), "Checking liveness")
|
||||
|
||||
// Start 50 workers for liveness checks (increased from 20)
|
||||
numLivenessWorkers := 50
|
||||
// Start 40 workers for liveness checks (increased from 20)
|
||||
numLivenessWorkers := 40
|
||||
for w := 0; w < numLivenessWorkers; w++ {
|
||||
wg.Add(1)
|
||||
go livenessWorker(w, livenessJobs, livenessResults, &wg, bar)
|
||||
@ -123,8 +123,8 @@ func CollectRelayLatencies(relays []Relay) []RelayLatency {
|
||||
latencyResults := make(chan RelayLatency, len(liveRelays))
|
||||
bar = progressbar.Default(int64(len(liveRelays)), "Measuring latency")
|
||||
|
||||
// Start 100 workers for latency checks (increased from 30)
|
||||
numLatencyWorkers := 100
|
||||
// Start 60 workers for latency checks (increased from 30)
|
||||
numLatencyWorkers := 60
|
||||
for w := 0; w < numLatencyWorkers; w++ {
|
||||
wg.Add(1)
|
||||
go latencyWorker(w, latencyJobs, latencyResults, &wg, bar)
|
||||
|
@ -43,7 +43,7 @@ func (r Relay) CheckLiveness() (bool, time.Duration, error) {
|
||||
return false, 0, err
|
||||
}
|
||||
pinger.Count = 1
|
||||
pinger.Timeout = 1 * time.Second // Reduced from 3 seconds for faster checks
|
||||
pinger.Timeout = 2 * time.Second // More reasonable timeout
|
||||
pinger.SetPrivileged(true)
|
||||
if err := pinger.Run(); err != nil {
|
||||
return false, 0, err
|
||||
@ -70,8 +70,8 @@ func (r Relay) MeasureLatency() (time.Duration, error) {
|
||||
return 0, err
|
||||
}
|
||||
pinger.Count = 3 // Reduced from 5 to 3 for faster measurements
|
||||
pinger.Interval = 200 * time.Millisecond // Reduced from 1 second to 200ms
|
||||
pinger.Timeout = 3 * time.Second // Adjusted timeout for 3 pings
|
||||
pinger.Interval = 500 * time.Millisecond // 500ms interval for reliable measurements
|
||||
pinger.Timeout = 5 * time.Second // Reasonable timeout for 3 pings
|
||||
pinger.SetPrivileged(true)
|
||||
if err := pinger.Run(); err != nil {
|
||||
return 0, err
|
||||
|
Loading…
Reference in New Issue
Block a user