Artillery Load Testing
Relevant source files
The following files were used as context for generating this wiki page:
Artillery Load Testing in the wouter-vue project serves as a performance benchmarking suite designed to validate the router's efficiency under high-concurrency scenarios. The testing infrastructure specifically compares wouter-vue against vue-router to measure throughput, latency, and resource consumption when handling large numbers of virtual users across extensive route sets.
The suite focuses on high-traffic application simulation, utilizing a scenario involving 3,300 virtual users and 200 routes over a 6-minute duration. This rigorous testing confirms the project's claims of being a high-performance, minimalist alternative for Vue 3 applications.
Sources: README.md:76-92, examples/example/test-all.sh:34-35
Testing Infrastructure and Workflow
The load testing process is integrated into the project's automated test pipeline. It follows a structured lifecycle: building the client and server assets, initiating a Server-Side Rendering (SSR) production server, executing the Artillery load scenario, and finally extracting metrics for comparison.
Automated Execution Pipeline
The test-all.sh script orchestrates the entire lifecycle for both the wouter-vue example and the vue-router comparison example.
The pipeline ensures that load tests are performed against production-ready builds to reflect real-world performance accurately.
Sources: examples/example/test-all.sh:10-47, examples/example-vue-router/test-all.sh:10-48
Script Components
The system relies on several specialized shell scripts to manage the Artillery lifecycle:
| Script | Purpose | Key File References |
|---|---|---|
generate-report.sh | Installs Artillery globally if missing and runs the test against artillery-config.yml. | artillery-config.yml, artillery-report.json |
test-all.sh | Full integration script that manages the background SSR process and executes Artillery via pnpm exec. | server.js, artillery-config.yml |
compare-results.sh | Extracts and compares metrics from generated JSON reports. | artillery-report.json |
Sources: examples/example/testkit/generate-report.sh:1-23, compare-results.sh:1-76, examples/example/test-all.sh:1-47
Data Extraction and Metrics
After the load test completes, the project uses a custom Node.js-based extraction logic within compare-results.sh to parse the artillery-report.json. This script targets specific fields within the Artillery aggregate results to calculate performance benchmarks.
Metric Calculation Logic
The extraction function processes the following data points:
- Total Transferred Bytes: Retrieved from
aggregate.http.responseData.transferredoraggregate.http.downloaded_bytes. - Requests Completed: Retrieved from
aggregate.http.requestsCompleted. - Average Size: Calculated as
transferred / requestsCompleted.
Sources: compare-results.sh:13-28
Performance Results
The load testing results demonstrate a significant performance advantage for wouter-vue in high-throughput environments.
Comparative Benchmark (3,300 Users / 200 Routes)
| Metric | wouter-vue | vue-router | Advantage |
|---|---|---|---|
| Throughput | 117 req/s | 68 req/s | +72% faster |
| Total Requests | 36,300 | 19,800 | +83% more |
| Latency (p50) | 1 ms | 1 ms | Equivalent |
| Avg Response Size | 1,311 bytes | 1,352 bytes | -3% smaller |
| Errors | 0 | 0 | Both stable |
Sources: README.md:78-90
Configuration and Tooling
The tests are configured via artillery-config.yml and output results to artillery-report.json. The suite provides a "readable summary" and links to the Artillery cloud platform for deep-dive analysis.
# Example execution command found in generate-report.sh
artillery run artillery-config.yml --output artillery-report.json
Sources: examples/example/testkit/generate-report.sh:14-23
Build Size Verification
In addition to load testing, the compare-results.sh script monitors the build sizes of the assets being served during the tests, verifying the "minimalist" claim (~7.9KB gzipped). It checks the dist/client/assets directory to count files and calculate total size using du -sh.
Sources: compare-results.sh:56-74, README.md:15
Conclusion
Artillery Load Testing is a core part of the wouter-vue quality assurance process. By automating high-concurrency simulations and providing direct comparisons with vue-router, the project maintains its commitment to high performance and efficiency. The integrated scripts allow developers to verify throughput improvements and latency stability across versions.