22.03-SNAPSHOT was defaulting to about 14k max active connections, I want to increase this number to 32k as I have more than enough RAM, but while researching the topic I found the information around sysctl to be confusing, OpenWRT does not follow the official guidance.
I've ran this script:
cat << "EOF" >> /etc/sysctl.conf
net.netfilter.nf_conntrack_buckets=32768 #was 14000
net.netfilter.nf_conntrack_expect_max=256 #was 232
net.netfilter.nf_conntrack_max=32768 #was 14000
EOF
/etc/init.d/sysctl restart
But I'm not sure if it makes sense, could someone with better knowledge give me pointers on this topic?
trendy
October 24, 2022, 10:21am
2
root@barracuda:[~]#cat /etc/sysctl.conf
# Defaults are configured in /etc/sysctl.d/* and can be customized in this file
Seems quite alright to me and I am also adding my customizations there too.
1 Like
The release version (22.03.x) appears to have 64,512 set by default - at least on my device.
1 Like
hnyman
October 24, 2022, 3:03pm
4
The default values depend on your system's hardware resources, both in master and 22.03
Here is the 22.03 commit:
committed 08:54PM - 11 Aug 22 UTC
Use the kernel's built-in formula for computing this value.
The value applied by… OpenWRT's sysctl configuration file does not scale
with the available memory, under-using hardware capabilities.
Also, that formula also influences net.netfilter.nf_conntrack_buckets,
which should improve conntrack performance in average (fewer connections
per hashtable bucket).
Backport upstream commit for its effect on the number of connections per
hashtable bucket.
Apply a hack patch to set the RAM size divisor to a more reasonable value (2048,
down from 16384) for our use case, a typical router handling several thousands
of connections.
Signed-off-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Rui Salvaterra <rsalvaterra@gmail.com>
(cherry picked from commit 15fbb916669dcdfcc706e9e75263ab63f9f27c00)
3 Likes
How much RAM does your device have?
1 Like
hnyman:
the 22.03 commit
OK, I recall multiple discussions on that notion - which I've followed since OpenWrt added the parameter (as I'm sure you recall). Cool.
The device I screenshoted has 512 MB of RAM.
hnyman
October 24, 2022, 5:14pm
7
I have two routers with 512 MB RAM , and they have somewhat different values:
59392 in my R7800 and 31744 in my RT3200 as the shown number of max. connections.