From 5d23a6ac8392b1eeec8effdee47fb725ace1e759 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Wed, 9 Nov 2011 18:44:04 +0000 Subject: [PATCH] 3214. [func] Add 'named -U' option to set the number of UDP listener threads per interface. [RT #26485] --- CHANGES | 3 +++ bin/named/include/named/globals.h | 3 ++- bin/named/interfacemgr.c | 4 ++-- bin/named/main.c | 15 +++++++++++++-- bin/named/named.docbook | 17 ++++++++++++++++- bin/named/server.c | 5 +++-- 6 files changed, 39 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index 55b92c3d55..4920a2ac94 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3214. [func] Add 'named -U' option to set the number of UDP + listener threads per interface. [RT #26485] + 3213. [doc] Clarify ixfr-from-differences behavior. [RT #25188] 3212. [bug] rbtdb.c: failed to remove a node from the deadnodes list diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index 25fda37336..aefedc4b8b 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: globals.h,v 1.91 2011/06/17 23:47:49 tbox Exp $ */ +/* $Id: globals.h,v 1.92 2011/11/09 18:44:04 each Exp $ */ #ifndef NAMED_GLOBALS_H #define NAMED_GLOBALS_H 1 @@ -51,6 +51,7 @@ EXTERN isc_mem_t * ns_g_mctx INIT(NULL); EXTERN unsigned int ns_g_cpus INIT(0); +EXTERN unsigned int ns_g_udpdisp INIT(0); EXTERN isc_taskmgr_t * ns_g_taskmgr INIT(NULL); EXTERN dns_dispatchmgr_t * ns_g_dispatchmgr INIT(NULL); EXTERN isc_entropy_t * ns_g_entropy INIT(NULL); diff --git a/bin/named/interfacemgr.c b/bin/named/interfacemgr.c index bcf70200b0..d632ae92e7 100644 --- a/bin/named/interfacemgr.c +++ b/bin/named/interfacemgr.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: interfacemgr.c,v 1.100 2011/10/04 16:04:22 each Exp $ */ +/* $Id: interfacemgr.c,v 1.101 2011/11/09 18:44:03 each Exp $ */ /*! \file */ @@ -268,7 +268,7 @@ ns_interface_listenudp(ns_interface_t *ifp) { attrmask |= DNS_DISPATCHATTR_UDP | DNS_DISPATCHATTR_TCP; attrmask |= DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_IPV6; - ifp->nudpdispatch = ISC_MIN(ns_g_cpus, MAX_UDP_DISPATCH); + ifp->nudpdispatch = ISC_MIN(ns_g_udpdisp, MAX_UDP_DISPATCH); for (disp = 0; disp < ifp->nudpdispatch; disp++) { result = dns_dispatch_getudp_dup(ifp->mgr->dispatchmgr, ns_g_socketmgr, diff --git a/bin/named/main.c b/bin/named/main.c index 0c23290abb..cdd16bb7d0 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: main.c,v 1.184 2011/11/05 00:45:31 each Exp $ */ +/* $Id: main.c,v 1.185 2011/11/09 18:44:03 each Exp $ */ /*! \file */ @@ -418,7 +418,7 @@ parse_command_line(int argc, char *argv[]) { isc_commandline_errprint = ISC_FALSE; while ((ch = isc_commandline_parse(argc, argv, "46c:C:d:E:fFgi:lm:n:N:p:P:" - "sS:t:T:u:vVx:")) != -1) { + "sS:t:T:U:u:vVx:")) != -1) { switch (ch) { case '4': if (disable4) @@ -527,6 +527,11 @@ parse_command_line(int argc, char *argv[]) { fprintf(stderr, "unknown -T flag '%s\n", isc_commandline_argument); break; + case 'U': + ns_g_udpdisp = parse_int(isc_commandline_argument, + "number of UDP listeners " + "per interface"); + break; case 'u': ns_g_username = isc_commandline_argument; break; @@ -585,6 +590,12 @@ create_managers(void) { #else ns_g_cpus = 1; #endif + if (ns_g_udpdisp == 0 || ns_g_udpdisp > ns_g_cpus) + ns_g_udpdisp = ns_g_cpus; + isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER, + ISC_LOG_INFO, "using %u UDP listener%s per interface", + ns_g_udpdisp, ns_g_udpdisp == 1 ? "" : "s"); + result = isc_taskmgr_create(ns_g_mctx, ns_g_cpus, 0, &ns_g_taskmgr); if (result != ISC_R_SUCCESS) { UNEXPECTED_ERROR(__FILE__, __LINE__, diff --git a/bin/named/named.docbook b/bin/named/named.docbook index c748911e24..bfdcbe89af 100644 --- a/bin/named/named.docbook +++ b/bin/named/named.docbook @@ -18,7 +18,7 @@ - PERFORMANCE OF THIS SOFTWARE. --> - + May 21, 2009 @@ -69,6 +69,7 @@ + @@ -281,6 +282,20 @@ + + -U #listeners + + + Use #listeners + worker threads to listen for incoming UDP packets on each + address. If not specified, named will + use all of the worker threads for this purpose; the + option allows the number to be + decreased but not increased. + + + + -u user diff --git a/bin/named/server.c b/bin/named/server.c index 729fe91769..39b940f73c 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.629 2011/11/07 00:14:10 marka Exp $ */ +/* $Id: server.c,v 1.630 2011/11/09 18:44:03 each Exp $ */ /*! \file */ @@ -6982,6 +6982,7 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) { #ifdef ISC_PLATFORM_USETHREADS "CPUs found: %u\n" "worker threads: %u\n" + "UDP listeners per interface: %u\n" #endif "number of zones: %u\n" "debug level: %d\n" @@ -6994,7 +6995,7 @@ ns_server_status(ns_server_t *server, isc_buffer_t *text) { "server is up and running", ns_g_version, ob, alt, cb, #ifdef ISC_PLATFORM_USETHREADS - ns_g_cpus_detected, ns_g_cpus, + ns_g_cpus_detected, ns_g_cpus, ns_g_udpdisp, #endif zonecount, ns_g_debuglevel, xferrunning, xferdeferred, soaqueries, server->log_queries ? "ON" : "OFF",