Blame SOURCES/bind99-rh1098959.patch

900526
diff -up bind-9.8.2rc1/bin/named/include/named/lwresd.h.lwres_tasks_clients bind-9.8.2rc1/bin/named/include/named/lwresd.h
900526
--- bind-9.8.2rc1/bin/named/include/named/lwresd.h.lwres_tasks_clients	2007-06-20 01:46:59.000000000 +0200
900526
+++ bind-9.8.2rc1/bin/named/include/named/lwresd.h	2014-05-19 09:41:56.792427201 +0200
900526
@@ -36,6 +36,8 @@ struct ns_lwresd {
900526
 	dns_view_t *view;
900526
 	ns_lwsearchlist_t *search;
900526
 	unsigned int ndots;
900526
+	unsigned int ntasks;
900526
+	unsigned int nclients;
900526
 	isc_mem_t *mctx;
900526
 	isc_boolean_t shutting_down;
900526
 	unsigned int refs;
900526
diff -up bind-9.8.2rc1/bin/named/lwresd.c.lwres_tasks_clients bind-9.8.2rc1/bin/named/lwresd.c
900526
--- bind-9.8.2rc1/bin/named/lwresd.c.lwres_tasks_clients	2009-09-03 01:48:01.000000000 +0200
900526
+++ bind-9.8.2rc1/bin/named/lwresd.c	2014-05-19 09:41:56.793427201 +0200
900526
@@ -60,11 +60,7 @@
900526
 #define LWRESLISTENER_MAGIC	ISC_MAGIC('L', 'W', 'R', 'L')
900526
 #define VALID_LWRESLISTENER(l)	ISC_MAGIC_VALID(l, LWRESLISTENER_MAGIC)
900526
 
900526
-/*!
900526
- * The total number of clients we can handle will be NTASKS * NRECVS.
900526
- */
900526
-#define NTASKS		2	/*%< tasks to create to handle lwres queries */
900526
-#define NRECVS		2	/*%< max clients per task */
900526
+#define LWRESD_NCLIENTS_MAX		32768	/*%< max clients per task */
900526
 
900526
 typedef ISC_LIST(ns_lwreslistener_t) ns_lwreslistenerlist_t;
900526
 
900526
@@ -395,6 +391,24 @@ ns_lwdmanager_create(isc_mem_t *mctx, co
900526
 		}
900526
 	}
900526
 
900526
+	obj = NULL;
900526
+	(void)cfg_map_get(lwres, "lwres-tasks", &obj);
900526
+	if (obj != NULL)
900526
+		lwresd->ntasks = cfg_obj_asuint32(obj);
900526
+	else
900526
+		lwresd->ntasks = ns_g_cpus;
900526
+
900526
+	obj = NULL;
900526
+	(void)cfg_map_get(lwres, "lwres-clients", &obj);
900526
+	if (obj != NULL) {
900526
+		lwresd->nclients = cfg_obj_asuint32(obj);
900526
+		if (lwresd->nclients > LWRESD_NCLIENTS_MAX)
900526
+			lwresd->nclients = LWRESD_NCLIENTS_MAX;
900526
+	} else if (ns_g_lwresdonly)
900526
+		lwresd->nclients = 1024;
900526
+	else
900526
+		lwresd->nclients = 256;
900526
+
900526
 	lwresd->magic = LWRESD_MAGIC;
900526
 
900526
 	*lwresdp = lwresd;
900526
@@ -604,15 +618,24 @@ static isc_result_t
900526
 listener_startclients(ns_lwreslistener_t *listener) {
900526
 	ns_lwdclientmgr_t *cm;
900526
 	unsigned int i;
900526
-	isc_result_t result;
900526
+	isc_result_t result = ISC_R_SUCCESS;
900526
+
900526
+	isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
900526
+		      NS_LOGMODULE_LWRESD, ISC_LOG_DEBUG(6),
900526
+		      "listener_startclients: creating %d "
900526
+		      "managers with %d clients each",
900526
+		      listener->manager->ntasks, listener->manager->nclients);
900526
 
900526
 	/*
900526
 	 * Create the client managers.
900526
 	 */
900526
-	result = ISC_R_SUCCESS;
900526
-	for (i = 0; i < NTASKS && result == ISC_R_SUCCESS; i++)
900526
-		result = ns_lwdclientmgr_create(listener, NRECVS,
900526
+	for (i = 0; i < listener->manager->ntasks; i++) {
900526
+		result = ns_lwdclientmgr_create(listener,
900526
+						listener->manager->nclients,
900526
 						ns_g_taskmgr);
900526
+		if (result != ISC_R_SUCCESS)
900526
+			break;
900526
+	}
900526
 
900526
 	/*
900526
 	 * Ensure that we have created at least one.
900526
diff -up bind-9.8.2rc1/bin/named/named.conf.docbook.lwres_tasks_clients bind-9.8.2rc1/bin/named/named.conf.docbook
900526
--- bind-9.8.2rc1/bin/named/named.conf.docbook.lwres_tasks_clients	2011-11-07 01:31:47.000000000 +0100
900526
+++ bind-9.8.2rc1/bin/named/named.conf.docbook	2014-05-19 09:41:56.793427201 +0200
900526
@@ -185,6 +185,8 @@ lwres {
900526
 	view <replaceable>string</replaceable> <replaceable>optional_class</replaceable>;
900526
 	search { <replaceable>string</replaceable>; ... };
900526
 	ndots <replaceable>integer</replaceable>;
900526
+	lwres-tasks <replaceable>integer</replaceable>;
900526
+	lwres-clients <replaceable>integer</replaceable>;
900526
 };
900526
 </literallayout>
900526
   </refsect1>
900526
diff -up bind-9.8.2rc1/doc/arm/Bv9ARM-book.xml.lwres_tasks_clients bind-9.8.2rc1/doc/arm/Bv9ARM-book.xml
900526
--- bind-9.8.2rc1/doc/arm/Bv9ARM-book.xml.lwres_tasks_clients	2014-05-19 09:41:56.770427201 +0200
900526
+++ bind-9.8.2rc1/doc/arm/Bv9ARM-book.xml	2014-05-19 10:26:40.147380836 +0200
900526
@@ -2964,7 +2964,12 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.
900526
         be configured to act as a lightweight resolver daemon using the
900526
         <command>lwres</command> statement in <filename>named.conf</filename>.
900526
       </para>
900526
-
900526
+      <para>
900526
+        The number of client queries that the <command>lwresd</command>
900526
+        daemon is able to serve can be set using the
900526
+        <option>lwres-tasks</option> and <option>lwres-clients</option> 
900526
+        statements in the configuration.
900526
+      </para>
900526
     </sect1>
900526
   </chapter>
900526
 
900526
@@ -4959,6 +4964,8 @@ badresp:1,adberr:0,findfail:0,valfail:0]
900526
     <optional> view <replaceable>view_name</replaceable>; </optional>
900526
     <optional> search { <replaceable>domain_name</replaceable> ; <optional> <replaceable>domain_name</replaceable> ; ... </optional> }; </optional>
900526
     <optional> ndots <replaceable>number</replaceable>; </optional>
900526
+    <optional> lwres-tasks <replaceable>number</replaceable>; </optional>
900526
+    <optional> lwres-clients <replaceable>number</replaceable>; </optional>
900526
 };
900526
 </programlisting>
900526
 
900526
@@ -5017,6 +5024,31 @@ badresp:1,adberr:0,findfail:0,valfail:0]
900526
           number of dots in a relative domain name that should result in an
900526
           exact match lookup before search path elements are appended.
900526
         </para>
900526
+        <para>
900526
+          The <option>lwres-tasks</option> statement specifies the number
900526
+          of worker threads the lightweight resolver will dedicate to serving
900526
+          clients.  By default the number is the same as the number of CPUs on
900526
+          the system; this can be overridden using the <option>-n</option>
900526
+          command line option when starting the server. 
900526
+        </para>
900526
+        <para>
900526
+          The <option>lwres-clients</option> specifies
900526
+          the number of client objects per thread the lightweight
900526
+          resolver should create to serve client queries.
900526
+          By default, if the lightweight resolver runs as a part
900526
+          of <command>named</command>, 256 client objects are
900526
+          created for each task; if it runs as <command>lwresd</command>,
900526
+          1024 client objects are created for each thread. The maximum
900526
+          value is 32768; higher values will be silently ignored and
900526
+          the maximum will be used instead.
900526
+          Note that setting too high a value may overconsume
900526
+          system resources.
900526
+        </para>
900526
+        <para>
900526
+          The maximum number of client queries that the lightweight
900526
+          resolver can handle at any one time equals
900526
+          <option>lwres-tasks</option> times <option>lwres-clients</option>.
900526
+        </para>
900526
       </sect2>
900526
       <sect2>
900526
         <title><command>masters</command> Statement Grammar</title>
900526
diff -up bind-9.8.2rc1/lib/isccfg/namedconf.c.lwres_tasks_clients bind-9.8.2rc1/lib/isccfg/namedconf.c
900526
--- bind-9.8.2rc1/lib/isccfg/namedconf.c.lwres_tasks_clients	2014-05-19 09:41:56.771427201 +0200
900526
+++ bind-9.8.2rc1/lib/isccfg/namedconf.c	2014-05-19 09:41:56.797427201 +0200
900526
@@ -2563,6 +2563,8 @@ lwres_clauses[] = {
900526
 	{ "view", &cfg_type_lwres_view, 0 },
900526
 	{ "search", &cfg_type_lwres_searchlist, 0 },
900526
 	{ "ndots", &cfg_type_uint32, 0 },
900526
+	{ "lwres-tasks", &cfg_type_uint32, 0},
900526
+	{ "lwres-clients", &cfg_type_uint32, 0},
900526
 	{ NULL, NULL, 0 }
900526
 };
900526