optimizing asp.net application performance: tough but necessary
DESCRIPTION
Learn why it's crucial to optimize ASP.NET application performance and how to use various technics to reach 100 grade both in YSlow and Page Slow tools. Technics to be described: - tools: YSlow, Page Slow, Fiddler - javascript and css minification including related tools - image optimization and sprites including related tools - tuning IIS for performance - separating static content and using CDNs - ASP.NET server side profiling with MVC Profiler - client side profiling with Web Beacons and HTML5 Navigation TimingTRANSCRIPT
![Page 1: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/1.jpg)
![Page 2: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/2.jpg)
Optimizing ASP.NET application performance: tough but necessarySergejus Barinovas
@sergejusb | [email protected]
![Page 3: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/3.jpg)
My background
500M+ web requests per day
![Page 4: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/4.jpg)
Why web performance is important?
![Page 5: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/5.jpg)
Microsoft and Google research
• Microsoft Bing Search• With 500 ms delay revenue per user
dropped by 1.2%
• Google Search• With 400 ms delay number of users
leaving the page increased by 0.6%
Source: Performance Related Changes and their User Impact by Eric Schurman and Jake Brutlang
![Page 6: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/6.jpg)
Performance is a feature and it costs
![Page 7: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/7.jpg)
Mobile feedback appAgile Tour Vilnius 2011
![Page 8: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/8.jpg)
Client side optimizationTough, but here are several hints for you…
![Page 9: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/9.jpg)
Hint #1
• Understand your application• What is loaded• How much does it take
• Tools• Firefox Firebug• IE Developer Tools• Chrome Developer Tools
![Page 10: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/10.jpg)
Hint #2
• Adhere to the web performance best practices• Yahoo! best practices for speeding up we
b site
• Google web performance best practices
• Tools• Yahoo! YSlow• Google Page Speed
![Page 11: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/11.jpg)
Hint #3
• Perform advanced HTTP traffic debugging of headers, cookies, etc.
• Tool• Fiddler
![Page 12: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/12.jpg)
Web performance rules (1/2)
• Minimize HTTP Requests• Combine JavaScript and CSS• Use CSS Sprites or inline images
• Put Stylesheets at the Top• Put Scripts at the Bottom• Make JavaScript and CSS External• Minify JavaScript and CSS• Optimize Images and CSS Sprites• Make favicon.ico Small and Cacheable
![Page 13: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/13.jpg)
Web performance rules (2/2)
• Gzip Components• Add an Expires or a Max-Age• Configure ETags
![Page 14: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/14.jpg)
Lets optimize mobile feedback app!
Demo: client side optimization
![Page 15: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/15.jpg)
Tools to consider
• SquishIt library• Combine and minify your JavaScript and
CSS• ASP.NET 4.5 will have similar functionality
built-in• Image Optimizer plugin• Optimize PNG, GIF and JPEG files
• Sprite and Image Optimization library• Generate sprite image and related CSS
![Page 16: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/16.jpg)
Other useful tools
• Visual Studio libraries• YUICompressor• AjaxMin
• JavaScript tools• Closure compiler• YUICompressor• AjaxMin• Packer• JSMin
• Image optimization• Smush.it• PunyPNG
• CSS tools• YUICompressor• AjaxMin• CSSTidy• Minify• CSSCompressor
![Page 17: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/17.jpg)
Client side optimization results
![Page 18: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/18.jpg)
Server side optimizationEven tougher and in most cases “it depends”…
![Page 19: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/19.jpg)
Hint #1
• Within ASP.NET• Minimize usage of Session• Disable ViewState by default• Take control over Post Backs
• Within ASP.NET MVC• Minimize usage of Session• Disable unused View Engines• Remove URL Rewrite module
![Page 20: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/20.jpg)
Hint #2
• Learn your most popular and slowest pages
• Tools• IIS logs and Microsoft Log Parser• ASP.NET MVC / WCF Mini Profiler• HTML5 Navigation Timing feature (IE, FF,
Chrome)
![Page 21: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/21.jpg)
DemoLearning page usage and load times
![Page 22: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/22.jpg)
Hint #3
• Minimize IIS footprint• Remove unused modules• Uninstall unused component
• Tool• Apache Bench
![Page 23: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/23.jpg)
Worth knowing
• Maximum IIS throughput I’ve seen so far – 10 000 requests per second for static content• Removed all unused IIS components• Removed ASP.NET components• Tuned IIS caching options
![Page 24: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/24.jpg)
Recap
• Performance is a feature and it costs
• Adhere to the web performance best
practices
• Learn page usage and load times
• Minimize IIS footprint
![Page 25: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/25.jpg)
Now go and optimize you ASP.NET application performance!
![Page 26: Optimizing ASP.NET application performance: tough but necessary](https://reader035.vdocuments.mx/reader035/viewer/2022062701/55424106b4c905b31a8b4600/html5/thumbnails/26.jpg)
Thank you! Questions?@sergejusb | [email protected]