moby / moby/buildkit

metrics for cache size / prune pauses

Open
#4,401 5 comments 0 reactions 1 assignee View on GitHub

@jsternberg is already working on this.

Since Dec 5, 2023.

Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

Why

We've seen issues where buildkit will sometimes pause for a long time while the cache manager is doing a prune().

It's fairly straightforward to reproduce this in isolation. A test that creates 1,000 cache entries then garbage collects them will hold the cache lock for about ~15s on my machine. But we don't have good visibility into how frequent these pauses are in a live system.

Feature request

Can we add a prometheus handler that exposes some metrics about cache / prune behavior?

A good place to start would be to take some inspiration from the pause metrics that Go itself uses for its GC (PauseTotalNs and PauseNs in https://pkg.go.dev/runtime#MemStats)

  • A Gauge metric that tracks how many cache records are currently tracked by the CacheManager
  • A Counter metric that tracks how much time, cumulatively, have been spent prune()
  • A Histogram metric that tracks how long a single prune() takes (maybe 0.1s, 1s, 10s, 100s+)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.