added more tuning knobs, particularly in cache sizes

This commit is contained in:
2026-02-20 15:44:06 -07:00
parent d8eeeb7140
commit 8a1c770079
10 changed files with 86 additions and 34 deletions
+6 -5
View File
@@ -20,6 +20,7 @@ import (
"sync"
"time"
"git.erbosoft.com/amy/amsterdam/config"
"git.erbosoft.com/amy/amsterdam/util"
lru "github.com/hashicorp/golang-lru"
"github.com/jmoiron/sqlx"
@@ -130,18 +131,18 @@ func stuffMembership(cid int32, uid int32, member bool, locked bool, level uint1
memberMutex.Unlock()
}
// init initializes the caches.
func init() {
// setupCommunityCache initializes the caches.
func setupCommunityCache() {
var err error
communityCache, err = lru.New2Q(50)
communityCache, err = lru.New2Q(config.GlobalConfig.Tuning.Caches.Communities)
if err != nil {
panic(err)
}
memberCache, err = lru.New(250)
memberCache, err = lru.New(config.GlobalConfig.Tuning.Caches.Members)
if err != nil {
panic(err)
}
communityPropCache, err = lru.New(100)
communityPropCache, err = lru.New(config.GlobalConfig.Tuning.Caches.CommunityProps)
if err != nil {
panic(err)
}