From 87d923c1ef91420d2a7667b10ea82e2db24b243f Mon Sep 17 00:00:00 2001 From: Johannes Kimmel Date: Fri, 5 Nov 2021 15:11:17 +0100 Subject: [PATCH] fff-dhcp: increase dns cachesize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default cachesize for dnsmasq is 150 entries, which results in a poor cache hit rate. Raise the default to 1024 to provide better cache hit rates on all devices while still keeping memory usage in check. Further increase the cachesize to 8192 entries for systems with enough ram (currently more than 64MB). The memory usage will increase roughly 100B per entry. The size was chosen empirically. Higher values don't seem to increase cache hit rate a lot. Signed-off-by: Johannes Kimmel Reviewed-by: Fabian Bläse --- .../fff/fff-dhcp/files/etc/uci-defaults/90-fff-dhcp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/packages/fff/fff-dhcp/files/etc/uci-defaults/90-fff-dhcp b/src/packages/fff/fff-dhcp/files/etc/uci-defaults/90-fff-dhcp index 8bffbf0..962c81a 100644 --- a/src/packages/fff/fff-dhcp/files/etc/uci-defaults/90-fff-dhcp +++ b/src/packages/fff/fff-dhcp/files/etc/uci-defaults/90-fff-dhcp @@ -1,3 +1,10 @@ +# Use a larger cachesize by default +cachesize=1024 + +# Increase cachesize for systems with enough memory +mem="$(awk '/^MemTotal:/ {print $2}' /proc/meminfo)" +[ "$mem" -gt 65536 ] && cachesize=8192 + uci batch >/dev/null </dev/null <