Preparing your workspace
API performance improves when expensive work is reduced, repeated results are reused appropriately, and data access is designed efficiently.
API performance depends on many layers: network time, application logic, database queries, serialization, and external services. Caching can reduce repeated expensive work when the data can safely be reused for a period of time. APIs should return only needed fields, paginate large collections, use efficient database indexes, and avoid unnecessary external requests. Performance problems should be measured with logs, metrics, traces, and profiling rather than guessed from code appearance.
A public course catalog can cache frequently requested published course lists while user-specific progress data remains dynamically loaded.
Cache-Control: public, max-age=60 GET /api/courses?published=true
The response tells compatible clients and caching layers that the result may be reused for a limited period.