]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3650. [tuning] Use separate rate limiting queues for refresh and
authorMark Andrews <marka@isc.org>
Sat, 21 Sep 2013 06:47:21 +0000 (16:47 +1000)
committerMark Andrews <marka@isc.org>
Sat, 21 Sep 2013 06:47:21 +0000 (16:47 +1000)
                        notify requests. [RT #30589]

(cherry picked from commit c1b8fa61604e153d6f2c6d91acc9481446e631f2)

CHANGES
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index 90fc4320726f7e398ae522970c0761ec3c4550bd..d27c9ddfcbc6a14f3cc2d21eeb8d4b2a937dda55 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3650.  [tuning]        Use separate rate limiting queues for refresh and
+                       notify requests. [RT #30589]
+
 3648.  [test]          Updated the ATF test framework to version 0.17.
                        [RT #25627]
 
index e7eb85c253e6770d61400e691dff4bd65190e270..982ff2047d893c501211a9ffd9e70364d7829d06 100644 (file)
@@ -404,7 +404,8 @@ struct dns_zonemgr {
        isc_socketmgr_t *       socketmgr;
        isc_taskpool_t *        zonetasks;
        isc_task_t *            task;
-       isc_ratelimiter_t *     rl;
+       isc_ratelimiter_t *     notifyrl;
+       isc_ratelimiter_t *     refreshrl;
        isc_rwlock_t            rwlock;
        isc_mutex_t             iolock;
        isc_rwlock_t            urlock;
@@ -6919,7 +6920,7 @@ notify_send_queue(dns_notify_t *notify) {
                return (ISC_R_NOMEMORY);
        e->ev_arg = notify;
        e->ev_sender = NULL;
-       result = isc_ratelimiter_enqueue(notify->zone->zmgr->rl,
+       result = isc_ratelimiter_enqueue(notify->zone->zmgr->notifyrl,
                                         notify->zone->task, &e);
        if (result != ISC_R_SUCCESS)
                isc_event_free(&e);
@@ -8042,7 +8043,7 @@ queue_soa_query(dns_zone_t *zone) {
 
        e->ev_arg = zone;
        e->ev_sender = NULL;
-       result = isc_ratelimiter_enqueue(zone->zmgr->rl, zone->task, &e);
+       result = isc_ratelimiter_enqueue(zone->zmgr->refreshrl, zone->task, &e);
        if (result != ISC_R_SUCCESS) {
                zone_idetach(&dummy);
                isc_event_free(&e);
@@ -10703,7 +10704,8 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
        zmgr->socketmgr = socketmgr;
        zmgr->zonetasks = NULL;
        zmgr->task = NULL;
-       zmgr->rl = NULL;
+       zmgr->notifyrl = NULL;
+       zmgr->refreshrl = NULL;
        ISC_LIST_INIT(zmgr->zones);
        ISC_LIST_INIT(zmgr->waiting_for_xfrin);
        ISC_LIST_INIT(zmgr->xfrin_in_progress);
@@ -10727,15 +10729,24 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
 
        isc_task_setname(zmgr->task, "zmgr", zmgr);
        result = isc_ratelimiter_create(mctx, timermgr, zmgr->task,
-                                       &zmgr->rl);
+                                       &zmgr->notifyrl);
        if (result != ISC_R_SUCCESS)
                goto free_task;
 
+       result = isc_ratelimiter_create(mctx, timermgr, zmgr->task,
+                                       &zmgr->refreshrl);
+       if (result != ISC_R_SUCCESS)
+               goto free_notifyrl;
+
        /* default to 20 refresh queries / notifies per second. */
        isc_interval_set(&interval, 0, 1000000000/2);
-       result = isc_ratelimiter_setinterval(zmgr->rl, &interval);
+       result = isc_ratelimiter_setinterval(zmgr->notifyrl, &interval);
+       RUNTIME_CHECK(result == ISC_R_SUCCESS);
+       isc_ratelimiter_setpertic(zmgr->notifyrl, 10);
+
+       result = isc_ratelimiter_setinterval(zmgr->refreshrl, &interval);
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
-       isc_ratelimiter_setpertic(zmgr->rl, 10);
+       isc_ratelimiter_setpertic(zmgr->refreshrl, 10);
 
        zmgr->iolimit = 1;
        zmgr->ioactive = 0;
@@ -10744,7 +10755,7 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
 
        result = isc_mutex_init(&zmgr->iolock);
        if (result != ISC_R_SUCCESS)
-               goto free_rl;
+               goto free_refreshrl;
 
        zmgr->magic = ZONEMGR_MAGIC;
 
@@ -10755,8 +10766,10 @@ dns_zonemgr_create(isc_mem_t *mctx, isc_taskmgr_t *taskmgr,
  free_iolock:
        DESTROYLOCK(&zmgr->iolock);
 #endif
- free_rl:
-       isc_ratelimiter_detach(&zmgr->rl);
+ free_refreshrl:
+       isc_ratelimiter_detach(&zmgr->refreshrl);
+ free_notifyrl:
+       isc_ratelimiter_detach(&zmgr->notifyrl);
  free_task:
        isc_task_detach(&zmgr->task);
  free_urlock:
@@ -10924,7 +10937,8 @@ dns_zonemgr_shutdown(dns_zonemgr_t *zmgr) {
 
        REQUIRE(DNS_ZONEMGR_VALID(zmgr));
 
-       isc_ratelimiter_shutdown(zmgr->rl);
+       isc_ratelimiter_shutdown(zmgr->notifyrl);
+       isc_ratelimiter_shutdown(zmgr->refreshrl);
 
        if (zmgr->task != NULL)
                isc_task_destroy(&zmgr->task);
@@ -10982,7 +10996,8 @@ zonemgr_free(dns_zonemgr_t *zmgr) {
        zmgr->magic = 0;
 
        DESTROYLOCK(&zmgr->iolock);
-       isc_ratelimiter_detach(&zmgr->rl);
+       isc_ratelimiter_detach(&zmgr->notifyrl);
+       isc_ratelimiter_detach(&zmgr->refreshrl);
 
        isc_rwlock_destroy(&zmgr->urlock);
        isc_rwlock_destroy(&zmgr->rwlock);
@@ -11371,9 +11386,14 @@ dns_zonemgr_setserialqueryrate(dns_zonemgr_t *zmgr, unsigned int value) {
        }
 
        isc_interval_set(&interval, s, ns);
-       result = isc_ratelimiter_setinterval(zmgr->rl, &interval);
+
+       result = isc_ratelimiter_setinterval(zmgr->notifyrl, &interval);
+       RUNTIME_CHECK(result == ISC_R_SUCCESS);
+       isc_ratelimiter_setpertic(zmgr->notifyrl, pertic);
+
+       result = isc_ratelimiter_setinterval(zmgr->refreshrl, &interval);
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
-       isc_ratelimiter_setpertic(zmgr->rl, pertic);
+       isc_ratelimiter_setpertic(zmgr->refreshrl, pertic);
 
        zmgr->serialqueryrate = value;
 }