Skip to content

Commit 7b1f6c6

Browse files
committed
1 parent b98507d commit 7b1f6c6

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/ftldns/dns-cache.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
`pihole-FTL` offers an efficient DNS cache that helps speed up your Internet experience. This DNS cache is part of the embedded `dnsmasq` server. Setting the cache size to zero disables caching. The DNS TTL value is used for determining the caching period. `pihole-FTL` clears its cache on receiving `SIGHUP`.
2+
3+
<!-- markdownlint-disable code-block-style -->
4+
!!! warning Some warning about the DNS cache size
5+
**There is no benefit in increasing this number *unless* the number of DNS cache evictions is greater than zero.**
6+
7+
A larger cache *will* consume more memory on your node, leaving less memory available for other caches of your Pi-hole. If you push this number to the extremes, it may even be that your Pi-hole gets short on memory and does not operate as expected.
8+
9+
You can not reduce the cache size below `150` when DNSSEC is enabled because the DNSSEC validation process uses the cache.
10+
<!-- markdownlint-enable code-block-style -->
11+
12+
### Cache metrics
13+
14+
The Settings page (System panel, FTL table) gives live information about the cache usage. It obtains its information from `http://pi.hole/admin/api.php?getCacheInfo`.
15+
16+
#### DNS cache size
17+
18+
Size of the DNS domain cache, defaulting to 10,000 entries. It is the number of entries that can be actively cached at the same time.
19+
This information may also be queried using `dig +short chaos txt cachesize.bind`
20+
21+
The cache size is set in `/etc/dnsmasq.d/01-pihole.conf`. However, note that this setting does not survive Pi-hole updates. If you want to change the cache size permanently, add a setting
22+
23+
```plain
24+
CACHE_SIZE=12345
25+
```
26+
27+
in `/etc/pihole/setupVars.conf` and run `pihole -r` (Repair) to get the cache size changed for you automatically.
28+
29+
#### DNS cache insertions
30+
31+
Number of total insertions into the cache. This number can be substantially larger than DNS cache size as expiring cache entries naturally make room for new insertions over time. Each lookup with a non-zero TTL will be cached.
32+
33+
This information may also be queried using `dig +short chaos txt insertions.bind`
34+
35+
#### DNS cache evictions
36+
37+
The number of cache entries that had to be removed although the corresponding entries were **not** expired. Old cache entries get removed if the cache is full to make space for more recent domains. The cache size should be increased when this number is larger than zero.
38+
39+
This information may also be queried using `dig +short chaos txt evictions.bind`

0 commit comments

Comments
 (0)