mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-13 20:20:00 -04:00
Raise the minimum cache size to 8 MB, warn below 256 MB
Lower the hard floor for max-cache-size from 2 MB to 8 MB to support resource-constrained environments (e.g. CPE devices) while remaining safe for LRU-only eviction.
This commit is contained in:
parent
6fa415f71f
commit
dc9564f14d
4 changed files with 11 additions and 14 deletions
|
|
@ -3610,10 +3610,6 @@ default_max_cache_size(const dns_view_t *view, const cfg_obj_t *obj) {
|
|||
|
||||
static size_t
|
||||
sanitized_max_cache_size(const cfg_obj_t *obj, uint64_t value) {
|
||||
if (value >= DNS_CACHE_MINSIZE && value <= SIZE_MAX) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (value > SIZE_MAX) {
|
||||
cfg_obj_log(obj, ISC_LOG_WARNING,
|
||||
"'max-cache-size %" PRIu64 "' "
|
||||
|
|
@ -3624,13 +3620,13 @@ sanitized_max_cache_size(const cfg_obj_t *obj, uint64_t value) {
|
|||
|
||||
if (value < DNS_CACHE_MINSIZE) {
|
||||
cfg_obj_log(obj, ISC_LOG_WARNING,
|
||||
"'max-cache-size' can't be less than %" PRIu64 "; "
|
||||
"setting 'max-cache-size' to the minimum value",
|
||||
DNS_CACHE_MINSIZE);
|
||||
"'max-cache-size %" PRIu64 "' "
|
||||
"is too small; setting to %" PRIu64,
|
||||
value, DNS_CACHE_MINSIZE);
|
||||
return DNS_CACHE_MINSIZE;
|
||||
}
|
||||
|
||||
UNREACHABLE();
|
||||
return value;
|
||||
}
|
||||
|
||||
static size_t
|
||||
|
|
|
|||
|
|
@ -3847,10 +3847,11 @@ system.
|
|||
default value of that option (90% of physical memory for each
|
||||
individual cache) may lead to memory exhaustion over time.
|
||||
|
||||
.. note::
|
||||
.. warning::
|
||||
|
||||
:any:`max-cache-size` does not work reliably for a maximum
|
||||
amount of memory of 256 MB or lower.
|
||||
Setting :any:`max-cache-size` to a value lower than 256 MB is
|
||||
permitted but not recommended; LRU-only cache eviction may cause
|
||||
excessive churn under load.
|
||||
|
||||
Upon startup and reconfiguration, caches with a limited size
|
||||
preallocate a small amount of memory (less than 1% of
|
||||
|
|
@ -3859,7 +3860,7 @@ system.
|
|||
internal cache structures.
|
||||
|
||||
On systems where detection of the amount of physical memory is not
|
||||
supported, the :iscman:`named` will fail to start.
|
||||
supported, :iscman:`named` will fall back to the minimum value (2 MB).
|
||||
|
||||
.. note::
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
#define DNS_ADBADDRINFO_MAGIC ISC_MAGIC('a', 'd', 'A', 'I')
|
||||
#define DNS_ADBADDRINFO_VALID(x) ISC_MAGIC_VALID(x, DNS_ADBADDRINFO_MAGIC)
|
||||
|
||||
#define DNS_ADB_MINADBSIZE (1024U * 1024U) /*%< 1 Megabyte */
|
||||
#define DNS_ADB_MINADBSIZE UINT64_C(1024 * 1024) /*%< 1 MB */
|
||||
|
||||
/***
|
||||
*** TYPES
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@
|
|||
* DNS_CACHE_MINSIZE is how many bytes is the floor for
|
||||
* dns_cache_setcachesize().
|
||||
*/
|
||||
#define DNS_CACHE_MINSIZE UINT64_C(2097152) /*%< Bytes. 2097152 = 2 MB */
|
||||
#define DNS_CACHE_MINSIZE UINT64_C(2 * 1024 * 1024) /*%< Bytes. 2 MB */
|
||||
|
||||
/***
|
||||
*** Functions
|
||||
|
|
|
|||
Loading…
Reference in a new issue