Skip to content

Eviction backlog cleaning prevents bazel-remote from starting #898

Description

@ofats

We currently use grpc proxy with a single backend pod writing/reading to NFS (single as it cannot write there concurrently out of the box). Restarts to this single pod take tens of minutes for eviction (10TB disk) backlog cleaning:

if c.lru.queuedEvictionsSize.Load() > 0 {
// We were either restarted with a lower cache size, or there is still
// a backlog of blobs to be removed. Wait for them to be removed before
// accepting connections, to avoid confusing error logs.
log.Println("Waiting for blob eviction backlog to complete.")
for c.lru.queuedEvictionsSize.Load() > 0 {
time.Sleep(200 * time.Millisecond)
}
log.Println("Finished waiting for blob evictions.")
}
log.Println("Finished loading disk cache files.")

As the result, we get into the following situation:

  • listeners are not up
  • => backend is not accessible
  • => frontend bazel-remote nodes are timing out on every request to backend
  • => clients wait for frontends to Get/Put to backend, rather than failing fast
  • => builds are slower with cache than if they were without it

Frontends have smaller local host dist, not able to hold the whole working set of cache, thus they need to go to backend for cold data.

There are 2 solutions to this:

  1. (simpler) Only wait for backlog to clean up if MAX_SIZE_HARD_LIMIT is set - there is literally no point of waiting for this cleanup if hard limit is not set - user takes the risk of disk overflow in this case
  2. (harder, but better) Start accepting connections and make disk cleanup in background (just like in normal non-startup flow). If MaxSize is close to MaxSizeHardLimit, Puts can reply "507 InsufficientStorage", just like they do already

I read comments in code and commit descriptions, but I don't see a good reason why this long blocking operation was put as a startup guard in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions