DNS configuration

MailerQ has its own async DNS resolver, that can operate independently from the resolver that is used by most other applications on your system. This allows you to finetune the DNS configuration for MailerQ. By default, the settings from /etc/resolv.conf and /etc/resolv.conf are used, but they can be overridden and tuned via various config file options.

DNS timeouts

Unfortunately, for some domains the TTLs for MX or A records that are pretty low, for example only a couple of seconds, or sometimes even 0 seconds. While this allows these domains to quickly move their servers between IP's, it also causes MailerQ to flood your DNS, as records can only be cached for a short amounts of time.

To mitigate this, the minimum respected TTL is 60 seconds by default. DNS records with a TTL of 60 seconds will be treated as if their TTL was set to 60. To change this minimum value, the following config file option can be used:

dns-min-ttl:  120

This will make sure that the mininum respected TTL is 120 seconds. Note that the minimum allowed value should be greater than zero, since zero is explicitly disallowed due to the performance penalty.

Nameservers

By default, MailerQ uses the nameservers defined in /etc/resolv.conf for DNS resolution. However, if you prefer to specify custom nameservers for MailerQ, you can provide a comma-separated list of IP addresses in the configuration. These custom nameservers will be used exclusively for DNS queries, overriding the system's default settings.

To specify custom nameservers, add the following to your configuration file:

dns-nameserver: 1.1.1.1, 2.2.2.2

This configuration ensures that MailerQ will ignore the system's DNS settings and rely only on the nameservers you provide.

Timeouts

Since 5.12, the timeouts on DNS requests can be configured in MailerQ. There are two settings for altering the timings. Naturally, settings from /etc/resolv.conf will be picked up first, and then the settings in MailerQ are applied on top of them. If the setting inside MailerQ is empty, the setting from resolv.conf will be kept.

dns-timeout:     60.0
dns-interval:    3.0

The dns-timeout setting limits the time the resolver waits for a response after the last attempt was made. The dns-interval specifies after how many seconds of waiting for a reply on the initial query, the query should be retransmitted.

Quality of Service

Since 5.13 three settings were added to finetune the maximum workload of the DNS resolver:

Buffer size

DNS works over UDP, and so these packets may be lost at any point in the process, which means that they may have never been seen by the recursor, or the recursor has replied and we had to drop the packet. To prevent the latter problem, the dns-buffersize setting was introduced.

dns-buffersize:  1MB

This sets the receiving and sending buffer size. We recommend raising this as high as possible, since that makes the probability of dropped packets because the receive buffer is full significantly lower. Keep in mind that this is bound by the system limit on the receive buffer size, which can be altered with sysctl. To make it larger, use the following commands to tune the settings.

sysctl -w net.core.rmem_max=1000000
sysctl -w net.core.wmem_max=1000000

Rotation

If all nameservers in /etc/resolv.conf are local resolvers and have a similar resolving speed, we recommend setting the rotate option to true:

dns-rotate:     true

This will allow MailerQ to distribute the load across the nameservers randomly, performing a rudimentary load-balancing on it.