PowerDNS performance with LMDB Backend

I want to compare the performances of a PowerDNS Authoritative server using a SQL backend, versus one using a LMDB backend.

LMDB stands for Lightning Memory-Mapped Database. In a nutshell, it provides an embedded transactional database in the form of a key-value store, and provides:

  • greatly-increased performance,
  • guaranteed data integrity and reliability.

LMDB in PowerDNS

One of the (many) nice features of the PowerDNS Authoritative server is its ability to use a variety of backends from which it's getting its data. This includes "classical" SQL backends (MySQL, PostgreSQL, ...), "flat-files" backends, but also the "Pipe" backend.

The LMDB backend was added in 2019 with the version 4.2.0 of the Authoritative server, but it was still experimental. In December 2020, it was made production ready with version 4.4.0.

The results of testing with 2 different backends ( gmysql and lmdb ) using dnsperf are not impressive. The difference is less then 15% with better results coming from lmdb backend.

Tried with Flamethrower and here comes the surprise. Looks like something is not quite right, let's look at /var/log/messages

18:49:48 freebsd pdns[77479]: Done launching threads, ready to distribute questions 
18:49:48 freebsd pdns[77479]: 5001 questions waiting for database/backend attention. Limit is 5000, respawning 
18:49:49 freebsd kernel: Limiting icmp unreach response from 65055 to 200 packets/sec 
18:49:49 freebsd pdns[77330]: Our pdns instance exited with code 1, respawning 
18:49:50 freebsd kernel: Limiting icmp unreach response from 85745 to 200 packets/sec

(The FreeBSD kernel message about limiting ICMP unreach response, is because PowerDNS' Guardian respawned the Authoritative process, therefore for a few moments, there was nothing listening on UDP/53, while Flamethrower was still sending traffic, therefore FreeBSD's blackhole kicked in.)

The results are almost 5,5x more QPS with lmdb backend.

So now important thing is to find a way to benefit from NATIVE zones of PowerDNS with LMDB backends - I must find a way to replicate LMDB databases. PowerDNS provides Lightning Stream, but it mades near realtime replication to Amazon S3 bucket. Maybe there is another simple and possible way for replication of LMDB?