Figure Out Your Requirements
The best way to start any testing process is by figuring out your own requirements and by talking to your current customers to figure out theirs — after all, who would know better? For APIs, this may be all endpoints, a specific endpoint or a subset you are looking to improve the performance of. It’s about knowing what your specific test is for and why.
Like with all good testing, you can start to ask questions, like: How many users do we have at peak time now? How many could we have? How many users would we have in an ideal world?
These numbers are great to begin setting your load testing parameters.
Always remember this rule: The more realistic your load testing is to your real-life workload, the more useful your load test will be.
This means that it’s not terribly useful to keep your load tests at a thousand requests per second if you’re only at 100. But, on the other hand, if you are only testing at 100, you aren’t preparing for the future and the reasonable scaling you may face soon. This is why, before you begin creating a load test, you must first research your current API usage.
Start by answering the following questions:
- What is your average number of requests per second?
- What is your peak throughput? What is the most traffic you could have over a certain period of time?
- Which, if any, endpoints get the most traffic?
- Is your traffic generated by all users or can you pinpoint a few hyper users?
According to 3scale by RedHat’s Victor Delgado, you should look for patterns and usage statistics that can offer insights into:
- Repetitive load generation
- Simulated traffic patterns
- Real traffic scenarios
He goes onto explain that you want to start by asking simple questions for simple answers. When in doubt, these are the most realistic and accurate answers.
“Running your firsts tests with repetitive load generation against your API endpoints will be a great way to validate that your load testing environment is stable. But most importantly, it will also let you find the absolute maximum throughput of your API and therefore establish an upper bound of the performance that you’ll be able to achieve,” says Delgado.
This is a great starting off point to understand your realistic traffic. He goes onto suggest that you can also kick off your API load testing with your API production logs as a way to replay your most realistic use cases. Between these two examples, you should be able to recognize not only what kind of traffic is typical, but also which endpoints are creating this traffic.
Utilizing the Right Tools
As you get started with your load testing, SmartBear has the tools you need to ensure that your APIs perform flawlessly under various traffic conditions. ReadyAPI is the industry’s leading API load testing tool that is great for beginners, because it’s scriptless and allows for easy reuse of your functional API tests from ReadyAPI.
ReadyAPI allows you to quickly get started and:
- Save time & resources by building load tests from pre-configured templates in just a few clicks
- Create real-life traffic patterns from servers ‘on premise’ or in the cloud
- Understand server performance by visualizing the effects of load on your servers with real-time monitoring
- Quickly analyze results by collecting advanced performance metrics for your load test runs and benchmarking them against past tests
- Reuse your existing functional test cases from ReadyAPI for increased efficiency
Read more:
How To Load Test APIs Without a Single Line of Code
Load Testing Strategies
What Is Distributed Load Testing?
Load Testing vs. Stress Testing vs. Performance Testing