[performance] cache media attachments (#1525)

* replace concurrency worker pools with base models in State.Workers, update code and tests accordingly

* add media attachment caching, slightly tweak default cache config

* further tweak default cache config values

* replace other media attachment db calls to go through cache

* update envparsing test

* fix delete media attachment sql

* fix media sql query

* invalidate cached media entries during status create / update

* fix envparsing test

* fix typo in panic log message...

* add 'updated_at' column during UpdateAttachment

* remove unused func

---------

Signed-off-by: kim <grufwub@gmail.com>
This commit is contained in:
kim
2023-03-03 23:02:23 +00:00
committed by GitHub
parent 5be59f4a25
commit a8e6bdfa33
15 changed files with 235 additions and 61 deletions

View File

@@ -116,13 +116,13 @@ var Defaults = Configuration{
Cache: CacheConfiguration{
GTS: GTSCacheConfiguration{
AccountMaxSize: 100,
AccountMaxSize: 500,
AccountTTL: time.Minute * 5,
AccountSweepFreq: time.Second * 10,
AccountSweepFreq: time.Second * 30,
BlockMaxSize: 100,
BlockTTL: time.Minute * 5,
BlockSweepFreq: time.Second * 10,
BlockSweepFreq: time.Second * 30,
DomainBlockMaxSize: 1000,
DomainBlockTTL: time.Hour * 24,
@@ -130,35 +130,39 @@ var Defaults = Configuration{
EmojiMaxSize: 500,
EmojiTTL: time.Minute * 5,
EmojiSweepFreq: time.Second * 10,
EmojiSweepFreq: time.Second * 30,
EmojiCategoryMaxSize: 100,
EmojiCategoryTTL: time.Minute * 5,
EmojiCategorySweepFreq: time.Second * 10,
EmojiCategorySweepFreq: time.Second * 30,
MediaMaxSize: 500,
MediaTTL: time.Minute * 5,
MediaSweepFreq: time.Second * 30,
MentionMaxSize: 500,
MentionTTL: time.Minute * 5,
MentionSweepFreq: time.Second * 10,
MentionSweepFreq: time.Second * 30,
NotificationMaxSize: 500,
NotificationTTL: time.Minute * 5,
NotificationSweepFreq: time.Second * 10,
NotificationSweepFreq: time.Second * 30,
ReportMaxSize: 100,
ReportTTL: time.Minute * 5,
ReportSweepFreq: time.Second * 10,
ReportSweepFreq: time.Second * 30,
StatusMaxSize: 500,
StatusTTL: time.Minute * 5,
StatusSweepFreq: time.Second * 10,
StatusSweepFreq: time.Second * 30,
TombstoneMaxSize: 100,
TombstoneTTL: time.Minute * 5,
TombstoneSweepFreq: time.Second * 10,
TombstoneSweepFreq: time.Second * 30,
UserMaxSize: 100,
UserTTL: time.Minute * 5,
UserSweepFreq: time.Second * 10,
UserSweepFreq: time.Second * 30,
},
},