Top Banner
Performance testing with Visual Studio & Azure How to test your application using the tools you already know! Andrew Siemer | Clear Measure [email protected] @asiemer
97

Load testing with Visual Studio and Azure - Andrew Siemer

Jul 15, 2015

Download

Software

Andrew Siemer
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Load testing with Visual Studio and Azure - Andrew Siemer

Performance testing with Visual Studio & Azure

How to test your application using the tools you already know!

Andrew Siemer | Clear Measure

[email protected]

@asiemer

Page 2: Load testing with Visual Studio and Azure - Andrew Siemer

Andrew Siemerhttp://about.me/andrewsiemer

ASP InsiderMS v-TSP (Azure)

Azure Advisor ProgramFather of 6. Jack of all trades, master of some.

Page 3: Load testing with Visual Studio and Azure - Andrew Siemer
Page 4: Load testing with Visual Studio and Azure - Andrew Siemer

We are hiring!!!

Page 5: Load testing with Visual Studio and Azure - Andrew Siemer

Introduction

Page 6: Load testing with Visual Studio and Azure - Andrew Siemer

Agenda

• What is performance testing?

• How can Visual Studio help?

• How can Azure make load testing easy?

Page 7: Load testing with Visual Studio and Azure - Andrew Siemer

What is performance

testing?

Page 8: Load testing with Visual Studio and Azure - Andrew Siemer

What is it?

• A type of testing intended to determine• Responsiveness

• Throughput

• Reliability

• Scalability

…under a given workload

Page 9: Load testing with Visual Studio and Azure - Andrew Siemer

Why would I care?

• Are you ready to go to production?

• Can you handle the expected load?

• Do you have edge case bugs?

• How much traffic causes your app to tip over?

• Do you need to optimize something?

• Have new features caused the app to support less traffic?

• Do you have enough hardware to support known load?

• What causes your application to fail spectacularly?

Page 10: Load testing with Visual Studio and Azure - Andrew Siemer

Three types of performance tests

• Performance testing

• Load testing

• Stress testing

Page 11: Load testing with Visual Studio and Azure - Andrew Siemer

Performance testing

• Speed

• Scalability

• Stability

• Achieves expected performance in general use case

• Can be run often

• Cheap to run with low volume

Page 12: Load testing with Visual Studio and Azure - Andrew Siemer

Load testing

• Expected performance remains steady under production load

• Assumes everything is normal

• Does the network handle this load

• Can the database handle it

• Is the application still meeting SLA and usable

Page 13: Load testing with Visual Studio and Azure - Andrew Siemer

Stress testing

• Pushing the application beyond expected limits

• Identifies ceilings in capacity

• Tests low memory, disk space limitations, or dead server

• Helps see how and when an application will fail

• What happens when the network gets clogged

Page 14: Load testing with Visual Studio and Azure - Andrew Siemer

Many other types of tests

• Capacity (system capacity meets business volume)

• Component (component meeting expectations)

• Endurance (is performance consistent over time)

• Investigation (performance trending over time)

• Smoke (build ready for perf testing)

• Spike (temporarily exceeds expected load)

• Unit (segment of code reasonably efficient)

• Validation (faster or slower)

Page 15: Load testing with Visual Studio and Azure - Andrew Siemer

Baselines

• A baseline tells you where the app is now

• Allows you to see change over time• Target to demonstrates improvements

• Baselines can be created for• System

• Component

• Application

Page 16: Load testing with Visual Studio and Azure - Andrew Siemer

Benchmarking

• The comparison of a current test with a baseline• Looking for changes in the results

• Or a comparison against industry standards• Are my commerce pages as fast as the industry expects

Page 17: Load testing with Visual Studio and Azure - Andrew Siemer

When to shift from testing to tuning?

• Once testing has found unacceptable results

• When results are acceptable, but servers are running extra hot

• When an SLA is breached that we know we need to fix• Especially when it impacts a large test surface

Page 18: Load testing with Visual Studio and Azure - Andrew Siemer

Test planning

Page 19: Load testing with Visual Studio and Azure - Andrew Siemer

Before we test

• Define acceptance criteria

• Write down key scenarios

• Create workload model

• Target load levels

• Determine metrics to capture

• Design tests

Page 20: Load testing with Visual Studio and Azure - Andrew Siemer

Acceptance criteria

• Write down your objectives• Response time – page load speed

• Throughput - number of concurrent users

• Resource utilization – processor, memory, disk I/O, network I/O

• Maximum user load

• Business metrics – number of orders to handle

Page 21: Load testing with Visual Studio and Azure - Andrew Siemer

User scenarios

• “Happy paths” through your application

• Touches many components in your system

• Commonly used paths through the application

• Highest business value paths through the application

Page 22: Load testing with Visual Studio and Azure - Andrew Siemer

User scenarios - examples

• Log in

• Browse catalog

• Add to cart

• Check out

• Register

• Search

• Faceted navigation

Page 23: Load testing with Visual Studio and Azure - Andrew Siemer

User scenarios – specific example

• For a given scenario – determine activities in the test

• The scenario “add to cart” may include these activities• View home page

• View dirt bike category page

• Choose grips

• Add a grip to the cart

• Go to the cart

• Validate that the item is in the cart

Page 24: Load testing with Visual Studio and Azure - Andrew Siemer

User scenarios – most common/intensive

• Be sure to include highest use scenarios

• And include most resource intensive scenarios

• Look at your existing applications log files for top use case

Page 25: Load testing with Visual Studio and Azure - Andrew Siemer

Define the workload

• Know and attempt to simulate existing traffic patterns

• Understand user delay, or “think” time• A load test should not be a denial of service attack!

• Plan scenarios around average session times• Not too short or too long

• Not every scenario can be a new user, returning user, or either• Plan around the reality of your application

Page 26: Load testing with Visual Studio and Azure - Andrew Siemer

Target load levels

• Load levels are applied to “workload”

• Understand business volume as it relates to your objectives• Common load, vs. a big marketing push, or black Friday

• Key scenarios

• Distribution of work

• Average session times

Page 27: Load testing with Visual Studio and Azure - Andrew Siemer

Define what metrics to capture - business

• Too many metrics can make the results hard to read

• Ask questions related to performance that have specific answers• How many orders are place per minute

• What is the response time of the cart page

• Identify what metrics to capture based on your questions

• Looks for lower level metrics that help answer your questions

• Reevaluate this often – applications change – so should the metrics

Page 28: Load testing with Visual Studio and Azure - Andrew Siemer

Define what metrics to capture - application

• Network – hardware, switches, routers, gateways, load balancers

• System – disk, processor, memory, network

• Platform – the host of your app: IIS, worker role, web role, VM

• Application – perf counters, instrumentation, file locks, db locks, queue

Page 29: Load testing with Visual Studio and Azure - Andrew Siemer

Design tests

• Using your thought so far design specific tests to meet your needs

• Don’t change the tests because it is hard to write it as designed

• Test expected data as well as unexpected data (form validation, bad credit card, etc.)

• Be sure to include think time

• Best tests data is collected from production data (where applicable)

• Think about spiders, batch processes, while real users are browsing

• Don’t over simplify your tests!

Page 30: Load testing with Visual Studio and Azure - Andrew Siemer

How can Visual Studio help?

Page 31: Load testing with Visual Studio and Azure - Andrew Siemer

Visual Studio 2013 Ultimate

• VS feature matrix: http://goo.gl/3VtY01

• Ultimate gets you web load and performance testing

• Test Pro doesn’t get you this functionality!

Page 32: Load testing with Visual Studio and Azure - Andrew Siemer
Page 33: Load testing with Visual Studio and Azure - Andrew Siemer

Web performance tests

The beginnings of our load testing!

Page 34: Load testing with Visual Studio and Azure - Andrew Siemer

The test project

Page 35: Load testing with Visual Studio and Azure - Andrew Siemer

Recording a test

Page 36: Load testing with Visual Studio and Azure - Andrew Siemer

Recording a test – uh oh!

• The first time you try to record, IE likely won’t work

• Basically, you need to• Disable Enhanced Protection Mode

• Enable Web Test Recorder

• Go here for full steps to fix this: http://goo.gl/LcFNSJ

Page 37: Load testing with Visual Studio and Azure - Andrew Siemer

Recording a test – uh oh!

Page 38: Load testing with Visual Studio and Azure - Andrew Siemer

Recording a test

Page 39: Load testing with Visual Studio and Azure - Andrew Siemer

Recording a test

Page 40: Load testing with Visual Studio and Azure - Andrew Siemer

Recording a test

Page 41: Load testing with Visual Studio and Azure - Andrew Siemer

Verbose recording…likely too much!

Page 42: Load testing with Visual Studio and Azure - Andrew Siemer

Let’s clean up the recording

Page 43: Load testing with Visual Studio and Azure - Andrew Siemer

Pruned tests

Page 44: Load testing with Visual Studio and Azure - Andrew Siemer

Recorded tests cleaned up

Page 45: Load testing with Visual Studio and Azure - Andrew Siemer

Run the tests locally

Page 46: Load testing with Visual Studio and Azure - Andrew Siemer

Run the tests locally

Page 47: Load testing with Visual Studio and Azure - Andrew Siemer

Modifying test run settings

Page 48: Load testing with Visual Studio and Azure - Andrew Siemer

Making dynamic tests

Way more useful!

Page 49: Load testing with Visual Studio and Azure - Andrew Siemer

Once you start seeing repetition

Page 50: Load testing with Visual Studio and Azure - Andrew Siemer

Consider investigating patterns in the tests

• Look for patterns in the requests

• Create a data source with variable data• Sku’s

• Makes

• Models

• Year

• Dynamically create a wide set of tests

Page 51: Load testing with Visual Studio and Azure - Andrew Siemer

Adding a data source

• Once tests need to cover more…

• Or you need to create representative load…

• Types of data source• Database – “select * from tablename”

• CSV

• XML

Page 52: Load testing with Visual Studio and Azure - Andrew Siemer

Create a shippable datasource

Page 53: Load testing with Visual Studio and Azure - Andrew Siemer

Add the data source to your project

Page 54: Load testing with Visual Studio and Azure - Andrew Siemer

Point at the file then magic

Page 55: Load testing with Visual Studio and Azure - Andrew Siemer

Choose the table to include

Page 56: Load testing with Visual Studio and Azure - Andrew Siemer

And then we have a data source

Page 57: Load testing with Visual Studio and Azure - Andrew Siemer

Update recording to use data source

Page 58: Load testing with Visual Studio and Azure - Andrew Siemer

Update recording to use data source

Page 59: Load testing with Visual Studio and Azure - Andrew Siemer

If the test only runs once…

Page 60: Load testing with Visual Studio and Azure - Andrew Siemer

View the dynamic results

Page 61: Load testing with Visual Studio and Azure - Andrew Siemer

Conditional & loop steps

• Context parameter exists (test context)

• Cookie exists

• Cookie value comparisons

• Last request outcome• Pass or fail

• Last response code • http response codes

• Number comparison

• String comparison

• Probability rules• Return true some times

• Loops

Page 62: Load testing with Visual Studio and Azure - Andrew Siemer

Plug ins

• Web test plug ins

• Web test request plugins

• Should be in a separate assembly

• Allows you to run code pre or post a test/request execution

• Microsoft.VisualStudio.TestTools.WebTesting• WebTestPlugin

• WebTestRequestPlugin

Page 63: Load testing with Visual Studio and Azure - Andrew Siemer

Load tests

Page 64: Load testing with Visual Studio and Azure - Andrew Siemer

Web tests to the max!!!

• Use the web test scenarios you create

• But put the workload, load, metrics, browser mix, and other points around them

Page 65: Load testing with Visual Studio and Azure - Andrew Siemer

Load test wizard

• Running the load test wizard makes life easy!

Page 66: Load testing with Visual Studio and Azure - Andrew Siemer
Page 67: Load testing with Visual Studio and Azure - Andrew Siemer
Page 68: Load testing with Visual Studio and Azure - Andrew Siemer

When matching transaction percentages

Page 69: Load testing with Visual Studio and Azure - Andrew Siemer

When matching percentage of users per test

Page 70: Load testing with Visual Studio and Azure - Andrew Siemer

When matching pace of user per test

Page 71: Load testing with Visual Studio and Azure - Andrew Siemer

When matching pace of user per test

Page 72: Load testing with Visual Studio and Azure - Andrew Siemer

Choose to tests to include

Page 73: Load testing with Visual Studio and Azure - Andrew Siemer

Set distribution for each test

Page 74: Load testing with Visual Studio and Azure - Andrew Siemer

Define network mix

Page 75: Load testing with Visual Studio and Azure - Andrew Siemer

Define browser mix

Page 76: Load testing with Visual Studio and Azure - Andrew Siemer

Capture computer metrics

Page 77: Load testing with Visual Studio and Azure - Andrew Siemer

Configure the run frequency

Page 78: Load testing with Visual Studio and Azure - Andrew Siemer

Ready to run!

Page 79: Load testing with Visual Studio and Azure - Andrew Siemer
Page 80: Load testing with Visual Studio and Azure - Andrew Siemer
Page 81: Load testing with Visual Studio and Azure - Andrew Siemer
Page 82: Load testing with Visual Studio and Azure - Andrew Siemer

Errors?

Page 83: Load testing with Visual Studio and Azure - Andrew Siemer

But waitthere’s more!

Page 84: Load testing with Visual Studio and Azure - Andrew Siemer

How can Azure let you go big?

Page 85: Load testing with Visual Studio and Azure - Andrew Siemer

Your laptop can’t tip over production!

• Local tests are great to capture big pain points

• Or to capture simple content missing errors

• Or to run as a smoke test

Page 86: Load testing with Visual Studio and Azure - Andrew Siemer

Test farm in Azure is magic!

• With Visual Studio Online• And Azure

• We can go big!

Page 87: Load testing with Visual Studio and Azure - Andrew Siemer

Open local test settings

Page 88: Load testing with Visual Studio and Azure - Andrew Siemer

Choose to run in VSO

Page 89: Load testing with Visual Studio and Azure - Andrew Siemer

Connect to your VSO account

Page 90: Load testing with Visual Studio and Azure - Andrew Siemer

Choose your team project

Page 91: Load testing with Visual Studio and Azure - Andrew Siemer

And run the test!

Page 92: Load testing with Visual Studio and Azure - Andrew Siemer
Page 93: Load testing with Visual Studio and Azure - Andrew Siemer
Page 94: Load testing with Visual Studio and Azure - Andrew Siemer
Page 95: Load testing with Visual Studio and Azure - Andrew Siemer
Page 96: Load testing with Visual Studio and Azure - Andrew Siemer

Ok, that rocks, HOW MUCH?

• Based on “Virtual Users Minutes” – VUM

• Azure calculator for load testing: • http://goo.gl/XBrkY1

• $.0004/VUM for 20,001-2M VUM

• $.0002/VUM for 2,000,001-10M VUM

• $.0001/VUM for usage above 10M VUM/MO

Page 97: Load testing with Visual Studio and Azure - Andrew Siemer

Questions?

Andrew Siemer - Clear Measure

[email protected]

(512) 387-1976

@asiemer