Knowledge base

PMTA knowledge base›Block <dns>›Directive§ 3.3.16.3

precached-max-domains

<dns>

The maximum number of domains to keep in the precache
in the configuration this is a lineprecached-max-domains 500inside the block <dns>
A ceiling beyond which the list is silently cut off

The default is 500. The line sets how many domains the engine takes from the precache file.

The manual stipulates: the value cannot exceed the number of domains declared in the file. That is, a ceiling above the length of the list is meaningless.

And it warns about the cost: a very large number will produce many frequent DNS queries, and this requires a scalable name resolution infrastructure.

The line works only together with the list (precached-domains-file) and the schedule (precached-refresh-interval).

The main trap is that the cut-off happens silently. A file longer than the ceiling causes neither an error nor a warning: the first entries are taken, the rest are ignored. Domains at the end of the list are resolved the usual way, while they look cached — they are in the file, after all.

This is discovered only by comparison: the number of lines in the file against the ceiling, or better, against the cache contents the node itself shows.

The other half: the ceiling and the interval together set a constant load on the resolver. It runs all the time, not only when there are messages — and grows in direct proportion to this number.

What the Hub does. It does not write it: the precache is not used at all, and there is no <dns> block in the configuration.
Recommended values

What to set. The number is calculated from the load, not from the file length:

Value When
500 (default) the list is short and fits under the ceiling
the file length the list is deliberately limited to important receivers
more only together with a resolver that can withstand this load

The calculation is simple: the ceiling divided by the refresh interval is the number of queries per second, going on constantly. Five hundred domains with a five-minute interval give about two queries per second around the clock.

The 500 default, the “cannot exceed the number of domains in the file” restriction and the warning about frequent queries come from the manual, § 3.3.16.3. The constant load calculation is ours.
Example configuration
# keep the ceiling equal to the file length, not higher
<dns>
    precached-domains-file /etc/pmta/precached-domains.txt
    precached-max-domains 500    precached-refresh-interval 5m
</dns>
Five hundred domains with a five-minute interval is about two DNS queries per second, going on constantly, regardless of whether there are messages.
yellow — — directive names, blue — blocks. They are highlighted the same way in the text of the card.
▲

Common mistakes and problems

what people get wrong and how it ends2 mistakes▶

Leaving the default with a long file

§ 3.3.16.3

What it costsThe first five hundred entries are taken from the file, the rest are silently ignored. Domains at the end of the list are resolved the usual way, even though they look cached.
How to spot itThe cache holds fewer entries than the file has lines.
How to do it rightRaise the ceiling to the file length or trim the file itself to what matters.

Setting a large ceiling without resolver headroom

§ 3.3.16.3

What it costsThe load is constant and grows in direct proportion to the number of domains. A resolver that coped with ordinary name resolution may not cope with the cache — and slow down all delivery.
How to spot itThe resolver responds more slowly after the cache is enabled, including with an empty queue.
How to do it rightCount the queries per second and check them against what the resolver can handle.
Compatibility
PowerMTA 6.0
described in the manual of this version · platform: any
The vendor does not state the first version for every directive — there is no note here. The name also appears in the 5.0 edition of the manual.
Reference data
Syntax
precached-max-domains <integer>
Values
an integer number of domains
Default
500 § 3.3.16.3
Applying
reload, no restart needed
Queue
will not touch what is already queued
Where to write it
<dns>
How many times
once in the block
Everything here comes from the manual, with the section.
Inheritance
The directive lives in <dns> and applies to the whole list at once: there is one block per node. There are no separate ceilings for different groups of domains — just as there are no separate lists.
How to check on the node
The ceiling is compared with the file length and with the cache contents:
grep -n -A4 '^<dns>' /etc/pmta/config
wc -l /etc/pmta/precached-domains.txt
pmta show precache | wc -l
The three numbers should match. If the cache holds fewer than the file, the ceiling cut-off has fired, and nobody reported it.
In the Hub
Cost of a mistake
reversible: harms only while it is set
Scenarios
Troubleshoot deliverability · Tune the pace for a provider