Skip to content

dbcleanup: add a dedicated cleanup worker mode#205

Open
sharmila-oai wants to merge 1 commit intobuildbarn:mainfrom
sharmila-oai:sharmila/cleanup-worker-flag
Open

dbcleanup: add a dedicated cleanup worker mode#205
sharmila-oai wants to merge 1 commit intobuildbarn:mainfrom
sharmila-oai:sharmila/cleanup-worker-flag

Conversation

@sharmila-oai
Copy link

@sharmila-oai sharmila-oai commented Mar 10, 2026

bb-portal currently starts the database cleanup loop inside every serving process. In a multi-replica deployment that multiplies cleanup work, makes compaction backlogs more expensive, and ties cleanup failures directly to the request-serving pods. We were seeing OOMs with especially trying to compact incomplete_build_logs.

Add a --cleanup-worker-only mode that starts only the BES cleanup loop. This lets deployments run cleanup in a separate singleton worker pod while leaving normal bb-portal replicas focused on serving traffic. I was thinking this could be a separate deployment and just re-use the backend image for bb-portal.

Also put a small ordered batch limit on CompactLogs(). A single cleanup pass should not try to compact every eligible invocation in one shot when there is a large backlog.

`bb-portal` currently starts the database cleanup loop inside every serving
process. In a multi-replica deployment that multiplies cleanup work, makes
compaction backlogs more expensive, and ties cleanup failures directly to the
request-serving pods.

Add a `--cleanup-worker-only` mode that starts only the BES cleanup loop. This
lets deployments run cleanup in a separate singleton worker pod while leaving
normal `bb-portal` replicas focused on serving traffic.

Also put a small ordered batch limit on `CompactLogs()`. A single cleanup pass
should not try to compact every eligible invocation in one shot when there is a
large backlog.
@sharmila-oai sharmila-oai force-pushed the sharmila/cleanup-worker-flag branch from 1c27947 to ab6ff10 Compare March 10, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant