Love piHole UI, but need to use with unbound or other resolver

pi-hole GUI is perfect with great statistics.
but, love to use it with unbound or pdns-recursor for heavy duty use.
when there is more than 18K user devices using for a week, the pihole-ftl start occupying 99~104 % of CPU high load usage for resizing its DB, and not reach to successful service reply.
if this is totally due to dnsmasq, why cant' we let run unbound or recursor at port :53 and let pihole keep processing unbound/recursor logs for its perfect reporting?

it is ok that we can add/block all ads and naughty zones in unbound or recursor exactly like dnsmasq + pihole does.
but, need to process that FTL will process those logs and keep showing its lovely pretty UI.

any clue to let any future versions comes with unbound or recursor instead of dnamasq?

Thanks.
PS: sorry, as my English is too poor and quite odd request.

Everything is based an the pihole-FTL binary:

pi@ph5b:~ $ which pihole-FTL
/usr/bin/pihole-FTL
pi@ph5b:~ $ file /usr/bin/pihole-FTL
/usr/bin/pihole-FTL: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, with debug_info, not stripped

Within this binary, the dnsmasq code is embedded:

pi@ph5b:~ $ strings /usr/bin/pihole-FTL | grep dnsmasq
FTL_log_dnsmasq_fatal
logg_fatal_dnsmasq_message
get_dnsmasq_cache_info
main_dnsmasq
FTL_dnsmasq_reload
dnsmasq_time
[..]
pi@ph5b:~ $ dig +short @localhost chaos txt version.bind
"dnsmasq-pi-hole-v2.87rc1"

Are you suggesting to ditch dnsmasq and embed the unbound code instead?
That will not be that easy as dnsmasq does more for Pi-hole than you think like DHCP and registering DHCP clients in DNS plus:

pi@ph5b:~ $ man dnsmasq
[..]
DESCRIPTION
       dnsmasq  is a lightweight DNS, TFTP, PXE, router advertisement and
       DHCP server.

You wont be able to replace all those with just the unbound code.

Most likely the issue isn't FTL/dnsmasq, it's the web interface.

Trying to push 18k clients through the DNS is easy and doesn't really put much load. Assuming you aren't trying to run your business on a Rasbperry Pi Zero.

Trying to use the web interface to monitor client behavior or see graphs will not work at that scale. I think you'll find that if you run htop or top or another system monitoring tool then you will see what is generating that huge CPU load. It's going to be lighttpd or php or fast-cgi.

The plan is to remove lighttpd and use a much better webserver daemon that will not crumble under high client loads. There will never be a change that removes FTL/dnsmasq.

during that time, the CPU load is 99 to +105-106% ... unusually, but, it slow down and not answering :frowning: not responding all dns queris..

[2023-02-07 01:49:14.829 15652M] INFO: FTL replaced 1 invalid characters with ~ in the query "~61.29.251.39"
[2023-02-07 01:49:17.200 15652M] Resizing "FTL-dns-cache" from 7028736 to (439552 * 16) == 7032832 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:19.946 15652M] Resizing "FTL-dns-cache" from 7032832 to (439808 * 16) == 7036928 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:21.402 15652M] INFO: FTL replaced 1 invalid characters with ~ in the query "~61.29.251.39"
[2023-02-07 01:49:24.129 15652M] Resizing "FTL-dns-cache" from 7036928 to (440064 * 16) == 7041024 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:29.626 15652M] Resizing "FTL-dns-cache" from 7041024 to (440320 * 16) == 7045120 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:33.546 15652M] Resizing "FTL-dns-cache" from 7045120 to (440576 * 16) == 7049216 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:37.111 15652M] Resizing "FTL-dns-cache" from 7049216 to (440832 * 16) == 7053312 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:41.525 15652M] Resizing "FTL-dns-cache" from 7053312 to (441088 * 16) == 7057408 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:45.979 15652M] Resizing "FTL-dns-cache" from 7057408 to (441344 * 16) == 7061504 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:49.129 15652M] Resizing "FTL-dns-cache" from 7061504 to (441600 * 16) == 7065600 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:52.249 15652M] Resizing "FTL-dns-cache" from 7065600 to (441856 * 16) == 7069696 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:56.255 15652M] Resizing "FTL-dns-cache" from 7069696 to (442112 * 16) == 7073792 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:49:59.814 15652M] Resizing "FTL-queries" from 380993536 to (6807552 * 56) == 381222912 (/dev/shm: 403.6MB used, 16.8GB total, FTL uses 403.6MB)
[2023-02-07 01:50:00.516 15652M] Resizing "FTL-dns-cache" from 7073792 to (442368 * 16) == 7077888 (/dev/shm: 403.8MB used, 16.8GB total, FTL uses 403.8MB)
[2023-02-07 01:50:05.087 15652M] Resizing "FTL-dns-cache" from 7077888 to (442624 * 16) == 7081984 (/dev/shm: 403.9MB used, 16.8GB total, FTL uses 403.8MB)
[2023-02-07 01:50:08.779 15652M] Resizing "FTL-dns-cache" from 7081984 to (442880 * 16) == 7086080 (/dev/shm: 403.9MB used, 16.8GB total, FTL uses 403.8MB)
[2023-02-07 01:50:12.026 15652M] Resizing "FTL-dns-cache" from 7086080 to (443136 * 16) == 7090176 (/dev/shm: 403.9MB used, 16.8GB total, FTL uses 403.8MB)
[2023-02-07 01:50:17.639 15652M] Resizing "FTL-dns-cache" from 7090176 to (443392 * 16) == 7094272 (/dev/shm: 403.9MB used, 16.8GB total, FTL uses 403.9MB)
[2023-02-07 01:50:22.506 15652M] Resizing "FTL-queries" from 381222912 to (6811648 * 56) == 381452288 (/dev/shm: 403.9MB used, 16.8GB total, FTL uses 403.9MB)
[2023-02-07 01:50:22.609 15652M] Resizing "FTL-dns-cache" from 7094272 to (443648 * 16) == 7098368 (/dev/shm: 404.1MB used, 16.8GB total, FTL uses 404.1MB)
[2023-02-07 01:50:26.179 15652M] Resizing "FTL-dns-cache" from 7098368 to (443904 * 16) == 7102464 (/dev/shm: 404.1MB used, 16.8GB total, FTL uses 404.1MB)
[2023-02-07 01:50:31.121 15652M] Resizing "FTL-dns-cache" from 7102464 to (444160 * 16) == 7106560 (/dev/shm: 404.1MB used, 16.8GB total, FTL uses 404.1MB)
[2023-02-07 01:50:37.237 15652M] Resizing "FTL-dns-cache" from 7106560 to (444416 * 16) == 7110656 (/dev/shm: 404.1MB used, 16.8GB total, FTL uses 404.1MB)
[2023-02-07 01:50:42.665 15652M] Resizing "FTL-dns-cache" from 7110656 to (444672 * 16) == 7114752 (/dev/shm: 404.1MB used, 16.8GB total, FTL uses 404.1MB)
[2023-02-07 01:50:44.521 15652M] Resizing "FTL-queries" from 381452288 to (6815744 * 56) == 381681664 (/dev/shm: 404.1MB used, 16.8GB total, FTL uses 404.1MB)
[2023-02-07 01:50:47.397 15652M] Resizing "FTL-dns-cache" from 7114752 to (444928 * 16) == 7118848 (/dev/shm: 404.3MB used, 16.8GB total, FTL uses 404.3MB)
[2023-02-07 01:50:51.569 15652M] Resizing "FTL-dns-cache" from 7118848 to (445184 * 16) == 7122944 (/dev/shm: 404.4MB used, 16.8GB total, FTL uses 404.3MB)
[2023-02-07 01:50:55.223 15652M] Resizing "FTL-dns-cache" from 7122944 to (445440 * 16) == 7127040 (/dev/shm: 404.4MB used, 16.8GB total, FTL uses 404.3MB)
[2023-02-07 01:50:59.992 15652M] Resizing "FTL-dns-cache" from 7127040 to (445696 * 16) == 7131136 (/dev/shm: 404.4MB used, 16.8GB total, FTL uses 404.3MB)
[2023-02-07 01:51:05.185 15652M] Resizing "FTL-dns-cache" from 7131136 to (445952 * 16) == 7135232 (/dev/shm: 404.4MB used, 16.8GB total, FTL uses 404.4MB)
[2023-02-07 01:51:06.339 15652M] Resizing "FTL-queries" from 381681664 to (6819840 * 56) == 381911040 (/dev/shm: 404.4MB used, 16.8GB total, FTL uses 404.4MB)
[2023-02-07 01:51:09.271 15652M] Resizing "FTL-dns-cache" from 7135232 to (446208 * 16) == 7139328 (/dev/shm: 404.6MB used, 16.8GB total, FTL uses 404.6MB)
[2023-02-07 01:51:16.157 15652M] Resizing "FTL-dns-cache" from 7139328 to (446464 * 16) == 7143424 (/dev/shm: 404.6MB used, 16.8GB total, FTL uses 404.6MB)
[2023-02-07 01:51:20.821 15652M] Resizing "FTL-dns-cache" from 7143424 to (446720 * 16) == 7147520 (/dev/shm: 404.6MB used, 16.8GB total, FTL uses 404.6MB)
[2023-02-07 01:51:25.683 15652M] Resizing "FTL-dns-cache" from 7147520 to (446976 * 16) == 7151616 (/dev/shm: 404.6MB used, 16.8GB total, FTL uses 404.6MB)
[2023-02-07 01:51:29.916 15652M] Resizing "FTL-dns-cache" from 7151616 to (447232 * 16) == 7155712 (/dev/shm: 404.6MB used, 16.8GB total, FTL uses 404.6MB)
[2023-02-07 01:51:30.976 15652M] Resizing "FTL-queries" from 381911040 to (6823936 * 56) == 382140416 (/dev/shm: 404.6MB used, 16.8GB total, FTL uses 404.6MB)
[2023-02-07 01:51:33.216 15652M] Resizing "FTL-dns-cache" from 7155712 to (447488 * 16) == 7159808 (/dev/shm: 404.8MB used, 16.8GB total, FTL uses 404.8MB)
[2023-02-07 01:51:38.551 15652M] Resizing "FTL-dns-cache" from 7159808 to (447744 * 16) == 7163904 (/dev/shm: 404.9MB used, 16.8GB total, FTL uses 404.8MB)
[2023-02-07 01:51:44.340 15652M] Resizing "FTL-dns-cache" from 7163904 to (448000 * 16) == 7168000 (/dev/shm: 404.9MB used, 16.8GB total, FTL uses 404.8MB)
[2023-02-07 01:51:49.540 15652M] Resizing "FTL-dns-cache" from 7168000 to (448256 * 16) == 7172096 (/dev/shm: 404.9MB used, 16.8GB total, FTL uses 404.8MB)
[2023-02-07 01:51:54.893 15652M] Resizing "FTL-dns-cache" from 7172096 to (448512 * 16) == 7176192 (/dev/shm: 404.9MB used, 16.8GB total, FTL uses 404.9MB)
[2023-02-07 01:51:54.898 15652M] Resizing "FTL-queries" from 382140416 to (6828032 * 56) == 382369792 (/dev/shm: 404.9MB used, 16.8GB total, FTL uses 404.9MB)
[2023-02-07 01:51:59.687 15652M] Resizing "FTL-dns-cache" from 7176192 to (448768 * 16) == 7180288 (/dev/shm: 405.1MB used, 16.8GB total, FTL uses 405.1MB)
[2023-02-07 01:52:03.025 15652M] Resizing "FTL-dns-cache" from 7180288 to (449024 * 16) == 7184384 (/dev/shm: 405.1MB used, 16.8GB total, FTL uses 405.1MB)
[2023-02-07 01:52:06.809 15652/T15693] Resizing "FTL-dns-cache" from 7184384 to (449280 * 16) == 7188480 (/dev/shm: 405.1MB used, 16.8GB total, FTL uses 405.1MB)

with over 22K users with around 900qps make the FTL really slow and occupy the CPU resources and no DNS respond is resolved, with above logs, the FTL optimization never finish. repeating those messages and system crush, DNS cant be started,. i am sure.., nobody is using or launching the UI nor doing log analysis that time.

thanks help checking ,
or how do we make performance of dnsmasq better
or FTL wont get lost with these processes? Thanks.

There is nothing odd about this. FTL merely logs that it needs more memory for storing the query data but doing this is very quick. The only reason we log this so verbosely is that it will give you a hint why FTL crashed when it reaches the end of the available memory (the end does not necessarily have to coincide with the actual memory size, some systems put more restrict limits). We can likely silence this warning.

The fact that the allocation is happening is so small steps is that we want to use the memory as efficient as possible. Allocating too much memory ahead can cause issues in low-memory devices (thinking about docker, embedded devices, etc.). That's why allocation isn't proportional to anything but always progressing is small steps.

When does this happen? Does it also happen when you don't have any web interface open? The issue with slow browsers, slow PHP drills down directly into FTL which can send the data only synchronously to PHP at this time. This will be changed with Pi-hole v6.0 which is under active development as we speak.

It would be handy if you could monitor pihole-FTL in tree-view (F5) with custom-thread-names (F2 -> display options -> Show custom thread names) enabled in htop.

1 Like

A post was split to a new topic: Pi-hole not responding with large number of clients