Skip to content

Commit f9b376e

Browse files
committed
test latency first pass
1 parent ff9a209 commit f9b376e

File tree

1 file changed

+49
-48
lines changed

1 file changed

+49
-48
lines changed

articles/virtual-network/virtual-network-test-latency.md

Lines changed: 49 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ manager: Marina Lipshteyn
77
ms.service: virtual-network
88
ms.topic: how-to
99
ms.workload: infrastructure-services
10-
ms.date: 03/21/2023
10+
ms.date: 03/23/2023
1111
ms.author: allensu
1212
---
1313

@@ -17,45 +17,51 @@ This article describes how to test network latency between Azure virtual machine
1717

1818
For the most accurate results, you should measure VM network latency with a tool that's designed for the task and excludes other types of latency, such as application latency. Latte and SockPerf provide the most relevant network latency results by focusing on Transmission Control Protocol [TCP] and User Datagram Protocol [UDP] traffic. Most applications use these protocols, and they have the greatest effect on application performance.
1919

20-
Many other common network latency test tools, such as Ping, don't measure the type of network traffic that's used in real workloads. Most of these tools use Internet Control Message Protocol (ICMP), which most applications don't use and which can be treated differently from application traffic. These test results might not apply to workloads that use TCP and UDP.
20+
Many other common network latency test tools, such as Ping, don't measure the type of network traffic that's used in real workloads. These tools use Internet Control Message Protocol (ICMP), which most applications don't use, and which can be treated differently from application traffic. These test results might not apply to workloads that use TCP and UDP.
2121

2222
Tools like Latte or SockPerf measure only TCP or UDP payload delivery times. These tools don't measure ICMP or other packet types that aren't used by applications and don't affect application performance.
2323

24-
## Network latency testing process and best practices
24+
## Network latency test process
2525

2626
Latte or SockPerf use the following approach to measure network latency between two physical or virtual computers:
2727

2828
1. Create a two-way communications channel between the computers by alternately designating one as sender and one as receiver.
2929
1. Send and receive packets in both directions and measure the round-trip time (RTT).
3030

31-
### Optimal VM configuration
31+
## Optimal VM configuration for latency
3232

3333
To optimize network latency, observe the following recommendations when you create your VMs:
3434

3535
- Use the latest version of Windows or Linux.
36-
- Enable Accelerated Networking for increased performance.
37-
- Deploy VMs within an [Azure proximity placement group](../virtual-machines/co-location.md).
36+
- Enable [Accelerated Networking](accelerated-networking-overview.md) for increased performance.
37+
- Deploy VMs within an [Azure proximity placement group](/azure/virtual-machines/co-location).
3838
- Create larger VMs for better performance.
3939

40-
### Recommended testing process
40+
### Latency testing best practices
4141

42-
Use the following process to test and analyze network latency results:
42+
Use the following process to test network latency and analyze results:
4343

44-
1. Use network latency measurements to establish a benchmark for network latency between deployed VMs. Take a network latency baseline measurement as soon as you complete VM deployment, configuration, and optimizations.
44+
1. As soon as you complete VM deployment, configuration, and optimizations, take baseline measurements to establish a benchmark for network latency between deployed VMs.
4545

4646
1. Test the effect on network latency of any changes to:
4747
- Operating system (OS) or network stack software, including configuration changes.
4848
- VM deployment method, such as deploying to an availability zone or proximity placement group (PPG).
4949
- VM properties, such as Accelerated Networking or size changes.
5050
- The virtual network, such as routing or filtering changes.
5151

52-
1. Always compare new test results to the baseline or to the last test result after controlled changes.
52+
1. Always compare new test results to the baseline or to the last test results before controlled changes.
5353

5454
1. Repeat tests whenever you observe or deploy changes.
5555

5656
-
5757
## Test VMs with Latte or SockPerf
5858

59+
Use the following procedures to install and test network latency with [Latte](https://github.com/mellanox/sockperf) for Windows or [SockPerf](https://github.com/mellanox/sockperf) for Linux.
60+
61+
# [Windows](#tab/windows)
62+
63+
### Install Latte and configure VMs
64+
5965
1. [Download the latest version of latte.exe](https://github.com/microsoft/latte/releases/download/v0/latte.exe) into a separate folder on your computer, such as *c:\\tools*.
6066

6167
1. On the *receiver* VM, create a Windows Defender Firewall `allow` rule to allow the Latte traffic to arrive through Windows Defender Firewall. It's easiest to allow the *latte.exe* program by name rather than to allow specific inbound TCP ports. In the command, replace the `<path>` placeholder with the path you downloaded *latte.exe* to, such as *c:\\tools\\*.
@@ -64,7 +70,9 @@ Use the following process to test and analyze network latency results:
6470
netsh advfirewall firewall add rule program=<path>latte.exe name="Latte" protocol=any dir=in action=allow enable=yes profile=ANY
6571
```
6672

67-
1. Start *latte.exe* from the Windows command line, not from PowerShell. Replace the `<receiver IP address>`, `<port>`, and `<iterations>` placeholders with your own values.
73+
### Test latency between VMs
74+
75+
1. On the receiver VM, start *latte.exe* from the Windows command line, not from PowerShell. Run the following command, replacing the `<receiver IP address>`, `<port>`, and `<iterations>` placeholders with your own values.
6876

6977
```cmd
7078
latte -a <receiver IP address>:<port> -i <iterations>
@@ -75,29 +83,25 @@ Use the following process to test and analyze network latency results:
7583

7684
For a VM with an IP address of `10.0.0.4`, the command might look like:<br><br>`latte -a 10.0.0.4:5005 -i 65100`
7785

78-
1. On the *sender* VM, start *latte.exe* from the command line. The command is the same as on the receiver, except with `-c` added to indicate that this is the *client*, or sender.
86+
1. On the *sender* VM, start *latte.exe* from the command line. Run the same command as on the receiver, except with `-c` added to indicate that this is the *client*, or sender. Again replace the `<receiver IP address>`, `<port>`, and `<iterations>` placeholders with your own values.
7987

8088
```cmd
8189
latte -c -a <receiver IP address>:<port> -i <iterations>
8290
```
8391

84-
Again replace the `<receiver IP address>`, `<port>`, and `<iterations>` placeholders with your own values, for example:
92+
For example:
8593

8694
`latte -c -a 10.0.0.4:5005 -i 65100`
8795

8896
1. Wait for the results. Depending on how far apart the VMs are, the test could take a few minutes to finish. Consider starting with fewer iterations to test for success before running longer tests.
8997

90-
## Test VMs that are running Linux
91-
92-
To test VMs that are running Linux, use [SockPerf](https://github.com/mellanox/sockperf).
98+
# [Linux](#tab/linux)
9399

94-
### Install SockPerf on the VMs
100+
### Prepare VMs
95101

96-
On the Linux VMs, both *sender* and *receiver*, run the following commands to prepare SockPerf on the VMs. Commands are provided for the major distros.
102+
On both the *sender* and *receiver* Linux VMs, run the following commands to prepare SockPerf on the VMs, depending on your Linux distro.
97103

98-
#### For Red Hat Enterprise Linux (RHEL)/CentOS
99-
100-
Run the following commands:
104+
# [Red Hat Enterprise Linux (RHEL) / CentOS](#tab/linux/rhel)
101105

102106
```bash
103107
#RHEL/CentOS - Install Git and other helpful tools
@@ -110,9 +114,7 @@ Run the following commands:
110114
sudo yum install -y libtool
111115
```
112116

113-
#### For Ubuntu
114-
115-
Run the following commands:
117+
# [Ubuntu](#tab/linux/ubuntu)
116118

117119
```bash
118120
#Ubuntu - Install Git and other helpful tools
@@ -125,8 +127,9 @@ Run the following commands:
125127
sudo apt update
126128
sudo apt upgrade
127129
```
130+
---
128131

129-
#### For all distros
132+
### Copy, compile, and install SockPerf
130133

131134
Copy, compile, and install SockPerf according to the following steps:
132135

@@ -139,7 +142,7 @@ cd sockperf/
139142
./autogen.sh
140143
./configure --prefix=
141144

142-
#make is slower, may take several minutes
145+
#make is slow, may take several minutes
143146
make
144147

145148
#make install is fast
@@ -148,33 +151,31 @@ sudo make install
148151

149152
### Run SockPerf on the VMs
150153

151-
After the SockPerf installation is complete, the VMs are ready to run the latency tests.
152-
153-
First, start SockPerf on the *receiver*.
154-
155-
Any available port number is fine. In this example, we use port 12345:
154+
1. After the SockPerf installation is complete, start SockPerf on the *receiver* VM. Any available port number is fine. The following example uses port `12345`. Replace the example IP address `10.0.0.4` with your own value.
156155

157-
```bash
158-
#Server/Receiver - assumes server's IP is 10.0.0.4:
159-
sudo sockperf sr --tcp -i 10.0.0.4 -p 12345
160-
```
156+
```bash
157+
#Server/Receiver for IP 10.0.0.4:
158+
sudo sockperf sr --tcp -i 10.0.0.4 -p 12345
159+
```
161160

162-
Now that the server is listening, the client can begin sending packets to the server on the port on which it is listening (in this case, 12345).
161+
1. Now that the server is listening, on the *sender* or client computer, start sending packets to the server on the listening port, in this case `12345`.
163162

164-
About 100 seconds is long enough to return representative results, as shown in the following example:
163+
- The `-t` option sets testing time in seconds. About 100 seconds is long enough to return representative results.
164+
- The `-m` denotes message size in bytes. A 350-byte message size is typical for an average packet. You can adjust the size higher or lower to more accurately represent your VM's workloads.
165165

166-
```bash
167-
#Client/Sender - assumes server's IP is 10.0.0.4:
168-
sockperf ping-pong -i 10.0.0.4 --tcp -m 350 -t 101 -p 12345 --full-rtt
169-
```
170-
171-
Wait for the results. Depending on how far apart the VMs are, the number of iterations will vary. To test for success before you run longer tests, consider starting with shorter tests of about 5 seconds.
166+
```bash
167+
#Client/Sender for IP 10.0.0.4:
168+
sockperf ping-pong -i 10.0.0.4 --tcp -m 350 -t 101 -p 12345 --full-rtt
169+
```
172170

173-
This SockPerf example uses a 350-byte message size, which is typical for an average packet. You can adjust the size higher or lower to achieve results that more accurately represent the workload that's running on your VMs.
171+
1. Wait for the results. Depending on how far apart the VMs are, the number of iterations varies. To test for success before you run longer tests, consider starting with shorter tests of about 5 seconds.
174172

173+
---
175174

176175
## Next steps
177-
* Improve latency with an [Azure proximity placement group](../virtual-machines/co-location.md).
178-
* Learn how to [Optimize networking for VMs](../virtual-network/virtual-network-optimize-network-bandwidth.md) for your scenario.
179-
* Read about [how bandwidth is allocated to virtual machines](../virtual-network/virtual-machine-network-throughput.md).
180-
* For more information, see [Azure Virtual Network FAQ](../virtual-network/virtual-networks-faq.md).
176+
177+
- Reduce latency with an [Azure proximity placement group](/azure/virtual-machines/co-location).
178+
- [Optimize network throughput for Azure virtual machines](virtual-network-optimize-network-bandwidth.md).
179+
- Allocate [virtual machine network bandwidth](virtual-machine-network-throughput.md).
180+
- [Test bandwidth and throughput](virtual-network-bandwidth-testing.md).
181+
- For more information about Azure virtual networking, see [Azure Virtual Network FAQ](virtual-networks-faq.md).

0 commit comments

Comments
 (0)