fix: improve large subnet scan reliability - #320
Conversation
|
50 seconds to scan a /22 seems really high to me? Gotta be some way to improve past that... |
|
Yeah, I'm not thrilled about that result either (it's closer to 2m with the tcp probe and the miner discovery added together). I'll move it from a draft once I get something I think is effective. |
|
Not sure if its just me or what, scanning a local network, /20 subnet (~4k addresses), it seems to have no consistency issues AFTER an initial run. For some reason that first run just wants to miss stuff. Is there anything we can do to make the ARP table less garbage at its job? |
|
I also do see significant improvements once the ARP table/cache starts getting filled out. |
|
Some sloppified suggestions, maybe somewhere to start looking. I have curated out the irrelevant ones, but some things to look into here possibly. Scan reliability and concurrency findingsAfter reviewing Confirmed issues
Possible contributing issues
Lower-priority follow-ups
Suggested initial changesThe highest-priority change is to fix After that, testing should compare:
Metrics for timeouts, refused connections, unreachable hosts, resource errors, and retry recoveries would help determine whether missed devices are caused by transient network loss or local resource exhaustion. |
|
Maybe also worth looking at the relevant scanning section from btctools, it seems pretty consistent. https://github.com/btccom/libbtctools/blob/master/src/miner/MinerScanner.cpp |
|
I'll take a look, I appreciate the direction. |
|
Benchmarks significantly improved with these defaults, and changes to the tcp retries. Sometimes on a cold network scan it will drop considerable miners, but I don't see a simple way to get around that. In this test environment over a vpn to another farm the ARP caching happens downstream so just running it again is the best I can do. I found that there was a potential unlimited wait for certain umcos endpoints for the identification stage, and those now time out. I was unable to reproduce those situations running repeated scans for 6 hours but it's the only place I see the potential for multi-minute scans to get stuck. Probably best for other issues so I didn't include the changes here:
Update summaryUpdated defaults
TCP ports 80, 4028, 4029, and 8889 are checked concurrently for each address. TCP probing and firmware identification remain separate bounded stages. The connectivity retry behavior was corrected so that configuring zero retries still performs the initial TCP attempt. APIs. Benchmark resultsTesting used a routed /22 network with approximately 461 supported devices. The selected configuration consistently found 460 devices in five consecutive end-to-end release scans, completing in approximately 19.6–21.5 seconds. Identification concurrency remained above 99% recall through 256, but degraded at higher values: Concurrency Mean detected Minimum recall Mean duration A separate TCP-probe benchmark produced 100% recall across five runs at concurrency 256 and averaged approximately 1.58 seconds. Misses began appearing at concurrency 478. Latency measurements across roughly 4,500 successful device constructions supported the new timeout bounds. Miner construction had a p99.9 of approximately 2.7 seconds and a maximum of approximately 3.0 seconds, leaving meaningful A global socket semaphore and connection-start rate limiter were not added. The current evidence did not isolate connection-start rate as a problem independently of network and neighbour-cache warm-up effects. Validation
|
|
I'd also like some input on the desired scope of PRs. I can subdivide PRs into more atomic changes like update constants, make tcp port scan parallel etc if that would make review easier. In my head these are all scan improvements so they belong together. These current changes are full of AI slop so I still have to review them before I take this out of draft -- but I am happy with what the benchmarking shows. |
Closes #319
Summary
attempts.
Performance
11.7s to scan a /22 subnet with 441 target devices
Reliability considerations
The initial benchmark ran Nmap immediately before each test, which warmed neighbor and ARP state. Cold end-to-end scans demonstrated that
TCP probing could still miss responsive miners transiently. For this reason, TCP results are not a hard exclusion by default.
Strict filtering is still available for callers that prefer minimum scan time and can tolerate possible false negatives.
Validation