You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Test Azure Virtual Machines network latency in an Azure Virtual Network | Microsoft Docs
2
+
title: Test Azure virtual machine network latency in an Azure virtual network | Microsoft Docs
3
3
description: Learn how to test network latency between Azure virtual machines on a virtual network
4
4
services: virtual-network
5
5
documentationcenter: na
@@ -20,113 +20,116 @@ ms.author: steveesp
20
20
21
21
22
22
23
-
# Testing network latency
23
+
# Test VM network latency
24
24
25
-
Measuring network latency with a tool that is designed for the task will give the most accurate results. Publicly available tools like SockPerf (for Linux) and Latte (for Windows) are examples of tools that can isolate and measure network latency while excluding other types of latency, such as application latency. These tools focus on the kind of network traffic that affects application performance, namely TCP and UDP. Other common connectivity tools, like ping, may sometimes be used for measuring latency but those results may not be representative of network traffic used in real workloads. That's because most of these tools employ the ICMP protocol, which can be treated differently from application traffic, and the results may not be applicable to workloads that use TCP and UDP. For accurate network latency testing of protocols used by most applications, SockPerf (for Linux) and Latte (for Windows) produce the most relevant results. This document covers both of these tools.
25
+
To achieve the most accurate results, measure your Azure virtual machine (VM) network latency with a tool that's designed for the task. Publicly available tools such as SockPerf (for Linux) and latte.exe (for Windows) can isolate and measure network latency while excluding other types of latency, such as application latency. These tools focus on the kind of network traffic that affects application performance (namely, Transmission Control Protocol [TCP] and User Datagram Protocol [UDP] traffic).
26
+
27
+
Other common connectivity tools, such as Ping, might measure latency, but their results might not represent the network traffic that's used in real workloads. That's because most of these tools employ the Internet Control Message Protocol (ICMP), which can be treated differently from application traffic and whose results might not apply to workloads that use TCP and UDP.
28
+
29
+
For accurate network latency testing of the protocols used by most applications, SockPerf (for Linux) and latte.exe (for Windows) produce the most relevant results. This article covers both of these tools.
26
30
27
31
## Overview
28
32
29
-
Using two VMs, one as sender and one as receiver, a two-way communications channel is created to send and receive packets in both directions to measure the round-trip time (RTT).
33
+
By using two VMs, one as sender and one as receiver, you create a two-way communications channel. With this approach, you can send and receive packets in both directions and measure the round-trip time (RTT).
30
34
31
-
These steps can be used to measure network latency between two Virtual Machines (VMs) or even between two physical computers. Latency measurements can be useful for the following scenarios:
35
+
You can use this approach to measure network latency between two VMs or even between two physical computers. Latency measurements can be useful for the following scenarios:
32
36
33
-
- Establish a benchmark for network latency between the deployed VMs
37
+
- Establish a benchmark for network latency between the deployed VMs.
34
38
- Compare the effects of changes in network latency after related changes are made to:
35
-
-OS or network stack software, including configuration changes
36
-
- VM deployment method, such as deploying to a Zone or PPG
37
-
- VM properties, like Accelerated Networking or size changes
38
-
-Virtual network, such as routing or filtering changes
39
+
-Operating system (OS) or network stack software, including configuration changes.
40
+
-A VM deployment method, such as deploying to an availability zone or proximity placement group (PPG).
41
+
- VM properties, such as Accelerated Networking or size changes.
42
+
-A virtual network, such as routing or filtering changes.
39
43
40
44
### Tools for testing
41
-
To measure latency we have two different options, one for Windows-based systems, and one for Linux-based systems
* For Linux-based systems: [SockPerf (Linux)](https://github.com/mellanox/sockperf)
48
49
49
-
Using these tools ensures that only TCP or UDP payload delivery times are measured and not ICMP (Ping) or other packet types that aren't used by applications and don't affect their performance.
50
+
By using these tools, you help ensure that only TCP or UDP payload delivery times are measured and not ICMP (Ping) or other packet types that aren't used by applications and don't affect their performance.
50
51
51
-
### Tips for an optimal VM configuration:
52
+
### Tips for creating an optimal VM configuration
52
53
53
-
- Use the latest version of Windows or Linux
54
-
- Enable Accelerated Networking for best results
55
-
- Deploy VMs with [Azure Proximity Placement Group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location)
56
-
- Larger VMs generally perform better than smaller VMs
54
+
When you create your VM configuration, keep in mind the following recommendations:
55
+
- Use the latest version of Windows or Linux.
56
+
- Enable Accelerated Networking for best results.
57
+
- Deploy VMs with an [Azure proximity placement group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location).
58
+
- Larger VMs generally perform better than smaller VMs.
57
59
58
60
### Tips for analysis
59
61
60
-
- Establish a baseline early, as soon as deployment, configuration, and optimizations are complete
61
-
- Always compare new results to a baseline or otherwise from one test to another with controlled changes
62
-
- Repeat tests whenever changes are observed or planned
63
-
64
-
65
-
## Testing VMs running Windows
62
+
As you're analyzing test results, keep in mind the following recommendations:
66
63
67
-
## Get Latte.exe onto the VMs
64
+
- Establish a baseline early, as soon as deployment, configuration, and optimizations are complete.
65
+
- Always compare new results to a baseline or, otherwise, from one test to another with controlled changes.
66
+
- Repeat tests whenever changes are observed or planned.
68
67
69
-
Download the latest version: [https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b](https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b)
70
68
71
-
Consider putting Latte.exe in separate folder, like c:\tools
69
+
## Test VMs that are running Windows
72
70
73
-
##Allow Latte.exe through the Windows firewall
71
+
### Get latte.exe onto the VMs
74
72
75
-
On the RECEIVER, create an Allow rule on the Windows Firewall to allow the Latte.exe traffic to arrive. It's easiest to allow the entire Latte.exe program by name rather than to allow specific TCP ports inbound.
73
+
Download the [latest version of latte.exe](https://gallery.technet.microsoft.com/Latte-The-Windows-tool-for-ac33093b).
76
74
77
-
Allow Latte.exe through the Windows Firewall like this:
75
+
Consider putting latte.exe in separate folder, such as *c:\tools*.
### Allow latte.exe through Windows Defender Firewall
80
78
79
+
On the *receiver*, create an Allow rule on Windows Defender Firewall to allow the latte.exe traffic to arrive. It's easiest to allow the entire latte.exe program by name rather than to allow specific TCP ports inbound.
81
80
82
-
For example, if you copied latte.exe to the "c:\\tools" folder, this would be the command:
81
+
Allow latte.exe through Windows Defender Firewall by running the following command:
latte -a <Receiver IP address>:<port> -i <iterations>
91
+
### Run latency tests
93
92
94
-
Around 65k iterations is long enough to return representative results.
93
+
* On the *receiver*, start latte.exe (run it from the CMD window, not from PowerShell):
95
94
96
-
Any available port number is fine.
95
+
```cmd
96
+
latte -a <Receiver IP address>:<port> -i <iterations>
97
+
```
97
98
98
-
If the VM has an IP address of 10.0.0.4, it would look like this:
99
+
Around 65,000 iterations is long enough to return representative results.
99
100
100
-
```cmd
101
-
latte -a 10.0.0.4:5005 -i 65100
102
-
```
103
-
104
-
Start latte.exe on the SENDER (run from CMD, not from PowerShell):
101
+
Any available port number is fine.
105
102
106
-
latte -c -a \<Receiver IP address\>:\<port\> -i \<iterations\>
103
+
If the VM has an IP address of 10.0.0.4, the command would look like this:
107
104
105
+
`latte -a 10.0.0.4:5005 -i 65100`
108
106
109
-
The resulting command is the same as on the receiver except with the addition of "-c" to indicate that this is the "client" or sender:
107
+
* On the *sender*, start latte.exe (run it from the CMD window, not from PowerShell):
110
108
111
-
```cmd
112
-
latte -c -a 10.0.0.4:5005 -i 65100
113
-
```
109
+
```cmd
110
+
latte -c -a <Receiver IP address>:<port> -i <iterations>
111
+
```
114
112
115
-
Wait for the results. Depending on how far apart the VMs are, it could take a few minutes to complete. Consider starting with fewer iterations to test for success before running longer tests.
113
+
The resulting command is the same as on the receiver, except with the addition of *-c* to indicate that this is the *client*, or *sender*:
116
114
115
+
`latte -c -a 10.0.0.4:5005 -i 65100`
117
116
117
+
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.
118
118
119
-
## Testing VMs running Linux
119
+
## Test VMs that are running Linux
120
120
121
-
Use SockPerf. It is available from [https://github.com/mellanox/sockperf](https://github.com/mellanox/sockperf)
121
+
To test VMs that are running Linux, use [SockPerf](https://github.com/mellanox/sockperf).
122
122
123
123
### Install SockPerf on the VMs
124
124
125
-
On the Linux VMs (both SENDER and RECEIVER), run these commands to prepare SockPerf on your VMs. Commands are provided for the major distros.
125
+
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.
126
+
127
+
#### For Red Hat Enterprise Linux (RHEL)/CentOS
128
+
129
+
Run the following commands:
126
130
127
-
#### For RHEL / CentOS, follow these steps:
128
131
```bash
129
-
#CentOS / RHEL - Install GIT and other helpful tools
132
+
#RHEL/CentOS - Install Git and other helpful tools
130
133
sudo yum install gcc -y -q
131
134
sudo yum install git -y -q
132
135
sudo yum install gcc-c++ -y
@@ -135,21 +138,27 @@ Use SockPerf. It is available from [https://github.com/mellanox/sockperf](https:
135
138
sudo yum install -y autoconf
136
139
```
137
140
138
-
#### For Ubuntu, follow these steps:
141
+
#### For Ubuntu
142
+
143
+
Run the following commands:
144
+
139
145
```bash
140
-
#Ubuntu - Install GIT and other helpful tools
146
+
#Ubuntu - Install Git and other helpful tools
141
147
sudo apt-get install build-essential -y
142
148
sudo apt-get install git -y -q
143
149
sudo apt-get install -y autotools-dev
144
150
sudo apt-get install -y automake
145
151
sudo apt-get install -y autoconf
146
152
```
147
153
148
-
#### For all distros, copy, compile and install SockPerf according to the following steps:
154
+
#### For all distros
155
+
156
+
Copy, compile, and install SockPerf according to the following steps:
157
+
149
158
```bash
150
159
#Bash - all distros
151
160
152
-
#From bash command line (assumes git is installed)
161
+
#From bash command line (assumes Git is installed)
153
162
git clone https://github.com/mellanox/sockperf
154
163
cd sockperf/
155
164
./autogen.sh
@@ -162,32 +171,35 @@ make
162
171
sudo make install
163
172
```
164
173
165
-
### Run SockPerf on the VMs
174
+
### Run SockPerf on the VMs
175
+
176
+
After the SockPerf installation is complete, the VMs are ready to run the latency tests.
166
177
167
-
With the SockPerf installation complete, the VMs are ready to run the latency tests.
178
+
First, start SockPerf on the *receiver*.
168
179
169
-
First, start SockPerf on the RECEIVER.
180
+
Any available port number is fine. In this example, we use port 12345:
170
181
171
-
Any available port number is fine. In this example we use port 12345:
172
182
```bash
173
183
#Server/Receiver - assumes server's IP is 10.0.0.4:
174
184
sudo sockperf sr --tcp -i 10.0.0.4 -p 12345
175
185
```
176
-
Now that the server is listening, the client can begin sending packets to the server on the port on which it is listening, 12345 in this case.
177
186
178
-
About 100 seconds is long enough to return representative results as shown in the following example:
187
+
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).
188
+
189
+
About 100 seconds is long enough to return representative results, as shown in the following example:
Wait for the results. Depending on how far apart the VMs are, the number of iterations will vary. Consider starting with shorter tests of about 5 seconds to test for success before running longer tests.
196
+
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.
185
197
186
-
This SockPerf example uses a 350byte message size because it is a typical average size packet. The message size can be adjusted higher or lower to achieve results that more accurately represent the workload that will be running on the VMs.
198
+
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.
187
199
188
200
189
201
## Next steps
190
-
* Improve latency with [Azure Proximity Placement Group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location)
191
-
* Learn about how to [Optimize networking for VMs](../virtual-network/virtual-network-optimize-network-bandwidth.md) for your scenario.
192
-
* Read about how [bandwidth is allocated to virtual machines](../virtual-network/virtual-machine-network-throughput.md)
193
-
*Learn more with [Azure Virtual Network frequently asked questions (FAQ)](../virtual-network/virtual-networks-faq.md)
202
+
* Improve latency with an [Azure proximity placement group](https://docs.microsoft.com/azure/virtual-machines/linux/co-location).
203
+
* Learn how to [Optimize networking for VMs](../virtual-network/virtual-network-optimize-network-bandwidth.md) for your scenario.
204
+
* Read about [how bandwidth is allocated to virtual machines](../virtual-network/virtual-machine-network-throughput.md).
205
+
*For more information, see [Azure Virtual Network FAQ](../virtual-network/virtual-networks-faq.md).
0 commit comments