documentation:technical_docs:performance
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| documentation:technical_docs:performance [2019/06/27 01:37] – [Where is the bottleneck ?] olivier | documentation:technical_docs:performance [2025/08/15 15:52] (current) – olivier | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== FreeBSD | + | ====== FreeBSD |
| {{description> | {{description> | ||
| - | There are lot' | + | There are lots of guides |
| ===== Concepts ===== | ===== Concepts ===== | ||
| Line 7: | Line 7: | ||
| ==== How to bench a router ==== | ==== How to bench a router ==== | ||
| - | Benchmarking a router **is not** measuring the maximum bandwidth crossing the router, but it's about measuring the network throughput | + | Benchmarking a router **is not** about measuring the maximum bandwidth crossing the router; it's about measuring the network throughput in packets-per-second |
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| Line 15: | Line 15: | ||
| ==== Definition ==== | ==== Definition ==== | ||
| - | Clear definition | + | A clear definition |
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| Line 27: | Line 27: | ||
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| + | * [[https:// | ||
| + | |||
| ==== FreeBSD ==== | ==== FreeBSD ==== | ||
| - | Here are some benchs | + | Here are some benchmarks |
| * AsiaBSDCon 2018 - Tuning FreeBSD for routing and firewalling ([[https:// | * AsiaBSDCon 2018 - Tuning FreeBSD for routing and firewalling ([[https:// | ||
| * [[http:// | * [[http:// | ||
| Line 39: | Line 41: | ||
| ===== Bench lab ===== | ===== Bench lab ===== | ||
| - | The [[bench lab]] should | + | The [[bench lab]] should |
| ===== Tuning ===== | ===== Tuning ===== | ||
| Line 45: | Line 47: | ||
| ==== Literature ==== | ==== Literature ==== | ||
| - | Here is a list of sources | + | Here is a list of sources |
| - | How to bench or tune the network stack: | + | How to benchmark |
| * [[http:// | * [[http:// | ||
| * [[http:// | * [[http:// | ||
| Line 66: | Line 68: | ||
| ==== Multiple flows ==== | ==== Multiple flows ==== | ||
| - | Don' | + | Do not try to benchmark |
| - | Multi-queue NIC uses feature like [[https:// | + | Multi-queue NIC uses feature like the [[https:// |
| - | During your load, check that each queues are used with sysctl or with [[https:// | + | During your load test, check that each queue is used with sysctl or a |
| - | On this example | + | In this example, all flows are correctly shared between |
| < | < | ||
| Line 84: | Line 86: | ||
| <note warning> | <note warning> | ||
| - | Beware of configurations | + | Beware of configurations that prevent multi-queueing, such as GRE, GIF, and IPSec tunnels or PPPoE (which use the same source/ |
| </ | </ | ||
| - | ==== Choosing | + | |
| + | ==== Choosing | ||
| === CPU === | === CPU === | ||
| - | Avoid NUMA architecture | + | Avoid NUMA architecture |
| - | If you are using NUMA, check that inbound/outbound NIC queues are correctly | + | If you are using NUMA, you need to check that inbound |
| === Network Interface Card === | === Network Interface Card === | ||
| - | Mellanox or Chelsio, | + | Mellanox or Chelsio, |
| - | Intel seems to have problem for managing | + | Intel seems to have problems |
| - | Avoid " | + | Avoid " |
| * 10G Emulex OneConnect (be3) | * 10G Emulex OneConnect (be3) | ||
| * 10G Broadcom NetXtreme II BCM57810 | * 10G Broadcom NetXtreme II BCM57810 | ||
| - | ==== Choosing | + | ==== Choosing |
| - | + | ||
| - | Before tuning, you need to use the good FreeBSD version. | + | |
| - | This mean a FreeBSD -head version older than r309257 (Andrey V. Elsukov 's improvement: | + | |
| - | + | ||
| - | BSDRP since version 1.70 is using a FreeBSD 11-stable (r312663) that includes this improvement. | + | |
| - | {{documentation: | + | Before tuning, you need to use the good FreeBSD |
| - | For better (and linear scale) performance there is the [[https:// | + | BSDRP follows the FreeBSD main branch to strike a balance between recent features |
| - | ==== Disabling Hyper Threading ==== | + | ==== Disabling Hyper-Threading |
| - | Disable Hyper Threading (HT): By default, | + | By default, |
| - | But "logical" | + | However, on some older CPUs (like Xeon E5-2650 V1), these logical cores do not help at all with managing interrupts generated by a high-speed NIC. |
| HT can be disabled with this command: | HT can be disabled with this command: | ||
| Line 123: | Line 121: | ||
| </ | </ | ||
| - | Here is an example on a 8cores x hardware threads Intel CPU and 10G Chelsio NIC: | + | Here is an example on a Xeon E5 2650 (8c,16t) with a 10G Chelsio NIC, where disabling HT improve performance: |
| < | < | ||
| - | x HT-enabled-8rxq(default).packets-per-seconds | + | x HT-enabled-8rxq(default): inet packets-per-second forwarded |
| - | + HT-enabled-16rxq.packets-per-seconds | + | + HT-enabled-16rxq: inet packets-per-second forwarded |
| - | * HT-disabled.packets-per-seconds | + | * HT-disabled-8rxq: inet packets-per-seconds |
| +--------------------------------------------------------------------------+ | +--------------------------------------------------------------------------+ | ||
| | **| | | **| | ||
| Line 150: | Line 148: | ||
| </ | </ | ||
| - | There is a benefit of about 24% to disable hyper threading. | + | There is a benefit of about 24% to disable hyper threading |
| - | ==== fastforwarding ==== | + | However, here is another example on a Xeon E5 2650L (10c, 20t) where it is a beneficial to kept HT enabled and configure the NIC to use all threads: |
| - | === FreeBSD 10.3 or older === | ||
| - | |||
| - | You should enable fastforwarding with a: | ||
| < | < | ||
| - | echo "net.inet.ip.fastforwarding=1" >> | + | x HT on, 8q (default): inet4 packets-per-second forwarded |
| - | service sysctl restart | + | + HT off, 8q: inet4 packets-per-second forwarded |
| + | * HT on, 16q: inet4 packets-per-second forwarded | ||
| + | +--------------------------------------------------------------------------+ | ||
| + | |x x ++ | ||
| + | |x xx +++ * * *| | ||
| + | ||AM| |A_| |_MA_|| | ||
| + | +--------------------------------------------------------------------------+ | ||
| + | N | ||
| + | x | ||
| + | + | ||
| + | Difference at 95.0% confidence | ||
| + | 1.01311e+06 +/- 113098 | ||
| + | 23.2388% +/- 2.94299% | ||
| + | (Student' | ||
| + | * | ||
| + | Difference at 95.0% confidence | ||
| + | 4.41004e+06 +/- 173536 | ||
| + | 101.157% +/- 5.21388% | ||
| + | | ||
| </ | </ | ||
| + | |||
| + | ==== fastforwarding ==== | ||
| === FreeBSD 12.0 or newer === | === FreeBSD 12.0 or newer === | ||
| Line 173: | Line 188: | ||
| ==== Entropy harvest impact ==== | ==== Entropy harvest impact ==== | ||
| - | Lot's of tuning guide indicate to disable: | + | Many tuning guide suggest disabling: |
| * kern.random.sys.harvest.ethernet | * kern.random.sys.harvest.ethernet | ||
| * kern.random.sys.harvest.interrupt | * kern.random.sys.harvest.interrupt | ||
| Line 191: | Line 206: | ||
| </ | </ | ||
| - | And we can notice on forwarding performance of a FreeBSD 11.1: | + | On a FreeBSD 11.1, we can see the impact on forwarding performance: |
| < | < | ||
| Line 235: | Line 250: | ||
| {{documentation: | {{documentation: | ||
| - | ==== Polling mode ==== | ||
| - | Polling can be used in 2 cases: | ||
| - | * On **old hardware only** (where Ethernet card doesn' | ||
| - | * When used [[http:// | ||
| - | For enabling polling mode: | ||
| - | - Edit / | ||
| - | - Execute: service polling start | ||
| - | |||
| - | === NIC drivers compatibility matrix === | ||
| - | |||
| - | BSDRP can use some special features on somes NIC: | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | |||
| - | And only theses devices support these modes: | ||
| - | |||
| - | ^ name ^ Description | ||
| - | | ae | Attansic/ | ||
| - | | age | Attansic/ | ||
| - | | alc | Atheros AR813x/ | ||
| - | | ale | Atheros AR8121/ | ||
| - | | bce | Broadcom NetXtreme II (BCM5706/ | ||
| - | | bfe | Broadcom BCM4401 Ethernet Device Driver | no | yes | | ||
| - | | bge | Broadcom BCM570x/ | ||
| - | | cas | Sun Cassini/ | ||
| - | | cxgbe | Chelsio T4 and T5 based 40Gb, 10Gb, and 1Gb Ethernet adapter driver | no | yes | | ||
| - | | dc | DEC/Intel 21143 and clone 10/100 Ethernet driver | yes | yes | | ||
| - | | de | DEC DC21x4x Ethernet device driver | no | yes | | ||
| - | | ed | NE-2000 and WD-80x3 Ethernet driver | no | yes | | ||
| - | | em | Intel(R) PRO/1000 Gigabit Ethernet adapter driver | yes | yes | | ||
| - | | et | Agere ET1310 10/ | ||
| - | | ep | Ethernet driver for 3Com Etherlink III (3c5x9) interfaces | no | yes | | ||
| - | | fxp | Intel EtherExpress PRO/100 Ethernet device driver | yes | yes | | ||
| - | | gem | ERI/ | ||
| - | | hme | Sun Microelectronics STP2002-STQ Ethernet interfaces device driver | no | yes | | ||
| - | | igb | Intel(R) PRO/1000 PCI Express Gigabit Ethernet adapter driver | yes | needs IGB_LEGACY_TX | | ||
| - | | ixgb(e) | Intel(R) 10Gb Ethernet driver | yes | needs IGB_LEGACY_TX | | ||
| - | | jme | JMicron Gigabit/ | ||
| - | | le | AMD Am7900 LANCE and Am79C9xx ILACC/PCnet Ethernet interface driver | no | yes | | ||
| - | | msk | Marvell/ | ||
| - | | mxge | Myricom Myri10GE 10 Gigabit Ethernet adapter driver | no | yes | | ||
| - | | my | Myson Technology Ethernet PCI driver | no | yes | | ||
| - | | nfe | NVIDIA nForce MCP Ethernet driver | yes | yes | | ||
| - | | nge | National Semiconductor PCI Gigabit Ethernet adapter driver | yes | no | | ||
| - | | nve | NVIDIA nForce MCP Networking Adapter device driver | no | yes | | ||
| - | | qlxgb | QLogic 10 Gigabit Ethernet & CNA Adapter Driver | no | yes | | ||
| - | | re | RealTek 8139C+/ | ||
| - | | rl | RealTek 8129/8139 Fast Ethernet device driver | yes | yes | | ||
| - | | sf | Adaptec AIC‐6915 " | ||
| - | | sge | Silicon Integrated Systems SiS190/191 Fast/ | ||
| - | | sis | SiS 900, SiS 7016 and NS DP83815/ | ||
| - | | sk | SysKonnect SK-984x and SK-982x PCI Gigabit Ethernet adapter driver | yes | yes | | ||
| - | | ste | Sundance Technologies ST201 Fast Ethernet device driver | no | yes | | ||
| - | | stge | Sundance/ | ||
| - | | ti | Alteon Networks Tigon I and Tigon II Gigabit Ethernet driver | no | yes | | ||
| - | | txp | 3Com 3XP Typhoon/ | ||
| - | | vge | VIA Networking Technologies VT6122 PCI Gigabit Ethernet adapter driver | yes | yes | | ||
| - | | vr | VIA Technologies Rhine I/II/III Ethernet device driver | yes | yes | | ||
| - | | xl | 3Com Etherlink XL and Fast Etherlink XL Ethernet device driver | yes | yes | | ||
| - | |||
| - | Using others NIC will works too :-) | ||
| ==== NIC drivers tuning ==== | ==== NIC drivers tuning ==== | ||
| Line 694: | Line 648: | ||
| Now you can display the most time consumed process with: | Now you can display the most time consumed process with: | ||
| + | * AMD: ls_not_halted_cyc | ||
| + | * Intel: cpu_clk_unhalted.thread_p | ||
| + | * ARM: | ||
| < | < | ||
| - | pmcstat -TS inst_retired.any_p -w1 | + | pmcstat -TS cpu_clk_unhalted.thread_p |
| </ | </ | ||
| Line 746: | Line 703: | ||
| </ | </ | ||
| - | On this case the bootleneck is just the network stack. | + | On this case the bootleneck is just the network stack (most of the time spend into function ip_findroute called by ip_tryforward). |
| == CPU cycles spent == | == CPU cycles spent == | ||
| Line 764: | Line 721: | ||
| less / | less / | ||
| </ | </ | ||
| + | |||
| + | === Lock contention source === | ||
| + | |||
| + | To identifying lock contention source (like if function lock_delay or __mtx_lock_sleep was quite high from the pcm output), you can try to search which lock is contended and why with lockstat. | ||
| + | |||
| + | You can generate 2 output: | ||
| + | * contented locks broken down by type: < | ||
| + | * stacks associated with the lock contention to identify the source: < | ||
documentation/technical_docs/performance.1561592230.txt.gz · Last modified: 2019/06/27 01:37 by olivier
