Skip to content

feat: Carrier thread analysis and utilization metrics #11

@rlaope

Description

@rlaope

Problem

Virtual threads run on carrier (platform) threads, but Argus currently doesn't provide visibility into:

  • Which carrier threads are being used
  • Carrier thread utilization rates
  • How virtual threads are distributed across carriers
  • Potential carrier thread bottlenecks

Proposed Solution

Add carrier thread analysis features:

  1. Track carrier thread assignments from JFR events
  2. Calculate utilization per carrier thread
  3. Show distribution of virtual threads across carriers
  4. Alert when carrier pool is saturated

Acceptance Criteria

  • Extract carrier thread info from JFR events
  • Track active virtual threads per carrier
  • Calculate carrier utilization (busy time / total time)
  • Add /carrier-threads API endpoint
  • Add carrier analysis section to dashboard
  • Show carrier thread count vs virtual thread count ratio
  • Visualize carrier utilization as a heatmap

Technical Considerations

  • Carrier thread ID available in jdk.VirtualThreadStart event
  • Need to correlate START and END events to calculate duration
  • Consider ForkJoinPool default carrier pool behavior
  • Track context switches between virtual threads on same carrier

API Design

GET /carrier-threads

{
  "carrierThreadCount": 8,
  "virtualThreadCount": 1523,
  "ratio": 190.4,
  "carriers": [
    {
      "carrierId": 1,
      "name": "ForkJoinPool-1-worker-1",
      "currentVirtualThreads": 3,
      "totalVirtualThreadsHandled": 245,
      "utilizationPercent": 78.5,
      "avgVirtualThreadDuration": 12.5
    }
  ]
}

UI Mockup

┌─────────────────────────────────────────────────────────────┐
│ Carrier Thread Analysis                                     │
├─────────────────────────────────────────────────────────────┤
│ Carrier Threads: 8    Virtual Threads: 1,523    Ratio: 190x │
├─────────────────────────────────────────────────────────────┤
│ Carrier Utilization Heatmap                                 │
│                                                             │
│ FJP-1-worker-1  ████████████████████░░░░░  78%             │
│ FJP-1-worker-2  ██████████████████████████  92%             │
│ FJP-1-worker-3  ████████████░░░░░░░░░░░░░  45%             │
│ FJP-1-worker-4  ██████████████████████░░░  85%             │
│ ...                                                         │
└─────────────────────────────────────────────────────────────┘

Metrics to Track

  • Virtual threads per carrier (current, max, avg)
  • Carrier busy time percentage
  • Context switch rate
  • Queue depth per carrier (if accessible)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions