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
+5 -4
View File
@@ -22,6 +22,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"
@@ -188,14 +189,14 @@ var getUserPropMutex sync.Mutex
// anonUid is the UID of the "anonymous" user.
var anonUid int32 = -1
// init initializes the caches.
func init() {
// setupUserCache initializes the caches.
func setupUserCache() {
var err error
userCache, err = lru.New2Q(100)
userCache, err = lru.New2Q(config.GlobalConfig.Tuning.Caches.Users)
if err != nil {
panic(err)
}
userPropCache, err = lru.New(100)
userPropCache, err = lru.New(config.GlobalConfig.Tuning.Caches.UserProps)
if err != nil {
panic(err)
}