A recent article on C# Corner brought attention to the performance issues due to legacy hardware that were causing the site not to scale well to meet its growing demand. Since then, they have upgraded their server infrastructure to maintain a good time to first byte, but like most of their performance issues extend well beyond that point.
In this video, I used WebPageTest to test the C# Corner's web performance. I go over a few JavaScript performance tips and explain how excess JavaScript affects your page's loading profile.
I ran two WebPageTest runs - one from Northern Virginia and another from Mumbai, India.
Performance Improvement Opportunities
Some obvious areas they should address are - optimizing images, utilizing a Content Delivery Network, and applying proper Cache-Control headers to static assets.
But the biggest factor affecting their page load times is excessive JavaScript. Recently, they have more than doubled their use of JavaScript, exceeding 360 kb compressed. They can eliminate the most of the script used to run the page. However, they lean heavily on third-party scripts, which are causing more issues than anything else.
Third Party Script Issues
Some of the third party scripts caused excessive delays in Mumbai. One way they could counteract that issue is to host the scripts themselves, avoiding potential latency from the third party servers. In the first Mumbai run, three of these scripts took over 700 seconds to load.
Analyzing where JavaScript would be used, I determined they could implement the same functionality with roughly a 100 lines of JavaScript, not 100kb. This is a common flaw I see propagated around the web, that being you must use a large library or framework and the plugin ecosystem to perform simple, routine tasks.
Optimize Images
The site has many images used for ads that should be optimized. This would reduce their file size by 1/3 to 2/3 their current size. Not only will this improve the load performance, it will also reduce the hosting costs. The site serves multiple million pageloads, with multiple unoptimized images. Amortizing the cost to serve these images across all the page views adds up quickly.
They should also create responsive image arrays of images so that the mobile phones don't load large image dimensions. This ensures that the images are properly scaled for the device as well as reduces the network requirements.
Improving Time to First Byte with a Static Site
As for their time to first byte, the site is achieving a quarter second profile in Virginia, but over half a second in Mumbai. To solve the Mumbai time, they could use a CDN with a location near India.
They should also upgrade to HTTPS using HTTP/2, something any reputable CDN provider will offer as a standard service.
While their new hardware is scaling well, adding more iron to your server is not the proper strategy today. Instead, utilize a static website infrastructure by using a tool like Varnish to hit the rendering server, and storing the HTML on a static web server.
Summary
Even though C# Corner has a good page load time compared to most sites today, they could do some work to significantly improve their load times around the world and on any data connection.