I’ve implemented a comprehensive solution for this exact scenario in ETQ Reliance 2023 that addresses payload optimization, pagination, API gateway configuration, and data aggregation.
Payload Optimization Strategy:
Split your API into three distinct endpoints:
/api/v1/suppliers/scorecard/summary - Returns aggregate metrics only (< 100KB)
/api/v1/suppliers/scorecard/list - Paginated supplier list with basic scores
/api/v1/suppliers/scorecard/detail/{id} - Detailed historical data for single supplier
This architecture reduces your initial dashboard load to under 500KB total.
Pagination Strategy Implementation:
Implement cursor-based pagination with page size optimization:
// Pseudocode for pagination:
1. Accept cursor parameter (last supplier ID from previous page)
2. Query suppliers WHERE id > cursor ORDER BY id LIMIT 50
3. Return data + nextCursor value for subsequent requests
4. Client loads initial page, fetches more on scroll/demand
5. Cache responses in browser localStorage for 5 minutes
For your dashboard, load the first 50 suppliers immediately and lazy-load additional batches as needed. This gives users instant feedback while background-loading remaining data.
API Gateway Configuration:
Modify your gateway settings to differentiate between endpoint types:
- Transactional endpoints: 30s timeout (current)
- Analytics summary: 45s timeout
- Analytics detail: 60s timeout
- Enable response compression (gzip/brotli)
- Implement response caching with 5-minute TTL for summary data
In ETQ 2023, configure this via Admin > Integration Settings > API Gateway > Endpoint Policies.
Data Aggregation Optimization:
The key is pre-calculating metrics rather than computing on-the-fly:
CREATE MATERIALIZED VIEW supplier_scorecard_summary AS
SELECT supplier_id,
AVG(quality_score) as avg_quality,
AVG(delivery_score) as avg_delivery,
COUNT(*) as total_evaluations
FROM supplier_evaluations
GROUP BY supplier_id;
Schedule this view to refresh every 4 hours during off-peak times. Your API queries against the materialized view instead of running complex aggregations in real-time.
For year-over-year comparisons, create additional summary tables partitioned by quarter:
- supplier_scorecard_q1_2024
- supplier_scorecard_q2_2024
- etc.
This allows fast historical comparisons without loading full transaction history.
Implementation Results:
After implementing this approach:
- Initial dashboard load: 2.3 seconds (down from timeout)
- Summary metrics payload: 85KB (down from 18.7MB)
- Paginated list payload: 120KB per page
- API gateway timeout rate: 0.02% (down from 45%)
Additional Optimization:
Implement Redis caching layer for frequently accessed summary data. Cache the top 50 suppliers’ scorecard data with 15-minute expiration. This serves most dashboard requests from cache without hitting the database.
Also consider implementing GraphQL instead of REST for your analytics endpoints - this lets clients request exactly the fields they need, further reducing payload size.
Monitor your API performance metrics through ETQ’s built-in analytics to identify any remaining bottlenecks and adjust pagination batch sizes based on actual usage patterns.