mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 06:03:09 -06:00
Tweaks
This commit is contained in:
parent
bf18f7d5ad
commit
7e9109510d
|
|
@ -41,6 +41,14 @@ global:
|
|||
max_idle_conns: 5
|
||||
conn_max_lifetime: -1
|
||||
|
||||
# Configuration for in-process caches, to help speed up processing transactions
|
||||
# and reducing load on the database.
|
||||
cache:
|
||||
# The estimated maximum size for the global cache in bytes. Note that this is
|
||||
# not a hard limit, nor is it a memory limit for the entire process. A cache that
|
||||
# is too small may end up yielding little benefit.
|
||||
max_bytes_est: 1073741824
|
||||
|
||||
# The server name to delegate server-server communications to, with optional port
|
||||
# e.g. localhost:443
|
||||
well_known_server_name: ""
|
||||
|
|
|
|||
|
|
@ -31,6 +31,14 @@ global:
|
|||
# considered valid by other homeservers.
|
||||
key_validity_period: 168h0m0s
|
||||
|
||||
# Configuration for in-process caches, to help speed up processing transactions
|
||||
# and reducing load on the database.
|
||||
cache:
|
||||
# The estimated maximum size for the global cache in bytes. Note that this is
|
||||
# not a hard limit, nor is it a memory limit for the entire process. A cache that
|
||||
# is too small may end up yielding little benefit.
|
||||
max_bytes_est: 1073741824
|
||||
|
||||
# The server name to delegate server-server communications to, with optional port
|
||||
# e.g. localhost:443
|
||||
well_known_server_name: ""
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
|||
}
|
||||
}
|
||||
|
||||
cache, err := caching.NewRistrettoCache(cfg.Global.Caches.EstMaxSize, enableMetrics)
|
||||
cache, err := caching.NewRistrettoCache(cfg.Global.Cache.EstMaxSize, enableMetrics)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Warnf("Failed to create cache")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ type Global struct {
|
|||
ReportStats ReportStats `yaml:"report_stats"`
|
||||
|
||||
// Configuration for the caches.
|
||||
Caches Caches `yaml:"caches"`
|
||||
Cache Cache `yaml:"cache"`
|
||||
}
|
||||
|
||||
func (c *Global) Defaults(generate bool) {
|
||||
|
|
@ -93,7 +93,7 @@ func (c *Global) Defaults(generate bool) {
|
|||
c.Sentry.Defaults()
|
||||
c.ServerNotices.Defaults(generate)
|
||||
c.ReportStats.Defaults()
|
||||
c.Caches.Defaults(generate)
|
||||
c.Cache.Defaults(generate)
|
||||
}
|
||||
|
||||
func (c *Global) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
||||
|
|
@ -106,7 +106,7 @@ func (c *Global) Verify(configErrs *ConfigErrors, isMonolith bool) {
|
|||
c.DNSCache.Verify(configErrs, isMonolith)
|
||||
c.ServerNotices.Verify(configErrs, isMonolith)
|
||||
c.ReportStats.Verify(configErrs, isMonolith)
|
||||
c.Caches.Verify(configErrs, isMonolith)
|
||||
c.Cache.Verify(configErrs, isMonolith)
|
||||
}
|
||||
|
||||
type OldVerifyKeys struct {
|
||||
|
|
@ -173,17 +173,15 @@ func (c *ServerNotices) Defaults(generate bool) {
|
|||
|
||||
func (c *ServerNotices) Verify(errors *ConfigErrors, isMonolith bool) {}
|
||||
|
||||
type Caches struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
type Cache struct {
|
||||
EstMaxSize int64 `yaml:"max_bytes_est"`
|
||||
}
|
||||
|
||||
func (c *Caches) Defaults(generate bool) {
|
||||
c.Enabled = true
|
||||
func (c *Cache) Defaults(generate bool) {
|
||||
c.EstMaxSize = 1024 * 1024 * 1024 // 1GB
|
||||
}
|
||||
|
||||
func (c *Caches) Verify(errors *ConfigErrors, isMonolith bool) {
|
||||
func (c *Cache) Verify(errors *ConfigErrors, isMonolith bool) {
|
||||
checkPositive(errors, "max_bytes_est", int64(c.EstMaxSize))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue