Skip to content

Feature/dynamic timeout#80

Open
boy-hack wants to merge 7 commits intomainfrom
feature/dynamic-timeout
Open

Feature/dynamic timeout#80
boy-hack wants to merge 7 commits intomainfrom
feature/dynamic-timeout

Conversation

@boy-hack
Copy link
Owner

No description provided.

- Add rttSlidingWindow struct using EWMA (alpha=0.125, beta=0.25, RFC 6298)
- Add effectiveTimeoutSeconds() on Runner: returns dynamic timeout when
  DynamicTimeout=true and RTT samples exist, else falls back to fixed config
- Record RTT sample in recv.go when DNS response arrives (statusDB.Get -> time.Since)
- Use effectiveTimeoutSeconds() in retry.go instead of r.timeoutSeconds
- Add DynamicTimeout bool to Options, commonFlags (--dynamic-timeout / -dt),
  enum.go, verify.go CLI wiring, and sdk.Config
- Default: false (opt-in), preserving existing behaviour
- Timeout upper bound = user --timeout, lower bound = 1s
… timeout

- Remove Options.TimeOut and Options.DynamicTimeout fields
- Remove SDK Config.Timeout and Config.DynamicTimeout fields
- Remove --timeout and --dynamic-timeout CLI flags
- Dynamic RTT timeout is now always enabled; upper bound hardcoded to
  rttMaxTimeoutSeconds=10s, lower bound rttMinTimeoutSeconds=1s
- rttSlidingWindow initialized unconditionally in New()
- recv.go: RTT sampling runs unconditionally (no DynamicTimeout guard)
- effectiveTimeoutSeconds() now simply delegates to rttTracker
- Update retry.go comment to reflect new design
- Add recvBackpressure int32 field to Runner (atomic flag)
- In recv.go: monitor packetChan utilization in the reader goroutine;
  set recvBackpressure=1 when len>=80% (8000), clear to 0 when len<=50% (5000)
- In send.go: sendBatch checks recvBackpressure and sleeps 5ms when set,
  allowing the recv pipeline (packetChan->dnsChan->resultChan) to drain
  instead of piling up and dropping packets
- Also remove TimeOut from runner_test.go (field no longer exists)
- Remove the retryDomainCh channel + 4 worker goroutines
  (was: statusDB.Scan -> retryDomainCh -> worker -> domainChan -> sendCycle)
  (now: statusDB.Scan -> update statusDB -> send() directly, grouped by DNS server)
- Group retried domains by DNS server in dnsBatches map; send each group
  consecutively to reduce pcap handle contention and per-call overhead
- Pre-compute effectiveTimeoutSeconds() once per tick instead of per domain
- Reuse items slice and dnsBatches map across ticks to reduce GC pressure
- Skip recv-deleted domains: check statusDB.Get before updating retry state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant