Understanding Iperf3 and Retries: A Comprehensive Guide

Abstract: Optimize Iperf3 throughput on high-bandwidth, high-latency networks by using the -w flag to set an appropriate TCP window size.

Created: 2026-10-09 by
Iperf3 uses the -w flag to set the TCP window size for the socket, not the operating system kernel buffer limits. Specifying an appropriate window size is critical for high-bandwidth, high-latency networks because it allows more data to be in flight before requiring an acknowledgment. Without this adjustment, throughput often remains artificially low due to insufficient buffering capacity on the client or server side.

Why Window Size Matters in Iperf3

The primary reason network throughput falls short of theoretical maximums is often the TCP window size. In standard networking, the sender can transmit a certain amount of data before needing an acknowledgement from the receiver. This amount is defined by the window size. If the window size is too small relative to the bandwidth-delay product (BDP) of the network path, the connection will stall frequently waiting for acknowledgements, leading to poor performance. When you run Iperf3 without specifying the window size, it defaults to a value determined by the underlying operating system. On many systems, this default might be 64KB or 128KB, which is sufficient for local area networks but disastrous for wide area networks or high-speed links with significant latency. The -w option explicitly sets this parameter, allowing you to optimize the socket behavior for your specific test environment. It is important to distinguish between the Iperf3 socket window and OS-level buffer limits. While -w tells the application what window size to request via the setsockopt system call, the operating system may still enforce its own upper limits on socket buffers. If the OS limit is lower than the requested window size, the actual effective window will be capped at the OS limit. Therefore, while -w is essential, it is not the only factor influencing final throughput.

How to Use the -w Flag Correctly

To specify the window size in Iperf3, use the -w flag followed by the desired size. The size can be specified in bytes, kilobytes (K), megabytes (M), or gigabytes (G). For example, to set a window size of 1 megabyte, you would use -w 1M. On the server side, you start the Iperf3 daemon with the following command:
iperf3 -s -w 1M
On the client side, you must also specify the same window size to ensure both ends are negotiating correctly. Running the client with:
iperf3 -c [server_ip] -w 1M
If you omit the -w flag on either side, Iperf3 will attempt to use the default system setting. In high-performance testing scenarios, it is best practice to explicitly define this on both ends to avoid ambiguity and ensure consistent results. Mismatched window sizes can lead to suboptimal performance where one side is constrained by a smaller buffer than the other.

Calculating the Optimal Window Size

Determining the right window size involves understanding the Bandwidth-Delay Product (BDP). The BDP represents the amount of data that can be in transit on the network link at any given time. It is calculated as: BDP = Bandwidth × Round-Trip Time (RTT) For instance, if you have a 1 Gbps link with a 50ms RTT, the BDP is approximately 6.25 MB. Setting the window size slightly above this value ensures the pipe stays full. However, setting it excessively high does not provide additional benefits and may consume unnecessary memory resources. A common approach is to start with a reasonable default like 1M or 2M and observe the throughput. If the throughput is limited by latency rather than bandwidth, increasing the window size further may help. Conversely, if the throughput plateaus despite increasing the window size, other factors such as CPU limitations, NIC offloading features, or OS kernel buffer limits are likely the bottleneck.

Troubleshooting Common Issues

Even with the correct -w setting, users may encounter issues where the window size appears ignored or throughput remains low. One common issue is that the operating system rejects the requested socket buffer size because it exceeds system-defined limits. On Linux, these limits are controlled by parameters such as net.core.rmem_max and net.core.wmem_max. If the Iperf3 request exceeds these values, the kernel will clamp the window size to the maximum allowed. Another potential problem is firewall interference. Some firewalls may drop packets or alter TCP flags in ways that disrupt large window negotiations. Ensure that no intermediate network devices are interfering with the TCP handshake or data transmission. Additionally, verify that both the client and server are running compatible versions of Iperf3 to avoid protocol mismatches. Understanding 'Connection' and 'Session' in Networking is crucial when interpreting these results, as a single session may involve multiple TCP connections depending on the test configuration. For more complex network setups, such as those involving virtual machines or nested routers, refer to guides on Understanding 'Connection' and 'Session' in Networking to better diagnose where bottlenecks occur.

Best Practices for Network Testing

Always run Iperf3 tests multiple times to account for variability. Network conditions can fluctuate, and a single run may not represent typical performance. Use the -t flag to extend the test duration, providing a more stable average. Combine this with explicit window sizing using -w to isolate TCP layer performance from other variables. Remember that Iperf3 measures transport-layer throughput. It does not account for application-layer overheads or file system I/O speeds. For end-to-end application performance, consider complementing Iperf3 tests with real-world application benchmarks. Understanding how different network segments interact, such as when Combining Two Networks into One Network on Huawei EG8145V5 Router, can also provide context for why certain bottlenecks appear in isolated Iperf3 tests.

Frequently Asked Questions

Does -w change the OS kernel buffer size?

No, the -w flag only requests a specific window size for the TCP socket via socket options. It does not modify the operating system's global kernel buffer limits, which are separate system parameters that may cap the effective window size.

What happens if I set -w higher than the OS max?

If the requested window size exceeds the OS-defined maximum socket buffer limits, the kernel will typically clamp the value down to the maximum allowed. You should check your system's net.core.wmem_max settings to determine the true upper bound.

Can Iperf3 test UDP with a window size?

No, the -w flag is specific to TCP connections. UDP is connectionless and does not use TCP windows or acknowledgements, so window size adjustments do not apply to UDP traffic tests.

Why is my throughput still low after setting -w?

Low throughput despite adequate window sizing usually indicates other bottlenecks such as CPU saturation, NIC offloading issues, or physical layer limitations. Check system resource usage and verify that no firewalls are dropping packets.

Should I use the same -w value on client and server?

Yes, it is best practice to specify the same window size on both ends. While TCP negotiation handles mismatches, explicit configuration ensures predictable behavior and avoids reliance on potentially inconsistent default system settings.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More