mirror of
				https://github.com/superseriousbusiness/gotosocial
				synced 2025-06-05 21:59:39 +02:00 
			
		
		
		
	[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>
This commit is contained in:
		| @@ -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 ##### | ||||
|   | ||||
		Reference in New Issue
	
	Block a user