Project sponsored by

Project hosted on

SourceForge Logo

The PostgreSQL driver performed fairly well considering it accesses a SQL database and has all the associated overhead that brings with it. With a top speed of 759 Queries Per Second, the database was actually handling close to 2277 SQL select queries each second. On a database with nearly 2.7 million records, that is pretty good.

There were few optimizations needed for the Postgres database. All database connections used named pipes instead of TCP/IP sockets to eliminate the TCP/IP network stack's overhead. The only other optimization was to set the "shared_buffers" to 1536 in the postgresql.conf file. When too many buffers are used, the system needs to start using virtual memory instead of real memory, and the page swapping begins hurting performance. Fewer buffers reduces the database's cache hit rate, which negatively affects performance as well.

The DLZ configuration below was used during testing. This configuration provides optimum performance by limiting the number of returned rows in the find zone query and using the simplest lookup query possible. This lookup query does not wrap DNS TXT records in double quotes, as TXT records should be stored in the database with double quotes already. The DNS SOA record fields are also returned in each query because doing so is faster than performing a check to determine what type of DNS record is returned in the query itself using case statements.

dlz "postgres zone" {
   database "postgres 2
      {host=/tmp dbname=dns_data user=postgres}
      {select zone from dns_records where zone = '%zone%' limit 1}
      {select ttl, type, mx_priority, data, resp_person, serial, refresh, retry,
 expire, minimum from dns_records where zone ='%zone%' and host = '%record%'}";