New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WAL watcher has high CPU usage with low throughput #11625
Comments
I played around with an fsnotify approach and couldn't get it to work as expected. At least on my Mac, fsnotify was only emitting events every ~60 seconds with a 5 second scrape interval. I can't figure out why, which isn't giving me much faith in the fsnotify-based approach. |
Some additional brainstorming... a combination of 1 and 2 could be considered.
|
Closed by #11949 |
grafana/agent#1148 reports unexpectedly high CPU usage (~4-6%) at very low metric workloads.
I've been able to track this down to being at least partially due to the WAL watcher, which tails the latest WAL segment every 10ms, and checks for new segments every 100ms. This is very high for a process which only scrapes a single target every minute, and causes a lot of unnecessary CPU time being spent.
To verify the issue, I tried a read period of 1s, a segment read period of 1m, and a checkpoint period of 1h. This lowered my CPU usage from 4% to <1%.
I see a few potential resolutions to this issue:
*sync.Cond
) from the storage.Appendable implementation to the WAL reader to notify that new samples have been written to the WALIs there a reason fsnotify isn't already being used for this?
The text was updated successfully, but these errors were encountered: