Your repository manager and registry hold 40 TB and grow 2 TB a month; what retention policy would you commit the organisation to, and why?
answer
- not one class of artifact
- recreatable or not
- a recovery window
- quotas cap, never clean
- replication changes deletes
basics
~20 sClassify content by what deleting it costs: proxy caches by last download, snapshots and per-commit builds by keep-newest-N, releases kept long, deployed digests exempt. Add previews, a soft-delete recovery window, a reclaim schedule, team quotas and an owner reviewing growth.
solid answer
~40 sI would not pick one age for everything. I'd split content by what a deletion costs: proxy caches can usually be fetched again, so they go by days since last download; snapshots, pre-releases and per-commit images keep the newest few per component; releases stay long and leave only after review; anything deployed is exempt through a tag retention always keeps. Every policy change ships with a preview or dry run, deletions pass through a recovery window (soft delete with a compaction delay, or a trash can), and compaction or garbage collection runs on a schedule the registry can afford, since some need a read-only window. Quotas cap teams but delete nothing, and replication matters: some replicas never see deletions, federated members all do. An owner reviews growth monthly against the 2 TB baseline.
go deeper
Know that different content deserves different rules, and that quotas stop growth without deleting anything.
Explain the criteria each class uses, the gap between a soft delete and reclaimed space, and how hard and soft quotas behave differently.
Show the safeguards: an exemption list of deployed digests, a preview on every policy change, a recovery window, and how replication or federation spreads a deletion.
Own the trade-off between storage cost and recoverability, set content classes with owners and review cadence, and be able to explain any deletion the policy makes.
## The numbers first A repository manager and registry holding **40 TB and growing 2 TB a month** will pass 60 TB within a year if nothing changes. Storage cost is the visible symptom; the hidden ones are slower collection and compaction runs, longer backups and restores, and a growing pile of content nobody can say is safe to remove. A lead's job here is not to pick a number of days. It is to decide which content may be deleted, on what evidence, by whom, and how quickly the space must come back, and to make that a written policy rather than a one-off cleanup. ## Classify content by what a deletion costs The single most useful step is to stop treating "artifacts" as one class: | Content class | Can it be recreated? | Typical rule | |---|---|---| | Proxy caches of public registries | usually, by fetching again, while the upstream still serves it | delete by days since last download | | Snapshots, pre-releases, per-commit images | yes, by rebuilding, but nobody should need them | keep the newest N per component, short age | | Released versions | not reliably byte for byte | keep long; delete only if never downloaded for a long period, after review | | Anything currently deployed | no, and deleting it breaks things | exempt by a retained tag or pattern | Some caveats belong in the policy itself: - **Proxy content is not free to delete.** A public package can be withdrawn or the upstream can be down when you need it; if an air-gapped site depends on the cache, it is a primary copy. - **Rollback windows are a delivery rule.** How many past releases a deployment must be able to return to is decided with delivery, and retention must honour it, not invent it. - **Compliance may require keeping releases** for years, which makes a release repository's growth a fixed cost to plan for, not a target to cut. ## Decide how deletions happen A policy that only lists criteria is half a policy. It also needs: 1. **A preview on every change.** Nexus Repository's preview, Artifactory's dry run and Harbor's dry run all exist; the rule should be that no policy change ships without someone reading one. 2. **A recovery window.** Soft delete followed by compaction in Nexus Repository, a configurable **Blobs Older Than** delay, or Artifactory's **Trash Can** turn an over-broad rule into a restore rather than an incident. 3. **A reclaim schedule.** Compaction and registry garbage collection are separate jobs. The open-source Distribution registry needs a read-only window for collection; Harbor collects online. That difference decides how often you can afford to reclaim. ## Quotas: a brake, not a cleaner Quotas cap growth per team, but they delete nothing: - **Harbor project quotas** are hard: a project cannot exceed one, and retention rules cannot bypass it. A push that would exceed it fails. A new global default applies only to projects created afterwards, and a blob shared by several projects counts once in each, so the sum of quotas can exceed the disk. - **Nexus Repository soft quotas** only alert and mark a blob store unhealthy; writes continue. Hard quotas push teams to own their usage; soft quotas give the platform team warning. One workable split is soft limits on shared stores and hard limits on team-owned projects. ## Replication changes the blast radius - **Nexus Repository content replication does not replicate deletions**, so each instance needs its own policies, or the replica grows forever. - **Artifactory federated repositories propagate deletions to every member**; a policy should run on one member only, and its deletions are irreversible unless the Trash Can is enabled on that member. - A remote cache in another instance can make content look unused at its source: an Artifactory smart remote repository reports its downloads back to the source so cleanup there sees them. ## What the lead commits to - the content classes and the rule for each, written down and versioned; - the evidence a deletion needs: age, last download, and an exemption list of deployed digests; - the recovery window, and who may restore; - the reclaim schedule and its maintenance windows; - quota levels per team, and the escalation when one is hit; - an owner who reviews growth monthly against the 2 TB baseline. ## The trade-offs Aggressive retention saves storage and speeds every maintenance job, but risks deleting something a build, an audit or a rollback needs. Conservative retention is safe but turns the repository into an archive that costs more each month. There is no universally right answer; the right policy is the one whose deletions the organisation can explain and, within its recovery window, undo.
- Why should cached proxy content be treated differently from hosted releases?Cached proxy content can usually be fetched from upstream again, so deleting it by days since last download is cheap. A hosted release exists only in your repository, so deleting it is final once the delete is reclaimed. The caveat is that the upstream may withdraw a version or be down, and an air-gapped site's cache is a primary copy.
- What changes in the policy when repositories are replicated to a second site?It depends on the replication. Nexus Repository content replication does not replicate deletions, so the target needs its own cleanup policies or it grows without bound. Artifactory federated repositories propagate deletions to every member, so run the policy on one member and enable the Trash Can there, because propagated deletions are otherwise irreversible.
- Would you use hard or soft storage quotas?Hard quotas, such as Harbor's project quotas, stop a push that would exceed them and cannot be bypassed by retention rules, so teams must clean up their own projects. Soft quotas, such as Nexus Repository's, only alert. One workable split is hard quotas on team-owned projects and soft quotas on shared stores the platform team manages.
- Delete everything older than a fixed number of days, whatever its type.
- Proxy caches are always safe to purge because the upstream will still serve them.
- A storage quota by itself keeps a repository's growth bounded.
- Retention is a one-off cleanup project rather than a scheduled, owned policy.
- Every kind of replica receives the source's deletions, so one policy covers all sites.