Files
tm_app/docs/home-page-api-benchmarks.md
T
AmirReza Jamali 72881df210
continuous-integration/drone/push Build encountered an error
Implement tender workflows and dashboard integration
2026-07-14 11:12:09 +03:30

166 lines
4.2 KiB
Markdown

# Home Page API — Response Time Benchmarks
Measured from the client network (curl) against production.
| Field | Value |
|-------|-------|
| **Date** | 2026-07-07 |
| **Base URL** | `https://app.opplenz.com` |
| **Runs per endpoint** | 10 |
| **Account** | `test@email.com` |
| **Company ID** | `69dbef4e0917c63d28787737` |
All requests returned **HTTP 200** on every run.
---
## Average response time
| # | Endpoint | Method | Avg (ms) | Min (ms) | Max (ms) | Blocks UI? | % of blocking load |
|---|----------|--------|----------|----------|----------|------------|-------------------|
| 1 | `/api/v1/tender-approvals/stats` | GET | **614** | 520 | 793 | Yes | 3.4% |
| 2 | `/api/v1/tender-approvals?limit=10&offset=0` | GET | **16,688** | 16,503 | 17,061 | Yes | **93.6%** |
| 3 | `/api/v1/feedback?feedback_type=like&limit=1&offset=0` | GET | **554** | 506 | 668 | Yes | 3.1% |
| 4 | `/api/v1/notifications?seen=false&limit=1&event_type=PUSH` | GET | **548** | 483 | 642 | No | — |
| 5 | `/api/v1/tenders/recommend?limit=10&offset=0` | GET | **5,716** | 4,010 | 8,361 | No* | — |
\* Call #5 only fires when call #2 returns an empty tender list. It does not block the initial loading spinner, but still adds server load and may update the list shortly after render.
---
## Totals
| Metric | Time |
|--------|------|
| **Sequential blocking total** (calls 1 + 2 + 3) | **~17.9 s** |
| **Slowest single endpoint** | `GET /api/v1/tender-approvals`**16.7 s avg** |
| **Fastest endpoint** | `GET /api/v1/notifications`**0.5 s avg** |
The home page waits on calls 1 → 2 → 3 in series before rendering. **`/api/v1/tender-approvals` accounts for ~94% of that wait.**
---
## Raw timings (seconds)
### 1. Tender approval stats
`GET /api/v1/tender-approvals/stats`
| Run | Time (s) |
|-----|----------|
| 1 | 0.779 |
| 2 | 0.662 |
| 3 | 0.644 |
| 4 | 0.793 |
| 5 | 0.597 |
| 6 | 0.536 |
| 7 | 0.562 |
| 8 | 0.533 |
| 9 | 0.520 |
| 10 | 0.520 |
| **Avg** | **0.614** |
### 2. Your tenders
`GET /api/v1/tender-approvals?limit=10&offset=0`
| Run | Time (s) |
|-----|----------|
| 1 | 16.503 |
| 2 | 16.573 |
| 3 | 16.873 |
| 4 | 16.607 |
| 5 | 17.061 |
| 6 | 16.600 |
| 7 | 16.628 |
| 8 | 16.707 |
| 9 | 16.727 |
| 10 | 16.606 |
| **Avg** | **16.688** |
### 3. Liked tenders count
`GET /api/v1/feedback?feedback_type=like&limit=1&offset=0`
| Run | Time (s) |
|-----|----------|
| 1 | 0.629 |
| 2 | 0.506 |
| 3 | 0.515 |
| 4 | 0.594 |
| 5 | 0.521 |
| 6 | 0.509 |
| 7 | 0.529 |
| 8 | 0.529 |
| 9 | 0.542 |
| 10 | 0.668 |
| **Avg** | **0.554** |
### 4. Unread notifications (background)
`GET /api/v1/notifications?seen=false&limit=1&event_type=PUSH`
| Run | Time (s) |
|-----|----------|
| 1 | 0.566 |
| 2 | 0.540 |
| 3 | 0.486 |
| 4 | 0.607 |
| 5 | 0.541 |
| 6 | 0.498 |
| 7 | 0.614 |
| 8 | 0.642 |
| 9 | 0.506 |
| 10 | 0.483 |
| **Avg** | **0.548** |
### 5. Recommended tenders (conditional)
`GET /api/v1/tenders/recommend?limit=10&offset=0`
| Run | Time (s) |
|-----|----------|
| 1 | 4.364 |
| 2 | 5.880 |
| 3 | 5.402 |
| 4 | 4.010 |
| 5 | 6.512 |
| 6 | 5.827 |
| 7 | 5.584 |
| 8 | 5.653 |
| 9 | 8.361 |
| 10 | 5.575 |
| **Avg** | **5.716** |
---
## Key finding
| Priority | Endpoint | Issue |
|----------|----------|-------|
| **P0** | `GET /api/v1/tender-approvals?limit=10&offset=0` | ~17 s average — dominates home page load |
| P1 | `GET /api/v1/tenders/recommend?limit=10&offset=0` | ~5.7 s average — slow when used as fallback |
| P2 | `GET /api/v1/tender-approvals/stats` | ~0.6 s — acceptable but called on every home visit |
| — | Feedback + notifications | ~0.55 s each — not a bottleneck |
---
## How to reproduce
```bash
TOKEN='<access_token>'
BASE='https://app.opplenz.com'
for url in \
"$BASE/api/v1/tender-approvals/stats" \
"$BASE/api/v1/tender-approvals?limit=10&offset=0" \
"$BASE/api/v1/feedback?feedback_type=like&limit=1&offset=0" \
"$BASE/api/v1/notifications?seen=false&limit=1&event_type=PUSH" \
"$BASE/api/v1/tenders/recommend?limit=10&offset=0"
do
curl -s -o /dev/null -w "%{time_total}s %{http_code} $url\n" \
-H "Authorization: Bearer $TOKEN" "$url"
done
```
---
## Related
See [home-page-api-calls.md](./home-page-api-calls.md) for full call order, parameters, and optimization suggestions.