MVC Architecture – Server Side vs Client Side: Which Reduces Server Load?

angularjsapiasp.net-mvcmvc

Which is the best approach when developing a dynamic web app with multiple views and dynamic content. regarding server load and responce times:

  1. use a server side mvc (such as Sailsjs or ASP.NET MVC) to render and then display views or
  2. use an api to get data from the server and a client side MVC (such as angular) to render the views

Which approach imposes less load on the server?

Best Answer

Disclaimer: There are so many other factors in play that your decision on which approach to use should probably not be made solely on this evaluation. Consider team skill sets, long-term maintainability, features needed versus features provided by various frameworks, which client platforms/devices you need to support, and so on. However, from a purely academic standpoint...

  • Server-side MVC: Server handles data access + building HTML

  • Client-side MVC: Server handles data access + serializing DTOs

So at first glance, it seems to be a simple matter of which is more resource-intensive, building HTML or serializing DTOs? If building HTML is less taxing than serializing DTOs, then go with server-side MVC. If not, then go with client-side MVC.

But one other factor to keep in mind is the raw number of HTTP requests hitting your server. With server-side MVC, this is likely to be relatively low (typically 1 request per "page"). But with client-side MVC, depending on how you set up your web services API, you could have any number of HTTP requests hitting your server for each "page" in the app. An extremely chatty approach could cause far more server resource utilization from HTTP request processing overhead than from the actual work of either building HTML or serializing DTOs.