There isn’t much that scares the developers, but I know testing makes that short list for sure. Today, if I were to ask you to web test or load test your application, the thought itself would make you to start calculating the number of servers you would need and ponder about deployment. Add to that list load generator setups like Visual Studio test agent and controllers, and all those things don’t make the overall testing process any simpler.
If you have started exploring Azure VMs you would realize that finally a time has come when you no longer need to keep a physical deployment for whatever you may have. All you need is captured Images and you can awake them whenever you want. There is a great article on msdn which explains how to set up load testing on the PaaS cloud services. You can find it here, this article describes how to setup a test environment, but honestly, with the VMs I rather have an easy route for the setup. You will know what that means.
Let’s say our sample application is a simple 2-tier web application with data stored in SQL Server. So, what do we need to run a simple load test?
- A web server Box ( Windows Server 2008 R2, IIS, all updates)
- A Database server ( Windows Server 2008 R2, SQL 2012, all updates)
- A Visual Studio Controller setup machine. The controllers can be downloaded from here ( Windows Server 2008 R2, Controller setup, Sql Express and all updates)
- Visual Studio Agents ( The guys who generate the traffic on your websites) , again from the link above. ( Windows Server 2008 R2, Agents setup, and all updates)
- A local on-premise VS 2012 machine. This machine will manage your controllers/agents and download the reports + the real time data while the tests are running. (Win 7, Visual Studio 2012)
So, I have setup VMs for each of the above 4, and here are the setups done on each box. Here is what my Azure VM gallery looks like. I have images for all 4 machines.
Things to keep in mind, for the Controllers, Agents and Visual Studio box:
- Create a single user with the same password for all the machines
- Make sure all of the VMs are a part of the same virtual network created through Azure portal.
- Ensure that Azure connect is also setup for all the boxes including your on-premise Visual Studio box, so that the VS machine can access data from all the VMs. I don’t have the luxury of setting up a VPN through a physical device
- Log in to the VM, and make sure you install the controller setup from the link shared before.
- Install SQL express.
- Install Azure connect agent
- Your controller configuration screen should appear as below.
- Log in to the VM, configure the agents setup
- Install Azure connect
- Agent configuration as below.
Web Role Setup:
- Other than the usual, my Web Application has been deployed.
- Azure connect
- Sql server box with the application database.
- Azure connect.
Okay, time to kick start all the machines.
All the VMs up and running (lovely, isn’t it?). All of them running connected through a Virtual network through my local machine.
So, Let’s do a quick check before we run the load test to verify if everything is in order.
- My web role can talk to the database, here is the proof
- Agents are connected to the controller
- The VS 2012 machine settings:
- Once we have the above ready, let’s fire the load test which only executes a simple Web test running a few pages from the website, here is what the web test looks like :
When we start the test, we set it for 250 users. So, am interested in seeing if my web application and database CPU and Memory will suffice for the test. Well, we are here to find out, once I run the test, here is what my Visual Studio and the Process Explorer from my roles look at the peak load.
My web role is getting killed here, but my SQL is calm as ever. We need to scale out obvious on WFE. Wait till you see the complete stats.
Isn’t it just an awesome feeling that you can NOW stress test your applications sitting at home with a laptop and good internet connectivity (not a requirement though). I have 4 server boxes which I ran for 2 hours and I paid 2 $ for running the test and came to know a lot about my application under crazy load. There is still a good amount of configuration that I needed to take care of, but once done, it will save you hours next time.
It would be tough to publish every single configuration detail, but if you are interested in knowing do drop in a line-
-Phani/ Vineet (email@example.com)