30 Days of API Testing - Day 28: Performance is key to a good API, how are you performance testing your APIs?

I already did a performance test for an API. In my opinion, performance testing an API is the same with a website.

Base on customer’s requirements we will do:

  • Baseline testing: to find metrics for system performance under normal load
  • Load Testing: to find metrics for system performance under high load.
  • Stress Testing: to find the system breaking point.
  • Soak/Endurance Testing: to make sure no unwanted behavior emerges over a long period of time.

I think the difference performance testing between an API and a website is the testing data. We need to prepare a very large data set up to 1 million records to perform performance testing our API.

2 Likes

I agree with oceannguyen. Also, I want to add that it’s very important to analyze and understand results of perfomance api tests. The end aim of perfomance testing is not to drop down server but to estimate at what loads and data it will work stably :slightly_smiling_face:

1 Like

From Twitter

I haven’t worked on performance testing api project yet. So I research and summary about performance testing my APIs :
**When performance APIs testing, there are some questions should answer:

  • What number of users can work with the API at the same time?
  • How long can users work with the API before the restart is needed?
  • What if a high number of users are working with the API for an extended period?
  • What happens if a sudden spike of users that the API cannot handle happens?

**5 scenarios can test:

  1. Baseline testing
  2. Stress testing
  3. Soak testing
  4. Peak testing
  5. Spike testing
3 Likes

I have just been taught using Jmeter for load test a website, however, just do a simple step in process with template, still not really work in a project or research more. Therefore, to do a performance test APIs, I am going to refer https://www.guru99.com/performance-testing.html for general about Performance Testing:

The focus of Performance Testing is checking a software program’s

  • Speed - Determines whether the application responds quickly
  • Scalability - Determines maximum user load the software application can handle.
  • Stability - Determines if the application is stable under varying loads

Types of Performance Testing

  • Load testing - checks the application’s ability to perform under anticipated user loads. The objective is to identify performance bottlenecks before the software application goes live.
  • Stress testing - involves testing an application under extreme workloads to see how it handles high traffic or data processing. The objective is to identify breaking point of an application.
  • Endurance testing - is done to make sure the software can handle the expected load over a long period of time.
  • Spike testing - tests the software’s reaction to sudden large spikes in the load generated by users.
  • Volume testing - Under Volume Testing large no. of. Data is populated in database and the overall software system’s behavior is monitored. The objective is to check software application’s performance under varying database volumes.
  • Scalability testing - The objective of scalability testing is to determine the software application’s effectiveness in “scaling up” to support an increase in user load. It helps plan capacity addition to your software system.

Performance Testing Process
image

3 Likes

I didn’t have a chance to work on Performance testing for API. I searched on internet and found a article for performance:

However, when I work on API Automation testing, I have a record to store all execution time for a list of test cases (baseline test cases). Based on the change of execution time I can have the overview of the current performance of the API then send my finding for the team.

3 Likes

The most important focus of Performance Testing is checking a software program’s. I searched on internet and found a article for performance: https://www.guru99.com/performance-testing.html

  • Speed - Determines whether the application responds quickly
  • Scalability - Determines maximum user load the software application can handle.
  • Stability - Determines if the application is stable under varying loads

Types of Performance Testing

  • Load testing - checks the application’s ability to perform under anticipated user loads. The objective is to identify performance bottlenecks before the software application goes live.
  • Stress testing - involves testing an application under extreme workloads to see how it handles high traffic or data processing. The objective is to identify the breaking point of an application.
  • Endurance testing - is done to make sure the software can handle the expected load over a long period of time.
  • Spike testing - tests the software’s reaction to sudden large spikes in the load generated by users.
  • Volume testing - Under Volume Testing large no. of. Data is populated in a database and the overall software system’s behavior is monitored. The objective is to check software application’s performance under varying database volumes.
  • Scalability testing - The objective of scalability testing is to determine the software application’s effectiveness in “scaling up” to support an increase in user load. It helps plan capacity addition to your software system.

Common Performance Problems

  • Long Load time - Load time is normally the initial time it takes an application to start. This should generally be kept to a minimum. While some applications are impossible to make load in under a minute, Load time should be kept under a few seconds if possible.
  • Poor response time - Response time is the time it takes from when a user inputs data into the application until the application outputs a response to that input. Generally, this should be very quick. Again if a user has to wait too long, they lose interest.
  • Poor scalability - A software product suffers from poor scalability when it cannot handle the expected number of users or when it does not accommodate a wide enough range of users. Load Testing should be done to be certain the application can handle the anticipated number of users.
  • Bottlenecking - Bottlenecks are obstructions in a system which degrade overall system performance. Bottlenecking is when either coding errors or hardware issues cause a decrease of throughput under certain loads. Bottlenecking is often caused by one faulty section of code. The key to fixing a bottlenecking issue is to find the section of code that is causing the slowdown and try to fix it there. Bottlenecking is generally fixed by either fixing poor running processes or adding additional Hardware. Some common performance bottlenecks are
    • CPU utilization
    • Memory utilization
    • Network utilization
    • Operating System limitations
    • Disk usage

And you will read more at Guru99 this article will help you explain more for Performance testing API

3 Likes

We can use 6 types of performance testing as:

I refer this link for more detail: https://www.softwaretestingclass.com/what-is-performance-testing/

4 Likes

I have not done much performance Testing in my time but I really like all the points made before.

I did find the below article with some information on the topic that might bring some plus to the thread

https://levelup.gitconnected.com/how-to-performance-test-your-api-the-right-way-and-improve-reliability-8d7ff17c0037

1 Like

Well most of the types have already been mentioned but I’ll add one more:

  • Recovery Testing

Recovery testing is a type of non-functional testing technique performed in order to determine how quickly the system can recover after it has gone through system crash or hardware failure. Recovery testing is the forced failure of the software to verify if the recovery is successful.

Extra info: What is Recovery Testing? with Example

I have not worked on performance testing API project yet.
I reviewed articles mentioned here. I also found there is MoT’s 30 Days of Performance Testing Challenge and lots of lessons and courses in MoT’s Dojo section about performance testing, for example: