In this article of the Performance Tuning Windows 2012 series we’ll focus on the Networking Subsystem. We’ll approach the various optimization guidelines by layer, starting with the hardware and drivers. We’ll also cover NDIS, the protocol stack, and user mode applications. Let’s start by looking at the network adapter itself and some of the features high-end adapters support that you can use to optimize network-intensive workloads. If you’re running any network-intensive application, you’ll need a high-performance network adapters. In this section we’ll explore some considerations for selecting a suitable network adapter.

Offload CapabilitiesOffloading tasks can reduce CPU usage on the server, which improves the overall system performance. The network stack in Windows 2012 (and prior versions of the OS) can offload one or more tasks to a network adapter permitted you have an adapter with offload capabilities. The table below lists the details about offload capabilities:

Receive-side scaling (RSS) is a network driver technology that enables the efficient distribution of network receive processing across multiple CPUs in multiprocessor systems.

Checksum calculation

The network stack can offload the calculation and validation of Transmission Control Protocol (TCP) and User Datagram Protocol (UDP) checksums on send and receive code paths. It can also offload the calculation and validation of IPv4 and IPv6 checksums on send and receive code paths.

IP security authentication and encryption

The TCP/IP transport layer can offload the calculation and validation of encrypted checksums for authentication headers and Encapsulating Security Payloads (ESPs). The TCP/IP transport layer can also offload the encryption and decryption of ESPs.

Segmentation of large TCP packets

The TCP/IP transport layer supports Large Send Offload v2 (LSOv2). With LSOv2, the TCP/IP transport layer can offload the segmentation of large TCP packets to the hardware.

Receive Segment Coalescing (RSC)

RSC is the ability to group packets together to minimize the header processing that is necessary for the host to perform. A maximum of 64 KB of received payload can be coalesced into a single larger packet for processing.

Receive-Side Scaling (RSS)

Receive-Side Scaling (RSS)Windows Server 2012 (as well as Windows Server 2008 R2, and Windows Server 2008) supports Receive Side Scaling (RSS). RSS directs network processing to up to one logical processor per core. For example, given a server with Intel Hyper-Threading and 4 cores (8 logical processors), RSS will use no more than 4 logical processors for network processing. RSS distributes incoming network I/O packets among logical processors so that packets that belong to the same TCP connection are processed on the same logical processor. RSS also load balances UDP unicast and multicast traffic from Windows Server 2012, and it routes related flows (as determined by hashing the source and destination addresses) to the same logical processor, preserving the order of related arrivals. Windows Server 2012 provides the following methods to tune RSS behavior:

oClosestStatic. Logical processor numbers near the network adapter’s base RSS processor are preferred. Windows will not rebalance logical processors dynamically based on load.

oNUMA. Logical processor numbers will tend to be selected on different NUMA nodes to distribute the load. Windows may rebalance logical processors dynamically based on load.

oNUMAStatic. This is the default profile. Logical processor numbers will tend to be selected on different NUMA nodes to distribute the load. Windows will not rebalance logical processors dynamically based on load.

oConservative: RSS uses as few processors as possible to sustain the load. This option helps reduce the number of interrupts.

You can use the set-netadapterRSS cmdlet to choose how many logical processors can be used for RSS on a per-network adapter basis, the starting offset for the range of logical processors, and which node the network adapter allocates memory from:

·MaxProcessors: Sets the maximum number of RSS processors to be used, ensuring application traffic is bound to a maximum number of processors on an interface.

set-netadapterRSS –Name “Ethernet” –MaxProcessors <value>

·BaseProcessorGroup:Sets the base processor group of a NUMA node, affecting the processor array used by RSS.

set-netadapterRSS –Name “Ethernet” –BaseProcessorGroup <value>

·MaxProcessorGroup:Sets the Max processor group of a NUMA node, affecting the processor array used by RSS.

set-netadapterRSS –Name “Ethernet” –MaxProcessorGroup <value>

·BaseProcessorNumber:Sets the base processor number of a NUMA node, allowing partitioning processors across network adapters and specifying the first logical processor in the range of RSS processors that is assigned to each adapter.

·NumberofReceiveQueues:If your logical processors seem to be underutilized for receive traffic, you can try increasing the number of RSS queues from the default of 2 to the maximum number supported.

set-netadapterRSS –Name “Ethernet” –NumberOfReceiveQueues <value>

RSS does not provide any interaction with virtual machines, instead you can configure VMQ. RSS can be enabled for virtual machines in the case of SR-IOV because the virtual function driver supports RSS capability. In this case, the guest and the host will have the benefit of RSS. The host however, does not get RSS capability because the virtual switch is enabled with SR-IOV.

Receive-Segment Coalescing (RSC)Receive Segment Coalescing can improve performance by reducing the number of IP headers that are processed for a given amount of received data. You should use RSC to tune performance of received data by grouping (or coalescing) smaller packets into larger units. This can reduce latency and increase throughput for received heavy workloads. On network adapters supporting RSC, make sure that it is enabled, unless you have low latency, low throughput networking needs that benefit from RSC being turned off.

In Windows Server 2012 you can use the following PowerShell cmdlets to configure RSC capable adapters: Enable-NetAdapterRsc, Disable-NetRsc, Get-NetAdapterAdvancedProperty, and Set-NetAdapterAdvancedProperty.RSC can be examined using the cmdlets Get-NetAdapterRSC and Get-NetAdapterStatistics. The Get cmdlet shows if RSC is enabled and if TCP enables RSC to be in operational state. In the example above, IPv4 RSC is enabled. To understand failures, you can view the coalesced bytes or exceptions caused by entering the following command:

PS C:\Users\Administrator> $x = Get-NetAdapterStatistics “myAdapter”

PS C:\Users\Administrator> $x.rscstatistics

CoalescedBytes: 0

CoalescedPackets: 0

CoalescingEvents: 0

CoalescingExceptions : 0

RSC and virtualizationIf the host adapter is not bound to the virtual switch, RSC is supported on the physical host. If the adapter is bound to the virtual switch, Windows 2012 will disable RSC on the physical host. RSC can be enabled for a virtual machine when SR-IOV is enabled. In this case, virtual functions will support RSC capability; hence, virtual machines will also get the benefit of RSC.

Network Adapter Resources

A few network adapters actively manage their resources to achieve optimum performance. Several network adapters let the administrator manually configure resources by using the Advanced Networking tab for the adapter. For such adapters, you can set the values of a number of parameters including the number of receive buffers and send buffers. In Windows Server 2012, you can configure advanced network settings using the following PowerShell cmdlets:

Get-NetAdapterAdvancedProperty

SetNetAdapterAdvancedProperty

Enable-NetAdapter

Enable-NetAdapterBinding

Enable-NetAdapterChecksumOffload

Enable-NetAdapterLso

Enable-NetAdapterIPSecOffload

Enable-NetAdapterPowerManagemetn

Enable-NetAdapterQos

Enable-NetAdapterRDMA

Enable-NetAdapter

Enable-NetAdapterSriov

Message-Signaled Interrupts (MSI/MSI-X)Network adapters that support MSI/MSI-X can target specific logical processors. If your network adapter also support RSS, then a logical processor can be dedicated to servicing interrupts and deferred procedure calls (DPCs) for a given TCP connection. This will greatly improve performance, by preserving the TCP cache.

Interrupt ModerationLastly, we’ll discuss interrupt moderation. Some network adapters expose different interrupt moderation levels, or buffer coalescing parameters, or both. You definitely should consider buffer coalescing when the network adapter does not perform interrupt moderation. Interrupt moderation will reduce CPU utilization because it minimizes the per-buffer processing cost, but you should consider that interrupt-moderation and buffer coalescing can have a negative impact on latency-sensitive situations. The table below lists the suggested adapter features for various server roles.

Role

Checksum offload

Large Send Offload (LSO)

Receive-side scaling (RSS)

Receive Segment Coalescing (RSC)

File server

X

X

X

X

Web server

X

X

X

Mail server (short-lived connections)

X

X

Database server

X

X

X

FTP server

X

X

X

Media server

X

X

X

These settingsserve as guidelines only . Depending on the workload, your network adapter(s), and your specific situation, your experience can be different. In our next article we’ll go deeper into tuning the network adapter and utilizing some of the features we discussed.

About Hovhannes AvoyanHovhannes Avoyan is the CEO of Monitis, Inc., a provider of on-demand systems management and monitoring software to 50,000 users spanning small businesses and Fortune 500 companies.

Prior to Monitis, he served as General Manager and Director of Development at prominent web portal Lycos Europe, where he grew the Lycos Armenia group from 30 people to over 200, making it the company's largest development center. Prior to Lycos, Avoyan was VP of Technology at Brience, Inc. (based in San Francisco and acquired by Syniverse), which delivered mobile internet content solutions to companies like Cisco, Ingram Micro, Washington Mutual, Wyndham Hotels , T-Mobile , and CNN. Prior to that, he served as the founder and CEO of CEDIT ltd., which was acquired by Brience. A 24 year veteran of the software industry, he also runs Sourcio cjsc, an IT consulting company and startup incubator specializing in web 2.0 products and open-source technologies.

Hovhannes is a senior lecturer at the American Univeristy of Armenia and has been a visiting lecturer at San Francisco State University. He is a graduate of Bertelsmann University.

Platform-as-a-Service (PaaS) is a technology designed to make DevOps easier and allow developers to focus on application development. The PaaS takes care of provisioning, scaling, HA, and other cloud management aspects. Apache Stratos is a PaaS codebase developed in Apache and designed...

Containers and microservices have become topics of intense interest throughout the cloud developer and enterprise IT communities.
Accordingly, attendees at the upcoming 16th Cloud Expo at the Javits Center in New York June 9-11 will find fresh new content in a new track called PaaS...

Application metrics, logs, and business KPIs are a goldmine. It’s easy to get started with the ELK stack (Elasticsearch, Logstash and Kibana) – you can see lots of people coming up with impressive dashboards, in less than a day, with no previous experience. Going from proof-of-concept ...

Docker is becoming very popular--we are seeing every major private and public cloud vendor racing to adopt it. It promises portability and interoperability, and is quickly becoming the currency of the Cloud.
In his session at DevOps Summit, Bart Copeland, CEO of ActiveState, discusse...

Operational Hadoop and the Lambda Architecture for Streaming Data
Apache Hadoop is emerging as a distributed platform for handling large and fast incoming streams of data. Predictive maintenance, supply chain optimization, and Internet-of-Things analysis are examples where Hadoop prov...

Log data provides the most granular view into what is happening across your systems, applications, and end users. Logs can show you where the issues are in real-time, and provide a historical trending view over time. Logs give you the whole picture.
Containerization and micro-service...