虚拟机网络带宽Virtual machine network bandwidth

Azure 提供各种 VM 大小和类型,每一种包含的性能各不相同。Azure offers a variety of VM sizes and types, each with a different mix of performance capabilities. 其中一种是网络吞吐量(也称带宽),以兆位/秒 (Mbps) 表示。One capability is network throughput (or bandwidth), measured in megabits per second (Mbps). 由于虚拟机托管在共享硬件上,因此网络容量必须在共享同一硬件的虚拟机中公平地共享。Because virtual machines are hosted on shared hardware, the network capacity must be shared fairly among the virtual machines sharing the same hardware. 在分配时,较大的虚拟机相对于较小的虚拟机会获得相对较多的带宽。Larger virtual machines are allocated relatively more bandwidth than smaller virtual machines.

分配给每个虚拟机的网络带宽按虚拟机的传出(出站)流量计算。The network bandwidth allocated to each virtual machine is metered on egress (outbound) traffic from the virtual machine. 从虚拟机流出的所有网络流量均计入分配限制,不管流向哪个目标。All network traffic leaving the virtual machine is counted toward the allocated limit, regardless of destination. 例如,如果虚拟机的限制为 1,000 Mbps,则不管出站流量的目标是同一虚拟网络中的另一虚拟机,还是 Azure 外部,均适用该限制。For example, if a virtual machine has a 1,000 Mbps limit, that limit applies whether the outbound traffic is destined for another virtual machine in the same virtual network, or outside of Azure.

传入流量不直接计算,或者说不直接受到限制。Ingress is not metered or limited directly. 但是,其他因素(例如 CPU 和存储限制)可能会影响虚拟机处理传入数据的能力。However, there are other factors, such as CPU and storage limits, which can impact a virtual machine's ability to process incoming data.

加速网络是一项旨在改进网络性能(包括延迟、吞吐量和 CPU 使用率)的功能。Accelerated networking is a feature designed to improve network performance, including latency, throughput, and CPU utilization. 虽然虚拟机的吞吐量可以通过加速网络来改进,但仍受分配给该虚拟机的带宽的限制。While accelerated networking can improve a virtual machine's throughput, it can do so only up to the virtual machine's allocated bandwidth. 若要详细了解如何使用加速网络,请查看适用于 WindowsLinux 虚拟机的加速网络。To learn more about Accelerated networking, see Accelerated networking for Windows or Linux virtual machines.

Azure 虚拟机必须有一个(但也可能有多个)连接的网络接口。Azure virtual machines must have one, but may have several, network interfaces attached to them. 分配给某个虚拟机的带宽是流经所有网络接口(已连接到该虚拟机)的所有出站流量的总和。Bandwidth allocated to a virtual machine is the sum of all outbound traffic across all network interfaces attached to a virtual machine. 换言之,分配的带宽是针对每个虚拟机的,不管为该虚拟机连接了多少网络接口。In other words, the allocated bandwidth is per virtual machine, regardless of how many network interfaces are attached to the virtual machine. 若要了解不同的 Azure VM 大小支持的网络接口数,请查看 Azure WindowsLinux VM 大小。To learn how many network interfaces different Azure VM sizes support, see Azure Windows and Linux VM sizes.

预期的网络吞吐量Expected network throughput

若要详细了解每种 VM 大小支持的预期出站吞吐量和网络接口数,请查看 Azure WindowsLinux VM 大小。Expected outbound throughput and the number of network interfaces supported by each VM size is detailed in Azure Windows and Linux VM sizes. 选择一个类型(例如“通用”),然后在生成的页面上选择一个大小系列(例如“Dv2 系列”)。Select a type, such as General purpose, then select a size-series on the resulting page, such as the Dv2-series. 每个系统都有一个表,在最后一列(名为“最大 NIC 数/预期网络性能(Mbps)”)中包含网络规格。 Each series has a table with networking specifications in the last column titled, Max NICs / Expected network performance (Mbps).

吞吐量限制适用于虚拟机。The throughput limit applies to the virtual machine. 吞吐量不受以下因素影响:Throughput is unaffected by the following factors:

  • 网络接口数:带宽限制是源自虚拟机的所有出站流量的累积。Number of network interfaces: The bandwidth limit is cumulative of all outbound traffic from the virtual machine.
  • 加速网络:尽管此功能有助于流量达到已发布的限制,但不会更改限制。Accelerated networking: Though the feature can be helpful in achieving the published limit, it does not change the limit.
  • 流量目标:所有目标都计入出站限制。Traffic destination: All destinations count toward the outbound limit.
  • 协议:基于所有协议的所有出站流量都计入限制。Protocol: All outbound traffic over all protocols counts towards the limit.

网络流限制Network Flow Limits

除了带宽,VM 上任意给定时间存在的网络连接数目也可能影响其网络性能。In addition to bandwidth, the number of network connections present on a VM at any given time can affect its network performance. Azure 网络堆栈保留名为“流”的数据结构中 TCP/UDP 连接的每个方向的状态。The Azure networking stack maintains state for each direction of a TCP/UDP connection in data structures called 'flows'. 典型的 TCP/UDP 连接将创建 2 个流,一个对应于入站方向,另一个对应于出站方向。A typical TCP/UDP connection will have 2 flows created, one for the inbound and another for the outbound direction.

在终结点之间进行数据传输时,除了那些执行数据传输的流,还必须创建多个流。Data transfer between endpoints requires creation of several flows in addition to those that perform the data transfer. 例如,为 DNS 解析创建的流,以及为负载均衡器运行状况探测创建的流。Some examples are flows created for DNS resolution and flows created for load balancer health probes. 另请注意,网关、代理、防火墙之类的网络虚拟设备 (NVA) 会看到为在设备上终止的连接创建的流,以及为设备所发起的连接创建的流。Also note that network virtual appliances (NVAs) such as gateways, proxies, firewalls, will see flows being created for connections terminated at the appliance and originated by the appliance.

通过转发设备进行的 TCP 对话的流计数

流限制和建议Flow Limits and Recommendations

目前,Azure 网络堆栈支持网络流总计为 250K 且为 CPU 核心数大于 8 的 VM 提供良好性能的方案,以及网络流总计为 100k 且为 CPU 核心数小于 8 的 VM 提供良好性能的方案。Today, the Azure networking stack supports 250K total network flows with good performance for VMs with greater than 8 CPU cores and 100k total flows with good performance for VMs with fewer than 8 CPU cores. 超过此限制后,由于超出的流量,网络性能会正常下降,直到达到 500K 总流量(250K 入站流量和 250K 出站流量)的硬限制,然后丢弃超出的流量。Past this limit network performance degrades gracefully for additional flows up to a hard limit of 500K total flows, 250K inbound and 250K outbound, after which additional flows are dropped.

CPU 核心数 <8 的 VMVMs with <8 CPU Cores CPU 核心数 >8 的 VMVMs with 8+ CPU Cores
性能良好Good Performance 100K 流100K Flows 250K 流250K Flows
性能下降Degraded Performance 大于 100k 流Above 100k Flows 大于 250K 流Above 250K Flows
流限制Flow Limit 500K 流500K Flows 500K 流500K Flows

Azure Monitor 中提供的指标用于跟踪 VM 或 VMSS 实例上的网络流数和流创建速率。Metrics are available in Azure Monitor to track the number of network flows and the flow creation rate on your VM or VMSS instances.

azure-monitor-flow-metrics.png

连接建立速度和终止速度也可能影响网络性能,因为连接的建立和终止与包处理例程共享 CPU。Connection establishment and termination rates can also affect network performance as connection establishment and termination shares CPU with packet processing routines. 建议针对预期的流量模式对工作负荷进行基准测试,并根据性能需要对工作负荷进行相应的横向扩展。We recommend that you benchmark workloads against expected traffic patterns and scale out workloads appropriately to match your performance needs.

后续步骤Next steps