How felipeneuwald/stressy works
Project type and purpose
• This is an open-source, command-line CPU stress-test tool written in Go.
• Its sole purpose is to spawn cryptographic computations on one or more CPU cores to simulate load.
• It ships as a standalone binary and as a Docker container, with cross-platform and multi-arch support.
File structure
• Top-level files:
• Dockerfile – builds container image
• .goreleaser.yaml – config for multi-arch binary/Docker releases
• GitHub workflows – CI/CD for releases and vulnerability scans
• cmd/main.go – CLI entrypoint
• internal/flag – flag parsing, environment binding, validation
• internal/stressy – core stress logic (worker creation, crypto loops)
• There are no external services or databases. It’s a single process with a worker pool.
README for additional insights
• CLI flags (workers, timeout, help, version) and corresponding environment variables
• Usage patterns for both direct binary invocation and Docker
• Build instructions for Go and Docker
• Emphasizes configurability, cross-platform, and CI-driven releases
a. Main components
• CLI Entrypoint (cmd/main.go)
• Configuration Layer (internal/flag):
– Flag definitions
– Environment variable loader
– Validation logic
• Core Stress Engine (internal/stressy):
– Worker pool manager
– Cryptographic CPU workload
– Timeout controller
• OS/Runtime & CPU cores
• Delivery Pipeline:
– GitHub Actions (vuln-scan, goreleaser)
– goreleaser (builds binaries, Docker images)
• Distribution outputs:
– Platform binaries
– Docker images
b. Relationships and interactions
• User invokes CLI or runs Docker → CLI Entrypoint
• CLI Entrypoint calls Configuration Layer → produces runtime settings
• Configuration Layer passes settings to Core Stress Engine
• Stress Engine spawns N workers → each binds to an OS thread/core → runs crypto loop
• Timeout controller signals workers to stop when the timer expires or runs indefinitely
• CI/CD pipeline triggers on tag → runs Go build and Docker build → publishes artifacts
c. Architectural patterns and design principles
• Clear separation of concerns:
– CLI vs. config vs. core logic
• Single-process, multi-threaded worker pool
• Internal packages to prevent API leakage
• Infrastructure as code for builds and releases
d. Relevant technologies and frameworks
• Go modules
• Go’s standard library flag package (wrapped by internal/flag)
• Docker for containerization
• GitHub Actions for CI/CD
• goreleaser for cross-arch builds and publishing