Tips and Tricks for Faster ASP.NET and MVC Applications
http://www.slideshare.net/SarveshKushwaha/tips-and-tricks-for-aspnet
Summary of this,
Design and Architecture play a major role before you start thinking about performance, if it is started with a sound design and architecture in focus with best practices which are obvious then you might not hit major bottle necks. Design for failure and Cloud applications follow this principle.
1.Static resources should be Cacheable
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UserMaxAge" cacheControlMaxAge="365:00:00" />
</staticContent>
</system.webServer>
2.Bundling and Minification
3.Use ViewState when its necessary
EnableViewState="false" in a text box control
Page level - <%@ Page EnableViewState="false"%>
in web config - <pages enableViewState="false"/>
4.Use effecting pages
5.URL Compression -
<system.webServer>
<urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true"/>
</system.webServer>
6.Use sprite images - you can use nuget packages to do this
7.Image Optimization - you can use Image Resizer nuget package also allocate space for image using <height/> <width/>
8.Always deploy in Release mode Set debug="false"
9.Use client side validations
10.Remove unnecessary HTTP Headers -
Removing X-AspNet-Version - <httpRuntimeenableVersionHeader="false"/>
Remove X-AspNetMvc-Version - in Global.asx.cx file - MvcHandler.DisableMvcResponseHeader=true;
Remove Server Http Header - https://blogs.technet.microsoft.com/stefan_gossner/2008/03/12/iis-7-how-to-send-a-custom-server-http-header/
Remove or Edit X-Powered-By - IIS7 Manager > Http Response Header > Edit or Remove
11.Pipeline Optimization - Remove unnecssary Http Modules
12.Use Content Delivery Network
13.Dispose Objects Manually - use a USING statement
14.Effective use of Jquery Ajax - async data fetching, not too many, on scroll load data
15.Use Asynchronous methods to get multiple data
16.Turn of tracing
17.Instead of Response.Redirect() use Server.Transfer() or Server.TransferRequest()
Response.Redirect simply sends a message (HTTP 302) down to the browser.
Server.Transfer happens without the browser knowing anything, the browser request a page, but the server returns the content of another.
https://www.facebook.com/photo.php?v=762186150488997
18.String Management Use += operator or String.Concat() if number of appends known else use StringBuilder
19.ASP .NET literal and lable are different
20.Remove Blank Space and lines from HTML
21.Use performance tools - DotNetMemoryProfiler, SQLServerProfiler -
YSlow, Speed Tracer, Firebug, Chrome Dev Tools, Page Analyzer, Pingdom, Fiddler
New Relic Blaze Meter for Performance Testing - Jmeter like but cloud based tied to new relic account
Comments
Post a Comment