Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae9b3bdbae | ||
|
|
45f7b201b7 |
@@ -1,3 +1,7 @@
|
||||
6247. [performance] Change the "tcp-clients" value to allow specifying
|
||||
percents of the maximum allowed file descriptors and
|
||||
set the default value to 50%. [GL #3958]
|
||||
|
||||
6246. [placeholder]
|
||||
|
||||
6245. [placeholder]
|
||||
@@ -303,6 +307,8 @@
|
||||
file. [GL #3991]
|
||||
|
||||
6160. [bug] 'delv +ns' could print duplicate output. [GL #4020]
|
||||
=======
|
||||
>>>>>>> 25abcb8750 (Add CHANGES and release note for [GL #3958])
|
||||
|
||||
6159. [bug] Fix use-after-free bug in TCP accept connection
|
||||
failure. [GL #4018]
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ options {\n\
|
||||
startup-notify-rate 20;\n\
|
||||
statistics-file \"named.stats\";\n\
|
||||
tcp-advertised-timeout 300;\n\
|
||||
tcp-clients 150;\n\
|
||||
tcp-clients 50%;\n\
|
||||
tcp-idle-timeout 300;\n\
|
||||
tcp-initial-timeout 300;\n\
|
||||
tcp-keepalive-timeout 300;\n\
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
/*! \file */
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <isc/log.h>
|
||||
#include <isc/loop.h>
|
||||
@@ -115,6 +116,7 @@ EXTERN bool named_g_foreground INIT(false);
|
||||
EXTERN bool named_g_logstderr INIT(false);
|
||||
EXTERN bool named_g_nosyslog INIT(false);
|
||||
EXTERN const char *named_g_logfile INIT(NULL);
|
||||
EXTERN rlim_t named_g_nofiles INIT(0);
|
||||
|
||||
EXTERN const char *named_g_defaultsessionkeyfile INIT(NAMED_LOCALSTATEDIR
|
||||
"/run/named/"
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include <pwd.h>
|
||||
#include <stdbool.h>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include <isc/types.h>
|
||||
|
||||
@@ -44,7 +45,7 @@ named_os_changeuser(void);
|
||||
uid_t
|
||||
ns_os_uid(void);
|
||||
|
||||
void
|
||||
rlim_t
|
||||
named_os_adjustnofile(void);
|
||||
|
||||
void
|
||||
|
||||
+1
-1
@@ -1283,7 +1283,7 @@ setup(void) {
|
||||
* System resources cannot effectively be tuned on some systems.
|
||||
* Raise the limit in such cases for safety.
|
||||
*/
|
||||
named_os_adjustnofile();
|
||||
named_g_nofiles = named_os_adjustnofile();
|
||||
|
||||
/*
|
||||
* If the named configuration filename is relative, prepend the current
|
||||
|
||||
+4
-4
@@ -613,7 +613,7 @@ ns_os_uid(void) {
|
||||
return (runas_pw->pw_uid);
|
||||
}
|
||||
|
||||
void
|
||||
rlim_t
|
||||
named_os_adjustnofile(void) {
|
||||
int r;
|
||||
struct rlimit rl;
|
||||
@@ -634,7 +634,7 @@ named_os_adjustnofile(void) {
|
||||
"maximum allowed value: "
|
||||
"%" PRIu64,
|
||||
(uint64_t)rl.rlim_max);
|
||||
return;
|
||||
return (rl.rlim_cur);
|
||||
}
|
||||
|
||||
rl.rlim_cur = rl.rlim_max;
|
||||
@@ -649,13 +649,13 @@ named_os_adjustnofile(void) {
|
||||
"%" PRIu64 " to "
|
||||
"%" PRIu64,
|
||||
(uint64_t)rlim_old, (uint64_t)rl.rlim_cur);
|
||||
return;
|
||||
return (rl.rlim_cur);
|
||||
|
||||
fail:
|
||||
strerror_r(errno, strbuf, sizeof(strbuf));
|
||||
named_main_earlywarning("adjusting limit on open files failed: %s",
|
||||
strbuf);
|
||||
return;
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+34
-1
@@ -8459,7 +8459,6 @@ load_configuration(const char *filename, named_server_t *server,
|
||||
*/
|
||||
configure_server_quota(maps, "transfers-out",
|
||||
&server->sctx->xfroutquota);
|
||||
configure_server_quota(maps, "tcp-clients", &server->sctx->tcpquota);
|
||||
configure_server_quota(maps, "recursive-clients",
|
||||
&server->sctx->recursionquota);
|
||||
configure_server_quota(maps, "update-quota", &server->sctx->updquota);
|
||||
@@ -8484,6 +8483,40 @@ load_configuration(const char *filename, named_server_t *server,
|
||||
|
||||
isc_quota_soft(&server->sctx->recursionquota, softquota);
|
||||
|
||||
obj = NULL;
|
||||
result = named_config_get(maps, "tcp-clients", &obj);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
|
||||
uint32_t tcp_clients = 0;
|
||||
if (cfg_obj_isstring(obj)) {
|
||||
const char *str = cfg_obj_asstring(obj);
|
||||
INSIST(strcasecmp(str, "unlimited") == 0);
|
||||
tcp_clients = UINT32_MAX;
|
||||
} else if (cfg_obj_ispercentage(obj)) {
|
||||
INSIST(named_g_nofiles != 0);
|
||||
uint32_t tcp_clients_percent = cfg_obj_aspercentage(obj);
|
||||
tcp_clients = named_g_nofiles * tcp_clients_percent / 100;
|
||||
|
||||
cfg_obj_log(obj, named_g_lctx, ISC_LOG_INFO,
|
||||
"'tcp-clients %" PRIu32 "%%' - setting to %" PRIu32
|
||||
" (out of %" PRIu32 " file descriptors)",
|
||||
tcp_clients_percent, tcp_clients,
|
||||
(uint32_t)named_g_nofiles);
|
||||
} else {
|
||||
uint64_t value = cfg_obj_asuint64(obj);
|
||||
if (value > UINT32_MAX) {
|
||||
cfg_obj_log(obj, named_g_lctx, ISC_LOG_WARNING,
|
||||
"'tcp-clients "
|
||||
"%" PRIu64 "' "
|
||||
"is too large for this "
|
||||
"system; reducing to %" PRIu32,
|
||||
value, UINT32_MAX);
|
||||
value = UINT32_MAX;
|
||||
}
|
||||
tcp_clients = (uint32_t)value;
|
||||
}
|
||||
isc_quota_max(&server->sctx->tcpquota, tcp_clients);
|
||||
|
||||
/*
|
||||
* Set "blackhole". Only legal at options level; there is
|
||||
* no default.
|
||||
|
||||
@@ -3563,7 +3563,8 @@ system.
|
||||
:short: Specifies the maximum number of simultaneous client TCP connections accepted by the server.
|
||||
|
||||
This is the maximum number of simultaneous client TCP connections that the
|
||||
server accepts. The default is ``150``.
|
||||
server accepts, in bytes of percentage of maximum allowed file descriptors.
|
||||
The default is ``50%``.
|
||||
|
||||
.. namedconf:statement:: clients-per-query
|
||||
:tags: server
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ options {
|
||||
statistics-file <quoted_string>;
|
||||
synth-from-dnssec <boolean>;
|
||||
tcp-advertised-timeout <integer>;
|
||||
tcp-clients <integer>;
|
||||
tcp-clients ( default | unlimited | <sizeval> | <percentage> );
|
||||
tcp-idle-timeout <integer>;
|
||||
tcp-initial-timeout <integer>;
|
||||
tcp-keepalive-timeout <integer>;
|
||||
|
||||
@@ -44,6 +44,10 @@ Feature Changes
|
||||
those versions do not provide the features required by current BIND 9
|
||||
releases. :gl:`#4296`
|
||||
|
||||
- The ``tcp-clients`` configuration option now also accepts value as percent of
|
||||
maximum allowed file descriptors. The default has been changed to ``50%``.
|
||||
:gl:`#3958`
|
||||
|
||||
Bug Fixes
|
||||
~~~~~~~~~
|
||||
|
||||
|
||||
@@ -1313,7 +1313,7 @@ static cfg_clausedef_t options_clauses[] = {
|
||||
{ "statistics-file", &cfg_type_qstring, 0 },
|
||||
{ "statistics-interval", NULL, CFG_CLAUSEFLAG_ANCIENT },
|
||||
{ "tcp-advertised-timeout", &cfg_type_uint32, 0 },
|
||||
{ "tcp-clients", &cfg_type_uint32, 0 },
|
||||
{ "tcp-clients", &cfg_type_sizeorpercent, 0 },
|
||||
{ "tcp-idle-timeout", &cfg_type_uint32, 0 },
|
||||
{ "tcp-initial-timeout", &cfg_type_uint32, 0 },
|
||||
{ "tcp-keepalive-timeout", &cfg_type_uint32, 0 },
|
||||
|
||||
Reference in New Issue
Block a user