26

Optimizing ASP.NET application performance: tough but necessary

Embed Size (px)

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

Citation preview

Page 1: Optimizing ASP.NET application performance: tough but necessary
Page 2: Optimizing ASP.NET application performance: tough but necessary

Optimizing ASP.NET application performance: tough but necessarySergejus Barinovas

@sergejusb | [email protected]

Page 3: Optimizing ASP.NET application performance: tough but necessary

My background

500M+ web requests per day

Page 4: Optimizing ASP.NET application performance: tough but necessary

Why web performance is important?

Page 6: Optimizing ASP.NET application performance: tough but necessary

Performance is a feature and it costs

Page 7: Optimizing ASP.NET application performance: tough but necessary

Mobile feedback appAgile Tour Vilnius 2011

Page 8: Optimizing ASP.NET application performance: tough but necessary

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

Page 9: Optimizing ASP.NET application performance: tough but necessary

Hint #1

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

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

Page 11: Optimizing ASP.NET application performance: tough but necessary

Hint #3

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

• Tool• Fiddler

Page 12: Optimizing ASP.NET application performance: tough but necessary

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

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

Lets optimize mobile feedback app!

Demo: client side optimization

Page 15: Optimizing ASP.NET application performance: tough but necessary

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 17: Optimizing ASP.NET application performance: tough but necessary

Client side optimization results

Page 18: Optimizing ASP.NET application performance: tough but necessary

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

Page 19: Optimizing ASP.NET application performance: tough but necessary

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

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

DemoLearning page usage and load times

Page 22: Optimizing ASP.NET application performance: tough but necessary

Hint #3

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

• Tool• Apache Bench

Page 23: Optimizing ASP.NET application performance: tough but necessary

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

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

Now go and optimize you ASP.NET application performance!

Page 26: Optimizing ASP.NET application performance: tough but necessary

Thank you! Questions?@sergejusb | [email protected]