akash-network / akash-network/console

perf(api): /v1/gpu-breakdown clinic flagged memory as 'data' category (potential leak)

Open
#2,591 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance tech-debt
Dominant language
TypeScript
Stars
264
Forks
94
Avg merge
18h 49m
Merged PRs (30d)
297

Description

Problem

GET /v1/gpu-breakdown was flagged by clinic doctor with the data category, which indicates a potential memory leak or unusual memory allocation pattern. Clinic specifically flagged heapTotal and heapUsed as data issues.

Clinic Doctor Results

  • Event loop delay: avg 0.95ms (low)
  • CPU: avg 0.02% (very low — endpoint barely processes)
  • Throughput: 0 req/s effective (only 20 requests completed in 10s)
  • RSS: 335MB (low)
  • Clinic category: data — indicates abnormal memory behavior
  • Clinic flags: cpu=performance, memory.heapTotal=data, memory.heapUsed=data

Analysis

The data category from clinic is unusual and suggests the endpoint's memory usage pattern doesn't follow normal request/response cycles. The very low throughput (20 requests in 10s) combined with data memory flags could mean:

  • Memory is allocated but not freed between requests
  • The endpoint triggers a large one-time computation that isn't properly garbage collected
  • Cache warming creates a large allocation spike

Suggested investigation

  • Review the GPU breakdown service for memory allocation patterns
  • Check if large intermediate data structures are created and retained
  • Profile with --heap-prof to identify allocation sources

Files

  • apps/api/src/gpu/ (routes + services for gpu-breakdown)

Context

Part of the API event loop performance audit.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the routes and services under apps/api/src/gpu/ for the /v1/gpu-breakdown endpoint. Run the suggested Clinic profiling with --heap-prof and inspect heapTotal and heapUsed allocation sources. Done means identifying and addressing the abnormal memory behavior, then confirming the endpoint no longer produces the flagged pattern.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.