When it comes to measuring the performance of one platform against another, you can often start a religious war. Some of this is caused by the fact that performance means different things to different people or depending on the tooling, you can get results that promote falsehoods. There are many definitions of web application performance. Every organization should have a documented stance on what performance means to them. Mozilla publishes its opinion, and Google has its own as well. You can see similarities and differences even between these two powerhouses, and that’s just one example.
Knowing Your Audience
One of the most critical factors, in my opinion, when it comes to performance analysis is understanding your audience. By knowing your audience, you can start to create an outline of what a well-performing website might look like to them; items to consider include.
- The user’s connection speed
- The users’ connection reliability
- The type of device utilized (Desktop/Tablet/Mobile)
- The frequency of application access
- The duration of application interaction
By knowing simple metrics, we can better look at the performance wins & losses for a particular platform.
For this article, I wanted to share some insight from a recent deep-dive that I completed comparing the performance and feasibility of ASP.NET Core MVC vs. Blazor WASM. The client scenario had the following key audience attributes.
- A large percentage of the users can be on slow DSL or Cellular connections
- Connectivity can drop off temporarily due to poor wifi/cellular coverage
- Initial page load time is a concern that users have reported in the past with older technology
- The application will grow very large over time, with thousands of pages being created
Our Testing Strategy
We created two similar applications with the above criteria in mind, one with MVC and the other with Blazor. Each application used similar UI structures and a minimal set of application features that would mimic standard user interaction with the application. We would then focus on the single-user performance of each of these applications looking specifically at the following behaviors:
- The total number of HTTP requests needed to complete a common task
- The total amount of data transmitted over the internet to accomplish the task
- The total time spent waiting for processing using two network connections; high-speed (100mbps+), low-speed DSL (5mbps/1mbps).
All tests were completed from production environments with compression enabled, and we followed all Microsoft published best practice documentation to minimize payloads.
We quickly saw the differences when comparing the two technologies; the table below shows a few key metrics from our testing.
|Platform||# Request||KB Transferred||MB Resources||Total Time (Fast Connection)|
|Advantage WASM (33%)||Advantage MVC (90%)||Advantage MVC (73.7%)||Advantage MVC (40.1%)|
As you can see, the downloaded payload size was more than 400% greater when comparing Blazor WASM to that of MVC. However, it is essential to understand that although these numbers look incredibly poor, they are not necessarily 100% telling. Our test scenario only involved ten interactions with the application; over time, the overhead of the initial application download and the relative performance of Blazor would even out and slightly reduce the gap.
I share this story not as a knock on Blazor but as a reminder to all developers of the importance of audience and tool selection. Blazor is excellent, and the end-user experience is pleasant; however, there are limitations on performance that MAY impact your organization. For our project, it did, and we will continue to monitor the great strides that not only come to benefit the Blazor community but all other technology frameworks out there. Your mileage may vary, and I look forward to the next project where Blazor WASM might be an option!
This blog is part of Azure Week. Find more great Azure content here.
About the Author:
Mitchel Sellers is the Founder, CEO, and Director of Development for IowaComputerGurus (ICG) and serves as one of its core technical contributors. He has personally managed hundreds of successful website and application projects, served as an adjunct technology professor at Iowa colleges, and become a published author – writing and contributing to numerous articles and three industry-standard programming texts.
Sellers, M. (2022). MVC vs Blazor WASM: A Different Look At Performance. Available at: https://mitchelsellers.com/blog/article/mvc-vs-blazor-wasm-a-different-look-at-performance [Accessed: 12th July 2022].