Azure Cloud Load Testing Made Easy

Load testing is a very import milestone in your development lifecycle that is usually ignored. Load testing allows you to discover how your system behaves while x number of users are using your application. It may uncover performance issues and hence you can optimize the code or beef up your hardware.

On Premises Load Testing

It is fairly easy to build a test lab to host your Visual Studio Test Controller and Visual Studio Test Agents. Microsoft MSDN documentation recommends one dual core CPU and 2GB for each Test Agent to support 1000 virtual users. In other words, you will need 20 core with at least 20GB of ram to create 10 VM’s to simulate 10,000 users or 200 cores and 200GB of ram to create VM’s to simulate 100,000 users and so on. As you can see it may get so expensive to purchase all that hardware, hire people to build and maintain your servers and add to that the hydro bill.

Azure Cloud Load Testing (CLT)

Microsoft Azure allows you with clicking of few buttons to leverage cloud agents to perform your load test. Current, you can only use 25,000 VUsers (100 cores) for up to an hour per test. If you want to increase those limits you can either run up to 10 test in parallel to use up to 1000 cores or 250,000 users or contact Microsoft at As of today, Each Visual Studio Online account gets a free 25,000 Virtual User Minutes (VUMin)

Getting Started with Cloud Load Testing


To create a load test from the Azure website you need

  • Azure account
  • VSO account that is linked to your Azure account. (as of today, your VSO account needs to be created in Azure)
  • Azure Web App (Your websites can be hosted out of Azure)
  • URL


Microsoft made it really easy to load test a single URL. The following is a step by step instructions on how get started with Azure Cloud Load Testing:

  • Go to
  • Click on Web Apps
  • If you are hosting your site in Azure, select it, otherwise create a new one
  • Click on Tools

  • On the Tools panel, clicks Performance Test

  • Click on Set Account

  • Click on Account to select an existing VSO account. If “Existing accounts” list is empty, follow the steps in the Create New Account section
  • Click OK to go back to the Performance tests panel


  • Click on New and fill the test info. The generate load from field allows you to select the geolocation where the test will be generated from.
  • If you are using a free Service Plan tier, you are limited to 40 user load for 1 Minute Duration. To change your Service Plan tier, follow the steps in the “Change Service Plan Tier” section

  • Click on Run test

  • You can run multiple tests from the same or different geographical location in parallel


Azure Cloud Load Testing allows you to hit the road and start load testing your application without waiting for an infrastructure to be built. In a future post, I will show how to use Visual Studio to build a more complex load test scenario while using Cloud Load Testing.

Create New VSO Account from Azure

  • While you are on the Account Settings panel, click “or create new account” hyper link

  • Type the name of the account and select the subscription

  • Click OK

Change Service Plan Tier

  • Click on Service Plan in the main Azure menu

  • Select the Service Plan you need to upgrade
  • Click on the Pricing tier tile

  • Select the pricing tier you want to upgrade your service plan to
Categories: ALM Tags: , , , ,

Xbap (ClickOnce): The underlying connection was closed: An unexpected error occurred on a send

Last week after deploying to one of one of the internal environments, we got the following error on the installation of an xbap application

An exception occurred while downloading the manifest. Following failure messages were detected:

+ Downloading https://<url>/app.xbap did not succeed.

+ The underlying connection was closed: An unexpected error occurred on a send.

+ Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

+ An existing connection was forcibly closed by the remote host

It turned out that the IT group had disabled TLS 1.0 and 1.1. After enabling those protocols, the xbap was operating as expected

Categories: Uncategorized

Performance tip – Caching expiry in web applications

Caching data that rarely change can give you a big performance boost especially if it takes time to fetch and/or calculate that data. In .NET 4.0, Microsoft introduced the .NET Memory Cache which is a thread safe cache that can be used Windows and Web applications. For more information about the MemoryCache class you can visit

While I was doing a load test for web application for one of my clients, I noticed that the Queued Requests performance counter goes up every five minutes. By using a code profiler, it showed that there were many calls to refresh some of the cached data. Taking a closer look at the code below, if user 1 executing line (value = service.GetStreets();) while the other users are checking if value is cached, there is a potential of thousands of requests to fetch the same data especially if that data is frequently used.

We were using a CacheWrapper that applies a cache policy based on the cache name. With the CacheWrapper we can write the code to cache the Street Streets as follows:

public List<Street> GetStreets()

var value = CacheWrapper.Get(CacheNames.Streets) as List<Street>;

if (value == null)

    value = service.GetStreet();
    CacheWrapper.Set(CacheNames.Streets, value);


return value;


My first approach was to use a lock and double check the value

bool StreetsDataInitialized = false;
Object StreetsLock = new Object();

public List<Street> GetStreets()

var value = CacheWrapper.Get(CacheNames.Streets) as List<Street>;

if (value == null)
StreetsDataInitialized = false;

lock (StreetsLock)
 if (StreetsDataInitialized)
    return CacheWrapper.Get(CacheNames.Streets) as List<Street>;

 value = service.GetStreets();
 CacheWrapper.Set(CacheNames.Streets, value);
 StreetsDataInitialized = true;



return value;


But there were many values that need to be cached and refreshed and I didn’t want to create two variables per cached value. I came up with a more generic way to achieve my goal. I started with the CacheLock Class

 public class CacheLock
     public bool Initialized { get; set; }
     public object LockObject = new object();


I used the ConcurrentDictionary to store the locks. I also created a generic GetOrSetCacheValue function which gets or creates a CacheLock for each cached data and invoke “function” if the data is not cached.

Public class CacheableLookupProvider
private static ConcurrentDictionary<string, CacheLock> LockDictionary = new ConcurrentDictionary<string, CacheLock>();
private readonly IStreetsService service;

Public CacheableStreetsProvider(IStreetsService service)
    this.service = service;

 private T GetOrSetCachedValue<T>(string cacheName, Func<T> function) where T : class
    var value = CacheWrapper.Get(cacheName) as T;
    if (value == null)
       var lockObject = LockDictionary.GetOrAdd(cacheName, new CacheLock());
       lockObject.Initialized = false;
      lock (lockObject.LockObject)
         if (lockObject.Initialized)
           return CacheWrapper.Get(cacheName) as T;
         value = function();
         CacheWrapper.Set(cacheName, value);
         lockObject.Initialized = true;
    return value;

 public List<Street> GetStreets ()
    return GetOrSetCachedValue(CacheNames.Streets, () => service.GetStreets());

 public List<Province> GetProvinces ()
   return GetOrSetCachedValue(CacheNames.Provinces, () => service. GetProvinces());


Categories: Tags: , , ,

Install TFS2015 ctp with basic configurations

Categories: Uncategorized Tags:

TFS2015 CTP and VS2015 CTP6 are available for download

In case you missed the news, Visual Studio 2015 CTP 6 and TFS 2015 CTP are available for download. The following link contains the release notes and the bits

Remember not to install CTP products on your production machines. They are for testing purposes and are not supported

Categories: Uncategorized Tags: ,

Test Controller machine is running out of space

Yesterday, the c: drive on the Test Controller machine was running out of space while doing load testing. There few solutions to this problem


Delete files and folders under %localappdata%\VSEQT\QTController

Solution 2

If you are still running out of space, consider moving the Test Controller VSEQT folder to another drive

  • Go to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE
  • Open QTController.exe.config and QTController64.exe.config
  • Add to the appSettings section the following line

    <add key=”WorkingDirectory” value=”D:\Test Controller Data”/>

    The WorkingDirectory entry is the base directory for staging/temporary files, overrides Windows default Application Data Directory

  • Restart the ‘Visual Studio Test Controller”

  • Run a Load Test

Categories: ALM Tags: , ,

Free Course: Introduction to Mobile App Development

Interested in learning something new during the holidays? Here is a free course from the Microsoft Virtual Academy

Categories: Uncategorized

Get every new post delivered to your Inbox.

Join 447 other followers