-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #183 from Desiki-high/doc-gc
docs: add garbage-collection.md for gc
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |