Skip to content

Commit 92b8b76

Browse files
committed
change style and add content
1 parent deced18 commit 92b8b76

29 files changed

+19121
-9
lines changed

content/casestudy-of-360internetional.md

+410
Large diffs are not rendered by default.

content/explore-nodejs.md

+455
Large diffs are not rendered by default.

content/high-performance-web.md

+345
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,345 @@
1+
<section data-state="bg-cover">
2+
<style>
3+
.bg-cover body {background-image: url(//farm4.staticflickr.com/3254/3120186015_b5e4feaa19_b.jpg)}
4+
</style>
5+
<h1 style="bottom:15%;top:auto;">High performance web</h1>
6+
</section>
7+
8+
<style>
9+
.reveal li {
10+
margin: 1em 0;
11+
}
12+
</style>
13+
14+
--------------------
15+
16+
# Why performance matters?
17+
18+
-------------------------
19+
20+
>Speed is the most important feature... If something is slow, they're just gone.
21+
22+
&nbsp;
23+
24+
>Yahoo! – A 400 milliseconds slowdown resulted in a 5-9% drop in full-page traffic.
25+
26+
&nbsp;
27+
28+
>Netflix – Adopting a single optimization, gzip compression, resulted in a 13-25% speedup and cut their outbound network traffic by 50%.
29+
30+
-------------------------
31+
32+
##What performance means?
33+
34+
* In this talk, we focus on __Response Time__ of __Websites__
35+
* Reduce the __Time To Interactivity (TTI)__
36+
37+
-----------------------
38+
39+
##In this talk
40+
41+
* Some facts about how browser load web page
42+
* Best practices of high performance web
43+
* Explain reasons behind these rules
44+
* Methods and tools used to improve performance
45+
46+
-----------------------
47+
48+
##Browser rendering Process
49+
50+
![waterfall](http://p6.qhimg.com/t01eb6ab40d0b4fc6d4.png)
51+
52+
-------------------
53+
54+
##Notes about rendering
55+
56+
* Browser [start rending](http://www.yahoo.com/) as soon as it receives HTML
57+
* Browser downloads components(js/css/image) parallel in a queue
58+
* Connections per host are [limited](http://www.stevesouders.com/blog/2008/03/20/roundup-on-parallel-connections/)
59+
60+
-------------------
61+
62+
## #0 Minimize HTTP Requests
63+
64+
* HTTP request is expensive
65+
* DNS Lookup + Connecting + Blocking + Sending + Waiting + Receiving
66+
* Ways to reduce requests number
67+
* Combine JS/CSS files
68+
* [CSS Sprites](http://css-tricks.com/examples/CSS-Sprites/Example1After/)
69+
* [Keep-Alive](http://en.wikipedia.org/wiki/HTTP_persistent_connection) in HTTP Headers
70+
* Minimize [redirects](http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_9/)
71+
* [Lazy](http://search.yahoo.com/mobile/s?p=obama) load [components](http://v.qq.com/)
72+
73+
------------------
74+
75+
## #1 Make components cacheable
76+
77+
* Add [Expires](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21) or [Cache-Control](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) Header
78+
* Make JavaScript and CSS External
79+
* Configure [ETags](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19)
80+
* Make Ajax [Cacheable](http://developer.yahoo.com/blogs/ydn/posts/2007/09/high_performanc_12/)
81+
82+
------------------
83+
84+
## #2 Reduce DNS Lookups
85+
86+
* Reducing the number of unique hostnames
87+
* will reduce the amount of parallel downloading
88+
* balance them
89+
90+
<style>
91+
.process-table {position:absolute;bottom: -2em;left:1em; border:none;border-collapse: collapse;}
92+
.process-table td {padding: 0.3em;background:orange;border-left:1px solid #FFF}
93+
.process-table td:first-child {border-left:none}
94+
.process-table td.current {background:green}
95+
</style>
96+
97+
<table class="process-table">
98+
<tr>
99+
<td class="current">DNS lookup</td>
100+
<td>Connecting</td>
101+
<td>Blocking</td>
102+
<td>Sending</td>
103+
<td>Waiting</td>
104+
<td>Receiving</td>
105+
</tr>
106+
</table>
107+
108+
------------------
109+
110+
## #3 Parallelize downloads
111+
112+
* Split Components [Across Domains](http://yuiblog.com/blog/2007/04/11/performance-research-part-4/)
113+
* Avoid CSS [@import](http://www.stevesouders.com/blog/2009/04/09/dont-use-import/)
114+
115+
<table class="process-table">
116+
<tr>
117+
<td>DNS lookup</td>
118+
<td>Connecting</td>
119+
<td class="current">Blocking</td>
120+
<td>Sending</td>
121+
<td>Waiting</td>
122+
<td>Receiving</td>
123+
</tr>
124+
</table>
125+
126+
------------------
127+
128+
## #4 Use Non-Blocking JS
129+
130+
* Fact: Javascript [blocks](http://dl.dropbox.com/u/6929017/slides/performance/blocking_js.html) rendering and parallel downloads
131+
* How to make js non-blocking
132+
* put js at bottom or lazy load js
133+
* create script tag [dynamically](http://dl.dropbox.com/u/6929017/slides/performance/non_blocking_d.html)
134+
* use _defer_ or [_async_](http://dl.dropbox.com/u/6929017/slides/performance/non_blocking_a.html) attribute
135+
136+
137+
<table class="process-table">
138+
<tr>
139+
<td>DNS lookup</td>
140+
<td>Connecting</td>
141+
<td class="current">Blocking</td>
142+
<td>Sending</td>
143+
<td>Waiting</td>
144+
<td>Receiving</td>
145+
</tr>
146+
</table>
147+
148+
------------------
149+
150+
## #5 Minimize request size
151+
152+
* Reduce Cookie Size
153+
* Use [localstorage](http://diveintohtml5.info/storage.html) over cookie
154+
* Use [Cookie-free](http://search.yahoo.com/mobile) Domains for Components
155+
* Use [GET](http://developer.yahoo.com/performance/rules.html#ajax_get) for AJAX request if possible
156+
157+
<table class="process-table">
158+
<tr>
159+
<td>DNS lookup</td>
160+
<td>Connecting</td>
161+
<td>Blocking</td>
162+
<td class="current">Sending</td>
163+
<td>Waiting</td>
164+
<td>Receiving</td>
165+
</tr>
166+
</table>
167+
168+
------------------
169+
170+
## #6 Responsive server-side
171+
172+
* Flush the buffer early
173+
* [Example without flush](http://dev.search.yahoo.com/test/no_flush.php)
174+
* [Example with flush](http://dev.search.yahoo.com/test/flush.php)
175+
* Parallelize workflow on server
176+
* [Facebook BigPipe](http://www.facebook.com/note.php?note_id=389414033919)
177+
178+
<table class="process-table">
179+
<tr>
180+
<td>DNS lookup</td>
181+
<td>Connecting</td>
182+
<td>Blocking</td>
183+
<td>Sending</td>
184+
<td class="current">Waiting</td>
185+
<td>Receiving</td>
186+
</tr>
187+
</table>
188+
189+
------------------
190+
191+
## #7 Minimize component transfer size
192+
193+
* [Minimize](http://yuilibrary.com/projects/yuicompressor/) Javascript and CSS file
194+
* [Optimize](http://www.smushit.com/ysmush.it/) images and CSS sprites
195+
* [Gzip](http://en.wikipedia.org/wiki/Gzip) components
196+
* Serve scaled images
197+
198+
<table class="process-table">
199+
<tr>
200+
<td>DNS lookup</td>
201+
<td>Connecting</td>
202+
<td>Blocking</td>
203+
<td>Sending</td>
204+
<td>Waiting</td>
205+
<td class="current">Receiving</td>
206+
</tr>
207+
</table>
208+
209+
------------------
210+
211+
## #8 Optimize browser rendering
212+
213+
* Avoid Repaint and [Reflow](http://www.youtube.com/watch?v=ZTnIxIA5KGw)
214+
* Put CSS at top
215+
* Specify image dimensions
216+
* Avoid CSS [expressions](https://developers.google.com/speed/docs/best-practices/rendering#AvoidCSSExpressions)
217+
* Avoid [Filters](http://developer.yahoo.com/blogs/ydn/posts/2007/07/high_performanc_6/)
218+
219+
------------------
220+
221+
<section data-state="singleui">
222+
<style>.singleui body {background-image:url(//farm7.staticflickr.com/6031/6328994265_daca6ca212_b.jpg)}</style>
223+
<h2 style="text-align:left;" class="fragment">UI Thread = <br/>update UI + execute Javascript</h2>
224+
</section>
225+
226+
------------------
227+
228+
## #9 Minimize UI update in JS
229+
230+
* Cache references to accessed elements
231+
* Update nodes "[offline](http://ejohn.org/blog/dom-documentfragments/)" and then add them to the tree
232+
* Change [className](http://www.quirksmode.org/dom/classchange.html) over change style
233+
* Use CSS3 transition over JS animation
234+
235+
------------------
236+
237+
## #10 Take UX into account
238+
239+
* Make [onload](http://dl.dropbox.com/u/6929017/slides/performance/loading.pdf) faster
240+
* Add [loading indicator or progress bar](http://www.usabilitypost.com/2009/01/23/making-wait-times-feel-shorter/) for long time operation
241+
242+
------------------
243+
244+
## Tools (1/2)
245+
246+
* Rule checking
247+
* Yahoo! [YSlow](http://yslow.org/)
248+
* Google [PageSpeed](https://developers.google.com/speed/)
249+
250+
* Timeline
251+
* [Firebug](http://getfirebug.com/)
252+
* [HTTPWatch](http://www.httpwatch.com/)
253+
* [Webkit](https://developers.google.com/chrome-developer-tools/)/[IE](http://en.wikipedia.org/wiki/Internet_Explorer_Developer_Tools) developer tools
254+
255+
-------------------------
256+
257+
## Tools (2/2)
258+
259+
* Image optimization
260+
* Yahoo! [Smush.it](http://www.smushit.com/ysmush.it/)
261+
* [Pngcrush](http://pmt.sourceforge.net/pngcrush/) and [ImageMagic](http://www.imagemagick.org/script/index.php)
262+
* [SpriteMe](http://spriteme.org/)
263+
264+
* JS/CSS compression
265+
* [YUI compressor](http://yuilibrary.com/projects/yuicompressor/)
266+
* [Google Closure](https://developers.google.com/closure/)
267+
268+
------------------
269+
270+
## Books
271+
272+
<a href="http://search.safaribooksonline.com/book/web-development/9780596529307"><img src="http://akamaicovers.oreilly.com/images/9780596529307/lrg.jpg" style="max-width: 40%;display:inline-block;" /></a> &nbsp; &nbsp;
273+
<a href="http://search.safaribooksonline.com/book/web-design-and-development/9780596803773"><img src="http://akamaicovers.oreilly.com/images/9780596522315/lrg.jpg" style="max-width:40%; display:inline-block" /></a>
274+
275+
276+
------------------
277+
278+
## Online Resources
279+
280+
* [Best Practices for Speeding Up Your Web Site](http://developer.yahoo.com/performance/rules.html) from Yahoo!
281+
* [Web Performance Best Practices](https://developers.google.com/speed/docs/best-practices/rules_intro) from Google
282+
* [Steve Souders](http://www.stevesouders.com/blog/)'s Blog
283+
284+
------------------
285+
286+
## &nbsp;
287+
##
288+
289+
##Keywords of web performance optimization
290+
291+
------------------
292+
293+
<div class="bg" style="background-image:url(http://farm1.staticflickr.com/22/88003222_c875cfda73_b.jpg)">
294+
<h1 style="top:auto;bottom:10%;left:6%;">Bottleneck</h1>
295+
</div>
296+
297+
------------------
298+
299+
<div class="bg" style="background-image:url(http://farm5.staticflickr.com/4040/4195859328_6ff0f4cce7_b.jpg)">
300+
<h1 style="top:auto;left:auto;right:6%;bottom:10%">Non-blocking</h1>
301+
</div>
302+
303+
------------------
304+
305+
<div class="bg" style="background-image:url(http://farm4.staticflickr.com/3595/3410239848_a84804547e_b.jpg)">
306+
<h1 style="">Parallel</h1>
307+
</div>
308+
309+
------------------
310+
311+
<div class="bg" style="background-image:url(http://farm6.staticflickr.com/5175/5550384603_c21d01d774_b.jpg)">
312+
<h1 style="top:auto;bottom:10%;left:6%">Lightweight</h1>
313+
</div>
314+
315+
------------------
316+
317+
<div class="bg" style="background-image:url(http://farm6.staticflickr.com/5166/5234047189_aca32601f6_b.jpg)">
318+
<h1 style="top:auto;left:auto;right:8%;bottom:10%">Balance</h1>
319+
</div>
320+
321+
------------------
322+
323+
<div class="bg" style="background-image:url(http://farm4.staticflickr.com/3155/4557184853_bd070613bb_b.jpg)">
324+
<h1 style="top:auto;bottom:10%">Perception</h1>
325+
</div>
326+
327+
------------------
328+
329+
# &nbsp;
330+
331+
#Q & A
332+
333+
------------------
334+
335+
##CC images used
336+
337+
338+
* http://www.flickr.com/photos/lrargerich/3120186015/
339+
* http://www.flickr.com/photos/atwatervillage/6328994265/
340+
* http://www.flickr.com/photos/jakescreations/88003222/
341+
* http://www.flickr.com/photos/rene1956/3410239848/
342+
* http://www.flickr.com/photos/jeffmollman/5550384603/
343+
* http://www.flickr.com/photos/benheine/4557184853/
344+
* http://www.flickr.com/photos/2c2believe/5234047189/
345+

0 commit comments

Comments
 (0)