๐ Load Testing
Pocket Network's comprehensive load testing suite for evaluating network performance and reliability under various stress conditions.
- ๐ Load Testing
Overviewโ
The load-testing suite uses Gherkin for creating human-readable test scenarios that validate network behavior under load. Tests are located in the load-testing/
directory and use YAML manifests to define network configurations.
โก Quick Startโ
The simplest way to run load tests is with the default LocalNet single supplier configuration:
- Ensure LocalNet is running
- Run the default load test:
make test_load_relays_stress_localnet_single_supplier
๐งช Test Typesโ
๐ฏ Default Load Test (Single Supplier)โ
The default test gradually increases the number of applications while maintaining a single supplier and gateway. This tests the supplier's ability to handle increasing load.
Configuration:
- Initial: 4 applications, 1 gateway, 1 supplier
- Scaling: Adds 4 applications every 10 blocks up to 12 total
- Rate: 1 relay request per second per application
Command:
make test_load_relays_stress_localnet_single_supplier
๐ Multi-Supplier Load Testโ
Tests the network with multiple suppliers and gateways scaling together.
Configuration:
- Initial: 4 applications, 1 gateway, 1 supplier
- Scaling: All actors scale together up to 3 suppliers and 3 gateways
- Rate: 1 relay request per second per application
Command:
make test_load_relays_stress_localnet
๐ Claim Settlement Stability Testโ
This test maintains high constant load to validate that the network remains stable during claim settlement periods.
This test checks the session lifetime caching optimization, which prevents Relay
serving freezes by:
- Smart Cache Timing: Instead of clearing cache every block, the system now clears cache only at the end of each session
- Reduced Node Pressure: This prevents unnecessary requests to full nodes during busy claim settlement blocks
The goal is to ensure this caching improvement prevents relay failures or timeouts during critical claim settlement periods.
Configuration:
- Constant load: 50 applications, 50 gateways, 50 suppliers (no scaling)
- Rate: 2 relay requests per second per application
- Focus: Validate that no timeouts occur and relay success rates remain stable during claim settlement
Key Validation Points:
- No timeout spikes during claim settlement blocks
- Consistent relay success rates despite of full node unresponsiveness
This test uses significantly more resources than other tests due to the high number of concurrent actors and relay rate.
๐ Test Manifestsโ
Load test manifests are YAML files that define network configurations for different testing scenarios.
Available manifest files:
loadtest_manifest_localnet_single_supplier.yaml
- Default single supplier configurationloadtest_manifest_localnet.yaml
- Multi-supplier configurationloadtest_manifest_example.yaml
- Template for custom networks
๐ Running Testsโ
โ ๏ธ Prerequisitesโ
Before running load tests, ensure your environment is properly configured:
- LocalNet must be running
- Run
make acc_initialize_pubkeys
to initialize blockchain public keys
๐ง LocalNet Setupโ
Proper LocalNet configuration is essential for successful load testing.
-
Configure
localnet_config.yaml
:- Set
gateways.count
andrelayminers.count
to match your test requirements - For single supplier tests:
relayminers.count = 1
- For multi-supplier tests:
relayminers.count = 3
- Set
-
Start LocalNet and run tests using the commands above
๐ Custom Network Testingโ
You can run load tests against external networks like testnets or custom deployments by modifying the test manifest.
For testing against testnets or custom deployments:
- Copy
loadtest_manifest_example.yaml
and modify it for your network - Update account addresses, RPC endpoints, and actor configurations
- Run with custom manifest:
LOAD_TEST_CUSTOM_MANIFEST=your_manifest.yaml make test_load_relays_stress_custom
๐ Monitoring Resultsโ
๐ฅ๏ธ Test Outputโ
Load tests provide detailed output about test execution and results.
PASS
indicates successful test completionFAIL
shows failures with error details- Monitor relay success/failure rates in the output
๐ Grafana Dashboards (LocalNet)โ
LocalNet provides comprehensive observability through Grafana dashboards for real-time monitoring during load tests.
When running on LocalNet, access observability at http://localhost:3003:
- Stress Test Dashboard - Real-time load metrics
- Load Testing Dashboard - Comprehensive performance insights
๐ Test Features Exampleโ
Load tests are written using Gherkin syntax, making them human-readable and easy to understand.
Feature: Loading gateway server with relays
Scenario: Incrementing the number of relays and actors
Given localnet is running
And a rate of "1" relay requests per second is sent per application
And the following initial actors are staked:
| actor | count |
| application | 4 |
| gateway | 1 |
| supplier | 1 |
And more actors are staked as follows:
| actor | actor inc amount | blocks per inc | max actors |
| application | 4 | 10 | 12 |
| gateway | 1 | 10 | 1 |
| supplier | 1 | 10 | 1 |
When a load of concurrent relay requests are sent from the applications
Then the number of failed relay requests is "0"
๐ฏ Available Commandsโ
Here are all the available make commands for running different types of load tests.
Command | Purpose |
---|---|
make test_load_relays_stress_localnet_single_supplier | Default single supplier load test |
make test_load_relays_stress_localnet | Multi-supplier load test |
make test_load_relays_stress_custom | Custom manifest load test |