Load Test: How to create a custom network profile for network emulation?

VS2010 supports true network emulation i.e. the ability to simulate network conditions by directly manipulating the network packets. The Network Emulation that we provide in Visual Studio 2010 is a software-based emulator which can emulate the behaviour of both wired and wireless networks using a reliable physical link, such as an Ethernet. A variety of network attributes are incorporated into the VS2010 Network Emulation model, including round-trip time across the network (latency), the amount of available bandwidth, queuing behaviour, packet loss, reordering of packets, and error propagations.

You can specify network mix while creating load test. The network mix gives you a way to simulate load more realistically in a load test scenario. Load is generated by using a heterogeneous mix of network types instead of one single network type. You create a closer approximation of how end-users interact with your applications. You can read here regarding how to specify n/w mix while creating load test.

Right now these profiles are available out of box for a Visual Studio Load Test user:

  • LAN (default)
  • 3G
  • Cable-DSL-1.5Mbps
  • Cable-DSL-768k
  • Cable/DSL-384k
  • CDMA
  • Dial-up 56k
  • Intercontinental slow WAN 300 Kbps
  • Intercontinental WAN 1.5 Mbps
  • Intercontinental WAN 1.5 Mbps

You can find *.network file for each of above profile at %ProgramFiles%\Microsoft Visual Studio 10.0\Common7\IDE\Templates\LoadTest\Networks e.g.Cable-DSL 1.5Mbps.network. This file contains all imp settings for a network file like Latency, Packet Loss, Queue Management etc.

You can either modify an existing file / create a new file according to your requirement to create a new custom network profile. After you restart VS, This new profile will be available to you while creating n/w mix in load test so creating a new custom network profile is very simple as such. But imp thing is understanding the various imp parameters available inside network profile that you can tweak according to your requirements. So let’s have a look at them:

Upstream / Downstream LinkRule

upstream network traffic flows away from the local computer toward the remote destination. Conversely, downstream traffic flows to the user's computer. The following are the imp network attributes that can be defined for them:

  • Bandwidth
  • Latency
  • Packet loss
  • Queuing behaviour

Let’s cover these network attributes in detail:

Bandwidth

Bandwidth describes “the amount of data that can be transferred to or from the website or server, measured in bytes transferred over a prescribed period of time.” –Wikipedia.  You can specify the bandwidth for the upstream and downstream of a link.  If no bandwidth is specified then network emulation will do nothing to modify the rate at which the packet passes through.

e.g.

<Bandwidth>
<Speed unit="kbps">1500</Speed>
</Bandwidth>

Latency

Latency is “the time taken for a packet of data to be sent from one application, travel to, and be received by another application. This includes transit time over the network, and processing time at the source and the destination computers.-Wikipedia.

There are five type of latencies that you can specify:

  1. Fixed delay: packets are delayed for a fixed amount of time.
  2. Uniform delay: packets are delayed according to a uniform probability distribution.
  3. Normal delay: packets are delayed according to a normal probability distribution.
  4. Linear delay: packets are delayed for an amount of time that linearly increases from a minimum to a maximum in a given period of time, and the delay time starts all over from the minimum again when it reaches the maximum.
  5. Burst delay: packets are delayed according to a given probability, and once one packet is delayed, multiple consecutive packets.

e.g.

<Latency>
<Fixed>
<Time unit="msec">150</Time>
</Fixed>
</Latency>

Packet Loss

In the real world, packets traveling across a network may fail to reach their target and packet loss occurs.  You can use any one of four packet loss patterns specified below:

  1. Periodic loss: packet loss occurs periodically, that is, one packet is dropped per given number of packets.
  2. Random loss: packet loss occurs randomly in a given loss rate.
  3. Burst loss: packet loss occurs according to a given probability, and when a packet loss occurs, multiple packets losses occur consecutively.
  4. G-E loss: packet loss occurs obeying the Gilbert-Elliot Model that consists of two states, good state and bad state. Packet loss rates are specified respectively for these two states. And the network transit between the two states is at given transition probabilities.

e.g.

<Loss>
<Random>
<Rate>0.035</Rate>
</Random>
</Loss>

Queue Behaviour

Queuing behaviour describes how received packets are queued and processed. You can specify normal / RED queue in network profile:

  • Normal queue: all received packets are put into a First In, First Out queue of a given queue size.
  • Randomly Early Detection (RED) queue: all received packets are put into a RED queue. If the queue size is smaller than a given lower threshold, the queue is assessed as not congested and nothing happens. If the queue size is larger than a given higher threshold, the queue is assessed as being congested, and some packet will be dropped based on dropping rules. In between, some packets are dropped according to a probability which is computed based on the lower threshold, higher threshold, and current queue size.

Dropping rules are also defined for queuing behaviour, and the following dropping rules are available:

  • Drop front: drop packet at the front of the queue when needed.
  • Drop tail: drop the packet at the tail of the queue when needed.
  • Drop random: when needed, randomly drop a packet in the queue according to a uniform probability distribution.

e.g.

<QueueManagement>
<NormalQueue>
<Size>100</Size>
<QueueMode>packet</QueueMode>
<DropType>DropTail</DropType>
</NormalQueue>
</QueueManagement>

 

I hope now you’ll be able to create a custom network profile easily. Let me know in case of any Qs / issues. You can post your query here as well.

Comments

  • Anonymous
    December 09, 2012
    Hi After I config network profile file, I don't see any affection to my test. I try to set bandwidth is 0 to test but the test  still run as default bandwidth. Can u explain to me this issue? Thank

  • Anonymous
    April 18, 2013
    Thanks Rubel, I found this post really useful. I'm trying to configure VS to replace a third party network emulator we currently use and this means I can do it. One small point; Anyone creating copying a profile as the basis for the new one needs to update the name field, otherwise the old name appears in the list twice! Thanks, Jonathan

  • Anonymous
    April 18, 2013
    Thanks Rubel, I found this post really useful. I'm trying to configure VS to replace a third party network emulator we currently use and this means I can do it. One small point; Anyone creating copying a profile as the basis for the new one needs to update the name field, otherwise the old name appears in the list twice! Thanks, Jonathan

  • Anonymous
    April 18, 2013
    Thanks Rubel, I found this post really useful. I'm trying to configure VS to replace a third party network emulator we currently use and this means I can do it. One small point; Anyone creating copying a profile as the basis for the new one needs to update the name field, otherwise the old name appears in the list twice! Thanks, Jonathan

  • Anonymous
    November 17, 2013
    Hi, Rubel! Thanks for your article. I have a question: I config my loadtest run local, I config network type mix other type not LAN. Can my loadtest emulate as internet enviroment? or how it emulate?