DEV Community

Keith Darragh
Keith Darragh

Posted on

Performance testing

I've recently been tasked with performance testing an application, here are things to consider for anyone starting to do this or if you've just started a new project.

Be realistic:

Be realistic with the number of requests you expect to hit your application. It may be useful to think of these in terms of user actions. Example is login, where the action will be create a new user. Try to get a hold on how many requests per second you expect your application to handle and the total requests during a specific period. These numbers will help decide how to run your test.

Loadtest tool

Think carefully about the tool to use. It's important to get a tool that simulates how actions would occur in real life. A tool like locust is designed to randomise requests, which is great for testing how randomised requests affect performance. If however you need to identify a specific issue, you may want to specify numbers. This can also be useful to produce an entirely repeatable test.

Short feedback

Short feedback is important, try to run some shorter tests first to check the accuracy of your load test and build up to longer running tests. This should help identify errors in your test code.

Constants

Be clear on what stays constant and what should vary. You may want to vary the instance size, number of instances or even db size. This will help identify how best to deploy your application.

Loadtest early

Start load testing early during development and continually run these tests to ensure performance doesn't degrade. Running this often will help identify what causes any performance degradation. It will help identify bottlenecks sooner so that they can be fixed before they become an issue. Having your loadtest in a specific build pipeline may help satisfy this requirement. It may not need to run on every commit but weekly should be a minimum consideration.

Environment

Create an environment identical to production to run your tests, this will allow for more accurate results than running against an existing test stack. Running load tests against production may not be a good idea, if your application reaches breaking point, you don't want users being unable to use your system.

Cost

Think about the cost involved, a whole new environment can be expensive. Think about the tool being used, there are plenty of free tools out there which may do the job but some paid for tools may offer more features. Check out what tool best suits your needs. Think too about the cost of developer time, how many are working on this, can it be automated to save on cost?

Top comments (0)