What is this thread about?
Having read a lot of forum threads, I came to the conclusion that many users (myself included) lack coherent information about how to conduct proper debugging and how to properly measure wifi performance. Furthermore, they lack information about tools available to do such. I invite everybody to point to proper practices, tools and methods in hopes of giving users and committers to OpenWRT alike a starting point to evaluate and debug their wifi issues. Posting measurements for educational purposes would be great. You are all very welcome to teach. Comparison of methods and tools sounds nice too, but might be a little exhaustive. Screenshots will be nice. I plan to sporadically update and edit this Initial message to account for responses and debate in this thread. Eventually, some info from here could be used for the docs.
What is this thread not about?
- Expecting help, because your measurements point to flaws in OpenWRT code.
- Debugging your very very personal setup of OpenWRT
→ If you have issues with your setup or if your measurements point to flaws in the code or hardware, please open a new forum post, instead of raising the issue here.
Best practices:
- test latency (e.g. round trip time) simultaneously with throughput (show graphics side by side) [1]
- run tests long enough [2]
- test same configuration on same hardware with various distances/paths [2]
- test same configuration on same hardware with various hindrances (e.g. walls inbetween)
- test same configuration with multiple devices and different hardware
- Measure latency under load ! [2]
- Measure latency/throughput also with multiple (client) streams[2]
- Do not interpret UDP and TCP results with equal weights [2]
- Do not overvalue throughput rate over range without looking at latency or rate control [2]
- Do not overvalue summary statistics that don’t look at inter-station behaviors [2]
Also check out the OpenWRT docs about Performance and logging
Sources: [1], [2]; OpenWRT Forum; Common Sense
Tools:
- aircrack-ng
- ping
- arping
- Ping Tracer
- Bufferbloat test hosted by waveform
- Crusader (Network bandwidth and latency tester)
-
Collectd
- additional info:
- graphical interface and data collected is roughly similar to Grafana, but less polished. Installation is easier though, as no data needs to be exported and collectd can be managed from within LuCI.
- additional info:
- Flent (The flexible network tester)
- Grafana
- irtt (isochronous round trip tester)
-
Iperf2
- The successor to Iperf
-
Iperf3
- iPerf3 and Iperf2 are based on different code. Iperf3 is not the successor to Iperf2.
- Difference between Iperf2 and Iperf3)
- Nuttcp
- netperf
- sockperf
- tcpdump + tcptrace -G and xplot.org
- OAM Tools
- OWAMP (One Way Active Measurement Protocol)
- TWAMP (Two-Way Active Measurement Protocol)
-
Wireshark
- how to:
- capture wifi management frames with wireshark: https://wiki.wireshark.org/CaptureSetup/WLAN
- how to:
- Wavemon
- WiFi Analyzer (VREM version)
Simple methods for beginners:
For starters, usually it is advised to differentiate between your actual wifi and the connection from your main router to your internet service provider or some other endpoint on the internet.
Hosted tests on the web, for example for throughput like speedtest.net or fast.com will be bottlenecked by the slowest performing device along the way (or alternatively your contracted speedlimits, as offered by your internet provider). Tests for latency like the bufferbloat test hosted by waveform fall in the same category and best describe your connection from your router outwards towards the web.
By testing your wifi separately and restricted to your local network, as a major first step, you will be able to eliminate all sources of errors that stem from your internet provider and other connectivity issues along that path. Additionally, often, your wifi will be substantially faster than the speeds offered by your internet provider, but sometimes, the reverse can hold true as well. Also, for this reason, please test wifi separately from your outwards internet connection.
To find out what truly has an impact on your wifi connection, it is advised to test both throughput AND latency. Sometimes, your throughput will be great, but you will still face severe connectivity issues, because of latency. In the last section, a great variety of tools have been listed that (mostly) can be used to do exactly this. The abundance of tools may paralyse newcomers. Which tool is best? Which tool do I need? How can I best use them? - The answer to these question is difficult and may depend on your exact use case. It may also change from time to time, as many of these tools experience ongoing development.
To help you newcomers, I have listed a short introcution to Iperf3 (for throughput) and Wireshark (latency) down below, which should suffice for the most basic of needs and give you a rough idea about your devices current wifi capabilities:
1. Iperf3
-
How to capture throughput:
-
Run following command at the serverside:
ĂŚperf3 -s
-
Run one of the following commands at the client side:
TCP test, which measures the upload from client to server
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -t 60 -i 10
TCP test with 4 Client Streams, which measures the uploads from clients to server
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -P 4 -t 60 -i 10
TCP test with 8 Client Streams, which measures the uploads from clients to server
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -P 8 -t 60 -i 10
TCP test; Reverse mode: server sends, client receives
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -t 60 -i 10 -R
TCP test with 4 Client Streams; Reverse mode: server sends, clients receive
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -P 4 -t 60 -i 10 -R
TCP test with 8 Client Streams; Reverse mode: server sends, clients receive
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -P 8 -t 60 -i 10 -R
Bidirectional TCP test
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -t 60 -i 10 --bidir
Bidirectional TCP test with 4 Client Streams
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -P 4 -t 60 -i 10 --bidir
Bidirectional TCP test with 8 Client Streams
iperf3 -c <IP of Iperf Server> -p <Port of Iperf Server> -P 8 -t 60 -i 10 --bidir
-
-
Tips and things to look out for when using Iperf3
2. Wireshark:
-
How to capture latency via testing round trip time:
Use Iperf in combination with Wireshark. Capture traffic with wireshark while doing throughput tests with iperf, choose a random data packet from that time frame, then look at Wireshark's "Statistics → Stream graphs → Round Trip Time"
How to further debug wifi issues:
- OpenWRT: Wireless FAQ
- OpenWRT: How can I debug my wireless
- https://oldwiki.archive.openwrt.org/doc/devel/debugging#wireless (actually holds more info than the current OpenWRT website!)
Additional info in German language:
- https://bergs.biz/blog/2017/01/05/wlan-probleme-erkennen-und-beseitigen/
- https://bergs.biz/blog/2022/01/15/mein-internet-funktioniert-nicht-was-tun/
Avoid configuration pitfalls:
- Choose the best channel and band for your wifi. Avoid channels that are contested by neighbouring devices. The more devices are trying to use the same channel, the worse the connection, as there will be interference. To find the best channels, use WiFi Analyzer (VREM version)
- Choose best wifi protocol for your use case:
- 802.11n (wifi 4) at the 2GHz band, for long range (low throughput)
- 802.11ac (wifi 5) at the 5 GHz band, for high throughput, but slightly lower range
- 802.11ax (wifi 6) for higher throughput than n and ac and for less interference when multiple devices are in close proxity to each other and sharing channels/bands. Usable with both 2 GHz and 5 GHz. Theoretically estimated to have lower range in 2 GHz than n and in 5 GHz than ac.
- Using VPN can drastically lower your experienced real world internet speed.
- Many users report issues with SSID encryption in mixed mode. Avoid mixed encryption.
- Have as less active devices connected as possible to avoid interference.
- Avoid long distance and multiple walls.
- Advanced configurations like roaming or mesh (802.11s, k, v...) bring their own problems and may be the cause of some of your network problems. If you really wanna know, disable these features during your tests
- A wifi repeater (e.g. using relayd) by default halfs your wifi speed. If you can, use access point configuration and cable.
Miscellaneous:
Key Vocabulary:
- throughput
- latency
-
round trip time (rtt)
- often measured in milliseconds (ms)
- What is round trip time? - Cloudfare
- Millisecond (ms)
- Bit
- Byte
- Difference between MB/s and Mb/s, or MBps and Mbps: A, B
- 1 Byte = 8 bit
- MB = MegaByte
- Mb = Megabit
- Mbps: Mega bits per second
- Mb/s: Mega bits per second
- MBps: Mega Bytes per second
- MB/s: Mega Bytes per second
- Gigacalculator: Mbps to MB/s Converter
- What is the Difference between TCP and UDP?
Methods that look like, but that actually do NOT measure wifi performance:
Projects that try (or tried) to fix Linux Wifi
History, Videos and Literature about how wifi works, how it used to work in the past and historical attempts to fix it:
- 2022: Linux Plumbers Conference: All types of wireless in Linux are terrible and why
the vendors should feel bad - 2022: Playlist/Tutorial: How TCP works
- 2020: "How internet congestion control actually works in the bufferbloat age" - Dave Taht (LCA 2020)
- 2016: Making Wifi Fast + Slides - BattleMeshV8 - When do you drop packets?
- 2016: Linux Plumbers conference - Fixing wifi latency
- 2016: "Making Wifi fast" - Article about the Linux Plumbers Conference - by Jonathan Corbet
November 8, 2016, LWN.net
Dump of links, which are related to the topic, but that still have to be sifted through and that I am possibly considering to comment upon:
-
https://forum.openwrt.org/t/is-there-tools-that-can-measure-latency-or-connection-performance/126555\- replaced by this thread. -
Best ways to conduct Speed and Network Performance test from OpenWrt? - #4 by guidosarducci- replaced by this thread. - Antenna diagnostics/info
- Bufferbloat - Continuous measurement script
- Reducing multiplexing latencies still further in wifi - #75 by amteza
- Speedtest: new package to measure network performance - #23 by davidc502
- How do you measure throughput on an OpenWrt device?
- Wifi diagnostics and performance measurement under LEDE
- Ways to measure bufferbloat
- Help me figure out why I have gaming latency - #3 by dlakelan
- Shaping performance
- How to measure (show) cake preformance with luci-app-statistic?
- dtaht: Explaining sch_cake's statistics
- Comparative Throughput Testing Including NAT, SQM, WireGuard, and OpenVPN - #3 by jeff
- Iperf 2.3.8-rc1 and bufferbloat testing - #17 by dtaht
- https://lore.kernel.org/linux-wireless/CAA93jw6F1WLDu=Fq2pDt+gswWkJpygv4CDswD06v=yoCMgHo6A@mail.gmail.com/T/#u (iperf2 now can measure round trip latency (rtt) alongside throughput
- Ethertype Packet counter needed
- Internet protocol suite
- https://github.com/Mellanox/libvma/wiki/Architecture (NVIDIA Messaging Accelerator (vma) userspace application that bypasses the kernel and its TCP/UDP handling network stack to achieve low latency)