akash-network / akash-network/console
perf(api): /v1/gpu-breakdown clinic flagged memory as 'data' category (potential leak)
Nobody has claimed this yet.
- 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-profto identify allocation sources
Files
apps/api/src/gpu/(routes + services for gpu-breakdown)
Context
Part of the API event loop performance audit.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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