[Unbound-users] libunbound - expected performance of cached rr

Paul Freeman unbound-users at lists-in.noc4.net
Mon Apr 23 20:34:47 UTC 2012


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






More information about the Unbound-users mailing list