<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >Performance related settings</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PowerDNS manual" HREF="index.html"><LINK REL="UP" TITLE="Performance" HREF="performance.html"><LINK REL="PREVIOUS" TITLE="Native Posix Thread Library vs LinuxThreads" HREF="nptl.html"><LINK REL="NEXT" TITLE="Migrating to PDNS" HREF="migration.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PowerDNS manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="nptl.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Chapter 9. Performance</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="migration.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="PERFORMANCE-SETTINGS" >9.3. Performance related settings</A ></H1 ><P > Different backends will have different characteristics - some will want to have more parallel instances than others. In general, if your backend is latency bound, like most relational databases are, it pays to open more backends. </P ><P > This is done with the <B CLASS="COMMAND" >distributor-threads</B > setting. Of special importance is the choice between 1 or more backends. In case of only 1 thread, PDNS reverts to unthreaded operation which may be a lot faster, depending on your operating system and architecture. </P ><P > Another very important setting <B CLASS="COMMAND" >cache-ttl</B >. PDNS caches entire packets it sends out so as to save the time to query backends to assemble all data. The default setting of 10 seconds may be low for high traffic sites, a value of 60 seconds rarely leads to problems. </P ><P > Some PDNS operators set cache-ttl to many hours or even days, and use <B CLASS="COMMAND" >pdns_control purge</B > to selectively or globally notify PDNS of changes made in the backend. Also look at the Query Cache described in this chapter. It may materially improve your performance. </P ><P > To determine if PDNS is unable to keep up with packets, determine the value of the <B CLASS="COMMAND" >qsize-q</B > variable. This represents the number of packets waiting for database attention. During normal operations the queue should be small. </P ><P > If it is known that backends will not contain CNAME records, the <B CLASS="COMMAND" >skip-cname</B > setting can be used to prevent the normally mandatory CNAME lookup that is needed at least once for each DNS query. </P ><P > Much the same holds for the <B CLASS="COMMAND" >wildcards</B > setting. On by default, each non-existent query will lead to a number of additional wildcard queries. If it is known that the backends do not contain wildcard records, performance can be improved by adding <B CLASS="COMMAND" >wildcards=no</B > to <TT CLASS="FILENAME" >pdns.conf</TT >. </P ><P > Logging truly kills performance as answering a question from the cache is an order of magnitude less work than logging a line about it. Busy sites will prefer to turn <B CLASS="COMMAND" >log-dns-details</B > and <B CLASS="COMMAND" >log-failed-updates</B > off. </P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="PACKETCACHE" >9.3.1. Packet Cache</A ></H2 ><P > PDNS by default uses the 'Packet Cache' to recognise identical questions and supply them with identical answers, without any further processing. The default time to live is 10 seconds. It has been observed that the utility of the packet cache increases with the load on your nameserver. </P ><P > Not all backends may benefit from the packetcache. If your backend is memory based and does not lead to context switches, the packetcache may actually hurt performance. </P ><P > The size of the packetcache can be observed with <B CLASS="COMMAND" >/etc/init.d/pdns show packetcache-size</B > </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="QUERYCACHE" >9.3.2. Query Cache</A ></H2 ><P > Besides entire packets, PDNS can also cache individual backend queries. Each DNS query leads to a number of backend queries, the most obvious additional backend query is the check for a possible CNAME. So, when a query comes in for the 'A' record for 'www.powerdns.com', PDNS must first check for a CNAME for 'www.powerdns.com'. </P ><P > The Query Cache caches these backend queries, many of which are quite repetitive. PDNS only caches queries with no answer, or with exactly one. In the future this may be expanded but this lightweight solution is very simple and therefore fast. </P ><P > Most gain is made from caching negative entries, ie, queries that have no answer. As these take little memory to store and are typically not a real problem in terms of speed-of-propagation, the default TTL for negative queries is a rather high 60 seconds. </P ><P > This only is a problem when first doing a query for a record, adding it, and immediately doing a query for that record again. It may then take up to 60 seconds to appear. Changes to existing records however do not fall under the negative query ttl ( <B CLASS="COMMAND" >negquery-cache-ttl</B >), but under the generic <B CLASS="COMMAND" >query-ttl</B > which defaults to 20 seconds. </P ><P > The default values should work fine for many sites. When tuning, keep in mind that the Query Cache mostly saves database access but that the Packet Cache also saves a lot of CPU because 0 internal processing is done when answering a question from the Packet Cache. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="nptl.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="migration.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Native Posix Thread Library vs LinuxThreads</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="performance.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Migrating to PDNS</TD ></TR ></TABLE ></DIV ></BODY ></HTML >