We're experiencing performance issues with the OS collector timing out on our production nodes. This seems in line with other collectors having performance issues when using WMI, so I'd like to suggest we replace the OS collector's metrics with compatible metrics from more performant sources.
I've found sysinfoapi which contains much of the same information as the WMI Operating System class. Perhaps this would make a good candidate for replacement?
My colleagues and I are doing some PoCs on this, so I thought I'd create this issue to track our efforts and seek feedback from maintainers.
This sounds similar to #649 where sysinfo is replacing WMI for the process collector.
Personally, I'm eager to replace any remaining usage of WMI if we can show the replacement is stable and fast, which isn't difficult as WMI sets such a low bar.
Would you be keen to open a Pull Request for this?
Thanks @breed808,
Yeah absolutely. We will write an implementation and some benchmarks, and come back here with results and PR once we confirm it's all working as intended.
Cheers!
Wow, well I decided to benchmark changes for the CS collector, as we're also having troubles with it and it seemed simpler than the OS to attack first. My branch is here
Current benchmark using WMI:
```goos: windows
goarch: amd64
pkg: github.com/prometheus-community/windows_exporter/collector
BenchmarkCsCollect-16 110 10972730 ns/op 4102 B/op 152 allocs/op
PASS
ok github.com/prometheus-community/windows_exporter/collector 3.267s
and new benchmark using sysinfoapi:
goos: windows
goarch: amd64
pkg: github.com/prometheus-community/windows_exporter/collector
BenchmarkCsCollect-16 28776 42153 ns/op 25440 B/op 36 allocs/op
PASS
ok github.com/prometheus-community/windows_exporter/collector 2.704
```
So a speedup of 262x... Not bad! I'll hopefully tackle the OS collector next and get a PR ready.
Performance is looking very nice, I've run the benchmarks and have a similar result on a testing Windows 10 VM.
Looking forward to the PR :smiley:
PR #702
Most helpful comment
Performance is looking very nice, I've run the benchmarks and have a similar result on a testing Windows 10 VM.
Looking forward to the PR :smiley: