how to improve performance of ASP.NET MVC application?


I would like to know methods to improve performance of asp.net MVC web application? To get better score on Google Page Insights

Thank you


Asked by:- jaiprakash
1
: 4275 At:- 6/16/2017 1:36:54 PM
asp.net MVC IIS performance







1 Answers
profileImage Answered by:- vikas_jk

There are several ways to improve the performance of your asp.net MVC web-application:

  1. Caching:
    You should use caching for the images/scripts/CSS etc which will help you improve Page insight score, this is also said by Google, check https://qawithexperts.com/article/asp.net/how-to-enable-caching-in-iis/24

    Cache not-prone-to-change content using OutputCacheAttribute to save unnecessary and action executions. You can take a look here at complete article:
    https://qawithexperts.com/article/asp.net/outputcache-in-aspnet-mvc-caching-in-mvc/95
  2. Use of Tools to check optimization Issues like
    YSlow: To get front end issue
    DotTrace: To check back discover memory leaks and performance problems in your application
  3. Use IQueryable Instead of List
  4. Check NHibernate second level cache
  5. Remove extra View Engines:
    Add following code in your Global.asax Application_start to remove extra View engines if you are using only (.cshtml pages)
    // Removing all the view engines
    ViewEngines.Engines.Clear();
    
    //Add Razor Engine (which we are using)
    ViewEngines.Engines.Add(new RazorViewEngine());?
  6. Add gzip (HTTP compression) and static cache in your web.config 
    <system.webServer> 
    <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/> 
    </system.webServer>?
  7. Bundle and Minify JS/CSS, you can take a look at how to do bundling and minification in MVC.
  8. Try to load partial view's using Ajax, so that page loading takes small loading time.
  9. Use Asynchronous Controllers to implement actions that depend on external resources processing.
  10. Use stored procedures whenever possible.
  11. Cookie Size should be small, as cookies are sent on each request to server.
  12. Remove unused HTTP Modules.
  13. Load your CSS first.
  14. Load Javascript at the end, as these interfere in loading pages quickly.
  15. Compress Images, before uploading on server, or if possible upload images on CDN link Cloudinary or Amazon S3 Storage for faster access.
  16. Lazy Load Images : Basically it will not load image from server, until user doesn't scroll to image area.
  17. Minimize database hits.
  18. If possible avaoid using Libraries like jQuery.
2
At:- 6/16/2017 4:11:14 PM Updated at:- 6/16/2017 4:13:44 PM
good answer, I will try all these optimizations methods 0
By : jaiprakash - at :- 6/18/2017 6:25:33 AM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use