Skip to main content
ClaudeWave
Skill59.2k estrellas del repoactualizado today

agent-performance-benchmarker

This Claude Code skill benchmarks distributed consensus protocols by measuring throughput, latency, and resource utilization across different scenarios. Use it when you need to evaluate and compare the performance of Byzantine, Raft, or Gossip protocols, optimize parameters for specific workloads, or generate detailed performance reports showing CPU, memory, and network consumption patterns.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/ruvnet/ruflo /tmp/agent-performance-benchmarker && cp -r /tmp/agent-performance-benchmarker/.agents/skills/agent-performance-benchmarker ~/.claude/skills/agent-performance-benchmarker
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

---
name: performance-benchmarker
type: analyst
color: "#607D8B"
description: Implements comprehensive performance benchmarking for distributed consensus protocols
capabilities:
  - throughput_measurement
  - latency_analysis
  - resource_monitoring
  - comparative_analysis
  - adaptive_tuning
priority: medium
hooks:
  pre: |
    echo "📊 Performance Benchmarker analyzing: $TASK"
    # Initialize monitoring systems
    if [[ "$TASK" == *"benchmark"* ]]; then
      echo "⚡ Starting performance metric collection"
    fi
  post: |
    echo "📈 Performance analysis complete"
    # Generate performance report
    echo "📋 Compiling benchmarking results and recommendations"
---

# Performance Benchmarker

Implements comprehensive performance benchmarking and optimization analysis for distributed consensus protocols.

## Core Responsibilities

1. **Protocol Benchmarking**: Measure throughput, latency, and scalability across consensus algorithms
2. **Resource Monitoring**: Track CPU, memory, network, and storage utilization patterns
3. **Comparative Analysis**: Compare Byzantine, Raft, and Gossip protocol performance
4. **Adaptive Tuning**: Implement real-time parameter optimization and load balancing
5. **Performance Reporting**: Generate actionable insights and optimization recommendations

## Technical Implementation

### Core Benchmarking Framework
```javascript
class ConsensusPerformanceBenchmarker {
  constructor() {
    this.benchmarkSuites = new Map();
    this.performanceMetrics = new Map();
    this.historicalData = new TimeSeriesDatabase();
    this.currentBenchmarks = new Set();
    this.adaptiveOptimizer = new AdaptiveOptimizer();
    this.alertSystem = new PerformanceAlertSystem();
  }

  // Register benchmark suite for specific consensus protocol
  registerBenchmarkSuite(protocolName, benchmarkConfig) {
    const suite = new BenchmarkSuite(protocolName, benchmarkConfig);
    this.benchmarkSuites.set(protocolName, suite);
    
    return suite;
  }

  // Execute comprehensive performance benchmarks
  async runComprehensiveBenchmarks(protocols, scenarios) {
    const results = new Map();
    
    for (const protocol of protocols) {
      const protocolResults = new Map();
      
      for (const scenario of scenarios) {
        console.log(`Running ${scenario.name} benchmark for ${protocol}`);
        
        const benchmarkResult = await this.executeBenchmarkScenario(
          protocol, scenario
        );
        
        protocolResults.set(scenario.name, benchmarkResult);
        
        // Store in historical database
        await this.historicalData.store({
          protocol: protocol,
          scenario: scenario.name,
          timestamp: Date.now(),
          metrics: benchmarkResult
        });
      }
      
      results.set(protocol, protocolResults);
    }
    
    // Generate comparative analysis
    const analysis = await this.generateComparativeAnalysis(results);
    
    // Trigger adaptive optimizations
    await this.adaptiveOptimizer.optimizeBasedOnResults(results);
    
    return {
      benchmarkResults: results,
      comparativeAnalysis: analysis,
      recommendations: await this.generateOptimizationRecommendations(results)
    };
  }

  async executeBenchmarkScenario(protocol, scenario) {
    const benchmark = this.benchmarkSuites.get(protocol);
    if (!benchmark) {
      throw new Error(`No benchmark suite found for protocol: ${protocol}`);
    }

    // Initialize benchmark environment
    const environment = await this.setupBenchmarkEnvironment(scenario);
    
    try {
      // Pre-benchmark setup
      await benchmark.setup(environment);
      
      // Execute benchmark phases
      const results = {
        throughput: await this.measureThroughput(benchmark, scenario),
        latency: await this.measureLatency(benchmark, scenario),
        resourceUsage: await this.measureResourceUsage(benchmark, scenario),
        scalability: await this.measureScalability(benchmark, scenario),
        faultTolerance: await this.measureFaultTolerance(benchmark, scenario)
      };
      
      // Post-benchmark analysis
      results.analysis = await this.analyzeBenchmarkResults(results);
      
      return results;
      
    } finally {
      // Cleanup benchmark environment
      await this.cleanupBenchmarkEnvironment(environment);
    }
  }
}
```

### Throughput Measurement System
```javascript
class ThroughputBenchmark {
  constructor(protocol, configuration) {
    this.protocol = protocol;
    this.config = configuration;
    this.metrics = new MetricsCollector();
    this.loadGenerator = new LoadGenerator();
  }

  async measureThroughput(scenario) {
    const measurements = [];
    const duration = scenario.duration || 60000; // 1 minute default
    const startTime = Date.now();
    
    // Initialize load generator
    await this.loadGenerator.initialize({
      requestRate: scenario.initialRate || 10,
      rampUp: scenario.rampUp || false,
      pattern: scenario.pattern || 'constant'
    });
    
    // Start metrics collection
    this.metrics.startCollection(['transactions_per_second', 'success_rate']);
    
    let currentRate = scenario.initialRate || 10;
    const rateIncrement = scenario.rateIncrement || 5;
    const measurementInterval = 5000; // 5 seconds
    
    while (Date.now() - startTime < duration) {
      const intervalStart = Date.now();
      
      // Generate load for this interval
      const transactions = await this.generateTransactionLoad(
        currentRate, measurementInterval
      );
      
      // Measure throughput for this interval
      const intervalMetrics = await this.measureIntervalThroughput(
        transactions, measurementInterval
      );
      
      measurements.push({
        timestamp: intervalStart,
        requestRate: currentRate,
        actualThroughput: intervalMetrics.throughput,
        successRate: intervalMetrics.successRate,
        averageLatency: intervalMetrics.averageLatency,