Eternal static (RIT 2011)

  • Published on
    13-Dec-2014

  • View
    458

  • Download
    0

Embed Size (px)

DESCRIPTION

«Вечная статика» оптимизация отдачи контента

Transcript

  • 1.

    2011-04-26

2. 3. I.
3
4.

/ /

: - stream

,
5.



6. 1)
/
/
Data URI, CSS sprites

AJAX, WebSockets
;Prefetching
JavaScript: async/defer; post-load
7. 1.1)/
(JS/CSS)
Yahoo Best Practices for Speeding Up Your Web Site
: CSSexpressions

. StoyanStefanov (Yahoo)

. ()
client-side (XSLT)
8. 2)

, ,
DNS-resolving
lookup ( , TTL)
Geo-balancing, IP anycast

HTTP 1.0 keep-alive== HTTP 1.1 persistent
9. 2)

CDN;DNS/geo-balancing, TCP anycast
: default 6
JS- ( jQuery, YUI, )
13% Google Libraries API

Privacy: Referer
10. 2)
HTTP pipelining -
proxy-servers,
!
10% ( Openstat.Trends)
- (HTTPS, SPDY)
HTTPS , overhead
SPDY Google, nginx :)
11. 3)




12. 3.1)
frontend
(backend)

flush()
:
(memcached)
(mod_cache*)
13. 3.2)

ngx_http_gzip, ngx_http_gzip_static
mod_gzip, mod_deflate
JS,
Post-loading
14. 3.2)
(minification)
JS/CSS
Closurecompiler, YUI Compressor

HTML
, , default ,
htmlcompressor,
15. 3.3)

: Cookie
Cookie
FYI: :
Firefox, Chrome - no limit
Opera, IE6 - 4096
IE8 - 10234
16. 3.4)

(JS, CSS)
(CSS sprites, Data URI, MHTML)


17.
checklist, :

, (|)
/
18. II.
18
19. HTTP
:
Last-Modified / ETag
, - :
Expires
Cache-Control
http://www.w3.org/Protocols/HTTP/1.1/rfc2616bis/
20. HTTP
:
:
If-Unmodified-Since/ If-None-Match
(304 Not modified): expiration
21. -
ETag :
nginx:
Apache:inode-size-timestamp
IIS:Filetimestamp:ChangeNumber

inode ChangeNumber
22.
ExpiresCache-Control: max-age
56% expiration
24% http://www.stevesouders.com/blog/2011/04/18/http-archive-max-ag/
:
CSS, JavaScript, , Flash, (!)
23.
expiration ( 304 Not modified)
:
2 IP


24. : expiration
expiration ( backend)
expiration ( , , )
Expire -
: URI
25.
? + timestamp: /favicon.ico?ver=3
URL ?
:
/style.css?ver=3 /logo.png?ver=5
26. :
: /favicon_1303591683.ico
VCS, ,
timestamp
, :
md5( timestamp + @versioned_dependencies_urls)
Base64 URLSafe
27.
/s/ URL
, ,
! , :
location /s/ {
expires max;
gzip_static on;
}
28.

  • :

(CSS, JS)
, /
Flash-

  • :

( )
:

29. :
30. mime-types:
31. mime-types:
32. HTTP Archive:
http://httparchive.org/interesting.php#responsesizes
33. 33
III.
34. Htdocs layout
:
htdocs/
frontend/
eternal/
backend/

  • frontend - , nginx

35. eternal , nginx 36. backend - , upstream