diff options
author | 2023-08-10 15:08:41 +0100 | |
---|---|---|
committer | 2023-08-10 15:08:41 +0100 | |
commit | 91cbcd589e7c4ab87e5994e4d0276ea1248dc5c2 (patch) | |
tree | a6b12c30168eb5fed4267dcb6a1f385b86afdcdf /internal/config | |
parent | [feature] List replies policy, refactor async workers (#2087) (diff) | |
download | gotosocial-91cbcd589e7c4ab87e5994e4d0276ea1248dc5c2.tar.xz |
[performance] remove last of relational queries to instead rely on caches (#2091)
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/config.go | 1 | ||||
-rw-r--r-- | internal/config/defaults.go | 3 | ||||
-rw-r--r-- | internal/config/helpers.gen.go | 25 |
3 files changed, 28 insertions, 1 deletions
diff --git a/internal/config/config.go b/internal/config/config.go index ef79d4e12..5a26222ed 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -178,6 +178,7 @@ type CacheConfiguration struct { MemoryTarget bytesize.Size `name:"memory-target"` AccountMemRatio float64 `name:"account-mem-ratio"` AccountNoteMemRatio float64 `name:"account-note-mem-ratio"` + ApplicationMemRatio float64 `name:"application-mem-ratio"` BlockMemRatio float64 `name:"block-mem-ratio"` BlockIDsMemRatio float64 `name:"block-mem-ratio"` BoostOfIDsMemRatio float64 `name:"boost-of-ids-mem-ratio"` diff --git a/internal/config/defaults.go b/internal/config/defaults.go index 2bc95f6f1..b78362973 100644 --- a/internal/config/defaults.go +++ b/internal/config/defaults.go @@ -147,6 +147,7 @@ var Defaults = Configuration{ // be able to make some more sense :D AccountMemRatio: 18, AccountNoteMemRatio: 0.1, + ApplicationMemRatio: 0.1, BlockMemRatio: 3, BlockIDsMemRatio: 3, BoostOfIDsMemRatio: 3, @@ -170,7 +171,7 @@ var Defaults = Configuration{ StatusFaveIDsMemRatio: 3, TagMemRatio: 3, TombstoneMemRatio: 2, - UserMemRatio: 0.1, + UserMemRatio: 0.25, WebfingerMemRatio: 0.1, VisibilityMemRatio: 2, }, diff --git a/internal/config/helpers.gen.go b/internal/config/helpers.gen.go index 0a299e7d0..03411853f 100644 --- a/internal/config/helpers.gen.go +++ b/internal/config/helpers.gen.go @@ -2499,6 +2499,31 @@ func GetCacheAccountNoteMemRatio() float64 { return global.GetCacheAccountNoteMe // SetCacheAccountNoteMemRatio safely sets the value for global configuration 'Cache.AccountNoteMemRatio' field func SetCacheAccountNoteMemRatio(v float64) { global.SetCacheAccountNoteMemRatio(v) } +// GetCacheApplicationMemRatio safely fetches the Configuration value for state's 'Cache.ApplicationMemRatio' field +func (st *ConfigState) GetCacheApplicationMemRatio() (v float64) { + st.mutex.RLock() + v = st.config.Cache.ApplicationMemRatio + st.mutex.RUnlock() + return +} + +// SetCacheApplicationMemRatio safely sets the Configuration value for state's 'Cache.ApplicationMemRatio' field +func (st *ConfigState) SetCacheApplicationMemRatio(v float64) { + st.mutex.Lock() + defer st.mutex.Unlock() + st.config.Cache.ApplicationMemRatio = v + st.reloadToViper() +} + +// CacheApplicationMemRatioFlag returns the flag name for the 'Cache.ApplicationMemRatio' field +func CacheApplicationMemRatioFlag() string { return "cache-application-mem-ratio" } + +// GetCacheApplicationMemRatio safely fetches the value for global configuration 'Cache.ApplicationMemRatio' field +func GetCacheApplicationMemRatio() float64 { return global.GetCacheApplicationMemRatio() } + +// SetCacheApplicationMemRatio safely sets the value for global configuration 'Cache.ApplicationMemRatio' field +func SetCacheApplicationMemRatio(v float64) { global.SetCacheApplicationMemRatio(v) } + // GetCacheBlockMemRatio safely fetches the Configuration value for state's 'Cache.BlockMemRatio' field func (st *ConfigState) GetCacheBlockMemRatio() (v float64) { st.mutex.RLock() |