Design Considerations for a Network Performance Test

Prior to optimizing a network driver, you should identify the performance improvements you are seeking. For example, your current hardware and driver might perform at a rate that is lower than expected. The first step in addressing a performance issue is for you to design a network performance test for your driver and hardware.

You must specifically design a network performance test. It is not sufficient to use an application that employs networking functionality and additional components to test network performance. For example, Microsoft® Internet Explorer uses networking functionality to download content for Web pages, but also uses graphics capabilities to generate and display Web pages. If you use any functionality other than the networking components, your test results will not necessarily indicate the maximum performance for a given set of hardware.

A typical design of a network performance test consists of a client computer and a server. Both the client computer and the server repeatedly call the send, recv and recvfrom Winsock functions to send or receive data over TCP\IP or User Datagram Protocol (UDP). The following code example shows the main loop of a TCP or UDP networking performance test.

//Set up connection SOCKET sd.
DWORD dwBytesSent = 0;
DWORD dwTime = GetTickCount();
while(dwBytesSent < dwTotalBytesReq){
     int nRet = send(sd, buf, dwBufSize - dwBytesSent, 0)
     if(nRet == SOCKET_ERROR || nRet == 0){
          //Handle error or TCP closed connection.
          break;
     }
     dwBytesSent += nRet;
}
//Close connection.
_tprintf(TEXT("Sent %ld bytes in %ld ms; throughput: %f Mbps\n"),
     dwBytesSent,
     dwTime,
     (float)dwBytesSent * 8. / (float)dwTime / 1000.);

The connection setup and shutdown times, along with all other operations except the sending of data, are excluded from the block where the send or receive throughput is measured. In addition, there are no calls to the select or setsockopt functions from within the main send loop. Avoid excess function calls. These can have a negative impact on performance.

For a Microsoft Windows® CE-based device with x-86, Microsoft recommends that you design your performance test so that it is compatible with both Windows CE and a Windows-based desktop platform, such as Microsoft Windows XP. This design helps you compare results when you use the same hardware on different platforms.

Once you have designed your network performance test, you can implement your test. For more information, see Implementing a Network Performance Test.

See Also

Improving Performance of an NDIS Miniport Driver

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.