mcpField
P
performance-analysis

performance-analysis

github.com/ruvnetエージェントワークフロー80.0k1.2k 回インストール今日更新
リポジトリ

performance-analysis について

performance-analysis は、Claude Flow の swarm 性能を分析するスキルです。実行状況を追跡し、ボトルネックを調べる開発者向けに、検出、プロファイリング、レポート作成、最適化提案を提供します。

主な機能

  1. 01通信、処理、メモリ、ネットワークのボトルネック検出
  2. 02リアルタイム監視と履歴プロファイリング
  3. 03複数形式の性能レポート作成
  4. 04最適化提案と自動修正

活用シーン

  1. 01swarm 実行時の性能ボトルネック調査
  2. 02swarm の性能変化を比較してレポート作成
  3. 03タスク実行とリソース使用状況の継続監視

MCP 対応

Claude Flow MCP ツールを使ってボトルネックを検出し、タスク分析結果を取得します。

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/ruvnet/ruflo --skill performance-analysis

インストール後、Claude Code で/performance-analysisを入力して読み込まれたか確認します。

詳細

パフォーマンス分析スキル

ボトルネックの特定、スウォーム操作のプロファイリング、詳細なレポートの生成、実行可能な最適化の推奨事項の提示を行う包括的なパフォーマンス分析スイートです。

概要

このスキルでは、あらゆるパフォーマンス分析機能を統合しています。

  • ボトルネック検出:通信、処理、メモリ、ネットワークにおけるパフォーマンスのボトルネックを特定します
  • パフォーマンスプロファイリング:スウォーム操作をリアルタイムで監視し、履歴を分析します
  • レポート生成:複数の形式で包括的なパフォーマンスレポートを作成します
  • 最適化の推奨事項:パフォーマンスを改善するための AI による提案を提示します

クイックスタート

基本的なボトルネック検出
npx claude-flow bottleneck detect
パフォーマンスレポートの生成
npx claude-flow analysis performance-report --format html --include-metrics
分析と自動修正
npx claude-flow bottleneck detect --fix --threshold 15

主な機能

1. ボトルネック検出
コマンド構文
npx claude-flow bottleneck detect [options]
オプション
  • --swarm-id, -s <id> - 特定のスウォームを分析します(デフォルト:現在のスウォーム)
  • --time-range, -t <range> - 分析期間:1h、24h、7d、all(デフォルト:1h)
  • --threshold <percent> - ボトルネックのしきい値(パーセント、デフォルト:20)
  • --export, -e <file> - 分析結果をファイルにエクスポートします
  • --fix - 自動最適化を適用します
使用例
# Basic detection for current swarm
npx claude-flow bottleneck detect

# Analyze specific swarm over 24 hours
npx claude-flow bottleneck detect --swarm-id swarm-123 -t 24h

# Export detailed analysis
npx claude-flow bottleneck detect -t 24h -e bottlenecks.json

# Auto-fix detected issues
npx claude-flow bottleneck detect --fix --threshold 15

# Low threshold for sensitive detection
npx claude-flow bottleneck detect --threshold 10 --export critical-issues.json
分析対象のメトリクス

通信のボトルネック:

  • メッセージキューの遅延
  • エージェントの応答時間
  • 調整処理のオーバーヘッド
  • メモリアクセスのパターン
  • エージェント間通信のレイテンシ

処理のボトルネック:

  • タスクの完了時間
  • エージェントの使用率
  • 並列実行の効率
  • リソース競合
  • CPU$メモリ使用パターン

メモリのボトルネック:

  • キャッシュヒット率
  • メモリアクセスのパターン
  • ストレージ I/O のパフォーマンス
  • ニューラルパターンの読み込み時間
  • メモリ割り当ての効率

ネットワークのボトルネック:

  • API 呼び出しのレイテンシ
  • MCP 通信の遅延
  • 外部サービスのタイムアウト
  • 同時リクエストの上限
  • ネットワークスループットの問題
出力形式
🔍 Bottleneck Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━

📊 Summary
├── Time Range: Last 1 hour
├── Agents Analyzed: 6
├── Tasks Processed: 42
└── Critical Issues: 2

🚨 Critical Bottlenecks
1. Agent Communication (35% impact)
   └── coordinator → coder-1 messages delayed by 2.3s avg

2. Memory Access (28% impact)
   └── Neural pattern loading taking 1.8s per access

⚠️ Warning Bottlenecks
1. Task Queue (18% impact)
   └── 5 tasks waiting > 10s for assignment

💡 Recommendations
1. Switch to hierarchical topology (est. 40% improvement)
2. Enable memory caching (est. 25% improvement)
3. Increase agent concurrency to 8 (est. 20% improvement)

✅ Quick Fixes Available
Run with --fix to apply:
- Enable smart caching
- Optimize message routing
- Adjust agent priorities
2. パフォーマンスプロファイリング
リアルタイム検出

タスクの実行中に自動で分析します。

  • 実行時間と複雑さの比較
  • エージェントの使用率
  • リソースの制約
  • 操作のパターン
よくあるボトルネックのパターン

時間のボトルネック:

  • 5 分を超えるタスク
  • 並列化できる逐次処理
  • 冗長なファイル操作
  • 非効率なアルゴリズムの実装

調整処理のボトルネック:

  • 複雑なタスクを単一のエージェントで処理している
  • エージェント間の作業負荷の偏り
  • 不適切なトポロジーの選択
  • 過剰な同期ポイント

リソースのボトルネック:

  • 操作数が多い(> 100)
  • メモリの制約
  • I/O の制限
  • スレッドプールの飽和
MCP 統合
// Check for bottlenecks in Claude Code
mcp__claude-flow__bottleneck_detect({
  timeRange: "1h",
  threshold: 20,
  autoFix: false
})

// Get detailed task results with bottleneck analysis
mcp__claude-flow__task_results({
  taskId: "task-123",
  format: "detailed"
})

結果形式:

{
  "bottlenecks": [
    {
      "type": "coordination",
      "severity": "high",
      "description": "Single agent used for complex task",
      "recommendation": "Spawn specialized agents for parallel work",
      "impact": "35%",
      "affectedComponents": ["coordinator", "coder-1"]
    }
  ],
  "improvements": [
    {
      "area": "execution_time",
      "suggestion": "Use parallel task execution",
      "expectedImprovement": "30-50% time reduction",
      "implementationSteps": [
        "Split task into smaller units",
        "Spawn 3-4 specialized agents",
        "Use mesh topology for coordination"
      ]
    }
  ],
  "metrics": {
    "avgExecutionTime": "142s",
    "agentUtilization": "67%",
    "cacheHitRate": "82%",
    "parallelizationFactor": 1.2
  }
}
3. レポート生成
コマンド構文
npx claude-flow analysis performance-report [options]
オプション
  • --format <type> - レポート形式:json、html、markdown(デフォルト:markdown)
  • --include-metrics - 詳細なメトリクスとグラフを含めます
  • --compare <id> - 前回のスウォームと比較します
  • --time-range <range> - 分析期間:1h、24h、7d、30d、all
  • --output <file> - 出力ファイルのパス
  • --sections <list> - 含めるセクションをカンマ区切りで指定します
レポートのセクション
  1. エグゼクティブサマリー

    • 全体的なパフォーマンススコア
    • 主要なメトリクスの概要
    • 重要な調査結果
  2. スウォームの概要

    • トポロジーの構成
    • エージェントの分布
    • タスクの統計
  3. パフォーマンスメトリクス

    • 実行時間
    • スループット分析
    • リソースの使用率
    • レイテンシの内訳
  4. ボトルネック分析

    • 特定されたボトルネック
    • 影響の評価
    • 最適化の優先順位
  5. 比較分析(--compare 使用時)

    • パフォーマンスの傾向
    • 改善の指標
    • リグレッションの検出
  6. 推奨事項

    • 優先順位付きの対応項目
    • 期待される改善
    • 実装のガイダンス
使用例
# Generate HTML report with all metrics
npx claude-flow analysis performance-report --format html --include-metrics

# Compare current swarm with previous
npx claude-flow analysis performance-report --compare swarm-123 --format markdown

# Custom output with specific sections
npx claude-flow analysis performance-report \
  --sections summary,metrics,recommendations \
  --output reports$perf-analysis.html \
  --format html

# Weekly performance report
npx claude-flow analysis performance-report \
  --time-range 7d \
  --include-metrics \
  --format markdown \
  --output docs$weekly-performance.md

# JSON format for CI/CD integration
npx claude-flow analysis performance-report \
  --format json \
  --output build$performance.json
Markdown レポートの例
# Performance Analysis Report

## Executive Summary
- **Overall Score**: 87/100
- **Analysis Period**: Last 24 hours
- **Swarms Analyzed**: 3
- **Critical Issues**: 1

## Key Metrics
| Metric | Value | Trend | Target |
|--------|-------|-------|--------|
| Avg Task Time | 42s | ↓ 12% | 35s |
| Agent Utilization | 78% | ↑ 5% | 85% |
| Cache Hit Rate | 91% | → | 90% |
| Parallel Efficiency | 2.3x | ↑ 0.4x | 2.5x |

## Bottleneck Analysis
### Critical
1. **Agent Communication Delay** (Impact: 35%)
   - Coordinator → Coder messages delayed by 2.3s avg
   - **Fix**: Switch to hierarchical topology

### Warnings
1. **Memory Access Pattern** (Impact: 18%)
   - Neural pattern loading: 1.8s per access
   - **Fix**: Enable memory caching

## Recommendations
1. **High Priority**: Switch to hierarchical topology (40% improvement)
2. **Medium Priority**: Enable memory caching (25% improvement)
3. **Low Priority**: Increase agent concurrency to 8 (20% improvement)
4. 最適化の推奨事項
自動修正

--fix を使用すると、次の最適化が適用される場合があります。

1. トポロジーの最適化

  • より効率的なトポロジーに切り替えます(メッシュ → 階層型)
  • 通信パターンを調整します
  • 調整にかかるオーバーヘッドを削減します
  • メッセージルーティングを最適化します

2. キャッシュの強化

  • メモリーキャッシュを有効にします
  • キャッシュ戦略を最適化します
  • よく使われるパターンを事前に読み込みます
  • キャッシュウォーミングを実装します

3. 並行処理の調整

  • エージェント数を調整します
  • 並列実行を最適化します
  • ワークロードの分散を調整します
  • 負荷分散を実装します

4. 優先度の調整

  • タスクキューの順序を変更します
  • 重要な処理経路を優先します
  • 待ち時間を短縮します
  • 公平なスケジューリングを実装します

5. リソースの最適化

  • メモリー使用量を最適化します
  • I/O 操作を削減します
  • API 呼び出しをバッチ処理します
  • コネクションプーリングを実装します
パフォーマンスへの影響

ボトルネックの解消後に期待できる一般的な改善:

  • 通信:メッセージ配信が 30~50%高速化
  • 処理:タスク完了時間が 20~40%短縮
  • メモリー:キャッシュミスが 40~60%減少
  • ネットワーク:API レイテンシが 25~45%短縮
  • 全体:パフォーマンスが合計で 25~45%向上

高度な使用方法

継続的なモニタリング
# Monitor performance in real-time
npx claude-flow swarm monitor --interval 5

# Generate hourly reports
while true; do
  npx claude-flow analysis performance-report \
    --format json \
    --output logs$perf-$(date +%Y%m%d-%H%M).json
  sleep 3600
done
CI/CD との統合
# .github$workflows$performance.yml
name: Performance Analysis
on: [push, pull_request]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - uses: actions$checkout@v2
      - name: Run Performance Analysis
        run: |
          npx claude-flow analysis performance-report \
            --format json \
            --output performance.json
      - name: Check Performance Thresholds
        run: |
          npx claude-flow bottleneck detect \
            --threshold 15 \
            --export bottlenecks.json
      - name: Upload Reports
        uses: actions$upload-artifact@v2
        with:
          name: performance-reports
          path: |
            performance.json
            bottlenecks.json
カスタム分析スクリプト
// scripts$analyze-performance.js
const { exec } = require('child_process');
const fs = require('fs');

async function analyzePerformance() {
  // Run bottleneck detection
  const bottlenecks = await runCommand(
    'npx claude-flow bottleneck detect --format json'
  );

  // Generate performance report
  const report = await runCommand(
    'npx claude-flow analysis performance-report --format json'
  );

  // Analyze results
  const analysis = {
    bottlenecks: JSON.parse(bottlenecks),
    performance: JSON.parse(report),
    timestamp: new Date().toISOString()
  };

  // Save combined analysis
  fs.writeFileSync(
    'analysis$combined-report.json',
    JSON.stringify(analysis, null, 2)
  );

  // Generate alerts if needed
  if (analysis.bottlenecks.critical.length > 0) {
    console.error('CRITICAL: Performance bottlenecks detected!');
    process.exit(1);
  }
}

function runCommand(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, (error, stdout, stderr) => {
      if (error) reject(error);
      else resolve(stdout);
    });
  });
}

analyzePerformance().catch(console.error);

ベストプラクティス

1. 定期的な分析
  • 大幅な変更後にボトルネック検出を実行します
  • 週次のパフォーマンスレポートを生成します
  • 時間の経過に伴う傾向をモニタリングします
  • 自動アラートを設定します
2. しきい値の調整
  • デフォルトのしきい値(20%)から始めます
  • 本番システムでは低めに設定します(10~15%)
  • 開発環境では高めに設定します(25~30%)
  • 要件に応じて調整します
3. 修正の方針
  • --fix を適用する前に、必ず内容を確認します
  • まず開発環境で修正をテストします
  • 修正を段階的に適用します
  • 変更後の影響をモニタリングします
4. レポートの活用
  • ドキュメントに含めます
  • 定期的にチームと共有します
  • 改善を継続的に追跡します
  • キャパシティプランニングに活用します
5. 継続的な最適化
  • 分析のたびに得られた知見を活用します
  • パフォーマンス予算を作成します
  • ベースラインを設定します
  • 改善目標を設定します

トラブルシューティング

よくある問題

メモリー使用量が多い

# Analyze memory bottlenecks
npx claude-flow bottleneck detect --threshold 10

# Check cache performance
npx claude-flow cache manage --action stats

# Review memory metrics
npx claude-flow memory usage

タスクの実行が遅い

# Identify slow tasks
npx claude-flow task status --detailed

# Analyze coordination overhead
npx claude-flow bottleneck detect --time-range 1h

# Check agent utilization
npx claude-flow agent metrics

キャッシュのパフォーマンスが低い

# Analyze cache hit rates
npx claude-flow analysis performance-report --sections metrics

# Review cache strategy
npx claude-flow cache manage --action analyze

# Enable cache warming
npx claude-flow bottleneck detect --fix

他のスキルとの統合

  • swarm-orchestration:パフォーマンスデータを使ってトポロジーを最適化します
  • memory-management:分析結果に基づいてキャッシュ戦略を改善します
  • task-coordination:ボトルネックに基づいてスケジューリングを調整します
  • neural-training:パフォーマンスデータからパターンを学習します

関連コマンド

  • npx claude-flow swarm monitor - リアルタイムモニタリング
  • npx claude-flow token usage - トークン最適化分析
  • npx claude-flow cache manage - キャッシュ最適化
  • npx claude-flow agent metrics - エージェントのパフォーマンス指標
  • npx claude-flow task status - タスク実行分析

関連項目


Version: 1.0.0 Last Updated: 2025-10-19 Maintainer: Claude Flow Team

コメント