Skip to content

Commit

Permalink
Merge pull request #183 from Desiki-high/doc-gc
Browse files Browse the repository at this point in the history
docs: add garbage-collection.md for gc
  • Loading branch information
imeoer authored Sep 6, 2023
2 parents f1e1593 + afc764f commit ef20453
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,5 @@ We can specify the driver name by modifying `converter.driver` in the configurat

## Documentation

* [API](./docs/api.md)
* [API](./docs/api.md)
* [Garbage Collection](./docs/garbage-collection.md)
30 changes: 30 additions & 0 deletions docs/garbage-collection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Garbage Collection

`Acceleration Service` has a garbage collector capable of removing resources
which are not used for a long time or unfrequently. The garbage collector consists
of leaseManager and leaseCache. The `acceld` has responsible for
ensuring that all resources(blobs) which are stored locally are held by
[leases](https://github.com/containerd/containerd/blob/main/docs/garbage-collection.md#what-is-a-lease)
at all times, else they will be cleared.

## What is leaseManager and leaseCache ?

`Acceleration Service` uses `leaseManager` and `leaseCache` to manager all leases
which are persisted in boltdb. The `leaseManager` will creat a new lease for the
new blob and delete leases of the blobs which should be cleared away.
The `leaseCache` will sync with the leases which are persisted in boltdb and provide
the lease that should be cleared in LFRU(LFU first, LRU second) order. The `acceld` will
init `leaseCache` when daemon started.

## Garbage Collection Policy

Garbage Collection can be triggered in two ways. Firstly, gc will be triggered after each
task completed. Secondly, gc has scheduled tasks every hourly since dameon started. GC clears
the blobs until local storage size below 80% of the threshold. Specially, scheduled gc tasks
clear the blobs until local storage size below 40% of the threshold.

## Garbage Collection Configuration

| Configuration | Example |Description |
|---|---|---|
| `gcpolicy.threshold` | "100MB" |size threshold that triggers GC, the `gc` will start reclaim blobs if exceeds the size. |

0 comments on commit ef20453

Please sign in to comment.