Commit 180dd42
committed
gocached, cmd/gocached: add storage tiering and a separate SQLite dir
Our AWS cache instance stores everything on its ephemeral NVMe disk, so
the whole cache is lost on every reboot and its size is capped by the
local disk. Let the blob directory live on a big slow filesystem (an S3
Files NFS mount) as the source of truth, with a new optional --hot-dir
flag naming a fast local tier (NVMe) holding a bounded copy of recently
used blobs, capped by --hot-capacity-gb. The new --sqlite-dir flag lets
the metadata database live on its own volume (EBS), defaulting to the
blob directory as before.
PUTs write through to both tiers in one pass; a hot tier failure never
fails the PUT since a later GET re-promotes. GETs try the hot tier
first and asynchronously promote cold hits into it. The hot tier is
tracked by an in-memory LRU index seeded from an mtime-ordered scan at
startup, evicting least recently used files down to 95% of capacity;
hot files are disposable copies, so eviction and reboot loss are always
safe. When tiering is not enabled, behavior is unchanged.
Updates tailscale/corp#44699
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
Change-Id: I298711f6ee38efa15304aad7295736197c3de0841 parent d4ff6bc commit 180dd42
5 files changed
Lines changed: 1001 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
25 | 28 | | |
26 | 29 | | |
27 | 30 | | |
| |||
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
| 71 | + | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
74 | 88 | | |
75 | 89 | | |
76 | 90 | | |
| |||
0 commit comments