Skip to content

Load testing

Andrew Boni Signori edited this page Oct 13, 2023 · 18 revisions

Goal

  • Anticipate possible production issues due to a high application load in main areas as much as possible.
  • Adjust PODs resources (CPU/Memory) and HorizontalPodAutoscaler configurations.
  • Tests will initially be conducted on the DEV environment that has the same resources right now as production.
  • Tests will be initially executed from a local machine but they can also be executed from GitHub actions (K6 also has a Cloud available to execute tests).

Framework

  • K6 will be used to execute the load tests to be created and be available in the GitHub repository.
  • The test scenarios should be available to be executed at any point.

Recommended reading to start the basics about the tests

Reason to choose K6

  • It has an Open Souce version.
  • Out-of-box output visualization can be extended (https://k6.io/blog/ways-to-visualize-k6-results).
  • It seems to be a well-known and largely used framework.
  • Extensive documentation and articles about it.
  • Tests can be written in javascript. "JavaScript is not generally well suited for high performance. To achieve maximum performance, the tool itself is written in Go, embedding a JavaScript runtime allowing for easy test scripting." (source https://k6.io/docs/).
    • The Javascript will be transpiled from Typescript keeping the overall test structure close to the other packages in SIMS.
  • More information can be found on the ticket that contains the initial effort to enable load testing #2407.

Source code structure

  • Load tests are created under sources/packages.
  • The tests are created in specific folders using unique names that will later be used by Webpack to create the javascript bundle to be executed.
  • Every new test scenario should have an associated npm command, for instance, npm run application-submission.

How to run a load test

  • Download the SIMS repository.
  • Navigate to the folder sources/packages/load-test
  • Execute npm i.
  • Every test can require sensitive information configuration. Look for files like config.env.ts.sample and follow the instructions.
  • Install K6 following the instructions here: https://k6.io/docs/get-started/installation
  • Execute one of the available tests. The list can be found in the package.json scripts section.

How a simple load test output looks like

image

To know more about these values please see: https://k6.io/docs/get-started/results-output/