What Is The Difference Between Performance Testing And Load Testing
Tags: testing, programming, test, codequality
Published: 2021-11-03 06:00:06

Performance testing and load testing are often used interchangeably but they are actually different parts of an overall test plan that should be executed in combination with each other.

**Load testing** is all about testing how your website or application can handle increased load – i.e number of requests per second/period of time.

**Performance testing**, on the other hand, seeks to measure performance under normal operating conditions on a single instance. For example page load time, response time, server response time, network latency and disk I/O. Load testing is a subset of performance testing.

This is an important distinction as your application performance is measured by the user’s perception of how fast a page loads. If a user perceives a page takes too long to load, they might wait longer before making the next request. This would make your application appear slow(poor performance) even though it might be able to handle hundreds or thousands of requests per second(can handle high load).

##Performance testing techniques##
###1) Load testing###
This is a frequent part of a development process. Most web applications need to be tested for performance before they go live to the public.

###2) Soak testing###
This is similar to load testing, except that the test load is gradually increased over a period of time. This helps find performance issues such as memory leaks, which can be difficult to find with ordinary load testing.

###3) Stress testing###
Testing how an application behaves when it is pushed to or beyond its limits, such as how it behaves if too many users try to use it at one time.

###4) Scalability testing###
How well an application or hardware can support more users or requests, or how it behaves when the number of users increases. For example, scalability testing is performed to determine if there are any bottlenecks in the system, such as memory usage.

###5) Micro-benchmarking###
Micro benchmarks are able to test a site as it would be seen by a single user. Micro-benchmarks capture the most important aspects of what will be seen by a typical user. The best sites are able to provide an optimal user experience for their users under all conditions. To perform micro-benchmarking, one needs to test the same tasks the site will experience in production using realistic workloads.

###6) Spike testing###
Spike testing is similar to load testing except that the test load is carried out only once by increasing the number of users suddenly.

##What determines performance?##
1) Network conditions
2) Server performance – host configurations, number of cores, memory, disk I/O
3) Database performance – database I/O, query execution times, is the data cached?
4) Thrid party access – API access to other services, caches, 3rd party content delivery networks
5) Client load – what happens when multiple clients are connected to your application?
6) Image rendering
Since you can’t test for all of these, you should carefully think about the performance risks and design tests to isolate them.

##Factors to consider when doing load tests##
Load tests seek to simulate load from a variety of different use cases including:

1. Use a staging server with a fixed set of data
2. Simulate a large number of users making requests in parallel so that your application will behave as expected under high load.
3. Load tests are launched from a script use a variety of tools to simulate load.
4. Will the Load tests be done manually or automatically.?
5. Consider using a combination of load test and performance testing tools to determine how your application will behave under a range of load conditions

##Questions to ask yourself when doing performance tests##
1) When is the page visible? After how long?
2) How quickly can users begin to interact with the page?
3) What is the server response time?
4) Could there be any latency issues on networks or with browser plug-ins?
5) Can users have a seamless experience across various devices?
6) How do performance metrics change when more third party content is loaded on the page?
7) How much scripting is there? Are they blocking the main thread
8) Is the site using CDN, is the website able to load resources on time?

##Example Performance Test Cases##
1) How many assets can a device download in parallel?
2) What is the minimum page size that a device can successfully load in a single request?
3) How does the page size and number of images affect load time?
4)How does CSS (stylesheets) and JS(javscript) affect performance of the page?
5) How much XMLHttpRequests (APIs calls, or usage of services) can be done simultaneously without blocking the UI thread.

##Most common Performance testing issues##
1) Server response time is fine for some users but not others
2) Site or application works fine on a fast connection but slows down when on a mobile/slower connection
3) Increase of 3rd party content on a page causes performance issues as more connections are made to the server, more assets are loaded and requests queued up. The main thread becomes slow, which blocks other operations.

##Load Testing tools##
There are many different load testing tools available that allow you to test the performance of software applications. 
Some are made specifically for users to perform load testing. Others are made for developers who want to test the performance of their own websites. 

A lot of companies now use load testing tools instead of manual tests as it is much more efficient, accurate and faster at finding issues with your application.

##Load testing scripts##
There are many different types of load tests that can be carried out with the most common script types being:

**1) Random** – These will simply talk to your application as if it is a real user and randomly send requests at any time. This is known as “random” or “sporadic”.
**2) Varying Load** – This will gradually increase the number of users or requests over a duration of time. This tests your application under what is known as “steady-state conditions”.
**3) Data-Driven** – These will randomly send requests using the same data that would be sent to your application. Each time a request is made, the data will be repeated to create a realistic simulation of the normal use of your application.

##Common performance testing and load testing tools##
There are several different types of software performance testing tools available that allow you to test websites and applications. Some are made specifically for users to perform load testing. Others are made for developers who want to test the performance of their own sites. A lot of companies now use website performance testing tools instead of manual tests as it is much more efficient, accurate and faster at finding issues with your application.

***1) JMeter*** – is a Java application that can be used to measure performance on a website. It is open-source and can be used to simulate a range of tasks, such as page refresh, database queries, user interactions and more. JMeter also allows you to create separate tests for different content within your site.
***2) WebLoad*** – This is a tool that allows you to script load testing of website and it offers the ability to run scripts on a schedule or when thresholds are reached.
***3) Loadrunner*** – is a product designed for performance testing websites. It allows you to test multiple websites in the same environment, which allows you to compare results.
***4) LoadNinja*** – is a free tool that includes an editor, recorder, test script compiler and automatic report generator. It allows you to run load tests via the command line.
***6) Sauce Labs*** – Allows you to automatically run load tests on real devices.
***5) Loader*** – is a JavaScript library that provides tools for loading websites. It can be used to simulate different network conditions, repeat requests or introduce latency into requests.