how to improve performance of ASP.NET MVC application?

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

Thank you

Asked by:- jaiprakash
: 4378 At:- 6/16/2017 1:36:54 PM MVC IIS performance

1 Answers
profileImage Answered by:- vikas_jk

There are several ways to improve the performance of your 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

    Cache not-prone-to-change content using OutputCacheAttribute to save unnecessary and action executions. You can take a look here at complete article:
  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
    //Add Razor Engine (which we are using)
    ViewEngines.Engines.Add(new RazorViewEngine());?
  6. Add gzip (HTTP compression) and static cache in your web.config 
    <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/> 
  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.
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
Register directly by posting answer/details

Full Name *

Email *

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

Subscribe Now

Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly