building high performance websites - session-1

33
SURE Internal Training High Performance Websites Focus on Client side best practices and optimizations Usama Nada SESSION-1

Upload: usama-nada

Post on 28-May-2015

262 views

Category:

Technology


2 download

DESCRIPTION

Building High Performance Websites Session-1: Focus on Client side best practices and optimizations

TRANSCRIPT

Page 1: Building High Performance Websites - Session-1

SUREInternal Training

High Performance WebsitesFocus on Client side best practices and optimizations

Usama Nada

SESSION-1

Page 2: Building High Performance Websites - Session-1

We believe in…

Giving Users THE Best Experience

Page 3: Building High Performance Websites - Session-1

We believe…

In building THE perfect web apps

Page 4: Building High Performance Websites - Session-1

We believe…

Your tools are important

Page 5: Building High Performance Websites - Session-1

We believe…

Server + client-side =

Page 6: Building High Performance Websites - Session-1

Defining Performance.Understand the RulesPerformance ToolboxApply The Rules in ASP.Net web App

Lets Start Goals

Page 7: Building High Performance Websites - Session-1

What? Reducing the amount of bandwidth and number of requests served from your Website

High User ExpectationsUsers usually expects less than a second. More than 2 seconds now considered slow. +Age of Mobility

The Performance Golden Rule “optimize front-end performance first, because that’s where 80% or more of the end-user response time is spent.”

Web Performance

Page 8: Building High Performance Websites - Session-1

Web PerformanceResponse Tree Backend vs. frontend

Page 9: Building High Performance Websites - Session-1

The impact website speed has on business

“Even a small ant can hurt the mighty elephant.” (Google Maps!, SEO)

• Google: 500 ms slower = 20% drop in traffic• Google Maps: home page was reduced 100 KB

to 70KB, traffic went up 10% in the first week and an additional 25% in the following three weeks

• Higher SEO Rank• Amazon: 100 ms slower = 1% drop in sales

$2,054,794 per day

Web Performance

Page 10: Building High Performance Websites - Session-1

How to Optimize (The performance cycle)

Page 11: Building High Performance Websites - Session-1

Show Me the Numbers

Page 12: Building High Performance Websites - Session-1

The Rules

Page 13: Building High Performance Websites - Session-1

Request-and-response communication system.

HTTP messages are made up of a header and a body. (key/value pair format)

Each HTTP request also contains an HTTP verb that tells the server what to do with the data (GET and POST)

Status Codes

HTTP Basics

Page 14: Building High Performance Websites - Session-1

Make fewer HTTP requestsUse a content delivery networkAdd an Expires headerCompress components with GzipPut CSS at the topMove JavaScript to the bottomAvoid CSS expressionsMake JavaScript and CSS externalReduce DNS lookupsMinify JavaScript, and cssAvoid redirectsRemove duplicate scriptsTurn off EtagsMake AJAX cacheable and small

The Rules List 14 Rules and More!

Page 15: Building High Performance Websites - Session-1

The Tools

Page 16: Building High Performance Websites - Session-1

Profiling ToolsYslow http://yslow.org/Google PageSpeed: https://developers.google.com/speed/pagespeed/WebPageTest http://www.webpagetest.org/FireBug, and Chrome developer toolsFiddler

Optimization ToolsOnline Google Closure compiler: http://closure-compiler.appspot.com/homeYUI Compressor: http://yui.github.io/yuicompressor/Smush.it: http://smush.it/VS Web Essentials http://vswebessentials.com/

Performance Practices Checklist: http://webdevchecklist.com/ wi

Web Performance Toolbox

Page 17: Building High Performance Websites - Session-1

Why? Reducing the amount of bandwidth served from your WebsiteJS: 6.52 KB -> 2.43 KB (62.74%) CSS: 91.57 KB -> 21.12 KB (76.93%)

HowCompressing HTTP Response to optimal sizes.The Browser then decompress to render.

Compression

Page 18: Building High Performance Websites - Session-1

Formats:Gzip, Deflate, SDCH

What to CompressBiggest savings were made on text-based files Don’t try to compress PDF, zip, and image files

Tools:IIS Web ServerProgrammatically

Compression

Page 19: Building High Performance Websites - Session-1

SUREInternal Training

Demo

Page 20: Building High Performance Websites - Session-1

How?Server instructs the browser to cache static content

What can be cached

Images, scripts, styles, Ajax calls

Empty Cache VS. Primed Cache

HTTP Caching

Page 21: Building High Performance Websites - Session-1

HTTP Caching

Page 22: Building High Performance Websites - Session-1

SUREInternal Training

Demo

Page 23: Building High Performance Websites - Session-1

What is minification?What is bundling?Why should I minify or bundle my static files?

Less Number of requests (better performance).jQuery 225.78 KB -> 93.28 KB (58.68%)jQuery Mobile 240 -> KB 91 KB (62%)JavaScript can be minified and obfuscated to reduce the file size even further

Tools

Minifying and Bundling static files

Page 24: Building High Performance Websites - Session-1

The overall page weight and number of HTTP requests before and after minificationand bundling

How much it enhances

Page 25: Building High Performance Websites - Session-1

SUREInternal Training

Demo

Page 26: Building High Performance Websites - Session-1

Positioning CSS and JavaScript in a web page for best performance

HTML Optimization

Page 27: Building High Performance Websites - Session-1

JavaScript on top blocks the browser’s ability to download components in parallel.

HTML Optimization

Page 28: Building High Performance Websites - Session-1

The importance of image optimizationOnline and command line image optimization toolsAutomatic data URIsUse CSS Sprites for icons and small images

Image Optimization

Page 29: Building High Performance Websites - Session-1

Allows users to access content on servers that are relatively close to them, minimizing the distance a request travels and reducing your site’s web page load times.

improves your chances of serving the same website experience to all your users, regardless of their location.

Content Delivery Network (CDN)

Page 30: Building High Performance Websites - Session-1

SUREInternal Training

Bundling & Minification + Compression + Caching + HTML Optimization + Image Optimization = High Performance Website

Page 31: Building High Performance Websites - Session-1

Server Side Best Practices in building high performance web apps

ASP.Net Specifc Optimization and Best PracticesServer Caching, and distributed cachingMessage Queuing ConceptsDatabase Offloading IdeasSession ManagementPerformance MonitoringInfrastructure optimizations

Next Session

Page 32: Building High Performance Websites - Session-1

ReferencesBook: Fast ASP.Net Websites (Manning, 2013)Book: High Performance Web Sites (O’Reilly, 2007)Book: Ultra Fast ASP.Net Websites (Apress, 2012)Yahoo! Performance Rules https://developer.yahoo.com/performance/https://github.com/ligershark/webdevchecklist.comPerformance Optimize Your ASP.NET Web App https://channel9.msdn.com/Events/TechEd/NorthAmerica/2014/DEV-B418#fbid=

Page 33: Building High Performance Websites - Session-1

SUREInternal Training

Thank You