$ show artilleryio/artillery
Artillery is a cloud-scale load testing and functional testing framework for backend services and APIs. It supports multiple protocols (HTTP, WebSocket, Socket.IO, Playwright, PostHog) through a plugin-based engine architecture. The system is primarily a CLI tool (built on oclif) that executes YAML/JSON test scripts defining virtual user flows with configurable arrival phases, payloads, and assertions. It provides distributed execution across local worker threads, AWS Lambda, AWS ECS/Fargate, and Azure ACI, with a bill-of-materials (BOM) system that bundles test dependencies for cloud workers. Metrics are aggregated via a custom Simple Statistics Measurement System (SSMS) supporting counters, histograms (DDSketch), and rates, and can be published to Datadog, CloudWatch, Prometheus, OpenTelemetry, Splunk, New Relic, and other observability platforms. The codebase is a monorepo managed with Turborepo, containing the core runner, platform integrations, first-party plugins (expect, ensure, apdex, slack, fake-data, metrics-by-endpoint, publish-metrics, memory-inspector), and shared type definitions. Key entry points include the `artillery` binary (`packages/artillery/bin/run`), the core runner (`packages/artillery/lib/core/runner.ts`), and platform launchers (`packages/artillery/lib/launch-platform.ts`). External dependencies include AWS SDK, Azure SDK, Playwright, got (HTTP client), and various metric publishing SDKs. The architecture is event-driven, using EventEmitter for lifecycle events and plugin hooks, with a global `global.artillery` object for shared state.
The LLM identified 5 files worth highlighting for reuse:
The SSMS (Simple Statistics Measurement System) class provides a generic metric aggregation store supporting counters, histograms (via DDSketch), and rates with time-bucketed periods. It offers serialization/deserialization for distributed reporting, merge capabilities for combining results from multiple workers, and legacy report format conversion. This component is self-contained and could be extracted for use in any system requiring lightweight, period-based metric aggregation.
The BOM (Bill of Materials) creation module implements a waterfall process to bundle test scripts and their dependencies for cloud execution. It traces imports using esbuild-wasm, resolves npm modules, includes local files, and produces a deployable archive. This pattern is reusable for any cloud deployment system that needs to package code and dependencies without requiring a full build server.
This utility module provides a template engine for variable interpolation (`{{ var }}` and `{{{ expression }}}`), capture/match functions for extracting values from JSON, XML, headers, regex, and Cheerio selectors, and flow control helpers (loops, think, parallel). The template engine supports function calls (`$randomString`, `$randomNumber`) and is used across all engines and configs. It is a self-contained, reusable component for any system needing dynamic string substitution.
The plugin loader supports v1/v2/v3 plugin APIs, loading plugins from the filesystem, environment variables, and built-in packages. It handles CJS and ESM modules, including top-level await, and provides a consistent interface for plugins to subscribe to lifecycle events and inject hooks. This pattern demonstrates a well-designed extensibility mechanism that could be adapted for other CLI tools or frameworks.
The cloud API client provides a reusable HTTP client with configurable retry logic, timeout handling, and API key authentication. It is used by the Artillery Cloud integration but is implemented as a standalone class that could be extracted for any service requiring resilient HTTP communication with retry and error handling.