Search code examples
node.jstestingdeploymentload-testingstress-testing

Load testing an api locally, vs in a deployed testing environment


We have an expressJS API utilising mongoDB Atlas which will be deployed live to AWS. We want to stress and load test this API before users begin using it.

The question is whether to perform the load tests locally, or whether to deploy to AWS within a testing environment and load test the deployed API.

Could anyone provide any advice on this subject?


Solution

  • If you're capable to kick off a local environment with the same specifications like the cloud - it should be no or little difference in the results.

    But you need to ensure that the local is the exact replica including:

    • number and frequency of CPUs
    • RAM
    • Network and Disk IO
    • Network Latency (if you're in Europe and the cloud is in Australia you should be running tests geographically close to the server, otherwise you will see higher response times because packets need some time to travel around the globe)
    • etc.

    If not - you still can do some testing of the aspects which are not directly connected with Mongo, i.e. using profiler tools to find potentially problematic code parts, etc.

    The only approach you shouldn't touch with a ten-feet pole is running load tests against a scaled-down environment