[Unbound-users] Fwd: libunbound - expected performance of cached rr - 22 times slower than libc ?

W.C.A. Wijngaards wouter at nlnetlabs.nl
Mon May 7 08:37:02 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Paul,

The code that is involved creates the resolver object, notices there
is a local etc/hosts entry, creates the reply and destroys the
resolver object involved.  (and a couple mutexes are acquired and
released).

The etc/hosts file was read in on the first query, and the contents
are retained in memory in the ctx.

Perhaps these mallocs are the overhead that libc does not have to
bother with?

Best regards,
   Wouter

On 05/04/2012 03:13 PM, Paul Freeman wrote:
> 
> does anyone have any idea why this is ~22 times slower than 
> libc/getaddrinfo()?
> 
> -------- Original Message -------- Subject: [Unbound-users]
> libunbound - expected performance of cached rr Date: Mon, 23 Apr
> 2012 21:34:47 +0100 From: Paul Freeman
> <unbound-users at lists-in.noc4.net> To: <unbound-users at unbound.net>
> 
> 
> Hi, Having just carried out some crude benchmarking, I just thought
> I would sound out the list here.
> 
> Version 1.4.16 linked libs: libevent 2.0.16-stable (it uses epoll),
> ldns 1.6.11, OpenSSL 1.0.0h 12 Mar 2012 linked modules: validator
> iterator configured for x86_64-pc-linux-gnu on Mon Apr 23 17:54:58
> BST 2012 with options: '--prefix=/usr'
> '--build=x86_64-pc-linux-gnu' '--host=x86_64-pc-linux-gnu'
> '--mandir=/usr/share/man' '--infodir=/usr/share/info'
> '--datadir=/usr/share' '--sysconfdir=/etc' 
> '--localstatedir=/var/lib' '--libdir=/usr/lib64' 
> '--with-pidfile=/var/run/unbound.pid' '--with-ldns=/usr' 
> '--with-libevent=/usr' 
> '--with-rootkey-file=/etc/dnssec/root-anchors.txt'
> '--disable-debug' '--disable-gost' '--disable-static'
> '--with-pthreads' '--without-pyunbound' '--without-pythonmodule'
> '--disable-rpath'
> 
> uname -a Linux fire 3.3.0-gentoo #3 SMP Fri Mar 30 21:00:18 BST
> 2012 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 4200+
> AuthenticAMD GNU/Linux
> 
> /etc/hosts contains a line of the form:
> 
> 127.0.0.2    test.local
> 
> 
> the following snippet yields ~850 queries/second
> 
> #define HC 10000
> 
> if( (retval=ub_ctx_hosts(ctx, "/etc/hosts")) != 0) { printf("error
> reading hosts: %s. errno says: %s\n", ub_strerror(retval),
> strerror(errno)); return 1; }
> 
> gettimeofday(&start_time, NULL);
> 
> 
> for (i=0; i<HC; i++){ retval = ub_resolve(ctx, "test.local", 1, 1,
> &result); if(retval != 0) { printf("resolve error: %s\n",
> ub_strerror(retval)); return 1; }
> 
> if((i == HC-1) &&result->havedata) printf("The address is %s\n",
> inet_ntoa(*(struct in_addr*)result->data[0]));
> 
> ub_resolve_free(result); }
> 
> gettimeofday(&end_time, NULL);
> 
> 
> a similar loop using getaddrinfo() yields ~19,000 queries per
> second
> 
> 
> I was expecting the ub_resolve() rate to be higher given that the
> data is locally cached, unless I have missed something?
> 
> 
> any advice graciously accepted, thanks.
> 
> 
> regards Paul
> 
> 
> 
> _______________________________________________ Unbound-users
> mailing list Unbound-users at unbound.net 
> http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users
> 
> _______________________________________________ Unbound-users
> mailing list Unbound-users at unbound.net 
> http://unbound.nlnetlabs.nl/mailman/listinfo/unbound-users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJPp4muAAoJEJ9vHC1+BF+NsFoP/1RIs8+8PIDmmdUxNvSX45dY
vFFB0oyMeHiJCN9IJ64TZWkoK96oBgWzl3Vl3LGBKqYBEJ37GkiBDYNfiuYIanIt
ukkeKDdZojqrcIAWj7g4Q3MlJmd1NO84TltU82mj2W+NdL8+CTgQRTf4X0ZntCHO
NTglPj+ZYMsRoEGxhJYtj8bhwa1w+wJkmKfkqhPr/FzaQfZRTz4YsyhfMNnw3qkZ
yIg4jkr45YXvDtueYEv8aLEbkBvWPmirD8MFBXzXmKPOvlOJUf13qvj5UMCvtM77
Ez7bV0vR7enj0sTT+7vyI61i9gViFPTZSB2oAm6x6FLLqe6pJwdEXsLjJ0f8dLT2
sXzhg8q7lNxeLw9zxT3yM1ZBl0VNubQ0RAsHN44PdGWxsDTnqmCKo1UFidmlxuyF
BT+xHm0T+ZGxSytzZalJVFRiJV6qj7lHddV6gbVPl/Bth6gPuLA6Fp6R7wI4xMWs
QbR2tXGLtH7JEZBB/LxyToPADTEqYvaqIDpSE1vVi7xmklpvA53H3xBgsgRWmESb
8LDc/6LsJ4opthJbh0OS704fNiFVTw6QMmppmaLXPZzalzQwguOii8WxMfwhfrzd
ZosKsEdstniUV5bOIK3+zj1X4+KdYWa594aqTxhj1fKDxBc8G3f88IXgVsJF6Ttw
2SD0LarljK+Rk6l+D/51
=L1R2
-----END PGP SIGNATURE-----



More information about the Unbound-users mailing list