This is the most common question from ASP.NET forum to any interview. In this post I’m going to point out some of the important points that may help to improve the performance.
Here I used the word “improve performance” in the sense to decrease the loading time of the page. There are various reasons behind. Some of them we look into from the “backend side” (Database side) and rest of them we need to take care in “front-end” ((UI) side.
For illustrative purpose, you have an ASP.NET Web site, one of the aspx page take much time to load. Through out this article, we are going to see how to decrease the loading time.
Back End (DB)
- Try to check the Query performance, that is how much time the query will take to execute and pull the records from DB. The Use SQL Server Profiler and Execution plan for that query. So that you can come to the conclusion in which part it took much time.
- Check in every table (who are all part of the query) Index is created properly.
- If your query involves a complex Stored procedure, which in turn use lot of joins, then you should focus on every table. In some cases, sub-query perform better than the joins.
- If your web page involves paging concepts, try to move the paging concepts to SQL Server. I meant that based on the page count the SP will return the records, instead of bringing the records as a whole.
Front End (UI)
- If your page displays a lot of records, try to introduce “paging”. For example, your page displays 1000 records in a page. Instead of pulling 1000 records as a whole, by introducing paging such that page size as 10, you need to pull 10 records only!
- Try to choose “tabless” design, that is try to avoid “table” to design the webpage. In order to achieve this use should use “div” tag.
- If you want to design responsive pages, try to use existing (proved) frameworks such as Bootstrap, instead of trying your own code.
- Also if your webpage deals with lot of images or videos to display, then consider to use appropriate CDN (Content Delivery Network).
- Use bundling and minification techniques, which reduce the server calls to load the javascript and CSS files, which in turn reduce the loading time.
Hope this helps to improve the performance at some extend.
Readers!! Do you think that I have missed out anything? Let me know your thoughts in comments!