prometheus-community / windows_exporter

Prometheus exporter for Windows machines

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

perflib `queryRawData` takes a long time

nitroxis opened this issue · comments

On my machine, queryRawData takes a long time (about 15 seconds) and consumes quite a lot of CPU cycles. Taking a peek using a debugger, it seems that the RegQueryValueEx loop is doing many iterations due to a too small buffer. After it finally completes, the buffer has grown from 150KB to over 2MB.

One potential fix would be doubling the buffer size each iteration instead of growing it by 16KB. Or one could maybe cache the bufLen value for later calls?

Could you please verify, if #1376 (comment) solves your issue?

I'm using the windows_exporter version included with Grafana Agent Flow, but I can try the standalone version.

I can confirm that it seems to be substantially faster now with the exe you provided

Heads up the same fix is going to be released in the Agent today.