akash-network / akash-network/console

perf(api): high loop utilization on multiple endpoints (clinic event-loop category)

Open
#2,592 1 comment 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

Clinic doctor flagged 7 endpoints with loopUtilization=performance, categorizing them as event-loop bottlenecked. High loop utilization (>90%) means the event loop is saturated and has little headroom for additional work.

Affected Endpoints

Endpoint Loop Util avg Loop Util max Delay avg Category
/v1/gpu 90% 97% 2.39ms event-loop
/v1/graph-data/compute 92% 98% 0.17ms event-loop
/v1/templates-list 91% 98% 2.97ms event-loop
/v1/blocks/1 91% 97% 0.21ms event-loop
/v1/transactions 90% 97% 0.22ms event-loop
/v1/providers/akash1example 91% 98% 0.23ms event-loop
/v1/provider-dashboard/akash1example 91% 100% 0.88ms event-loop

Analysis

While event loop delay is low for these endpoints, the loop utilization is near 100%. This means:

  • The server has no spare capacity during sustained load
  • Any additional CPU work (other requests, timers, garbage collection) will immediately cause delays
  • Under production traffic with mixed endpoints, these will degrade faster than profiled in isolation

Suggested investigation

  • These endpoints likely do synchronous JSON serialization or computation that keeps the loop busy
  • Consider response caching at the HTTP layer (ETag/304) to avoid re-serialization
  • For /v1/graph-data/compute, check if the map/filter/reduce chains can be pre-computed
  • For /v1/templates-list, check JSON.parse/stringify overhead

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 profiling the seven listed API endpoints, especially /v1/graph-data/compute and /v1/templates-list, under sustained load. Check synchronous serialization, JSON.parse/stringify overhead, and the map/filter/reduce work described in the investigation notes. Done means the event-loop audit shows reduced utilization and the endpoints retain their expected behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.