[Tutorial/Call for Testing] Enabling Receive Side Scaling on OPNsense

Started by tuto2, August 16, 2021, 02:13:24 PM

Previous topic - Next topic
Repost of my earlier (more generic) questions about the use of RSS (22.1-RC2):

Following the tutorial I can choose between 3 (8-core) or 4 (16-core) for the rss bits tunable:


net.inet.rss.bits = X


Using a 'real' 12 Core system (No HyperThreading) this results in the following bucket mapping, I guess the same result would be true for 6 Core systems _with_ HT.


net.inet.rss.bucket_mapping: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 8:8 9:9 10:10 11:11 12:0 13:1 14:2 15:3


Being unaware of the rss scheduling magic 'under the hood', it looks like core 0,1,2 and 3 getting double the threads


... 12:0 13:1 14:2 15:3


Is this just visual and will the 12-15 map never been used with 12 cores?

The rss bucket map tunable is read-only, if having 16 buckets is the result of how the rss bits tunable works, is there a way to "remap" the buckets. I would rather like something like this (saving core 0)


net.inet.rss.bucket_mapping: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7 8:8 9:9 10:10 11:11 12:8 13:9 14:10 15:11


12:8 13:9 14:10 15:11

My rss enabled netstat output:


# netstat -Q
Configuration:
Setting                        Current        Limit
Thread count                        12           12
Default queue limit                256        10240
Dispatch policy               deferred          n/a
Threads bound to CPUs          enabled          n/a

Protocols:
Name   Proto QLimit Policy Dispatch Flags
ip         1   3000    cpu   hybrid   C--
igmp       2    256 source  default   ---
rtsock     3    256 source  default   ---
arp        4    256 source  default   ---
ether      5    256    cpu   direct   C--
ip6        6   1000    cpu   hybrid   C--
ip_direct     9    256    cpu   hybrid   C--
ip6_direct    10    256    cpu   hybrid   C--

Workstreams:
WSID CPU   Name     Len WMark   Disp'd  HDisp'd   QDrops   Queued  Handled
   0   0   ip         0    48        0     1186        0   127492   128678
   0   0   igmp       0     0        0        0        0        0        0
   0   0   rtsock     0     0        0        0        0        0        0
   0   0   arp        0     0        0        0        0        0        0
   0   0   ether      0     0    70140        0        0        0    70140
   0   0   ip6        0     1        0        0        0      203      203
   0   0   ip_direct     0     0        0        0        0        0        0
   0   0   ip6_direct     0     0        0        0        0        0        0
   1   1   ip         0   193        0      107        0   694180   694287
   1   1   igmp       0     0        0        0        0        0        0
   1   1   rtsock     0     0        0        0        0        0        0
   1   1   arp        0     2        0        0        0      288      288
   1   1   ether      0     0    14552        0        0        0    14552
   1   1   ip6        0     1        0        0        0      207      207
   1   1   ip_direct     0     0        0        0        0        0        0
   1   1   ip6_direct     0     0        0        0        0        0        0
   2   2   ip         0    32        0       80        0   205258   205338
   2   2   igmp       0     0        0        0        0        0        0
   2   2   rtsock     0     2        0        0        0      175      175
   2   2   arp        0     1        0        0        0       84       84
   2   2   ether      0     0   142672        0        0        0   142672
   2   2   ip6        0     1        0        0        0       74       74
   2   2   ip_direct     0     0        0        0        0        0        0
   2   2   ip6_direct     0     0        0        0        0        0        0
   3   3   ip         0   463        0       69        0   380352   380421
   3   3   igmp       0     0        0        0        0        0        0
   3   3   rtsock     0     0        0        0        0        0        0
   3   3   arp        0     0        0        0        0        0        0
   3   3   ether      0     0   135986        0        0        0   135986
   3   3   ip6        0     1        0        0        0      145      145
   3   3   ip_direct     0     0        0        0        0        0        0
   3   3   ip6_direct     0     0        0        0        0        0        0
   4   4   ip         0    11        0        0        0   177655   177655
   4   4   igmp       0     0        0        0        0        0        0
   4   4   rtsock     0     0        0        0        0        0        0
   4   4   arp        0     0        0        0        0        0        0
   4   4   ether      0     0   128748        0        0        0   128748
   4   4   ip6        0     2        0        0        0       48       48
   4   4   ip_direct     0     0        0        0        0        0        0
   4   4   ip6_direct     0     0        0        0        0        0        0
   5   5   ip         0     9        0        9        0    73864    73873
   5   5   igmp       0     0        0        0        0        0        0
   5   5   rtsock     0     0        0        0        0        0        0
   5   5   arp        0     0        0        0        0        0        0
   5   5   ether      0     0   165365        0        0        0   165365
   5   5   ip6        0     1        0        0        0       14       14
   5   5   ip_direct     0     0        0        0        0        0        0
   5   5   ip6_direct     0     0        0        0        0        0        0
   6   6   ip         0    26        0        0        0   306593   306593
   6   6   igmp       0     0        0        0        0        0        0
   6   6   rtsock     0     0        0        0        0        0        0
   6   6   arp        0     0        0        0        0        0        0
   6   6   ether      0     0    71276        0        0        0    71276
   6   6   ip6        0     2        0        0        0      141      141
   6   6   ip_direct     0     0        0        0        0        0        0
   6   6   ip6_direct     0     0        0        0        0        0        0
   7   7   ip         0   475        0        0        0   169312   169312
   7   7   igmp       0     0        0        0        0        0        0
   7   7   rtsock     0     0        0        0        0        0        0
   7   7   arp        0     1        0        0        0       34       34
   7   7   ether      0     0   309366        0        0        0   309366
   7   7   ip6        0     2        0        1        0      199      200
   7   7   ip_direct     0     0        0        0        0        0        0
   7   7   ip6_direct     0     0        0        0        0        0        0
   8   8   ip         0    34        0    64406        0    75441   139847
   8   8   igmp       0     0        0        0        0        0        0
   8   8   rtsock     0     0        0        0        0        0        0
   8   8   arp        0     2        0        0        0     1002     1002
   8   8   ether      0     0  3487916        0        0        0  3487916
   8   8   ip6        0     1        0       23        0        4       27
   8   8   ip_direct     0     0        0        0        0        0        0
   8   8   ip6_direct     0     0        0        0        0        0        0
   9   9   ip         0    13        0       80        0   408429   408509
   9   9   igmp       0     0        0        0        0        0        0
   9   9   rtsock     0     0        0        0        0        0        0
   9   9   arp        0     3        0        0        0      499      499
   9   9   ether      0     0    15999        0        0        0    15999
   9   9   ip6        0     4        0        0        0      268      268
   9   9   ip_direct     0     0        0        0        0        0        0
   9   9   ip6_direct     0     0        0        0        0        0        0
  10  10   ip         0   970        0       61        0   167884   167945
  10  10   igmp       0     0        0        0        0        0        0
  10  10   rtsock     0     0        0        0        0        0        0
  10  10   arp        0     0        0        0        0        0        0
  10  10   ether      0     0    74687        0        0        0    74687
  10  10   ip6        0     1        0        0        0       43       43
  10  10   ip_direct     0     0        0        0        0        0        0
  10  10   ip6_direct     0     0        0        0        0        0        0
  11  11   ip         0   450        0      104        0   170014   170118
  11  11   igmp       0     0        0        0        0        0        0
  11  11   rtsock     0     0        0        0        0        0        0
  11  11   arp        0     2        0        0        0     2262     2262
  11  11   ether      0     0   140111        0        0        0   140111
  11  11   ip6        0     1        0        1        0       37       38
  11  11   ip_direct     0     0        0        0        0        0        0
  11  11   ip6_direct     0     0        0        0        0        0        0

Quote from: DanMc85 on January 25, 2022, 09:11:36 PM
Does this work with a VMware VMX NIC Interface VMXNet3?

Running OPNsense in a VM on ESXi 7.0 U3

I have RSS enabled on my OPNsense VM running on ESXi 6.7 U3, so I suspect it should run fine on ESXi 7.0 U3 as well.

i notice a lot of latency with RSS enabled, especially when a website makes many XHR requests. Loading takes a long time compared to default setup no RSS.

intel quad core, no HT
x710t2l 8.00 firmware
opnsense 22.1


What sort of page load times are we talking about overall in the on and off case? It's a little hard to tell if this is expected or not.

I general requests to the same server should still land on the same CPU...


Cheers,
Franco

Hi,

I'm shooting in the dark here. I activated RSS yesterday on my system with AMD Ryzen CPU. Since the multi-threading technology used by AMD is not the same as Intels hyper-threading should the net.inet.rss.bits be per core or per number of threads for AMD? If I understand it correctly AMD can write simultaneously to the core from the threads and are not limited like Intels hyper-threading?

Any expert out there who knows? Thanks!

Hello,

I would also like to test this improvement with RSS. I have read through all the forum posts and believe I need to make these changes. I have a protectli with ix (ixl?) NIC driver and also 2 cores, 4 threads.

The values I believe I need to set are as following under the gui tunables section:

net.isr.maxthreads =  4
net.isr.dispatch = deferred
hw.ix.enable_rss = 1
net.isr.bindthreads = 1
net.inet.rss.enabled = 1
net.inet.rss.bits = 2

Does this above 6 tunables seem to make sense. Sorry for asking, its hard to follow but I believe they should work correctly.

Also I am on     OPNsense 22.1-amd64 .

Do i need to still run this command?

opnsense-update -zfkr 21.7.2-rss -D

Or can I just change to a dev build or something?
Many thanks in advance. I will do some performance testing before and after if someone can confirm my changes :)

Kind regards
Pete

you do not want to install the 21.7 kernel if you are on 22.1

my atom firewall 8core 16GB

net.inet.rss.bits              2   
net.inet.rss.enabled           1
net.isr.bindthreads      1   
net.isr.dispatch              hybrid   
net.isr.maxthreads      -1   
net.isr.numthreads      2

results via netstat -Q
Setting                        Current        Limit
Thread count                         8            8
Default queue limit                256        10240
Dispatch policy                 hybrid          n/a
Threads bound to CPUs          enabled          n/a


Protocols:
Name         Proto   QLimit    Policy Dispatch Flags
ip                 1     1000        cpu   hybrid   C--
igmp            2       256      source  default   ---
rtsock         3       256      source  default   ---
arp                   4       256      source  default   ---
ether            5       256          cpu   direct   C--
ip6                  6     1000          cpu   hybrid   C--
ip_direct          9       256          cpu   hybrid   C--
ip6_direct        10      256          cpu   hybrid   C--

Thank you zz00mm.

Based on what you said I did this in my screenshot.
I tested before and after things like latency, speed upload download etc from opnsense itself and from a client machine and also checked cpu etc.

Before and after I could detect no discernible difference. I was expecting some sort of speed boost but apparently not much changed.

Here is my output of commands. I guess its working although I dont see any benefit at all from it. Not sure if thats expected? Everything is the same even the temperatures of the unit.

My understanding of enabling RSS will only show improvement when under heavy load. Speedtest doesn't really count as heavy load. you need multiple devices running to really stress the firewall. Also all the software components running within the FW need to be multi threaded (not single threaded)

Ok cool, guess it works then. Or at least no problems. Unsure if anyone is seeing some major benefit. Guess I dont hammer my firewall enough.

I looked back a few pages, looking for answers now we're on 22.1.x , I don't think I've missed it.
I am on OPNsense 22.1.1_3-amd64 and had the RSS tunables set for RSS testing during 22.7 and didn't remove them prior to the firewall upgrade to 22.1. I also had some non-RSS tunables for igb performance.
My tunables now show a few that are unsupported. I like that the upgrade routines found them and labelled nicely, devs are awesome!
Can I just remove them?


Name Type Value
hw.em.tx_process_limit unsupported -1
hw.uart.console unsupported default (io:0x3f8,br:115200)
legal.intel_igb.license_ack unsupported 1
net.inet.rss.bits unsupported 2
net.inet.rss.enabled unsupported 1
net.isr.bindthreads unsupported 1
net.isr.maxthreads unsupported -1


Update to 22.1.2 first before removing unsupported. At least hw.uart.console is not really unsupported just hidden from "sysctl" framework.

But yes, unsupported tunables are no longer in the kernel so they can be safely removed and don't do anything anymore.


Cheers,
Franco


I have the DEC850 with 8 core and yet maxthreads -1 does not seem to take...


net.inet.rss.bucket_mapping: 0:0 1:1 2:2 3:3 4:4 5:5 6:6 7:7
net.inet.rss.enabled: 0
net.inet.rss.debug: 0
net.inet.rss.basecpu: 0
net.inet.rss.buckets: 8
net.inet.rss.maxcpus: 64
net.inet.rss.ncpus: 8
net.inet.rss.maxbits: 7
net.inet.rss.mask: 7
net.inet.rss.bits: 3
net.inet.rss.hashalgo: 2
net.isr.numthreads: 1
net.isr.maxprot: 16
net.isr.defaultqlimit: 256
net.isr.maxqlimit: 10240
net.isr.bindthreads: 0
net.isr.maxthreads: 1
net.isr.dispatch: direct

netstat -Q
Configuration:
Setting                        Current        Limit
Thread count                         1            1
Default queue limit                256        10240
Dispatch policy                 direct          n/a
Threads bound to CPUs         disabled          n/a

Protocols:
Name   Proto QLimit Policy Dispatch Flags
ip         1   1000   flow  default   ---
igmp       2    256 source  default   ---
rtsock     3    256 source  default   ---
arp        4    256 source  default   ---
ether      5    256 source   direct   ---
ip6        6   1000   flow  default   ---

Workstreams:
WSID CPU   Name     Len WMark   Disp'd  HDisp'd   QDrops   Queued  Handled
   0   0   ip         0     8   121180        0        0    22651   143831
   0   0   igmp       0     0        0        0        0        0        0
   0   0   rtsock     0     2        0        0        0       54       54
   0   0   arp        0     0      602        0        0        0      602
   0   0   ether      0     0   285907        0        0        0   285907
   0   0   ip6        0     1        0        0        0       39       39