Page MenuHomePhabricator

Increase net.nf_conntrack_max on kerberos hosts if needed
Closed, ResolvedPublic

Description

krb1002 regularly gets huge spikes in connection numbers which approaches or even hits the limit of the conntracks enabled by default in the kernel:

image.png (1,913×986 px, 495 KB)

Once the level hits 80% of the configured limit we get alerts:

FIRING: MaxConntrack: Max conntrack at 82.93% on krb1002:9100 - https://wikitech.wikimedia.org/wiki/Monitoring/check_conntrack - https://grafana.wikimedia.org/d/oITUqwKIk/netfilter-connection-tracking - https://alerts.wikimedia.org/?q=alertname%3DMaxConntrack
RESOLVED: MaxConntrack: Max conntrack at 84.74% on krb1002:9100 - https://wikitech.wikimedia.org/wiki/Monitoring/check_conntrack - https://grafana.wikimedia.org/d/oITUqwKIk/netfilter-connection-tracking - https://alerts.wikimedia.org/?q=alertname%3DMaxConntrack

I'm not quite sure what is causing this, is it expected? Is the conntrack limit protecting the system somehow? Or is it reasonable to increase the limit to support what we need / supress the alert spam? Currently set to 256k

cmooney@krb1002:~$ sudo sysctl net.nf_conntrack_max
net.nf_conntrack_max = 262144

Event Timeline

cmooney triaged this task as Low priority.

From a brief look, most of these conntrack entries are from an-coord1003.eqiad.wmnet, along with log entries of the form:

presto/an-coord1003.eqiad.wmnet@WIKIMEDIA

which indicates this is the issue with presto's kerberos client not caching its kerberos credentials and submitting many TGS_REQs, see also, T353802.

@MoritzMuehlenhoff added more KDC capacity in T329831, to handle the presto load.

and switching auth providers was discussed, but the work was not prioritized, T358196.

The bug is still open upstream, but with no activity, https://github.com/prestodb/presto/issues/18818.

Since we seem to be able to handle the load okay, I think we should bump the max conntrack setting.

Since we seem to be able to handle the load okay, I think we should bump the max conntrack setting.

Ok. Yes I think it might be worth a shot. It's possible the current limit is also acting as a sort of rate-limiter and ensuring the numbers of reqs/second is staying within what the host can handle. So we need to be mindful increasing may cause the spikes to get bigger and overwhelm the host. But we can proceed cautiously.

We could also possibly use the nftables connection rate-limiting if that does prove to be the case? That's a better fit to restrict the rps than knowingly hitting a conntrack limit continually.

Hmm so the plot thickens, seems someone already tried this:

https://gerrit.wikimedia.org/r/plugins/gitiles/operations/puppet/+/refs/heads/production/modules/profile/manifests/kerberos/kdc.pp#190

And this has made it to the system, yet not taken effect:

cmooney@krb1002:~$ sudo grep net.netfilter.nf_conntrack_max /etc/sysctl.conf /etc/sysctl.d/* 
/etc/sysctl.d/70-ferm_conntrack.conf:net.netfilter.nf_conntrack_max = 262144
/etc/sysctl.d/75-kdc_conntrack.conf:net.netfilter.nf_conntrack_max = 524288
cmooney@krb1002:~$ 
cmooney@krb1002:~$ sudo sysctl net.netfilter.nf_conntrack_max
net.netfilter.nf_conntrack_max = 262144

Change #1198155 had a related patch set uploaded (by JHathaway; author: JHathaway):

[operations/puppet@production] sysctls: update sysctls 5min after boot

https://gerrit.wikimedia.org/r/1198155

Change #1198155 merged by JHathaway:

[operations/puppet@production] sysctls: add optional module param to sysctl::parameters

https://gerrit.wikimedia.org/r/1198155

Change #1271794 had a related patch set uploaded (by JHathaway; author: JHathaway):

[operations/puppet@production] kdc: ensure net.netfilter.nf_conntrack_max is updated

https://gerrit.wikimedia.org/r/1271794

Change #1271794 merged by JHathaway:

[operations/puppet@production] kdc: ensure net.netfilter.nf_conntrack_max is updated

https://gerrit.wikimedia.org/r/1271794

Mentioned in SAL (#wikimedia-operations) [2026-04-16T13:23:56Z] <jhathaway@cumin2002> DONE (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on krb2002.codfw.wmnet with reason: T407726

jhathaway claimed this task.

Fix has been applied and rolled out to both krb hosts. After rebooting krb2002 the sysctl for net.netfilter.nf_conntrack_max was properly updated.

Mentioned in SAL (#wikimedia-operations) [2026-04-16T15:35:30Z] <jhathaway@cumin2002> DONE (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on krb2002.codfw.wmnet with reason: T407726