]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] add "--with-tuning=large" option
authorEvan Hunt <each@isc.org>
Wed, 19 Feb 2014 06:36:14 +0000 (22:36 -0800)
committerEvan Hunt <each@isc.org>
Wed, 19 Feb 2014 06:36:14 +0000 (22:36 -0800)
3745. [func] "configure --with-tuning=large" adjusts various
compiled-in constants and default settings to
values suited to large servers with abundant
memory. [RT #29538]

12 files changed:
CHANGES
README
bin/named/interfacemgr.c
bin/named/named.docbook
bin/named/server.c
config.h.in
configure
configure.in
lib/dns/client.c
lib/dns/request.c
lib/dns/resolver.c
lib/isc/unix/socket.c

diff --git a/CHANGES b/CHANGES
index f062fe064d04af8690bd61afa46c49f75eeac551..a9084d23389d3026c968e0f42273c94efb5e8b03 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,8 @@
+3745.  [func]          "configure --with-tuning=large" adjusts various
+                       compiled-in constants and default settings to
+                       values suited to large servers with abundant
+                       memory. [RT #29538]
+
 3744.  [experimental]  SIT: send and process Source Identity Tokens
                        (similar to DNS Cookies by Donald Eastlake 3rd),
                        which are designed to help clients detect off-path
diff --git a/README b/README
index abfbc58c56971070b5e6cb505bb9f1979344bbb4..87b2f64dc87f04c325fa300d6ff5f31384200c1b 100644 (file)
--- a/README
+++ b/README
@@ -71,6 +71,11 @@ BIND 9.10.0
           DNSSEC problems.
         - Improved EDNS(0) processing for better resolver performance
           and reliability over slow or lossy connections.
+        - A new "configure --with-tuning=large" option tunes certain
+          compiled-in constants and default settings to values better
+          suited to large servers with abundant memory.  This can
+          improve performance on such servers, but will consume more
+          memory and may degrade performance on smaller systems.
         - Substantial improvement in response-policy zone (RPZ)
           performance.  Up to 32 response-policy zones can be
           configured with minimal performance loss.
@@ -119,7 +124,7 @@ BIND 9.10.0
           by default.
         - "named" now preserves the capitalization of names when
           responding to queries.  The former behavior can be restored
-           for specific clients via the new "no-case-compress" ACL.
+          for specific clients via the new "no-case-compress" ACL.
         - new "dnssec-importkey" command allows the use of offline
           DNSSEC keys with automatic DNSKEY management.
         - New "named-rrchecker" tool to verify the syntactic
@@ -297,6 +302,14 @@ Building
        To build shared libraries, specify "--with-libtool" on the
        configure command line.
 
+       Certain compiled-in constants and default settings can be
+       increased to values better suited to large servers with abundant
+       memory resources (e.g, 64-bit servers with 12G or more of memory)
+       by specifying "--with-tuning=large" on the configure command
+       line. This can improve performance on big servers, but will
+       consume more memory and may degrade performance on smaller
+       systems.
+
        For the server to support DNSSEC, you need to build it
        with crypto support.  You must have OpenSSL 0.9.5a
        or newer installed and specify "--with-openssl" on the
index 2dece8e6332862193f2c5c5869c70fa27110ef8b..150114e50ed49c66c540b56fc01e4cb29fd183f4 100644 (file)
 #endif
 #endif
 
+#ifdef TUNE_LARGE
+#define UDPBUFFERS 32768 
+#else
+#define UDPBUFFERS 1000
+#endif /* TUNE_LARGE */
+
 #define IFMGR_MAGIC                    ISC_MAGIC('I', 'F', 'M', 'G')
 #define NS_INTERFACEMGR_VALID(t)       ISC_MAGIC_VALID(t, IFMGR_MAGIC)
 
@@ -424,7 +430,8 @@ ns_interface_listenudp(ns_interface_t *ifp) {
                result = dns_dispatch_getudp_dup(ifp->mgr->dispatchmgr,
                                                 ns_g_socketmgr,
                                                 ns_g_taskmgr, &ifp->addr,
-                                                4096, 1000, 32768, 8219, 8237,
+                                                4096, UDPBUFFERS,
+                                                32768, 8219, 8237,
                                                 attrs, attrmask,
                                                 &ifp->udpdispatch[disp],
                                                 disp == 0
index f35432e853f6c7705415212a33bbedee41e277ef..f70787b142ccaa67a5eb4040434348067a2af2b7 100644 (file)
          <para>
            Allow <command>named</command> to use up to
            <replaceable class="parameter">#max-socks</replaceable> sockets.
+            The default value is 4096 on systems built with default
+            configuration options, and 21000 on systems built with
+            "configure --with-tuning=large".
          </para>
           <warning>
             <para>
index 675e200f2c1a299b542f4ad119d35ea1682c2403..494df97fff913aa9cc5b3e41e8083becdc3bd038 100644 (file)
 #define SIZE_MAX ((size_t)-1)
 #endif
 
+#ifdef TUNE_LARGE
+#define RESOLVER_NTASKS 523
+#define UDPBUFFERS 32768
+#define EXCLBUFFERS 32768
+#else
+#define RESOLVER_NTASKS 31
+#define UDPBUFFERS 1000
+#define EXCLBUFFERS 4096
+#endif /* TUNE_LARGE */
+
 /*%
  * Check an operation for failure.  Assumes that the function
  * using it has a 'result' variable and a 'cleanup' label.
@@ -960,7 +970,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af,
        isc_sockaddr_t sa;
        unsigned int attrs, attrmask;
        const cfg_obj_t *obj = NULL;
-       unsigned int maxdispatchbuffers;
+       unsigned int maxdispatchbuffers = UDPBUFFERS;
        isc_dscp_t dscp = -1;
 
        switch (af) {
@@ -1014,7 +1024,7 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af,
        }
        if (isc_sockaddr_getport(&sa) == 0) {
                attrs |= DNS_DISPATCHATTR_EXCLUSIVE;
-               maxdispatchbuffers = 4096;
+               maxdispatchbuffers = EXCLBUFFERS;
        } else {
                INSIST(obj != NULL);
                if (is_firstview) {
@@ -1023,7 +1033,6 @@ get_view_querysource_dispatch(const cfg_obj_t **maps, int af,
                                    "suppresses port randomization and can be "
                                    "insecure.");
                }
-               maxdispatchbuffers = 1000;
        }
 
        attrmask = 0;
@@ -2929,8 +2938,8 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
        dns_view_setresquerystats(view, resquerystats);
 
        ndisp = 4 * ISC_MIN(ns_g_udpdisp, MAX_UDP_DISPATCH);
-       CHECK(dns_view_createresolver(view, ns_g_taskmgr, 31, ndisp,
-                                     ns_g_socketmgr, ns_g_timermgr,
+       CHECK(dns_view_createresolver(view, ns_g_taskmgr, RESOLVER_NTASKS,
+                                     ndisp, ns_g_socketmgr, ns_g_timermgr,
                                      resopts, ns_g_dispatchmgr,
                                      dispatch4, dispatch6));
 
@@ -6898,7 +6907,7 @@ ns_add_reserved_dispatch(ns_server_t *server, const isc_sockaddr_t *addr) {
 
        result = dns_dispatch_getudp(ns_g_dispatchmgr, ns_g_socketmgr,
                                     ns_g_taskmgr, &dispatch->addr, 4096,
-                                    1000, 32768, 16411, 16433,
+                                    UDPBUFFERS, 32768, 16411, 16433,
                                     attrs, attrmask, &dispatch->dispatch);
        if (result != ISC_R_SUCCESS)
                goto cleanup;
index c6dd731812026d7f62d7c655c26e05a1eaa139b1..c65d8911bc80e70a197866cff7cc1d950d086d19 100644 (file)
@@ -491,6 +491,9 @@ int sigwait(const unsigned int *set, int *sig);
 /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
 #undef TIME_WITH_SYS_TIME
 
+/* Define to use large-system tuning. */
+#undef TUNE_LARGE
+
 /* Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make
    non-blocking. */
 #undef USE_FIONBIO_IOCTL
index 094c19c02af62f91dbc1e9e4be2e2d489debdd19..aa75e79686a9ec8ca1a1d8e8173aa4d74cd28027 100755 (executable)
--- a/configure
+++ b/configure
@@ -1014,6 +1014,7 @@ with_libiconv
 with_iconv
 with_idnlib
 with_atf
+with_tuning
 with_dlopen
 with_dlz_postgres
 with_dlz_mysql
@@ -1711,6 +1712,7 @@ Optional Packages:
   --with-iconv=LIBSPEC    specify iconv library default -liconv
   --with-idnlib=ARG       specify libidnkit
   --with-atf=ARG          support Automated Test Framework
+  --with-tuning=ARG       Specify server tuning (large or default)
   --with-dlopen=ARG       support dynamically loadable DLZ drivers
   --with-dlz-postgres=PATH   Build with Postgres DLZ driver yes|no|path.
                               (Required to use Postgres with DLZ)
 done
 
 
+#
+# was --with-tuning specified?
+#
+
+# Check whether --with-tuning was given.
+if test "${with_tuning+set}" = set; then :
+  withval=$with_tuning; use_tuning="$withval"
+else
+  use_tuning="no"
+fi
+
+
+case "$use_tuning" in
+       large)
+               if ! $use_threads; then
+                       as_fn_error $? "Large-system tuning requires threads." "$LINENO" 5
+               fi
+
+$as_echo "#define TUNE_LARGE 1" >>confdefs.h
+
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: using large-system tuning" >&5
+$as_echo "using large-system tuning" >&6; }
+               ;;
+       no|default)
+               { $as_echo "$as_me:${as_lineno-$LINENO}: result: using default tuning" >&5
+$as_echo "using default tuning" >&6; }
+               ;;
+       yes|*)
+                as_fn_error $? "You must specify \"large\" or \"default\" for --with-tuning." "$LINENO" 5
+               ;;
+esac
+
 #
 # Substitutions
 #
@@ -23552,6 +23586,7 @@ echo "Configuration summary:"
 echo "------------------------------------------------------------------------"
 echo "Optional features enabled:"
 $use_threads && echo "    Multiprocessing support (--enable-threads)"
+test "$use_tuning" = "large" && echo "    Large-system tuning (--with-tuning)"
 test "$use_geoip" = "no" || echo "    GeoIP access control (--with-geoip)"
 test "$use_gssapi" = "no" || echo "    GSS-API (--with-gssapi)"
 if test "$enable_sit" != "no"; then
@@ -23620,6 +23655,7 @@ echo "Features disabled or unavailable on this platform:"
 $use_threads || echo "    Multiprocessing support (--enable-threads)"
 test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" && \
        echo "    IPv6 support (--enable-ipv6)"
+test "$use_tuning" = "large" || echo "    Large-system tuning (--with-tuning)"
 
 test "$use_geoip" = "no" && echo "    GeoIP access control (--with-geoip)"
 test "$use_gssapi" = "no" && echo "    GSS-API (--with-gssapi)"
index 853d436cbc37f0bf7e045398dfebf0b61c968062..4027e40cc5bcd200cbe2576148b9a89c3969abc4 100644 (file)
@@ -3739,6 +3739,29 @@ AC_SUBST(UNITTESTS)
 AC_CHECK_HEADERS(locale.h)
 AC_CHECK_FUNCS(setlocale)
 
+#
+# was --with-tuning specified?
+#
+AC_ARG_WITH(tuning,
+       [  --with-tuning=ARG       Specify server tuning (large or default)],
+       use_tuning="$withval", use_tuning="no")
+
+case "$use_tuning" in
+       large)
+               if ! $use_threads; then
+                       AC_MSG_ERROR([Large-system tuning requires threads.])
+               fi
+                AC_DEFINE(TUNE_LARGE, 1, [Define to use large-system tuning.])
+               AC_MSG_RESULT(using large-system tuning)
+               ;;
+       no|default)
+               AC_MSG_RESULT(using default tuning)
+               ;;
+       yes|*)
+                AC_MSG_ERROR([You must specify "large" or "default" for --with-tuning.])
+               ;;
+esac
+
 #
 # Substitutions
 #
@@ -4289,6 +4312,7 @@ echo "Configuration summary:"
 echo "------------------------------------------------------------------------"
 echo "Optional features enabled:"
 $use_threads && echo "    Multiprocessing support (--enable-threads)"
+test "$use_tuning" = "large" && echo "    Large-system tuning (--with-tuning)"
 test "$use_geoip" = "no" || echo "    GeoIP access control (--with-geoip)"
 test "$use_gssapi" = "no" || echo "    GSS-API (--with-gssapi)"
 if test "$enable_sit" != "no"; then
@@ -4357,6 +4381,7 @@ echo "Features disabled or unavailable on this platform:"
 $use_threads || echo "    Multiprocessing support (--enable-threads)"
 test "$enable_ipv6" = "no" -o "$found_ipv6" = "no" && \
        echo "    IPv6 support (--enable-ipv6)"
+test "$use_tuning" = "large" || echo "    Large-system tuning (--with-tuning)"
 
 test "$use_geoip" = "no" && echo "    GeoIP access control (--with-geoip)"
 test "$use_gssapi" = "no" && echo "    GSS-API (--with-gssapi)"
index 867f2c6322caeea543528ec6f193dc40e284e2bf..f37f6f36c00033699f9d1b7e8bc2e44740186c7e 100644 (file)
 
 #define MAX_RESTARTS 16
 
+#ifdef TUNE_LARGE
+#define RESOLVER_NTASKS 523
+#else
+#define RESOLVER_NTASKS 31
+#endif /* TUNE_LARGE */
+
 /*%
  * DNS client object
  */
@@ -509,9 +515,9 @@ dns_client_createx2(isc_mem_t *mctx, isc_appctx_t *actx,
        }
 
        /* Create the default view for class IN */
-       result = createview(mctx, dns_rdataclass_in, options, taskmgr, 31,
-                           socketmgr, timermgr, dispatchmgr,
-                           dispatchv4, dispatchv6, &view);
+       result = createview(mctx, dns_rdataclass_in, options, taskmgr,
+                           RESOLVER_NTASKS, socketmgr, timermgr,
+                           dispatchmgr, dispatchv4, dispatchv6, &view);
        if (result != ISC_R_SUCCESS)
                goto cleanup;
        ISC_LIST_INIT(client->viewlist);
index d50eaf833d6b629ccbbcca7ac45926b9797fc20d..b21786875c49156d4cff7e516028189478681203 100644 (file)
@@ -619,7 +619,7 @@ find_udp_dispatch(dns_requestmgr_t *requestmgr, isc_sockaddr_t *srcaddr,
                                    requestmgr->socketmgr,
                                    requestmgr->taskmgr,
                                    srcaddr, 4096,
-                                   1000, 32768, 16411, 16433,
+                                   32768, 32768, 16411, 16433,
                                    attrs, attrmask,
                                    dispatchp));
 }
index e0c765d51eff8c09633410c480089c6f9ce03388..fa188c128717b1bde77e947b3ebadeca3746eda5 100644 (file)
@@ -1545,7 +1545,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
                        result = dns_dispatch_getudp(res->dispatchmgr,
                                                     res->socketmgr,
                                                     res->taskmgr, &addr,
-                                                    4096, 1000, 32768, 16411,
+                                                    4096, 20000, 32768, 16411,
                                                     16433, attrs, attrmask,
                                                     &query->dispatch);
                        if (result != ISC_R_SUCCESS)
index b0ef546465c967f1fe460e11f0a6574709613801..78ff4d7fd2b11a44edeb76cebaee1a975ba4764f 100644 (file)
@@ -158,7 +158,11 @@ int isc_dscp_check_value = -1;
  */
 #ifndef ISC_SOCKET_MAXSOCKETS
 #if defined(USE_KQUEUE) || defined(USE_EPOLL) || defined(USE_DEVPOLL)
+#ifdef TUNE_LARGE
+#define ISC_SOCKET_MAXSOCKETS 21000
+#else
 #define ISC_SOCKET_MAXSOCKETS 4096
+#endif /* TUNE_LARGE */
 #elif defined(USE_SELECT)
 #define ISC_SOCKET_MAXSOCKETS FD_SETSIZE
 #endif /* USE_KQUEUE... */
@@ -220,7 +224,11 @@ typedef enum { poll_idle, poll_active, poll_checking } pollstate_t;
  */
 #if defined(USE_KQUEUE) || defined(USE_EPOLL) || defined(USE_DEVPOLL)
 #ifndef ISC_SOCKET_MAXEVENTS
+#ifdef TUNE_LARGE
+#define ISC_SOCKET_MAXEVENTS   2048
+#else
 #define ISC_SOCKET_MAXEVENTS   64
+#endif /* TUNE_LARGE */
 #endif
 #endif
 
@@ -296,7 +304,11 @@ typedef isc_event_t intev_t;
 /*%
  * The size to raise the receive buffer to (from BIND 8).
  */
+#ifdef TUNE_LARGE
+#define RCVBUFSIZE (16*1024*1024)
+#else
 #define RCVBUFSIZE (32*1024)
+#endif /* TUNE_LARGE */
 
 /*%
  * The number of times a send operation is repeated if the result is EINTR.