Load testing is designed to explore the performance of a single AWS configuration a single time. Load tests must be performed from our loadtesting EC2 instance in order for accurate readings to be useful.
Follow these steps to perform a load test:
- Ensure you're running k6 within EC2
- Ensure you've pre-scaled up the ECS service and database cluster to expected load levels. Standard levels are:
- ECS service (app-dev) = 10 containers (tasks)
- DB cluster (app-dev) = 10 ACUs
- Pause the "default" queue so we don't track a ton of useless Mixpanel events during the test.
- https://verify-demo.navapbc.cloud/jobs (un/pw in 1Password)
- Get a fresh COOKIE by starting the CBV session and copying out the value of the cookie
export COOKIE=$(curl -L --cookie-jar - https://verify-demo.navapbc.cloud/cbv/links/sandbox | grep _iv_cbv_payroll_session | cut -f 7) - Then run this script like:
Or to test the Tokenized Link API:
export URL=https://verify-demo.navapbc.cloud/cbv/employer_search k6 run loadtest.jsexport API_KEY=[foo] export HOST=https://verify-demo.navapbc.cloud k6 run loadtest-api.js - Record the metrics by copying them into Confluence.
- Delete all jobs enqueued within the "default" job queue:
# in top-level of repo bin/ecs-console # in the Rails console that opens: > SolidQueue::Queue.new("default").clear - Resume the "default" queue execution.
- Optional: Delete analytics event tracking jobs to not jam up Mixpanel. In a
bin/ecs-console:
testing_finished_at = DateTime.parse("2025-10-02 18:00:00-04:00") SolidQueue::Job.where('scheduled_at < ?', testing_finished_at).where(finished_at: nil).where(class_name: %w[EventTrackingJob RecordBatchedNewrelicMetricsJob]).includes(:recurring_execution).in_batches { |batch| batch.destroy_all; puts "next batch" }
- https://verify-demo.navapbc.cloud/jobs (un/pw in 1Password)
- Optional: Delete analytics event tracking jobs to not jam up Mixpanel. In a
Stress testing is designed to analyze the performance of our system in different configurations. Each stress test will run a number of load tests and output statistics that can be compiled in a spreadsheet. Since results vary, it will test multiple times so we can get an average.
- Ensure you're running k6 within EC2
- Ensure you've pre-scaled up the ECS service and database cluster to expected load levels.
We recommend holding one of these constant and varying the other. Eg holding DBs at 10 and changing the ECS tasks.
Standard levels are:
- ECS service (app-dev) = 10 containers (tasks)
- DB cluster (app-dev) = 10 ACUs
- Run
./run_stress_test.sh - Copy the output into your spreadsheet. The standard data being reported include:
- VUs: The number of VUs when an SLA was violated or we started getting timeouts
- Total_Reqs: the number of http requests handled before the failure
- Reqs_Per_Sec: the requests per second before the failure
Follow the cleanup instructions for load testing above.
The instructions below are for local development/prototyping of the load testing script (not intended to produce calibrated metrics).
brew install k6
docker-compose up
Grafana URL: http://localhost:3001 Default username: admin Default password: admin
In Grafana, add a data source: choose InfluxDB
URL: http://influxdb:8086
Database: k6
HTTP method: GET
Click save & test
In Grafana, add a dashboard:
use this dashboard as inspiration: https://grafana.com/grafana/dashboards/13719-k6-load-testing-results-by-groups/
If you'd like to import this dashboard, select "import dashboard" and copy-paste the above URL.
Set up a user in the environment you'd like to load test. While logged in as the user, in the browser console, grab the cookie _iv_cbv_payroll_session. Put the NON url decoded value, supply that into USER_TOKENS below.
K6_OUT=influxdb k6 run loadtest.js --env USER_TOKENS=<COMMA_SEPERATED_TOKENS> --env URL=<example: https://verify-demo.navapbc.cloud/cbv/employer_search>
instructions for running load tests on an ec2 instance Note that there might be an EC2 instance called loadtester that has the tools necessary installed onto it.
copy the files into the ec2 instance using something like scp -i ~/.ssh/my-ec2-key.pem load_testing/* ec2-user@:/home/ec2-user/
sudo yum install docker
sudo service docker start
sudo usermod -a -G docker ec2-user
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
docker-compose up
sudo dnf install https://dl.k6.io/rpm/repo.rpm sudo dnf install k6
k6 run loadtest.js --env COOKIE=<YOUR_COOKIE> --env URL=https://verify-demo.navapbc.cloud