performance_engine

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Performance Engine (pkg/core/tools/performance_engine)

The Performance Engine runs load and stress tests against your API.

Key Tool: run_performance

This tool executes multi-mode performance tests and tracks high-resolution latency metrics.

Modes
  • load: Simulates expected traffic volume to verify stability.
  • stress: Pushes the system beyond its limits to find breaking points.
  • spike: Sudden bursts of traffic to test resilience.
  • soak: Long-duration tests to detect memory leaks.

Metrics

Tracks total requests, success rate, RPS (Requests Per Second), and latency percentiles (p50, p95, p99).

Reports

After every run, run_performance automatically writes a Markdown report to .falcon/reports/. Pass report_name to set the filename (e.g. performance_report_dummyjson_products). If omitted, the filename defaults to performance_report_<timestamp>.md. No separate export step is needed — the report is written and validated internally.

Example Prompts

Trigger this tool by asking:

  • "Run a load test on the API with 50 concurrent users."
  • "Stress test the checkout endpoint to find its breaking point."
  • "Simulate a traffic spike on the search API."
  • "Run a soak test for 1 hour to check for memory leaks."

Documentation

Overview

Package performance_engine provides multi-mode performance and load testing for ZAP.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionMetrics

type ExecutionMetrics struct {
	Total       int           `json:"total"`
	Success     int           `json:"success"`
	Fail        int           `json:"fail"`
	SuccessRate float64       `json:"success_rate"`
	AvgLatency  time.Duration `json:"avg_latency"`
	P50         time.Duration `json:"p50"`
	P95         time.Duration `json:"p95"`
	P99         time.Duration `json:"p99"`
	Min         time.Duration `json:"min"`
	Max         time.Duration `json:"max"`
	RPS         float64       `json:"rps"`
}

ExecutionMetrics holds the final results of a performance test run.

func (*ExecutionMetrics) FormatSummary

func (m *ExecutionMetrics) FormatSummary(mode string) string

FormatSummary returns a human-readable summary of the performance metrics.

type LoadTestRunner

type LoadTestRunner struct {
	// contains filtered or unexported fields
}

LoadTestRunner executes the actual load simulation.

func NewLoadTestRunner

func NewLoadTestRunner(httpTool *shared.HTTPTool, params PerformanceParams) *LoadTestRunner

NewLoadTestRunner creates a new load test runner.

func (*LoadTestRunner) Run

Run executes the performance test according to the mode.

type MetricsCollector

type MetricsCollector struct {
	// contains filtered or unexported fields
}

MetricsCollector accumulates request statistics during a test run.

func (*MetricsCollector) Finalize

func (c *MetricsCollector) Finalize() ExecutionMetrics

Finalize calculates the final metrics from the collected statistics.

func (*MetricsCollector) Record

func (c *MetricsCollector) Record(stat RequestStat)

Record adds a single request statistic to the collector.

type PerformanceEngineTool

type PerformanceEngineTool struct {
	// contains filtered or unexported fields
}

PerformanceEngineTool provides multi-mode load testing and metrics tracking.

func NewPerformanceEngineTool

func NewPerformanceEngineTool(falconDir string, httpTool *shared.HTTPTool, reportWriter *shared.ReportWriter) *PerformanceEngineTool

NewPerformanceEngineTool creates a new performance engine tool.

func (*PerformanceEngineTool) Description

func (t *PerformanceEngineTool) Description() string

Description returns the tool description.

func (*PerformanceEngineTool) Execute

func (t *PerformanceEngineTool) Execute(args string) (string, error)

Execute performs the performance test.

func (*PerformanceEngineTool) Name

func (t *PerformanceEngineTool) Name() string

Name returns the tool name.

func (*PerformanceEngineTool) Parameters

func (t *PerformanceEngineTool) Parameters() string

Parameters returns the tool parameter description.

type PerformanceParams

type PerformanceParams struct {
	Mode        string   `json:"mode"`                   // load, stress, spike, soak
	BaseURL     string   `json:"base_url"`               // Base URL of the API
	Endpoints   []string `json:"endpoints,omitempty"`    // Specific endpoints to test
	Concurrency int      `json:"concurrency,omitempty"`  // Number of concurrent virtual users (default: 10)
	Duration    int      `json:"duration_sec,omitempty"` // Duration of test in seconds (default: 30)
	RPS         int      `json:"rps,omitempty"`          // Target requests per second (optional)
	ReportName  string   `json:"report_name,omitempty"`  // e.g. "performance_report_dummyjson_products"
}

PerformanceParams defines parameters for performance testing.

type RequestStat

type RequestStat struct {
	StatusCode int
	Latency    time.Duration
	Success    bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL