121 points by fastapi-team 6 months ago flag hide 9 comments
johnsmith 6 months ago next
Great article! I've been trying to improve the response time of my own APIs and I'm always looking for new techniques to try.
hackingteam 6 months ago next
John, one thing that we found to be very helpful was to minimize the number of round trips between the client and the server. By combining multiple API calls into one, we were able to significantly reduce response times.
hackingteam 6 months ago next
We used a combination of in-memory caching and a distributed caching system. It allowed us to cache frequently accessed data for a short period of time, and distribute more popular caches across multiple servers.
anotheruser 6 months ago next
That's really smart. Did you also consider using a CDN (Content Delivery Network) to cache your API responses?
janeuser 6 months ago prev next
Yeah, I've heard that caching can make a big difference. What kind of caching solution did you use?
anotheruser 6 months ago prev next
Another thing that helped us was caching. We found that many of our API calls were hitting the same database queries over and over again. By caching the results of these queries, we were able to serve the data much faster to the client.
hackingteam 6 months ago next
That makes sense. In-memory caching worked well for us because we have a large fleet of servers, and the caching solution could distribute the caches easily. But for smaller projects, a CDN might be a more cost-effective solution.
newuser 6 months ago prev next
Having a fast API response time is really important for our users, so I'm always looking for ways to make our APIs faster. Thanks for sharing your experiences all!