Performance Optimization
Optimize API Mapper for maximum performance
Performance Optimization
Learn how to make your API integrations as fast as possible.
Performance Checklist
Quick wins for better performance:
- Enable caching for all connections
- Set appropriate cache durations
- Limit data with query parameters
- Map only needed fields
- Use pagination for large datasets
- Compress images at source
Optimize API Requests
Fetch Only What You Need
Instead of:
Use:
Use Efficient Endpoints
Some APIs have optimized endpoints:
| Less Efficient | More Efficient |
|---|---|
/products then filter client-side | /products?featured=true |
Multiple calls to /product/1, /product/2 | Single call to /products?include=1,2 |
/posts then /media/123 for images | /posts?_embed=true (includes media) |
Minimize Requests Per Page
Each API call adds latency. Reduce calls by:
- Combining data in one request (use
_embed,include, etc.) - Caching aggressively
- Using efficient endpoints
Caching Strategy
Set Appropriate Durations
| Content | Cache Duration | Why |
|---|---|---|
| Product catalog | 1-4 hours | Balance freshness and speed |
| Blog posts | 1 hour | Content changes are planned |
| Weather | 30 minutes | Updates regularly |
| Static data | 24+ hours | Rarely changes |
Multi-Layer Caching
Optimize all cache layers:
- API Mapper → Caches raw API response
- YOOtheme → Caches rendered elements
- Page Cache → Caches full HTML
- CDN → Caches at edge locations
WordPress
Recommended stack:
- API Mapper caching (built-in)
- WP Rocket or W3 Total Cache
- Cloudflare CDN
Optimize Field Mappings
Map Only Needed Fields
Don't map the entire API response. Choose only fields you'll use:
Avoid Deep Nesting
Deeply nested paths are slower to parse:
If the API returns deeply nested data, consider:
- Using JMESPath to flatten the structure
- Contacting the API provider about simpler endpoints
Optimize for YOOtheme
Use Grid Instead of Multiple Elements
Instead of:
Use:
Lazy Load Below-the-Fold Content
For API content below the initial viewport:
- Use YOOtheme's lazy load options
- Consider separate sections with independent caching
Monitor Performance
Measure API Response Times
Test your connections and note response times:
- Under 200ms = Excellent
- 200-500ms = Good
- 500-1000ms = Acceptable
- Over 1000ms = Needs optimization
Check Page Load Impact
Use tools to measure overall impact:
- Browser DevTools → Network tab
- Google PageSpeed Insights
- GTmetrix
- WebPageTest
Track API Usage
Monitor your API calls:
- Many API providers have usage dashboards
- Watch for unexpected spikes
- Ensure you're within rate limits
Troubleshooting Slow Performance
Connection is Slow
- Test the API directly - Is the source slow?
- Check your server - Is outgoing request slow?
- Enable caching - Serve from cache instead
- Reduce data - Fetch less per request
Page Loads Slowly
- Check cache status - Is cache working?
- Count API calls - Too many per page?
- Check other factors - Images? JavaScript? Database?
Cache Not Working
WordPress
- Verify cache is enabled in API Mapper
- Check cache duration isn't set to 0
- Clear all caches and test
- Check for plugin conflicts
Advanced Optimization
Preload Critical Data
For above-the-fold content:
- Ensure cache is warm before traffic
- Consider lower cache duration for critical content
- Use CDN for static content
Optimize Images
If API returns images:
- Use CDN for image delivery
- Implement lazy loading
- Consider responsive images
- Compress images at source if possible
Consider API Alternatives
If performance is critical:
- Look for faster API providers
- Consider self-hosting critical data
- Use database caching for frequently accessed data
Was this page helpful?