-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write a cache cleaner for a file system #673
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5a0981f
Add a README for the cache cleaner
alexwlchan 48dd9e5
Remove old files and empty directories
alicefuzier 0569565
Merge branches 'efs-cache-cleaner' and 'master' of github.com:wellcom…
alicefuzier 4f65155
[WIP] getting directory size
alicefuzier 5c8a775
Add docstrings/comments, move to utils file
alexwlchan 0c6a6fa
Note a few TODOs
alexwlchan cbe2b36
word choice
alexwlchan 54b7e51
Delete oldest access file until desired cache size is reached and add…
alicefuzier d3589a0
Wrap in a docker container
alicefuzier d16c719
Review markups
alexwlchan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# efs_cache_cleaner | ||
|
||
This service allows us to purge our EFS cache based on the age and size of items. | ||
|
||
Some of our ECS applications use local storage as a cache (for example, Loris). | ||
Because ECS instances have very little disk space, we use an EFS mount rather than the host disk. | ||
However, EFS storage has a price – although it can grow to any size, it would be expensive to let it do so! | ||
This service deletes files from our EFS cache to keep our costs sustainable. | ||
|
||
Our caches are bounded by two configurable: | ||
|
||
* **maximum age** -- if an item is in the cache but hasn't been accessed for more than 30 days, there isn't much value in keeping it in the cache. | ||
We can delete it, and re-fetch it the next time it's requested. | ||
|
||
* **maximum size** -- EFS storage is priced based on how much you use. | ||
If the cache exceeds a given size, we can delete items from the cache until it comes back under the limit. | ||
Items are deleted in order of last access time -- items which haven't been accessed very recently are deleted first. | ||
|
||
Both of these parameters are configurable. | ||
|
||
Although we're using EFS, a lot of the core logic could be repurposed to run against a conventional file system. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/s/configurable/parameters