Performance issues with deadwood

Sam Trenholme strenholme.usenet at gmail.com
Mon Sep 6 23:47:07 EDT 2010


> $:> time $(for h in $(cat hosts.txt); do printf "\n\n\n"; dig $h; done > test.log)
>
> The result is rather disappointing, the mean value over several runs
> is around
>
>  8 min for deadwood and
>  1 min for unbound.

OK, I’ve found and fixed a bug in Deadwood which accounted for about
two thirds of the slowdown compared to unbound.

I just did the same test you did, and this the timings I saw:

* 7 minutes 29 seconds without the bug patched (about the same you
saw, with a fairly large cache in place)

* 2 minutes 57 seconds with the bug patched (from a “cold start”: No cache)

Now, the reason I’m getting slower numbers than you may be caused by
me having a slower internet connection than you.  Or, it may be caused
because there are other bugs slowing down resolution which I still
need to stamp out.

Anyway, deadwood-H-20100906-2.tar.bz2 at
http://maradns.org/deadwood/snap/ has the bug patched.  In addition, I
will add the patch after my rather long sig.

Thank you for the bug report and let me know how much of a speedup you see.

- Sam

Note: I do not answer MaraDNS (including Deadwood) support requests
sent by private email without being compensated for my time. A MaraDNS
support request is any and all discussion you may wish to have about
MaraDNS in private email; if you want to email me to talk about
MaraDNS then, yes, that is a support request. I will discuss rates if
you want this kind of support. Thank you for your understanding.

MaraDNS security vulnerability reports, however, will be dealt with
without charge and kept confidential. If you don't know what Bugtraq
is, then, no, your email is not a security report. It is not a
security report unless you've done due diligence to determine how the
security bug you think you found can reasonably be exploited.

--- deadwood-H-20100906-1/src/DwUdpSocket.c.orig        2010-09-06
20:01:26.000000000 -0700
+++ deadwood-H-20100906-1/src/DwUdpSocket.c     2010-09-06
20:03:49.000000000 -0700
@@ -179,8 +179,9 @@
      dw_str *query, SOCKET x_socket_num) {
         sockaddr_all_T server;
         SOCKET s = 0;
-        int32_t rnum = -1;
+        int_fast32_t rnum = -1;
         ip_addr_T addr = {0,{0,0},0,0};
+       int counter = 0;
         socklen_t inet_len = sizeof(struct sockaddr_in);

         if(rem[n].socket != x_socket_num || /* Already used (sanity check) */
@@ -195,7 +196,12 @@
         }

         /* Get IP of remote server and open a socket to them */
-        addr = get_upstream_ip(query,n);
+       for(counter = 0; counter < 7; counter++) { /* Don't stop on bad IP */
+               addr = get_upstream_ip(query,n);
+               if(addr.len > 0) {
+                       break;
+               }
+       }
         dw_log_ip("Making connection to IP",&addr,128);
         if(addr.len == 0) { /* Failed to get upstream IP */
                 return;


More information about the list mailing list