asp.net-mvcperformanceasp.net-web-apiconnectionasp.net-webpages

Is using a Web API as dataprovider for a website efficient?


I was thinking about setting up a project with Web API. Basically build the API first and program the web site using this API.

Although it's sound promising I was wondering: If I separate the logic in a nice way, I might end up retrieving data on a web-page through multiple API call's, which in turn are multiple connections with the server with all the overhead etc..

For example, if I use, let's say 8 different API call's on one page, I can't imagine it won't have an impact on the web-page's performance.

So, have I misunderstood something? Or is this kind of overhead negligible - or does the need for multiple call's indicates that the design is wrong?

Thanks in advance.


Solution

  • One aspect is that you can display the page to the end user very very fast . Once the page is loaded, use Jquery async calls and any Javscript template tool (like angularjs or mustacheJs) to call the web api simultaneously to build the client page views.

    I have used this approach in multiple project and experience of the user is tremendous.