HAR analysis: Asset insights page
Source: asset-insights.har — opening Asset insights from the control room.
Context: Asset insights opens in a new tab. Each open is a fresh page load with no shared state from the control room tab (no store, no cache).
Flow: User opens the Asset insights page in a new tab. The page loads view configs for each asset type (map view + table view), events summary, and preferences. All data must be fetched from scratch.
API calls (observed — initial open)
| API | Count | Notes |
|---|---|---|
GET /asset-types/{id}/views/map?merged=true |
14× | One per asset type |
GET /asset-types/{id}/views/table?merged=true |
14× | One per asset type |
GET /controlrooms/{id}/events/summary |
1× | |
POST /me/preferences |
1× |
N+1-style pattern
- 28 calls in ~170ms: for each of 14 asset types, the page fetches 2 view configs (map + table). That is 14 × 2 = 28 sequential or parallel requests.
- No duplicate identical requests, but the pattern is inefficient: many small calls instead of batched data.
- New-tab implication: Cross-tab store/cache cannot help; every open triggers the full 28 calls. Batching is the primary lever.
Suggested fix
- Backend (primary): Batch endpoint returning map+table views for multiple asset types (or all) in one or two calls. This is the main fix, since the new tab has no shared state.
- Frontend: Cache view configs within the Asset insights tab (e.g. when switching asset-type filters) to avoid re-fetch on tab-internal navigation. Does not help on initial open or cross-tab.
Estimated impact (open)
- Before: 28 asset-type view calls on every new-tab open.
- After batch (backend): 1–2 calls — ~93% reduction for asset-type views. This is the main improvement.
Asset insights refresh (asset-insights-refresh.har)
Flow: User refreshes the Asset insights page (same tab). Full page reload: control room shell + asset insights + selected asset metrics, etc.
| API | Count | Notes |
|---|---|---|
GET /controlrooms/{id}/asset-types/{id} |
14× | N+1: one per asset type |
GET /asset-types/{id}/views/map + views/table |
28× | 14 types × 2 (same N+1 as open) |
GET /assets/{id}/location |
2× | Same params |
GET /assets/{id}/metrics/speed |
3× | Same params |
GET /assets/{id}/metrics/fuelPercent |
3× | Same params |
GET /assets/{id}/metrics/inTrip |
3× | Same params |
POST /cycles/search |
2× | One 1.8 s; one 194ms |
POST /events/search?size=250&page=0 |
2× | One 1.8 s; one 37ms |
POST /asset-types/{id}/assets/aggregation |
2× | One 1.8 s; one 298ms |
GET /controlrooms/{id} |
3× | |
GET /controlrooms?size=100 |
3× | |
GET /controlrooms/{id}/collaborators |
2× | |
GET /controlrooms/{id}/config |
2× | |
POST /cycles/summary |
2× | Within 3ms |
GET /me/preferences?namespace=control-room-... |
2× |
Duplicates: Multiple components or effects trigger the same fetches (CR, config, control rooms, collaborators, cycles/search, events/search, asset aggregation, asset metrics 2–3× each, preferences). Same store-consolidation and batch fixes apply. Refresh = full reload, so no cache.
Slow calls: cycles/search 1.8s, events/search 1.8s, asset-types/…/aggregation 1.8s — all duplicated.