]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Don't update LRU if the node was recently used.
authorWitold Kręcicki <wpk@isc.org>
Fri, 31 Jan 2020 12:26:34 +0000 (13:26 +0100)
committerWitold Kręcicki <wpk@isc.org>
Fri, 7 Feb 2020 08:28:12 +0000 (09:28 +0100)
Updating LRU requires write-locking the node, which causes contention.
Update LRU only if time difference is large enough.

lib/dns/rbtdb.c

index 97c328041dfa71b55cede4f8209d20607f8180cb..48606cbea1cebdc6f38e2f56af99c23ff91e8ad0 100644 (file)
@@ -172,9 +172,12 @@ typedef isc_rwlock_t nodelock_t;
  * to be 0 by default either with or without threads.
  */
 #ifndef DNS_RBTDB_LIMITLRUUPDATE
-#define DNS_RBTDB_LIMITLRUUPDATE 0
+#define DNS_RBTDB_LIMITLRUUPDATE 1
 #endif
 
+#define DNS_RBTDB_LRUUPDATE_GLUE 300
+#define DNS_RBTDB_LRUUPDATE_REGULAR 600
+
 /*
  * Allow clients with a virtual time of up to 5 minutes in the past to see
  * records that would have otherwise have expired.
@@ -10088,11 +10091,11 @@ need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) {
                 * Glue records are updated if at least 60 seconds have passed
                 * since the previous update time.
                 */
-               return (header->last_used + 60 <= now);
+               return (header->last_used + DNS_RBTDB_LRUUPDATE_GLUE <= now);
        }
 
        /* Other records are updated if 5 minutes have passed. */
-       return (header->last_used + 300 <= now);
+       return (header->last_used + DNS_RBTDB_LRUUPDATE_REGULAR <= now);
 #else
        UNUSED(now);