Skip to content

Add net.isr.maxthreads, net.isr.bindthreads, net.isr.dispatch to Tunables and adjust defaults #5415

@amezin

Description

@amezin

Important notices

Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.

  • Hardware: Compulab fitlet2 - Atom E3950 CPU, dual Intel gigabit NICs.
  • Gigabit (almost) PPPoE WAN.

When running https://www.speedtest.net/ to my ISP's server, I noticed that OPNsense shows 20-30% packet loss on WAN.

It turns out that all PPP packets are handled on only one CPU core (with my hardware and default OPNsense configuration), and the single-core performance of E3950 is just not enough.

The issue (and the solution) is described in pfSense docs, FreeBSD Bugzilla

Describe the solution you like

I solved the issue by adding the following tunables:

  • net.isr.dispatch: deferred (hybrid works too)
  • net.isr.maxthreads: -1
  • net.isr.bindthreads: 1 (not sure if it's required, enabled just because it "makes sense")
  1. I think OPNsense UI should show these tunables by default.
  2. I think the default values for net.isr.maxthreads and net.isr.bindthreads should be adjusted.
  3. Maybe OPNsense should show a warning on PPP configuration page.

net.isr.maxthreads: I think on a router/firewall it should be set to "all cores" (-1) by default. Also, as far as I understand, this tunable has no effect when net.isr.dispatch == direct (the default).

net.isr.bindthreads: I haven't tested its performance impact. But if a thread is created for every CPU core, I think it makes sense to bind every thread to its own core.

net.isr.maxthreads and net.isr.bindthreads can be set only on boot, so a good default value is a bit more important than usual.

net.isr.dispatch: I've read in multiple places that you should avoid changing it unless you absolutely need to. Still don't understand the details. But at least it can be changed without a reboot, so:

  • Maybe it should be "more visible" than a "tunable"? I. e. maybe it should be added to "Interfaces: Settings" page, after various hardware offload options?
  • Maybe a script could detect that PPPoE is used, together with an affected NIC, and set the tunable automatically?
  • Comments in netisr.c suggest that dispatch policy can be set per-protocol. Maybe it could be set for PPP only? (although I haven't found how)

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedContributor missing / timeoutsupportCommunity support or awaiting triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions