Front end-performance

24
Azri Faster Page Loads with Front End Performance [email protected]

description

 

Transcript of Front end-performance

Page 1: Front end-performance

Azri

Faster Page Loads with Front End Performance

[email protected]

Page 2: Front end-performance

Azri

AGENDA

Me and my companyTools & MeasurementImprove page load time

Page 3: Front end-performance

Azri

‘Me’

My villageHUZURABAD

Page 4: Front end-performance

Azri

More about ‘Me’• I build applications on Drupal• I am an active contributor of code on

Drupal, jQuery and PHP communities• One of my projects, a real-time

collaboration suite was showcased at TechCrunch 50 in SF

• I build Facebook Applications• ...

Page 5: Front end-performance

Azri

My CompanyWe are based in

We code on

We build products & solutions using

Page 6: Front end-performance

Azri

Web Page

IMAGES + Flash

CSS

HTML + XHR

Javascript

Page 7: Front end-performance

Azri

80 % of load timeCome from

CSS + JS + Images

Page 8: Front end-performance

Azri

5 CSS Requests27 JS Requests29 Image Requests

Page 9: Front end-performance

Azri

Measure Overal load time Page size Time until DOM is loaded Time until Page is rendered Time until Page is functional

Page 10: Front end-performance

Azri

Page 11: Front end-performance

Azri

ToolsYslowFirebug NetWebpagetest.orgBlaze.io

Page 12: Front end-performance

Azri

YSlow

Page 13: Front end-performance

Azri

Waterfall Chart

Starrt Connect First byte transfer Last byte transfer

Page 14: Front end-performance

Azri

Reduce Requests Compress Styles and JS

Built into Drupal http://drupalmodules.com/module/ad

vanced-cssjs-aggregation Sprites

Many images into one file Shift into view with background-

position

Page 15: Front end-performance

Azri

Reduce Requests No Redirects Use CSS Instead of Images

-moz-border-radius:4px;-webkit-border-radius:4px;-border-radius:4px;

Data: URLs in style sheetsbackground: white url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///

+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/

A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC')

Page 16: Front end-performance

Azri

Use CDN Content Delivery Network Servers Scattered around world Reduces roundtrip time Some providers

Akamai Simple CDN Panther Express

Page 17: Front end-performance

Azri

Cache Use Exprires header for http request Browser caches content Browser checks whether content is

fresh For images, js, css set expires header

far future Change filename/URL when updating

Page 18: Front end-performance

Azri

Compress Content Use apache mod_deflate module to

compress content Reduces page size more than 50% Compress script and styles

Page 19: Front end-performance

Azri

Keep CSS TOPPut <style> or <link> tags in <head> Page renders when all css loaded Loading CSS later causes re-

rendering

Page 20: Front end-performance

Azri

Keep JS Bottom Just before </body> Loading scripts in the head will block

page rendering Scripts load sequentially

Page 21: Front end-performance

Azri

Cookie Free Domain Use cookie-free domain for static

content (images, css, js) Create sub domain that point to

same server Use CDN module to serve static

content with the new domain Serve static content with nginx or

lighttpd servers

Page 22: Front end-performance

Azri

Smush.it Run smush.it Will reduce the size of images Removes white space from the

images Keeps the quality of the image

Page 23: Front end-performance

Azri

Parallelization Browser has limitation of 2 requests

per domain User multiple domains to serve static

content Use CDN module to serve content

from multiple domains

Page 24: Front end-performance

Azri

Questions?Questions?

[email protected]@azrisolutions.com