Slalom Build
Published in

Slalom Build

Photo by ShareGrid on Unsplash

Load Testing in a Nutshell

Why is Load Testing important?

Well, the answer is quite simple- to find performance issues before we go live. Load Testing helps us:

  1. Determine our application’s capabilities by measuring its response time, throughput, CPU utilization, latency, etc. during average and heavy user load. This will eventually help in determining the infrastructure needs as the system scales upward.
  2. It gives us an opportunity to find strange behavior or surprises when we subject an application to an insane amount of load (stress testing). Strange behaviors include request timeouts, IO Exceptions, memory leaks, or any security issues.
  3. It also helps us understand if any new code path or database connection introduced any performance bottlenecks.

How to Load Test?

Visual Studio Web Performance & Load Test

Visual Studio provides this hidden gem (only in the Enterprise version) to create a Web Performance and Load Test project. It is used to simulate many users accessing a server at the same time so we can identify performance bottlenecks. Following are the steps to create a load test project in Visual Studio:

Load Testing a sample .NET MVC Application
Web Performance Test (WPT)
Web Test Recorder
Add a Load Test
Load Test Wizard
Run Settings
Load Pattern
Test Mix
Counter Sets
Load test summary

JMeter

Apache JMeter is an open-source, platform-independent, Java-based application designed to load test and measure performance. It is one of the oldest and best (IMHO) load testing tools. JMeter simulates HTTP requests to a target server and shows the performance of the target server via tables, graphs, aggregate report summaries, etc.

  • Web- HTTP, HTTPS (NodeJs, Java, Web API, ASP.NET, etc.)
  • Web Services- SOAP / REST
  • FTP
  • Database via JDBC drivers
JMeter GUI
  • Number of Threads: where we can specify the number of threads (users) we want to simulate.
  • Ramp-Up Period: the amount of time taken by JMeter to get all the threads (users) up and running.
  • Loop Count: the number of times we want to execute the performance test. We can also execute a forever loop by checking Forever.
Thread Group
HTTP Request Sampler
GET Request
POST Request
HTTP Header Manager
Summary Report

BlazeMeter

BlazeMeter provides an easy-to-use cloud-based performance testing platform. BlazeMeter extends JMeter; i.e. we can run our JMeter (.jmx) files on BlazeMeter. Let’s say we have a JMeter test plan and we want to simulate it with 8000–10,000 virtual users; It will be difficult to run it from a single machine using JMeter — either we run it in a distributed fashion (which is quite a headache), or we use BlazeMeter service.

  • JMeter Test: upload an existing JMeter .jmx file.
  • URL/API Test: when we want to test an API endpoint.
  • MultiTest: multiple scenario tests.
Create Test
URL/API Test
  • Originate Load from: a geographical location we wish to run the load from.
  • Users: the number of users to simulate.
  • Ramp up (sec): time it should take to get all users/threads started.
  • Iterations: the number of times to perform the test case.
  • Duration (min): BlazeMeter will use this time to calculate the end time.
  • Delay (ms): delay between HTTP requests.
BlazeMeter Report

Wrapping Up

Users today have high expectations when it comes to websites, and performance plays an important role in meeting those expectations. People are less interested in buying products or reading any content from a website that takes a few seconds or more to load. These slower websites are detrimental to businesses and eat up your revenue. Software that does exactly what the customer needs but takes too long to load might never get used.

  1. Record user activity for different use cases. I usually gather user activity data from web analytics services such as Google Analytics, App Dynamics, Splunk, or Amplitude. This data is used to model and simulate real-world user behavior.
  2. Throw traffic at the application for different scenarios.
  3. Reproduce performance related issues (if any).
  4. Identify bottlenecks in the application.
  5. Fix the performance problems.
  6. Repeat the process until desired performance results are achieved.

Further Reading

  1. Guide to get started with Visual Studio Web Load Testing and Automation.
  2. Run URL based load tests with VSTS.
  3. How to include Load Testing in your Continuous Integration Environment.
  4. Run Apache JMeter load tests with VSTS.
  5. Performance Testing in Continuous Delivery Using AWS CodePipeline and BlazeMeter.

--

--

The Build Blog is a collection of perspectives and viewpoints on the craft of building digital products today, written by the technologists that build them. By builders, for builders.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Amarpreet Singh

San Francisco-based Software Engineer and Solution Architect who loves learning new technologies and solving interesting problems.