|
| 1 | +# UCKN Load Testing Infrastructure |
| 2 | + |
| 3 | +This directory contains comprehensive load testing infrastructure for the UCKN framework, using [Locust](https://locust.io/) to simulate high-traffic and large data conditions. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Locust-based user simulation**: Realistic user behaviors for search, pattern addition, and mixed workloads. |
| 8 | +- **Configurable scenarios**: Easily adjust user counts, spawn rates, and scenario types. |
| 9 | +- **Large dataset scaling**: Supports testing with 1K to 1M+ patterns. |
| 10 | +- **Performance monitoring**: Collects response times, throughput, error rates, and system resource usage. |
| 11 | +- **CI/CD integration**: Ready for automated load testing in pipelines. |
| 12 | +- **Docker Compose support**: Consistent, reproducible test environments. |
| 13 | + |
| 14 | +## Directory Structure |
| 15 | + |
| 16 | +- `locustfile.py` — Entry point for Locust, scenario selection, and user classes. |
| 17 | +- `scenarios/` — Scenario definitions (search, add, mixed, scaling, stress). |
| 18 | +- `utils/` — Utilities for data generation and monitoring. |
| 19 | +- `config/` — Load test configuration files. |
| 20 | + |
| 21 | +## Running Load Tests |
| 22 | + |
| 23 | +### Prerequisites |
| 24 | + |
| 25 | +- Install dependencies: |
| 26 | + `pip install .[loadtest]` |
| 27 | +- Ensure the UCKN server is running and accessible. |
| 28 | + |
| 29 | +### Basic Usage |
| 30 | + |
| 31 | +```sh |
| 32 | +cd tests/load_tests |
| 33 | +locust -f locustfile.py --host=http://localhost:8000 |
| 34 | +``` |
| 35 | + |
| 36 | +### Scenario Selection |
| 37 | + |
| 38 | +You can select scenarios via the Locust web UI or by specifying user classes with the `--users` and `--spawn-rate` flags. |
| 39 | + |
| 40 | +### Docker Compose |
| 41 | + |
| 42 | +A sample `docker-compose.load-test.yml` is provided for running UCKN and Locust together. |
| 43 | + |
| 44 | +```sh |
| 45 | +docker compose -f docker-compose.load-test.yml up --build |
| 46 | +``` |
| 47 | + |
| 48 | +## Customization |
| 49 | + |
| 50 | +- Adjust user behavior and data generation in `scenarios/` and `utils/`. |
| 51 | +- Tune load parameters in `config/load_test_config.py`. |
| 52 | + |
| 53 | +## Metrics and Monitoring |
| 54 | + |
| 55 | +- Locust provides real-time metrics in its web UI. |
| 56 | +- Additional resource monitoring is available via `utils/monitoring.py`. |
| 57 | + |
| 58 | +## CI/CD Integration |
| 59 | + |
| 60 | +- Integrate load tests in your pipeline using the provided commands and Docker Compose setup. |
0 commit comments