Optimizing ASP.NET application performance: tough but necessary

Post on 30-Apr-2015

6,564 views 2 download

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 Timing

transcript

Optimizing ASP.NET application performance: tough but necessarySergejus Barinovas

@sergejusb | sergejus.barinovas@gmail.com

My background

500M+ web requests per day

Why web performance is important?

Performance is a feature and it costs

Mobile feedback appAgile Tour Vilnius 2011

Client side optimizationTough, but here are several hints for you…

Hint #1

• Understand your application• What is loaded• How much does it take

• Tools• Firefox Firebug• IE Developer Tools• Chrome Developer Tools

Hint #3

• Perform advanced HTTP traffic debugging of headers, cookies, etc.

• Tool• Fiddler

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

Web performance rules (2/2)

• Gzip Components• Add an Expires or a Max-Age• Configure ETags

Lets optimize mobile feedback app!

Demo: client side optimization

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

Client side optimization results

Server side optimizationEven tougher and in most cases “it depends”…

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

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)

DemoLearning page usage and load times

Hint #3

• Minimize IIS footprint• Remove unused modules• Uninstall unused component

• Tool• Apache Bench

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

Recap

• Performance is a feature and it costs

• Adhere to the web performance best

practices

• Learn page usage and load times

• Minimize IIS footprint

Now go and optimize you ASP.NET application performance!

Thank you! Questions?@sergejusb | sergejus.barinovas@gmail.com