]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3214. [func] Add 'named -U' option to set the number of UDP
authorEvan Hunt <each@isc.org>
Wed, 9 Nov 2011 18:44:04 +0000 (18:44 +0000)
committerEvan Hunt <each@isc.org>
Wed, 9 Nov 2011 18:44:04 +0000 (18:44 +0000)
listener threads per interface. [RT #26485]

CHANGES
bin/named/include/named/globals.h
bin/named/interfacemgr.c
bin/named/main.c
bin/named/named.docbook
bin/named/server.c

diff --git a/CHANGES b/CHANGES
index 55b92c3d5553730252206dbdfd91ee659fd3e8d5..4920a2ac94b99b244719f05137bb6cf45aee1fd4 100644 (file)
--- 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
index 25fda37336479a4f5fccf75f56701c85b7f4a9b4..aefedc4b8b1d0412a3d61af546d4f1fd4da539fd 100644 (file)
@@ -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);
index bcf70200b086b63329f6eda9f2ab1aece7d35ac5..d632ae92e7de89f4923dea823029ef45155a5baa 100644 (file)
@@ -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,
index 0c23290abbb36e12ea3b96f346e59a060c1894d5..cdd16bb7d04fc89c9dcf9e58f0838dafeb0d12ac 100644 (file)
@@ -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__,
index c748911e24a10452a6e906b02e59239865c43c45..bfdcbe89af3b3ca6c18ecda435c7781b087df607 100644 (file)
@@ -18,7 +18,7 @@
  - PERFORMANCE OF THIS SOFTWARE.
 -->
 
-<!-- $Id: named.docbook,v 1.26 2009/10/05 17:30:49 fdupont Exp $ -->
+<!-- $Id: named.docbook,v 1.27 2011/11/09 18:44:03 each Exp $ -->
 <refentry id="man.named">
   <refentryinfo>
     <date>May 21, 2009</date>
@@ -69,6 +69,7 @@
       <arg><option>-s</option></arg>
       <arg><option>-S <replaceable class="parameter">#max-socks</replaceable></option></arg>
       <arg><option>-t <replaceable class="parameter">directory</replaceable></option></arg>
+      <arg><option>-U <replaceable class="parameter">#listeners</replaceable></option></arg>
       <arg><option>-u <replaceable class="parameter">user</replaceable></option></arg>
       <arg><option>-v</option></arg>
       <arg><option>-V</option></arg>
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term>-U <replaceable class="parameter">#listeners</replaceable></term>
+        <listitem>
+          <para>
+            Use <replaceable class="parameter">#listeners</replaceable>
+            worker threads to listen for incoming UDP packets on each
+            address.  If not specified, <command>named</command> will
+            use all of the worker threads for this purpose; the
+            <option>-U</option> option allows the number to be
+            decreased but not increased.
+          </para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term>-u <replaceable class="parameter">user</replaceable></term>
         <listitem>
index 729fe91769a919b584d12e4999860ac12313178c..39b940f73c6a5bf6926f32ea7aefea1ea2ca1972 100644 (file)
@@ -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",