mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-08 14:43: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
|
max_idle_conns: 5
|
||||||
conn_max_lifetime: -1
|
conn_max_lifetime: -1
|
||||||
|
|
||||||
# Configuration for in-process caches, to help speed up processing transactions
|
# Configuration for in-memory caches. Caches can often improve performance by
|
||||||
# and reducing load on the database.
|
# keeping frequently accessed items (like events, identifiers etc.) in memory
|
||||||
|
# rather than having to read them from the database.
|
||||||
cache:
|
cache:
|
||||||
# The estimated maximum size for the global cache in bytes, or in terabytes,
|
# The estimated maximum size for the global cache in bytes, or in terabytes,
|
||||||
# gigabytes, megabytes or kilobytes when the appropriate 'tb', 'gb', 'mb' or
|
# 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
|
# '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
|
# memory limit for the entire process. A cache that is too small may ultimately
|
||||||
# provide little or no benefit.
|
# 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
|
# 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
|
# it will be evicted and/or refreshed from the database. Lower values result in
|
||||||
|
|
|
||||||
|
|
@ -31,15 +31,16 @@ global:
|
||||||
# considered valid by other homeservers.
|
# considered valid by other homeservers.
|
||||||
key_validity_period: 168h0m0s
|
key_validity_period: 168h0m0s
|
||||||
|
|
||||||
# Configuration for in-process caches, to help speed up processing transactions
|
# Configuration for in-memory caches. Caches can often improve performance by
|
||||||
# and reducing load on the database.
|
# keeping frequently accessed items (like events, identifiers etc.) in memory
|
||||||
|
# rather than having to read them from the database.
|
||||||
cache:
|
cache:
|
||||||
# The estimated maximum size for the global cache in bytes, or in terabytes,
|
# The estimated maximum size for the global cache in bytes, or in terabytes,
|
||||||
# gigabytes, megabytes or kilobytes when the appropriate 'tb', 'gb', 'mb' or
|
# 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
|
# '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
|
# memory limit for the entire process. A cache that is too small may ultimately
|
||||||
# provide little or no benefit.
|
# 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
|
# 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
|
# 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,
|
cache: cache,
|
||||||
Prefix: federationPDUsCache,
|
Prefix: federationPDUsCache,
|
||||||
Mutable: true,
|
Mutable: true,
|
||||||
MaxAge: time.Hour / 2,
|
MaxAge: lesserOf(time.Hour/2, maxAge),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
FederationEDUs: &RistrettoCostedCachePartition[int64, *gomatrixserverlib.EDU]{
|
FederationEDUs: &RistrettoCostedCachePartition[int64, *gomatrixserverlib.EDU]{
|
||||||
|
|
@ -102,7 +102,7 @@ func NewRistrettoCache(maxCost config.DataUnit, maxAge time.Duration, enableProm
|
||||||
cache: cache,
|
cache: cache,
|
||||||
Prefix: federationEDUsCache,
|
Prefix: federationEDUsCache,
|
||||||
Mutable: true,
|
Mutable: true,
|
||||||
MaxAge: time.Hour / 2,
|
MaxAge: lesserOf(time.Hour/2, maxAge),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SpaceSummaryRooms: &RistrettoCachePartition[string, gomatrixserverlib.MSC2946SpacesResponse]{
|
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)
|
value, ok = v.(V)
|
||||||
return
|
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) {}
|
func (c *ServerNotices) Verify(errors *ConfigErrors, isMonolith bool) {}
|
||||||
|
|
||||||
type Cache struct {
|
type Cache struct {
|
||||||
EstMaxSize DataUnit `yaml:"max_bytes_est"`
|
EstMaxSize DataUnit `yaml:"max_size_est"`
|
||||||
MaxAge time.Duration `yaml:"max_age"`
|
MaxAge time.Duration `yaml:"max_age"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ func (c *Cache) Defaults(generate bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Cache) Verify(errors *ConfigErrors, isMonolith 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.
|
// ReportStats configures opt-in anonymous stats reporting.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue