Caching For Cash php|tek – Chicago, May 2009
 
 
 
 
 
80%   of response time is spent downloading content
 
 
“ It all depends on how we look at things, and not how they are in  themselves.” - Carl G. Jung
 
 
Key factor in performance Fewer HTTP Requests Easy to improve on
Sent with static content Slow upstream speed Big cookies
Cookie Size Response Time (Delta) 0 bytes 78 ms  (  0 ms ) 500 bytes 79 ms  (  +1 ms ) 1000 bytes 94 ms  ( +16 ms ) 1500 b...
Eliminate unnecessary cookies Keep sizes low Appropriate domain levels Set Expires date appropriately
Be aware of max connection limits in browsers CNAME to point multiple sub domains to the same IP
One domain = 2 Parallel connections
Two domains = 4 Parallel connections
Too many hostnames can cause complications 2 – 4 sub domains is a  good  average
Combining  6  scripts into  1  eliminates  5  requests Challenges:  <ul><ul><li>develop as separate modules
combinations vs. loading more than needed </li></ul></ul>
JS does not comply with the parallel downloading rule
script defer  attribute is not a solution <ul><ul><li>blocks rendering and downloads in FF
slight blocking in IE </li></ul></ul>Solution:  move them as low in the page as possible
Crushes the files Strips out all cruft Voodoo magic
JSMin Dojo Shrinksafe Packer YUI Compressor http://short.ie/compression-rates
You  can  affect users download times
<ul>Gzip can be used on </ul><ul><ul><li>JS
CSS
XML
JSON </li></ul></ul>
<ul>Gzip should  not  be used on </ul><ul><ul><li>Images
PDFs
Compressed data formats </li></ul></ul>
CSS Sprites favicon
Badly optimized Thumbnails PNG can be compacted 50%, no quality loss OptiPNG
Test on slow connections Slow proxies for developers
Data served through a single domain Smart routing software Data closer to the end user – Less latency
Upcoming SlideShare
Loading in...5
×

Caching for Cash - Part 4

856

Published on

Have you come up with the next big thing? Coding it is something every new startup faces but what happens when it really does becomes the next big thing and servers start to crawl under the load?

In this workshop we'll cover a number of ways to identify bottlenecks and how to solve them once found. We'll also cover how to perform some extra scaling without expensive hardware.

* Benchmarking (f.ex. ab)
* Profiling with Xdebug
* Memcache
* APC
* and various other caching methodologies

Hopefully this will prevent you from becoming the next failwhale.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
856
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
18
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Caching for Cash - Part 4

    1. 1. Caching For Cash php|tek – Chicago, May 2009
    2. 7. 80% of response time is spent downloading content
    3. 10. “ It all depends on how we look at things, and not how they are in themselves.” - Carl G. Jung
    4. 13. Key factor in performance Fewer HTTP Requests Easy to improve on
    5. 14. Sent with static content Slow upstream speed Big cookies
    6. 15. Cookie Size Response Time (Delta) 0 bytes 78 ms ( 0 ms ) 500 bytes 79 ms ( +1 ms ) 1000 bytes 94 ms ( +16 ms ) 1500 bytes 109 ms ( +31 ms ) 2000 bytes 125 ms ( +47 ms ) 2500 bytes 141 ms ( +63 ms ) 3000 bytes 156 ms ( +78 ms ) Times are for page loads on DSL (~800 kbps).
    7. 16. Eliminate unnecessary cookies Keep sizes low Appropriate domain levels Set Expires date appropriately
    8. 17. Be aware of max connection limits in browsers CNAME to point multiple sub domains to the same IP
    9. 18. One domain = 2 Parallel connections
    10. 19. Two domains = 4 Parallel connections
    11. 20. Too many hostnames can cause complications 2 – 4 sub domains is a good average
    12. 21. Combining 6 scripts into 1 eliminates 5 requests Challenges: <ul><ul><li>develop as separate modules
    13. 22. combinations vs. loading more than needed </li></ul></ul>
    14. 23. JS does not comply with the parallel downloading rule
    15. 24. script defer attribute is not a solution <ul><ul><li>blocks rendering and downloads in FF
    16. 25. slight blocking in IE </li></ul></ul>Solution: move them as low in the page as possible
    17. 26. Crushes the files Strips out all cruft Voodoo magic
    18. 27. JSMin Dojo Shrinksafe Packer YUI Compressor http://short.ie/compression-rates
    19. 28. You can affect users download times
    20. 29. <ul>Gzip can be used on </ul><ul><ul><li>JS
    21. 30. CSS
    22. 31. XML
    23. 32. JSON </li></ul></ul>
    24. 33. <ul>Gzip should not be used on </ul><ul><ul><li>Images
    25. 34. PDFs
    26. 35. Compressed data formats </li></ul></ul>
    27. 36. CSS Sprites favicon
    28. 37. Badly optimized Thumbnails PNG can be compacted 50%, no quality loss OptiPNG
    29. 38. Test on slow connections Slow proxies for developers
    30. 39. Data served through a single domain Smart routing software Data closer to the end user – Less latency
    31. 40. Amazon CloudFront
    32. 41. Appropriate dates Cache far in the future Change file names on releases
    33. 42. Hash tag to compare between browser and server Gives more flexibility than last-modified-date Great on a single server setup
    34. 43. Typically unique to a server Disable if not being used!
    35. 44. Use options that are not unique per server
    36. 45. Firebug Firecookie Yslow Hammerhead http://stevesouders.com/hammerhead/
    37. 46. “ Knowledge rests not upon truth alone, but upon error also.” - Carl G. Jung
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×