mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-07 06:03:09 -06:00
Tweak max age handling, config key name
This commit is contained in:
parent
caecdedeed
commit
56b2672f92
|
|
@ -41,15 +41,16 @@ 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.
|
||||
# Configuration for in-memory caches. Caches can often improve performance by
|
||||
# keeping frequently accessed items (like events, identifiers etc.) in memory
|
||||
# rather than having to read them from the database.
|
||||
cache:
|
||||
# The estimated maximum size for the global cache in bytes, or in terabytes,
|
||||
# gigabytes, megabytes or kilobytes when the appropriate 'tb', 'gb', 'mb' or
|
||||
# 'kb' suffix is specified. 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 ultimately
|
||||
# provide little or no benefit.
|
||||
max_bytes_est: 1gb
|
||||
max_size_est: 1gb
|
||||
|
||||
# The maximum amount of time that a cache entry can live for in memory before
|
||||
# it will be evicted and/or refreshed from the database. Lower values result in
|
||||
|
|
|
|||
|
|
@ -31,15 +31,16 @@ 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.
|
||||
# Configuration for in-memory caches. Caches can often improve performance by
|
||||
# keeping frequently accessed items (like events, identifiers etc.) in memory
|
||||
# rather than having to read them from the database.
|
||||
cache:
|
||||
# The estimated maximum size for the global cache in bytes, or in terabytes,
|
||||
# gigabytes, megabytes or kilobytes when the appropriate 'tb', 'gb', 'mb' or
|
||||
# 'kb' suffix is specified. 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 ultimately
|
||||
# provide little or no benefit.
|
||||
max_bytes_est: 1gb
|
||||
max_size_est: 1gb
|
||||
|
||||
# The maximum amount of time that a cache entry can live for in memory before
|
||||
# it will be evicted and/or refreshed from the database. Lower values result in
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ func NewRistrettoCache(maxCost config.DataUnit, maxAge time.Duration, enableProm
|
|||
cache: cache,
|
||||
Prefix: federationPDUsCache,
|
||||
Mutable: true,
|
||||
MaxAge: time.Hour / 2,
|
||||
MaxAge: lesserOf(time.Hour/2, maxAge),
|
||||
},
|
||||
},
|
||||
FederationEDUs: &RistrettoCostedCachePartition[int64, *gomatrixserverlib.EDU]{
|
||||
|
|
@ -102,7 +102,7 @@ func NewRistrettoCache(maxCost config.DataUnit, maxAge time.Duration, enableProm
|
|||
cache: cache,
|
||||
Prefix: federationEDUsCache,
|
||||
Mutable: true,
|
||||
MaxAge: time.Hour / 2,
|
||||
MaxAge: lesserOf(time.Hour/2, maxAge),
|
||||
},
|
||||
},
|
||||
SpaceSummaryRooms: &RistrettoCachePartition[string, gomatrixserverlib.MSC2946SpacesResponse]{
|
||||
|
|
@ -174,3 +174,10 @@ func (c *RistrettoCachePartition[K, V]) Get(key K) (value V, ok bool) {
|
|||
value, ok = v.(V)
|
||||
return
|
||||
}
|
||||
|
||||
func lesserOf(a, b time.Duration) time.Duration {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ func (c *ServerNotices) Defaults(generate bool) {
|
|||
func (c *ServerNotices) Verify(errors *ConfigErrors, isMonolith bool) {}
|
||||
|
||||
type Cache struct {
|
||||
EstMaxSize DataUnit `yaml:"max_bytes_est"`
|
||||
EstMaxSize DataUnit `yaml:"max_size_est"`
|
||||
MaxAge time.Duration `yaml:"max_age"`
|
||||
}
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ func (c *Cache) Defaults(generate bool) {
|
|||
}
|
||||
|
||||
func (c *Cache) Verify(errors *ConfigErrors, isMonolith bool) {
|
||||
checkPositive(errors, "max_bytes_est", int64(c.EstMaxSize))
|
||||
checkPositive(errors, "max_size_est", int64(c.EstMaxSize))
|
||||
}
|
||||
|
||||
// ReportStats configures opt-in anonymous stats reporting.
|
||||
|
|
|
|||
Loading…
Reference in a new issue