mcpField
P
performance-analysis

performance-analysis

github.com/proffesor-for-testingエージェントワークフロー51940 回インストール今日更新
リポジトリ

performance-analysis について

performance-analysisは、Claude Flowのswarm性能を調べるSkillです。通信、処理、メモリ、ネットワークのボトルネックを検出し、レポートと最適化案を作成します。実行状況の監視や構成調整を行うチーム向けです。

主な機能

  1. 01複数種類のボトルネック検出
  2. 02リアルタイムおよび履歴分析
  3. 03複数形式の性能レポート
  4. 04最適化案と自動修正
  5. 05期間とswarmを指定した分析

活用シーン

  1. 01エージェント間の通信遅延の調査
  2. 02タスク実行とリソース利用率の分析
  3. 03swarm性能の経時比較
  4. 04CI/CD性能レポートの作成

MCP 対応

Claude FlowのMCPツールからボトルネックを検出し、分析結果付きのタスク結果を取得できます。

インストール

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

$npx skills add https://github.com/proffesor-for-testing/agentic-qe --skill performance-analysis

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

同梱ファイル

SKILL.md と一緒にインストールされる参考資料やスクリプト。

evals/
performance-analysis.yaml
schemas/
output.json
scripts/
validate-config.json

詳細

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

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

概要

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

  • ボトルネック検出:通信、処理、メモリ、ネットワーク全体のパフォーマンスボトルネックを特定します
  • パフォーマンスプロファイリング:スウォーム操作をリアルタイムで監視し、履歴を分析します
  • レポート生成:複数の形式で包括的なパフォーマンスレポートを作成します
  • 最適化の推奨: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 - タスク実行分析

関連項目


バージョン:1.0.0 最終更新日:2025-10-19 メンテナー:Claude Flow Team

コメント