ASP.NET Web Site Performance Tips
When we develop any web site using any technology then we should look at the performance along with functionality. because once we deploy web site on public host then huge no.of request s may hit the website from different devices with different network configurations hence performance of web site is the primary aspect when you create web site.
Below are some tips which we can adopt in any technology.
Caching
Bundling and minification
Place all scripts at bottom of page right before closing of body tag ().But keep CSS file links in head of element
404 Errors
Check your browser console and fix the bugs displayed.like 404 request not found for some internal resources or other errors.Making an HTTP request and receiving a 404 (Not Found) error is expensive and degrades the user experience. Particularly bad is when the link to an external JavaScript is wrong and the result is a 404. First, this download will block parallel downloads. Next the browser may try to parse the 404-response body as if it were JavaScript code, trying to find something usable in it
Check the network traffic in browser console and see which file is taking long to load.
Database Optimization
Stored Procedures should be efficiently written.Its execution time should be narrow as small as possible.Tables inside DB should be properly indexed.
GZIP Compression
GZIP compression saves 50% to 80% bandwidth and will significantly increase the website's loading speed. Compresses web pages, CSS, and javascript at the server level before sending them over to the browser. You can check ONLINE if your site is already compressed .
There are many sites where you can check this
Google PageSpeeds Insights
PageSpeed Insights analyzes the content of a web page, then generates suggestions to make that page faster.
Website should be well designed.There should not be unnecessary tables.Instead design
When you're hosting your website with a hosting provider or with a cloud provider, you'll get what you pay for. If you're running a quality website , avoid shared hosting. Instead, make sure that your hosting infrastructure is dedicated to your site only.
Below are some tips which we can adopt in any technology.
Caching
If same data is required among multiple users, Caching can be used. Cache stores the data on application server's cache memory. So each time when a request is made the data will come from cache memory than Database.Example, On a particular page load you want a grid of multiple records to be loaded and data to display is same for all the users.In such scenario you can place the data in cache memory. It will boost the performance to a certain height.
Make Static files as external
Make JavaScript and CSS external i.e create separate files and give those file path references in the page.Make internal only if they are too small.
Bundling and minification
It will club all the script and css files into bundles.
Example : if there are 5 JS files referred in a page, if you create a single bundle server will hit once instead of 5 times to get these files.Same is the case with CSS. Besides it will minify your files, meaning will remove unnecessary spaces and line breaks.
If not using Bundling, atleast go for minification on production.You can minify your files online.There are lots of online converters for the same.
Compressed images
Use compressed images and make use of Image Sprites, which allow you to combine several images into one. From there, you can use CSS to extract the portion of the combined image to render .It will also reduce HTTP request count.
Place all scripts at bottom of page right before closing of body tag ().But keep CSS file links in head of element
If you are using some scripts from some CDN, then use their online path instead of downloading to local and placing in your project. The reason behind this is, most of the time our browsers have already visited the sites that are referencing to such scripts and they are already cached in our browser.
Async
Make use of this keyword for those JS files that you can allow to download in background.
Example:
Example:
<script async src="myfile.js" />
404 Errors
Check your browser console and fix the bugs displayed.like 404 request not found for some internal resources or other errors.Making an HTTP request and receiving a 404 (Not Found) error is expensive and degrades the user experience. Particularly bad is when the link to an external JavaScript is wrong and the result is a 404. First, this download will block parallel downloads. Next the browser may try to parse the 404-response body as if it were JavaScript code, trying to find something usable in it
Check the network traffic in browser console and see which file is taking long to load.
Database Optimization
Stored Procedures should be efficiently written.Its execution time should be narrow as small as possible.Tables inside DB should be properly indexed.
GZIP Compression
GZIP compression saves 50% to 80% bandwidth and will significantly increase the website's loading speed. Compresses web pages, CSS, and javascript at the server level before sending them over to the browser. You can check ONLINE if your site is already compressed .
There are many sites where you can check this
Google PageSpeeds Insights
PageSpeed Insights analyzes the content of a web page, then generates suggestions to make that page faster.
Website should be well designed.There should not be unnecessary tables.Instead design
When you're hosting your website with a hosting provider or with a cloud provider, you'll get what you pay for. If you're running a quality website , avoid shared hosting. Instead, make sure that your hosting infrastructure is dedicated to your site only.
Comments
Post a Comment