Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You.

Similar presentations


Presentation on theme: "Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You."— Presentation transcript:

1 Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You

2 ” “ Well, I’m including a bunch of JavaScript and CSS, but users only have to download it once. After that, it’ll be really fast.

3 Web Browsing 101 Your HTML is a shopping list.

4 Yahoo! Extreme Performance

5 Make Fewer HTTP Requests Use a Content Delivery Network Add an Expires or a Cache-Control Header Gzip Components Put Stylesheets at the Top Put Scripts at the Bottom Avoid CSS Expressions Make JavaScript and CSS External Reduce DNS Lookups Minify JavaScript and CSS Avoid Redirects Remove Duplicate Scripts Configure ETags Make Ajax Cacheable Flush the Buffer Early Use GET for AJAX Requests Post-load Components Preload Components Reduce the Number of DOM Elements Split Components Across Domains Minimize the Number of iframes No 404s Reduce Cookie Size Use Cookie-free Domains for Components Minimize DOM Access Develop Smart Event Handlers Choose over @import Avoid Filters Optimize Images Optimize CSS Sprites Don't Scale Images in HTML Make favicon.ico Small and Cacheable Keep Components under 25K Pack Components into a Multipart Document

6 Time-based graph of HTTP traffic as a visitor hits yahoo.com

7 Servers are Overrated

8 HTTP Response Codes & Headers

9 HTTP Code: 200 Here’s the file you requested. Enjoy.

10 HTTP Code: 304 This file hasn’t changed since the last time you asked about it. Just use the cached version you have.

11 First Site Visit: 200s

12 Second Site Visit: 304s & 200s

13 Demo Let’s open up Firebug and understand the bandwidth difference between the first and second visits.

14 ” “ Wait, what else do we need? My 25 images and stylesheets weigh in at 100KB. That shouldn’t take more than a couple seconds to download. After it’s cached, it should be pretty much instant.

15 Demo Just how long does it take to communicate with a server? Is it fast enough that we can do it 20 times on one page?

16 Give me a ping, Vasili. One ping only, please.

17 HTTP Header: Expires Here’s the file you requested. Enjoy. Oh yeah, and don’t ask for this file again until Tuesday.

18 Demo So how does the Expires Header change things?

19 What determines the 304?

20 When Was My PHP Modified?

21 How do we make more 304s? PHP: header("Last-Modified: Mon, 26 Jul 2008 05:00:00 GMT") JSP: response.setHeader("Last-Modified", "Mon, 26 Jul 2008 05:00:00 GMT")

22 Channel Your Inner Columbo

23 RUWT? API: Hits

24 RUWT? API: Bytes

25 One-Size-Fits-All Coding HTTP Compression is your friend.

26 Final Paradox The number of hits on your site is not a badge of honor. Reducing the number of hits will improve the user experience.

27 Reduce Traffic. Increase Users.

28 Thanks! Mark Phillip markphillip.com

29 Yahoo! Exceptional Performance Team Blog http://developer.yahoo.net/blog/archives/performance/http://developer.yahoo.net/blog/archives/performance/ Performance Rules http://developer.yahoo.com/performance/rules.html http://developer.yahoo.com/performance/rules.html Web-based Tool Mozilla Web Sniffer http://web-sniffer.net/http://web-sniffer.net/ Firefox Add-ons Firebug https://addons.mozilla.org/en-US/firefox/addon/1843https://addons.mozilla.org/en-US/firefox/addon/1843 YSlow https://addons.mozilla.org/en-US/firefox/addon/5369https://addons.mozilla.org/en-US/firefox/addon/5369 IE Add-ons HttpWatch http://httpwatch.comhttp://httpwatch.com


Download ppt "Mark Phillip markphillip.com 200s, 304s, Expires Headers, HTTP Compression, And You."

Similar presentations


Ads by Google