I'm developing a project for a client with around 300 to 400 daily active users. Currently, my frontend is making about 12 to 15 API calls per page. While everything functions well, I'm unsure if this is a standard number, excessive, or perfectly fine. I want to avoid premature optimization but don't want to release something inefficient. What would be an acceptable number of API calls from the frontend to the backend for an average page? Are there any benchmarks or best practices I should consider?
7 Answers
The purpose of the API calls often matters more than the number itself. If they are all basic CRUD operations and not too resource-intensive, you’re likely fine.
Just check out any major website using developer tools. You'll find that 12-15 API calls is really a small number. Bigger sites make many more calls than that!
Tree Fiddy.
Are the API calls made simultaneously on every page? How many pages does an average user visit per session? Any caching involved? Many social media sites manage a lot of requests, especially after the first visit, with a caching layer like GraphQL to help.
Yeah, the calls happen on every page. Most users are logged in and using the site continuously. I have some caching for a few endpoints, but it's mostly plain REST right now.
It's tough to say without specifics. Are you including resource calls, like images, in those numbers? Also, how your page handles the calls — do they block each other, or is your page setup to load parts of it lazily? That's a big factor.
No resource calls, all 12-15 requests are to my own API server. Most of them are independent, so they can be done in parallel, but right now, I haven't optimized anything yet.
There's no magic number of requests that fits everyone. The key is performance. As long as your site loads quickly and your server scales well, your current number of requests is likely okay. But keep an eye on performance, especially on mobile networks where slower speeds can become an issue.
That makes sense! Currently, both the site and server are running smoothly, which is good. I'll definitely monitor performance as the user base grows.
You could consolidate some of the API calls on the backend. Consider creating page-specific routes and optimizing your database queries for those. This way, you maintain the benefits of individual calls while blending them for certain pages.

All of the calls are basic CRUD, nothing too heavy!