load

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkAIComplianceChecks_AllFrameworks

func BenchmarkAIComplianceChecks_AllFrameworks(b *testing.B)

BenchmarkAIComplianceChecks_AllFrameworks measures all AI frameworks

func BenchmarkAIComplianceChecks_EU_AI_Act

func BenchmarkAIComplianceChecks_EU_AI_Act(b *testing.B)

BenchmarkAIComplianceChecks_EU_AI_Act measures EU AI Act requirements

func BenchmarkAIComplianceChecks_NIST_AI_RMF

func BenchmarkAIComplianceChecks_NIST_AI_RMF(b *testing.B)

BenchmarkAIComplianceChecks_NIST_AI_RMF measures NIST AI RMF controls

func BenchmarkAIComplianceChecks_ValidationTime

func BenchmarkAIComplianceChecks_ValidationTime(b *testing.B)

BenchmarkAIComplianceChecks_ValidationTime measures compliance validation time

func BenchmarkAIWorkload_FullPipeline

func BenchmarkAIWorkload_FullPipeline(b *testing.B)

BenchmarkAIWorkload_FullPipeline measures full AI workload pipeline

func BenchmarkAIWorkload_P99Latency

func BenchmarkAIWorkload_P99Latency(b *testing.B)

BenchmarkAIWorkload_P99Latency measures P99 latency target (<50ms)

func BenchmarkAutoscalingReadiness

func BenchmarkAutoscalingReadiness(b *testing.B)

BenchmarkAutoscalingReadiness evaluates readiness for auto-scaling

func BenchmarkConcurrencyScaling

func BenchmarkConcurrencyScaling(b *testing.B)

BenchmarkConcurrencyScaling measures performance as concurrency increases

func BenchmarkConnectionFlood

func BenchmarkConnectionFlood(b *testing.B)

func BenchmarkLLMRequestLatency_Claude

func BenchmarkLLMRequestLatency_Claude(b *testing.B)

BenchmarkLLMRequestLatency_Claude patterns simulates Claude request patterns

func BenchmarkLLMRequestLatency_Concurrent

func BenchmarkLLMRequestLatency_Concurrent(b *testing.B)

BenchmarkLLMRequestLatency_Concurrent measures concurrent LLM request handling

func BenchmarkLLMRequestLatency_EndToEnd

func BenchmarkLLMRequestLatency_EndToEnd(b *testing.B)

BenchmarkLLMRequestLatency_EndToEnd measures end-to-end latency through proxy

func BenchmarkLLMRequestLatency_GPT4

func BenchmarkLLMRequestLatency_GPT4(b *testing.B)

BenchmarkLLMRequestLatency_GPT4 patterns simulates GPT-4 request patterns

func BenchmarkLLMRequestLatency_Llama

func BenchmarkLLMRequestLatency_Llama(b *testing.B)

BenchmarkLLMRequestLatency_Llama patterns simulates Llama request patterns

func BenchmarkLLMRequestLatency_PayloadSize

func BenchmarkLLMRequestLatency_PayloadSize(b *testing.B)

BenchmarkLLMRequestLatency_PayloadSize compares different payload sizes

func BenchmarkLLMRequestLatency_Streaming

func BenchmarkLLMRequestLatency_Streaming(b *testing.B)

BenchmarkLLMRequestLatency_Streaming measures streaming vs non-streaming overhead

func BenchmarkLatency

func BenchmarkLatency(b *testing.B)

func BenchmarkMemoryStress

func BenchmarkMemoryStress(b *testing.B)

func BenchmarkMemoryUsage

func BenchmarkMemoryUsage(b *testing.B)

BenchmarkMemoryUsage benchmarks memory usage under load

func BenchmarkPromptInjectionScanning_DetectionLatency

func BenchmarkPromptInjectionScanning_DetectionLatency(b *testing.B)

BenchmarkPromptInjectionScanning_DetectionLatency measures detection latency

func BenchmarkPromptInjectionScanning_DetectionOverhead

func BenchmarkPromptInjectionScanning_DetectionOverhead(b *testing.B)

BenchmarkPromptInjectionScanning_DetectionOverhead measures detection overhead

func BenchmarkPromptInjectionScanning_FalsePositiveRate

func BenchmarkPromptInjectionScanning_FalsePositiveRate(b *testing.B)

BenchmarkPromptInjectionScanning_FalsePositiveRate measures false positive impact

func BenchmarkPromptInjectionScanning_VariousPayloads

func BenchmarkPromptInjectionScanning_VariousPayloads(b *testing.B)

BenchmarkPromptInjectionScanning_VariousPayloads tests various injection payloads

func BenchmarkSIEMEventCreation

func BenchmarkSIEMEventCreation(b *testing.B)

BenchmarkSIEMEventCreation benchmarks SIEM event creation at scale

func BenchmarkScannerConcurrent

func BenchmarkScannerConcurrent(b *testing.B)

BenchmarkScannerConcurrent benchmarks scanner with concurrent requests

func BenchmarkScannerThroughput

func BenchmarkScannerThroughput(b *testing.B)

BenchmarkScannerThroughput benchmarks scanner at different RPS levels

func BenchmarkSimulatedRPS10K

func BenchmarkSimulatedRPS10K(b *testing.B)

BenchmarkSimulatedRPS10K simulates 10k RPS internally

func BenchmarkSimulatedRPS25K

func BenchmarkSimulatedRPS25K(b *testing.B)

BenchmarkSimulatedRPS25K simulates 25k RPS internally

func BenchmarkSimulatedRPS50K

func BenchmarkSimulatedRPS50K(b *testing.B)

BenchmarkSimulatedRPS50K simulates 50k RPS internally

func BenchmarkSimulatedRPS100K

func BenchmarkSimulatedRPS100K(b *testing.B)

BenchmarkSimulatedRPS100K simulates 100k RPS internally

func BenchmarkTokenLimitEnforcement_Concurrent

func BenchmarkTokenLimitEnforcement_Concurrent(b *testing.B)

BenchmarkTokenLimitEnforcement_Concurrent measures concurrent token counting

func BenchmarkTokenLimitEnforcement_Counting

func BenchmarkTokenLimitEnforcement_Counting(b *testing.B)

BenchmarkTokenLimitEnforcement_Counting measures token counting performance

func BenchmarkTokenLimitEnforcement_LimitCheck

func BenchmarkTokenLimitEnforcement_LimitCheck(b *testing.B)

BenchmarkTokenLimitEnforcement_LimitCheck measures enforcement latency

func BenchmarkTokenLimitEnforcement_StreamTokenCount

func BenchmarkTokenLimitEnforcement_StreamTokenCount(b *testing.B)

BenchmarkTokenLimitEnforcement_StreamTokenCount measures streaming token count

func BenchmarkVectorEmbeddingRequests_BatchEmbedding

func BenchmarkVectorEmbeddingRequests_BatchEmbedding(b *testing.B)

BenchmarkVectorEmbeddingRequests_BatchEmbedding measures batch embedding requests

func BenchmarkVectorEmbeddingRequests_BatchSizes

func BenchmarkVectorEmbeddingRequests_BatchSizes(b *testing.B)

BenchmarkVectorEmbeddingRequests_BatchSizes measures different batch sizes

func BenchmarkVectorEmbeddingRequests_ConcurrentEmbedding

func BenchmarkVectorEmbeddingRequests_ConcurrentEmbedding(b *testing.B)

BenchmarkVectorEmbeddingRequests_ConcurrentEmbedding measures concurrent embeddings

func BenchmarkVectorEmbeddingRequests_LargeVectors

func BenchmarkVectorEmbeddingRequests_LargeVectors(b *testing.B)

BenchmarkVectorEmbeddingRequests_LargeVectors measures large embedding vectors

func BenchmarkVectorEmbeddingRequests_PayloadProcessing

func BenchmarkVectorEmbeddingRequests_PayloadProcessing(b *testing.B)

BenchmarkVectorEmbeddingRequests_PayloadProcessing measures payload processing

func BenchmarkVectorEmbeddingRequests_SingleVector

func BenchmarkVectorEmbeddingRequests_SingleVector(b *testing.B)

BenchmarkVectorEmbeddingRequests_SingleVector measures single embedding request

func DefaultRPSConfigs

func DefaultRPSConfigs() map[RPSLevel]RPSConfig

DefaultRPSConfigs returns default configurations for each RPS level

func LatencyBuckets

func LatencyBuckets() []string

LatencyBuckets returns predefined latency bucket boundaries

func ValidateFloodResult

func ValidateFloodResult(r *FloodResult) error

func ValidateLatency

func ValidateLatency(r *LatencyResult) error

func ValidateMemoryResult

func ValidateMemoryResult(r *MemoryResult) error

Types

type ConnectionFloodTest

type ConnectionFloodTest struct {
	TargetHost     string
	TargetPort     int
	MaxConnections int
	Duration       time.Duration
}

ConnectionFloodTest simulates 10K concurrent connections

func NewConnectionFloodTest

func NewConnectionFloodTest(host string, port int) *ConnectionFloodTest

func (*ConnectionFloodTest) Run

type FloodResult

type FloodResult struct {
	TotalConnections  int64
	FailedConnections int64
	SuccessRate       float64
	Errors            []error
	Duration          time.Duration
}

type LLMRequestType

type LLMRequestType int

LLMRequestType represents different LLM API patterns

const (
	LLMChatCompletion LLMRequestType = iota
	LLMStreaming
	LLMEmbedding
	LLMCompletion
)

type LatencyBenchmark

type LatencyBenchmark struct {
	TargetHost      string
	TargetPort      int
	RequestCount    int
	Concurrency     int
	RequestInterval time.Duration
}

LatencyBenchmark measures response times under load

func NewLatencyBenchmark

func NewLatencyBenchmark(host string, port int) *LatencyBenchmark

func (*LatencyBenchmark) Run

type LatencyResult

type LatencyResult struct {
	RequestsSent   int
	RequestsFailed int
	Latencies      []time.Duration
	MinLatency     time.Duration
	MaxLatency     time.Duration
	AvgLatency     time.Duration
	P50Latency     time.Duration
	P99Latency     time.Duration
	P999Latency    time.Duration
	TotalDuration  time.Duration
}

type MemoryResult

type MemoryResult struct {
	StartHeap    uint64
	EndHeap      uint64
	PeakHeap     uint64
	HeapGrowth   int64
	Connections  int
	Duration     time.Duration
	LeakDetected bool
	Samples      []MemorySample
}

type MemorySample

type MemorySample struct {
	Timestamp time.Time
	HeapAlloc uint64
	HeapSys   uint64
	NumGC     uint32
}

type MemoryStressTest

type MemoryStressTest struct {
	TargetHost   string
	TargetPort   int
	Duration     time.Duration
	ConnInterval time.Duration
}

MemoryStressTest detects memory leaks under sustained load

func NewMemoryStressTest

func NewMemoryStressTest(host string, port int) *MemoryStressTest

func (*MemoryStressTest) Run

type RPSConfig

type RPSConfig struct {
	Level            RPSLevel
	TargetRPS        int
	Duration         time.Duration
	WarmupDuration   time.Duration
	CooldownDuration time.Duration
	Concurrency      int
	RequestTimeout   time.Duration
	TargetHost       string
	TargetPort       int
	UseHTTPS         bool
	KeepAlive        bool
	NumClients       int
}

RPSConfig defines the configuration for an RPS load test

type RPSLevel

type RPSLevel int

RPSLevel defines different RPS test levels

const (
	RPS10K RPSLevel = iota
	RPS25K
	RPS50K
)

func (RPSLevel) String

func (r RPSLevel) String() string

String returns string representation of RPS level

type RPSResult

type RPSResult struct {
	Config        RPSConfig
	StartTime     time.Time
	EndTime       time.Time
	TotalDuration time.Duration

	// Throughput metrics
	ActualRPS      float64
	TargetRPS      float64
	RPSAchievement float64 // Percentage of target achieved

	// Request metrics
	TotalRequests   int64
	SuccessCount    int64
	ErrorCount      int64
	TimeoutCount    int64
	ConnectionError int64

	// Latency metrics
	MinLatency   time.Duration
	MaxLatency   time.Duration
	AvgLatency   time.Duration
	P50Latency   time.Duration
	P90Latency   time.Duration
	P95Latency   time.Duration
	P99Latency   time.Duration
	P999Latency  time.Duration
	P9999Latency time.Duration

	// Latency percentiles (histogram buckets)
	LatencyBuckets map[string]int64

	// Error breakdown
	ErrorBreakdown map[string]int64

	// Resource metrics
	AvgMemoryMB   float64
	PeakMemoryMB  float64
	AvgCPUPercent float64
	NumGC         uint32

	// Scaling metrics (for auto-scaling analysis)
	Samples []RPSTimeSeriesSample
}

RPSResult contains the results of an RPS load test

type RPSTimeSeriesSample

type RPSTimeSeriesSample struct {
	Timestamp   time.Time
	RPS         float64
	LatencyP50  time.Duration
	LatencyP99  time.Duration
	ErrorRate   float64
	MemoryMB    float64
	CPUPercent  float64
	ActiveConns int
}

RPSTimeSeriesSample represents a point in time series data

Jump to

Keyboard shortcuts

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