summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2023-08-03 10:34:35 +0100
committerLibravatar GitHub <noreply@github.com>2023-08-03 11:34:35 +0200
commit00adf18c2470a69c255ea75990bbbae6e57eea89 (patch)
treed65408d4860b39f22f0aa853d25f57a37c65ee5c /example
parent[bugfix] Rework MultiError to wrap + unwrap errors properly (#2057) (diff)
downloadgotosocial-00adf18c2470a69c255ea75990bbbae6e57eea89.tar.xz
[feature] simpler cache size configuration (#2051)
* add automatic cache max size generation based on ratios of a singular fixed memory target Signed-off-by: kim <grufwub@gmail.com> * remove now-unused cache max-size config variables Signed-off-by: kim <grufwub@gmail.com> * slight ratio tweak Signed-off-by: kim <grufwub@gmail.com> * remove unused visibility config var Signed-off-by: kim <grufwub@gmail.com> * add secret little ratio config trick Signed-off-by: kim <grufwub@gmail.com> * fixed a word Signed-off-by: kim <grufwub@gmail.com> * update cache library to remove use of TTL in result caches + slice cache Signed-off-by: kim <grufwub@gmail.com> * update other cache usages to use correct interface Signed-off-by: kim <grufwub@gmail.com> * update example config to explain the cache memory target Signed-off-by: kim <grufwub@gmail.com> * update env parsing test with new config values Signed-off-by: kim <grufwub@gmail.com> * do some ratio twiddling Signed-off-by: kim <grufwub@gmail.com> * add missing header * update envparsing with latest defaults Signed-off-by: kim <grufwub@gmail.com> * update size calculations to take into account result cache, simple cache and extra map overheads Signed-off-by: kim <grufwub@gmail.com> * tweak the ratios some more Signed-off-by: kim <grufwub@gmail.com> * more nan rampaging Signed-off-by: kim <grufwub@gmail.com> * fix envparsing script Signed-off-by: kim <grufwub@gmail.com> * update cache library, add sweep function to keep caches trim Signed-off-by: kim <grufwub@gmail.com> * sweep caches once a minute Signed-off-by: kim <grufwub@gmail.com> * add a regular job to sweep caches and keep under 80% utilisation Signed-off-by: kim <grufwub@gmail.com> * remove dead code Signed-off-by: kim <grufwub@gmail.com> * add new size library used to libraries section of readme Signed-off-by: kim <grufwub@gmail.com> * add better explanations for the mem-ratio numbers Signed-off-by: kim <grufwub@gmail.com> * update go-cache Signed-off-by: kim <grufwub@gmail.com> * library version bump Signed-off-by: kim <grufwub@gmail.com> * update cache.result{} size model estimation Signed-off-by: kim <grufwub@gmail.com> --------- Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'example')
-rw-r--r--example/config.yaml112
1 files changed, 7 insertions, 105 deletions
diff --git a/example/config.yaml b/example/config.yaml
index b09561470..ddcea38d4 100644
--- a/example/config.yaml
+++ b/example/config.yaml
@@ -231,111 +231,13 @@ db-sqlite-cache-size: "8MiB"
db-sqlite-busy-timeout: "30m"
cache:
- # Cache configuration options:
- #
- # max-size = maximum cached objects count
- # ttl = cached object lifetime
- # sweep-freq = frequency to look for stale cache objects
- # (zero will disable cache sweeping)
-
- #############################
- #### VISIBILITY CACHES ######
- #############################
- #
- # Configure Status and account
- # visibility cache.
-
- visibility-max-size: 2000
- visibility-ttl: "30m"
- visibility-sweep-freq: "1m"
-
- gts:
- ###########################
- #### DATABASE CACHES ######
- ###########################
- #
- # Configure GTS database
- # model caches.
-
- account-max-size: 2000
- account-ttl: "30m"
- account-sweep-freq: "1m"
-
- block-max-size: 1000
- block-ttl: "30m"
- block-sweep-freq: "1m"
-
- domain-block-max-size: 2000
- domain-block-ttl: "24h"
- domain-block-sweep-freq: "1m"
-
- emoji-max-size: 2000
- emoji-ttl: "30m"
- emoji-sweep-freq: "1m"
-
- emoji-category-max-size: 100
- emoji-category-ttl: "30m"
- emoji-category-sweep-freq: "1m"
-
- follow-max-size: 2000
- follow-ttl: "30m"
- follow-sweep-freq: "1m"
-
- follow-request-max-size: 2000
- follow-request-ttl: "30m"
- follow-request-sweep-freq: "1m"
-
- instance-max-size: 2000
- instance-ttl: "30m"
- instance-sweep-freq: "1m"
-
- list-max-size: 2000
- list-ttl: "30m"
- list-sweep-freq: "1m"
-
- list-entry-max-size: 2000
- list-entry-ttl: "30m"
- list-entry-sweep-freq: "1m"
-
- media-max-size: 1000
- media-ttl: "30m"
- media-sweep-freq: "1m"
-
- mention-max-size: 2000
- mention-ttl: "30m"
- mention-sweep-freq: "1m"
-
- notification-max-size: 1000
- notification-ttl: "30m"
- notification-sweep-freq: "1m"
-
- report-max-size: 100
- report-ttl: "30m"
- report-sweep-freq: "1m"
-
- status-max-size: 2000
- status-ttl: "30m"
- status-sweep-freq: "1m"
-
- status-fave-max-size: 2000
- status-fave-ttl: "30m"
- status-fave-sweep-freq: "1m"
-
- tag-max-size: 2000
- tag-ttl: "30m"
- tag-sweep-freq: "1m"
-
- tombstone-max-size: 500
- tombstone-ttl: "30m"
- tombstone-sweep-freq: "1m"
-
- user-max-size: 500
- user-ttl: "30m"
- user-sweep-freq: "1m"
-
- webfinger-max-size: 250
- webfinger-ttl: "24h"
- webfinger-sweep-freq: "15m"
+ # cache.memory-target sets a target limit that
+ # the application will try to keep it's caches
+ # within. This is based on estimated sizes of
+ # in-memory objects, and so NOT AT ALL EXACT.
+ # Examples: ["100MiB", "200MiB", "500MiB", "1GiB"]
+ # Default: "200MiB"
+ memory-target: "200MiB"
######################
##### WEB CONFIG #####