Commit c091b67b authored by Daniel Salzman's avatar Daniel Salzman

conf: reorganize server workers

RENAME
------
server:
  workers -> udp-workers

ADD
---
server:
  tcp-workers

REMOVE
------
server:
  transfers
parent a1950934
......@@ -114,7 +114,8 @@ server:
rundir: STR
user: STR[:STR]
pidfile: STR
workers: INT
udp\-workers: INT
tcp\-workers: INT
background\-workers: INT
async\-start: BOOL
tcp\-idle\-timeout: TIME
......@@ -122,7 +123,6 @@ server:
tcp\-reply\-timeout: TIME
max\-tcp\-clients: INT
max\-udp\-payload: SIZE
transfers: INT
rate\-limit: INT
rate\-limit\-slip: INT
rate\-limit\-table\-size: INT
......@@ -167,9 +167,14 @@ Default: root:root
A PID file location.
.sp
Default: \fI\%rundir\fP/knot.pid
.SS workers
.SS udp\-workers
.sp
A number of quering workers (threads) per server interface.
A number of quering UDP workers (threads).
.sp
Default: auto\-estimated optimal value based on the number of online CPUs
.SS tcp\-workers
.sp
A number of quering TCP workers (threads).
.sp
Default: auto\-estimated optimal value based on the number of online CPUs
.SS background\-workers
......@@ -208,12 +213,6 @@ A maximum number of TCP clients connected in parallel, set this below the file
descriptor limit to avoid resource exhaustion.
.sp
Default: 100
.SS transfers
.sp
A maximum number of parallel transfers, including pending SOA queries. The
minimum value is determined by the number of CPUs.
.sp
Default: 10
.SS rate\-limit
.sp
Rate limiting is based on the token bucket scheme. Rate basically
......
......@@ -83,7 +83,8 @@ General options related to the server.
rundir: STR
user: STR[:STR]
pidfile: STR
workers: INT
udp-workers: INT
tcp-workers: INT
background-workers: INT
async-start: BOOL
tcp-idle-timeout: TIME
......@@ -91,7 +92,6 @@ General options related to the server.
tcp-reply-timeout: TIME
max-tcp-clients: INT
max-udp-payload: SIZE
transfers: INT
rate-limit: INT
rate-limit-slip: INT
rate-limit-table-size: INT
......@@ -157,12 +157,21 @@ A PID file location.
Default: :ref:`rundir<server_rundir>`/knot.pid
.. _server_workers:
.. _server_udp-workers:
workers
-------
udp-workers
-----------
A number of quering UDP workers (threads).
Default: auto-estimated optimal value based on the number of online CPUs
.. _server_tcp-workers:
tcp-workers
-----------
A number of quering workers (threads) per server interface.
A number of quering TCP workers (threads).
Default: auto-estimated optimal value based on the number of online CPUs
......@@ -226,16 +235,6 @@ descriptor limit to avoid resource exhaustion.
Default: 100
.. _server_transfers:
transfers
---------
A maximum number of parallel transfers, including pending SOA queries. The
minimum value is determined by the number of CPUs.
Default: 10
.. _server_rate-limit:
rate-limit
......
......@@ -1307,9 +1307,9 @@ char* conf_journalfile(
size_t conf_udp_threads(
conf_t *conf)
{
conf_val_t val = conf_get(conf, C_SRV, C_WORKERS);
conf_val_t val = conf_get(conf, C_SRV, C_UDP_WORKERS);
int64_t workers = conf_int(&val);
if (workers < 1) {
if (workers == YP_NIL) {
return dt_optimal_size();
}
......@@ -1319,20 +1319,25 @@ size_t conf_udp_threads(
size_t conf_tcp_threads(
conf_t *conf)
{
size_t thrcount = conf_udp_threads(conf);
return MAX(thrcount * 2, CONF_XFERS);
conf_val_t val = conf_get(conf, C_SRV, C_TCP_WORKERS);
int64_t workers = conf_int(&val);
if (workers == YP_NIL) {
return MAX(conf_udp_threads(conf) * 2, CONF_XFERS);
}
return workers;
}
int conf_bg_threads(
size_t conf_bg_threads(
conf_t *conf)
{
conf_val_t val = conf_get(conf, C_SRV, C_BG_WORKERS);
int64_t bg_workers = conf_int(&val);
if (bg_workers < 1) {
int64_t workers = conf_int(&val);
if (workers == YP_NIL) {
return MIN(dt_optimal_size(), CONF_XFERS);
}
return bg_workers;
return workers;
}
void conf_user(
......
......@@ -278,7 +278,7 @@ size_t conf_tcp_threads(
conf_t *conf
);
int conf_bg_threads(
size_t conf_bg_threads(
conf_t *conf
);
......
......@@ -78,7 +78,8 @@ static const yp_item_t desc_server[] = {
{ C_RUNDIR, YP_TSTR, YP_VSTR = { RUN_DIR } },
{ C_USER, YP_TSTR, YP_VNONE },
{ C_PIDFILE, YP_TSTR, YP_VSTR = { "knot.pid" } },
{ C_WORKERS, YP_TINT, YP_VINT = { 1, 255, YP_NIL } },
{ C_UDP_WORKERS, YP_TINT, YP_VINT = { 1, 255, YP_NIL } },
{ C_TCP_WORKERS, YP_TINT, YP_VINT = { 1, 255, YP_NIL } },
{ C_BG_WORKERS, YP_TINT, YP_VINT = { 1, 255, YP_NIL } },
{ C_ASYNC_START, YP_TBOOL, YP_VNONE },
{ C_TCP_HSHAKE_TIMEOUT, YP_TINT, YP_VINT = { 0, INT32_MAX, 5, YP_STIME } },
......@@ -88,7 +89,6 @@ static const yp_item_t desc_server[] = {
{ C_MAX_UDP_PAYLOAD, YP_TINT, YP_VINT = { KNOT_EDNS_MIN_UDP_PAYLOAD,
KNOT_EDNS_MAX_UDP_PAYLOAD,
4096, YP_SSIZE } },
{ C_TRANSFERS, YP_TINT, YP_VINT = { 1, INT32_MAX, 10 } },
{ C_RATE_LIMIT, YP_TINT, YP_VINT = { 0, INT32_MAX, 0 } },
{ C_RATE_LIMIT_SLIP, YP_TINT, YP_VINT = { 1, RRL_SLIP_MAX, 1 } },
{ C_RATE_LIMIT_TBL_SIZE, YP_TINT, YP_VINT = { 1, INT32_MAX, 393241 } },
......
......@@ -72,12 +72,12 @@
#define C_TCP_HSHAKE_TIMEOUT "\x15""tcp-handshake-timeout"
#define C_TCP_IDLE_TIMEOUT "\x10""tcp-idle-timeout"
#define C_TCP_REPLY_TIMEOUT "\x11""tcp-reply-timeout"
#define C_TCP_WORKERS "\x0B""tcp-workers"
#define C_TPL "\x08""template"
#define C_TRANSFERS "\x09""transfers"
#define C_UDP_WORKERS "\x0B""udp-workers"
#define C_USER "\x04""user"
#define C_VERSION "\x07""version"
#define C_VIA "\x03""via"
#define C_WORKERS "\x07""workers"
#define C_ZONE "\x04""zone"
#define C_ZONEFILE_SYNC "\x0D""zonefile-sync"
......
......@@ -2040,7 +2040,7 @@ yyreduce:
case 31:
#line 481 "cf-parse.y" /* yacc.c:1646 */
{ f_int(scanner, R_SYS, C_WORKERS, (yyvsp[-1].tok).i); }
{ f_int(scanner, R_SYS, C_UDP_WORKERS, (yyvsp[-1].tok).i); }
#line 2045 "cf-parse.tab.c" /* yacc.c:1646 */
break;
......@@ -2106,7 +2106,7 @@ yyreduce:
case 42:
#line 492 "cf-parse.y" /* yacc.c:1646 */
{ f_int(scanner, R_SYS, C_TRANSFERS, (yyvsp[-1].tok).i); }
{ /* Not used. */ }
#line 2111 "cf-parse.tab.c" /* yacc.c:1646 */
break;
......
......@@ -478,7 +478,7 @@ system:
| system MAX_UDP_PAYLOAD NUM ';' { f_int(scanner, R_SYS, C_MAX_UDP_PAYLOAD, $3.i); }
| system RUNDIR TEXT ';' { f_quote(scanner, R_SYS, C_RUNDIR, $3.t); free($3.t); }
| system PIDFILE TEXT ';' { f_quote(scanner, R_SYS, C_PIDFILE, $3.t); free($3.t); }
| system WORKERS NUM ';' { f_int(scanner, R_SYS, C_WORKERS, $3.i); }
| system WORKERS NUM ';' { f_int(scanner, R_SYS, C_UDP_WORKERS, $3.i); }
| system BACKGROUND_WORKERS NUM ';' { f_int(scanner, R_SYS, C_BG_WORKERS, $3.i); }
| system ASYNC_START BOOL ';' { f_bool(scanner, R_SYS, C_ASYNC_START, $3.i); }
| system MAX_CONN_IDLE INTERVAL ';' { f_int(scanner, R_SYS, C_TCP_IDLE_TIMEOUT, $3.i); }
......@@ -489,7 +489,7 @@ system:
| system RATE_LIMIT_SIZE SIZE ';' { f_int(scanner, R_SYS, C_RATE_LIMIT_TBL_SIZE, $3.l); }
| system RATE_LIMIT_SIZE NUM ';' { f_int(scanner, R_SYS, C_RATE_LIMIT_TBL_SIZE, $3.i); }
| system RATE_LIMIT_SLIP NUM ';' { f_int(scanner, R_SYS, C_RATE_LIMIT_SLIP, $3.i); }
| system TRANSFERS NUM ';' { f_int(scanner, R_SYS, C_TRANSFERS, $3.i); }
| system TRANSFERS NUM ';' { /* Not used. */ }
| system HOSTNAME TEXT ';' { /* Deprecated */ free($3.t); }
| system STORAGE TEXT ';' { /* Deprecated */ free($3.t); }
| system KEY TSIG_ALGO_NAME TEXT ';' { /* Deprecated */ free($3.t); free($4.t); }
......
......@@ -94,12 +94,12 @@ typedef enum {
#define C_TCP_HSHAKE_TIMEOUT "\x15""tcp-handshake-timeout"
#define C_TCP_IDLE_TIMEOUT "\x10""tcp-idle-timeout"
#define C_TCP_REPLY_TIMEOUT "\x11""tcp-reply-timeout"
#define C_TCP_WORKERS "\x0B""tcp-workers"
#define C_TPL "\x08""template"
#define C_TRANSFERS "\x09""transfers"
#define C_UDP_WORKERS "\x0B""udp-workers"
#define C_USER "\x04""user"
#define C_VERSION "\x07""version"
#define C_VIA "\x03""via"
#define C_WORKERS "\x07""workers"
#define C_ZONE "\x04""zone"
#define C_ZONEFILE_SYNC "\x0D""zonefile-sync"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment