SlideShare a Scribd company logo
1 of 34
Adaptive Static Resource Optimization AJAXian Conference 2009 Sep 15, 2009 Boston, MA David Wei and ChanghaoJiang
Agenda
Optimization has to be adaptive!
Facebook: a site powered by AJAX Challenges day-to-day ,[object Object]
Viral Adoption
Agile Development,[object Object]
Why we need adaptive packaging? Day 2: Some smart engineers run YSlow and thinks… <Print css tag for feature A> <Print css tag for feature B> <Print css tag for feature C> <print HTML of feature A> <print HTML of feature B> <print HTML of feature C> … “A & B & C are always used; let’s package them together!”
Why we need adaptive packaging? Day 2: Awesome!  <Print css tag for feature A&B&C> <print HTML of feature A> <print HTML of feature B> <print HTML of feature C> …
Why we need adaptive packaging? Day 3: feature C evolves… <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> If (users_signup_for_C()) { <print HTML of feature C>} …
Why we need adaptive packaging? Day 3: <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> If (users_signup_for_C()) { <print HTML of feature C>} … A&B are always used, while C is not. ..
Why we need adaptive packaging? Day 4: feature C is deprecated <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> // no one uses C { <print HTML of feature C>} …
Why we need adaptive packaging? Day 4: we start to send unused bits <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> // no one uses C { <print HTML of feature C>} … It is hard to remember we should remove C here.
Why we need adaptive packaging? One months later… <Print css tag for feature A & B & C & D & E & F & G…> if (F is used) <print HTML of feature F> <print HTML of feature G> if (F is not used) { <print HTML of feature E>} … Thousands of dead CSS rules in the package.
Static Resource Management @ Facebook Challenges: ,[object Object]
Viral Adoption
Agile Development Responses: ,[object Object]
Requirement declaration: lives with HTML generation
Delivery: Globally optimized based on trace analysis,[object Object]
Static Resource Management  Separate Declaration from actual Delivery               Back to Day 1:  require_static(A_css); <render HTML of feature A> require_static(B_css); <render HTML of feature B> require_static(C_css);<render HTML of feature C> <deliver all required CSS> <print all rendered HTML> Requirement Declaration lives with HTML  Global Optimization on Delivery
Offline analysis Packager: Global JS/CSS Optimization Online process require_static(A_css); <render HTML of feature A> require_static(B_css); <render HTML of feature B> require_static(C_css); <render HTML of feature C> <deliver all required CSS> <print all rendered HTML> Usage Pattern logs Packaging algorithm “Optimal” packages
Packager: models Cost/Benefit tradeoff model: To package two CSS/JS files A & B: Cost: for page requests that only uses A, we waste the bytes of B (bandwidth) Benefit: for page requests that uses both A and B: we save one round trip (latency ) Maximize “Profit” (Benefit – Cost) Future: Users with different network connections have different packaging solutions Usage Pattern logs Packaging algorithm “Optimal” packages
Packager: models Potential extensions (and trade-offs): Consider all resources used in user browsing sessions, instead of user page loads first page slower, subsequent pages faster Consider cache probability: new files change more New user slower, old users faster Consider other costs: CSS rules JS executions HTTP header overheads Usage Pattern logs Packaging algorithm “Optimal” packages
Packager: algorithm A classic optimization problem: Algorithms: Greedy algorithm Simulated Annealing Clustering algorithms Trade-off between offline computation cost and accuracy: Greedy is good enough for us Usage Pattern logs Packaging algorithm “Optimal” packages
Adaptive Performance Optimization: more Trace-based analysis for: ,[object Object]
Progressive rendering for common JS/CSS/Images
Prioritization of resource delivery,[object Object]
Packager: Deployment Fully deployed since Nov 2008 ,[object Object]
Javascript and CSS packaging only (image soon)
Efficiency monitors: size of wasted JS/CSS bytes; JS/CSS pkg numbers,[object Object]
Packager: scalable with development Nov 2008 => May 2009 ,[object Object]
 'js/lib/ui/timeeditor.js’,
 'resume/js/resumepro.js’,
 'resume/js/resumesection.js’,[object Object]

More Related Content

What's hot (6)

Dynamic Rendering - is this really an SEO silver bullet? SMX WEST
Dynamic Rendering - is this really an SEO silver bullet? SMX WESTDynamic Rendering - is this really an SEO silver bullet? SMX WEST
Dynamic Rendering - is this really an SEO silver bullet? SMX WEST
 
Imagetag
ImagetagImagetag
Imagetag
 
JavaScript Tips & Tricks 2018 - SMX East
JavaScript Tips & Tricks 2018 - SMX EastJavaScript Tips & Tricks 2018 - SMX East
JavaScript Tips & Tricks 2018 - SMX East
 
HTML5 - One spec to rule them all
HTML5 - One spec to rule them allHTML5 - One spec to rule them all
HTML5 - One spec to rule them all
 
The New Renaissance of JavaScript - SMX London 2019
The New Renaissance of JavaScript - SMX London 2019The New Renaissance of JavaScript - SMX London 2019
The New Renaissance of JavaScript - SMX London 2019
 
PHP and CSS
PHP and CSSPHP and CSS
PHP and CSS
 

Viewers also liked

09 10 Energy Sources Andie
09 10 Energy Sources Andie09 10 Energy Sources Andie
09 10 Energy Sources Andie
charsh
 
Beginningyearparentpacket
BeginningyearparentpacketBeginningyearparentpacket
Beginningyearparentpacket
ozarktigertalk
 
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
RCSLLC
 
201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding
Wout Visser
 
Patrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae SlidesPatrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae Slides
Ajax Experience 2009
 

Viewers also liked (20)

09 10 Energy Sources Andie
09 10 Energy Sources Andie09 10 Energy Sources Andie
09 10 Energy Sources Andie
 
Drive (conduzir) sung The Cars PPS by Sonia Medeiros
Drive (conduzir) sung The Cars PPS by Sonia Medeiros   Drive (conduzir) sung The Cars PPS by Sonia Medeiros
Drive (conduzir) sung The Cars PPS by Sonia Medeiros
 
Eklavya gold v1.2
Eklavya gold v1.2Eklavya gold v1.2
Eklavya gold v1.2
 
Take my breath away - Roxette PPS by Sonia Medeiros
Take my breath away - Roxette PPS by Sonia Medeiros Take my breath away - Roxette PPS by Sonia Medeiros
Take my breath away - Roxette PPS by Sonia Medeiros
 
150 Slater Sublease Flyer
150 Slater Sublease Flyer150 Slater Sublease Flyer
150 Slater Sublease Flyer
 
Smoothwall presentation feb open day
Smoothwall presentation feb open daySmoothwall presentation feb open day
Smoothwall presentation feb open day
 
Beginningyearparentpacket
BeginningyearparentpacketBeginningyearparentpacket
Beginningyearparentpacket
 
To be present1 eso
To be present1 esoTo be present1 eso
To be present1 eso
 
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
Upgrading Share Point Portal Server 2003 Customizations To Share Point Server...
 
Work, home or work from home?
Work, home or work from home?Work, home or work from home?
Work, home or work from home?
 
Transmedia and the Independent Filmmaker
Transmedia and the Independent FilmmakerTransmedia and the Independent Filmmaker
Transmedia and the Independent Filmmaker
 
Online Marketing Tips
Online Marketing TipsOnline Marketing Tips
Online Marketing Tips
 
201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding201104.wv.uvacollegepeacebuilding
201104.wv.uvacollegepeacebuilding
 
Patrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae SlidesPatrick Lightbody Presentation Tae Slides
Patrick Lightbody Presentation Tae Slides
 
Why we need sports character development
Why we need sports character developmentWhy we need sports character development
Why we need sports character development
 
2020 Social Decoding Employee Communities
2020 Social Decoding Employee Communities2020 Social Decoding Employee Communities
2020 Social Decoding Employee Communities
 
Comparative and Superlative - as-as 4 ESO
Comparative and Superlative - as-as 4 ESOComparative and Superlative - as-as 4 ESO
Comparative and Superlative - as-as 4 ESO
 
What I Learned About Linkedin
What I Learned About LinkedinWhat I Learned About Linkedin
What I Learned About Linkedin
 
Eprd easy-community garden
Eprd easy-community gardenEprd easy-community garden
Eprd easy-community garden
 
On the streets of Bay Ridge
On the streets of Bay RidgeOn the streets of Bay Ridge
On the streets of Bay Ridge
 

Similar to David Wei And Changhao Jiang Presentation

What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
Lisa Adkins
 
Lecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITPLecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITP
yucefmerhi
 
Peter lubbers-html5-overview-sf-dev-conf-2011
Peter lubbers-html5-overview-sf-dev-conf-2011Peter lubbers-html5-overview-sf-dev-conf-2011
Peter lubbers-html5-overview-sf-dev-conf-2011
Peter Lubbers
 
Lecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITPLecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITP
yucefmerhi
 

Similar to David Wei And Changhao Jiang Presentation (20)

HTML5 Overview
HTML5 OverviewHTML5 Overview
HTML5 Overview
 
What I brought back from Austin
What I brought back from AustinWhat I brought back from Austin
What I brought back from Austin
 
Microsoft and jQuery: A true love story - templating and other contributions
Microsoft and jQuery: A true love story - templating and other contributionsMicrosoft and jQuery: A true love story - templating and other contributions
Microsoft and jQuery: A true love story - templating and other contributions
 
Lecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITPLecture 6 - Comm Lab: Web @ ITP
Lecture 6 - Comm Lab: Web @ ITP
 
HTML5 - techMaine Presentation 5/18/09
HTML5 - techMaine Presentation 5/18/09HTML5 - techMaine Presentation 5/18/09
HTML5 - techMaine Presentation 5/18/09
 
Font End Development + Automation with Django
Font End Development + Automation with DjangoFont End Development + Automation with Django
Font End Development + Automation with Django
 
Shifting Gears
Shifting GearsShifting Gears
Shifting Gears
 
HTML5
HTML5HTML5
HTML5
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
HTML5 Fundamentals
HTML5 FundamentalsHTML5 Fundamentals
HTML5 Fundamentals
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
RDFa: The Semantic Web's Missing Link
RDFa: The Semantic Web's Missing LinkRDFa: The Semantic Web's Missing Link
RDFa: The Semantic Web's Missing Link
 
HTML5 with examples
HTML5 with examplesHTML5 with examples
HTML5 with examples
 
Html5
Html5Html5
Html5
 
Peter lubbers-html5-overview-sf-dev-conf-2011
Peter lubbers-html5-overview-sf-dev-conf-2011Peter lubbers-html5-overview-sf-dev-conf-2011
Peter lubbers-html5-overview-sf-dev-conf-2011
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
Fast Loading JavaScript
Fast Loading JavaScriptFast Loading JavaScript
Fast Loading JavaScript
 
Lecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITPLecture 1 - Comm Lab: Web @ ITP
Lecture 1 - Comm Lab: Web @ ITP
 
Html5
Html5Html5
Html5
 
WordPress Development Confoo 2010
WordPress Development Confoo 2010WordPress Development Confoo 2010
WordPress Development Confoo 2010
 

More from Ajax Experience 2009

Adam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAdam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And Mashups
Ajax Experience 2009
 
Eric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing ConsiderationsEric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing Considerations
Ajax Experience 2009
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Ajax Experience 2009
 
Jason.O Keefe.Genuitec.Presentation.Final
Jason.O Keefe.Genuitec.Presentation.FinalJason.O Keefe.Genuitec.Presentation.Final
Jason.O Keefe.Genuitec.Presentation.Final
Ajax Experience 2009
 
Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]
Ajax Experience 2009
 
Scott Isaacs Presentationajaxexperience (Final)
Scott Isaacs Presentationajaxexperience (Final)Scott Isaacs Presentationajaxexperience (Final)
Scott Isaacs Presentationajaxexperience (Final)
Ajax Experience 2009
 
Sergey Ilinsky Presentation Ample Sdk
Sergey Ilinsky Presentation Ample SdkSergey Ilinsky Presentation Ample Sdk
Sergey Ilinsky Presentation Ample Sdk
Ajax Experience 2009
 
Chris Williams Presentation Dissident
Chris Williams Presentation DissidentChris Williams Presentation Dissident
Chris Williams Presentation Dissident
Ajax Experience 2009
 
Ted Husted Presentation Testing Ajax Applications Ae2009
Ted Husted Presentation Testing Ajax Applications Ae2009Ted Husted Presentation Testing Ajax Applications Ae2009
Ted Husted Presentation Testing Ajax Applications Ae2009
Ajax Experience 2009
 
Ted Husted Api Doc Smackdown Ae2009
Ted Husted Api Doc Smackdown Ae2009Ted Husted Api Doc Smackdown Ae2009
Ted Husted Api Doc Smackdown Ae2009
Ajax Experience 2009
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
Ajax Experience 2009
 
Jon Trelfa Presentation From Desktop To Web – Getting It Right
Jon Trelfa Presentation From Desktop To Web – Getting It RightJon Trelfa Presentation From Desktop To Web – Getting It Right
Jon Trelfa Presentation From Desktop To Web – Getting It Right
Ajax Experience 2009
 
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsDouglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
Ajax Experience 2009
 
Douglas Crockford Presentation Jsonsaga
Douglas Crockford Presentation JsonsagaDouglas Crockford Presentation Jsonsaga
Douglas Crockford Presentation Jsonsaga
Ajax Experience 2009
 
Brian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone GapBrian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone Gap
Ajax Experience 2009
 
Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009
Ajax Experience 2009
 

More from Ajax Experience 2009 (20)

Adam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And MashupsAdam Peller Interoperable Ajax Tools And Mashups
Adam Peller Interoperable Ajax Tools And Mashups
 
Eric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing ConsiderationsEric Beland Ajax Load Testing Considerations
Eric Beland Ajax Load Testing Considerations
 
Chanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling PagecacheChanhao Jiang And David Wei Presentation Quickling Pagecache
Chanhao Jiang And David Wei Presentation Quickling Pagecache
 
Jason.O Keefe.Genuitec.Presentation.Final
Jason.O Keefe.Genuitec.Presentation.FinalJason.O Keefe.Genuitec.Presentation.Final
Jason.O Keefe.Genuitec.Presentation.Final
 
Jenny Donnelly
Jenny DonnellyJenny Donnelly
Jenny Donnelly
 
Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]Colin Clark Accessible U Is With J Query And Infusion[1]
Colin Clark Accessible U Is With J Query And Infusion[1]
 
Scott Isaacs Presentationajaxexperience (Final)
Scott Isaacs Presentationajaxexperience (Final)Scott Isaacs Presentationajaxexperience (Final)
Scott Isaacs Presentationajaxexperience (Final)
 
Sergey Ilinsky Presentation Ample Sdk
Sergey Ilinsky Presentation Ample SdkSergey Ilinsky Presentation Ample Sdk
Sergey Ilinsky Presentation Ample Sdk
 
Chris Williams Presentation Dissident
Chris Williams Presentation DissidentChris Williams Presentation Dissident
Chris Williams Presentation Dissident
 
Andrew Sutherland Presentation
Andrew Sutherland PresentationAndrew Sutherland Presentation
Andrew Sutherland Presentation
 
Bill Scott Presentation
Bill Scott PresentationBill Scott Presentation
Bill Scott Presentation
 
Ted Husted Presentation Testing Ajax Applications Ae2009
Ted Husted Presentation Testing Ajax Applications Ae2009Ted Husted Presentation Testing Ajax Applications Ae2009
Ted Husted Presentation Testing Ajax Applications Ae2009
 
Ted Husted Api Doc Smackdown Ae2009
Ted Husted Api Doc Smackdown Ae2009Ted Husted Api Doc Smackdown Ae2009
Ted Husted Api Doc Smackdown Ae2009
 
Laurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus PresentationLaurens Van Den Oever Xopus Presentation
Laurens Van Den Oever Xopus Presentation
 
Jon Trelfa Presentation From Desktop To Web – Getting It Right
Jon Trelfa Presentation From Desktop To Web – Getting It RightJon Trelfa Presentation From Desktop To Web – Getting It Right
Jon Trelfa Presentation From Desktop To Web – Getting It Right
 
Joe Mc Cann Tae Aria Presentation
Joe Mc Cann Tae Aria PresentationJoe Mc Cann Tae Aria Presentation
Joe Mc Cann Tae Aria Presentation
 
Douglas Crockford Presentation Goodparts
Douglas Crockford Presentation GoodpartsDouglas Crockford Presentation Goodparts
Douglas Crockford Presentation Goodparts
 
Douglas Crockford Presentation Jsonsaga
Douglas Crockford Presentation JsonsagaDouglas Crockford Presentation Jsonsaga
Douglas Crockford Presentation Jsonsaga
 
Brian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone GapBrian Le Roux Presentation Introducing Phone Gap
Brian Le Roux Presentation Introducing Phone Gap
 
Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009Ted Husted Presentation Testing The Testers Ae2009
Ted Husted Presentation Testing The Testers Ae2009
 

Recently uploaded

Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
baharayali
 
Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...
Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...
Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...
baharayali
 
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
No -1 Astrologer ,Amil Baba In Australia | Uk | Usa | Canada | Pakistan
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
baharayali
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
baharayali
 

Recently uploaded (20)

Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
Top Kala Jadu, Black magic expert in Faisalabad and Kala ilam specialist in S...
 
Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...
Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...
Famous Kala Jadu, Black magic specialist in Lahore and Kala ilam expert in ka...
 
Study of the Psalms Chapter 1 verse 3 - wanderean
Study of the Psalms Chapter 1 verse 3 - wandereanStudy of the Psalms Chapter 1 verse 3 - wanderean
Study of the Psalms Chapter 1 verse 3 - wanderean
 
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
Famous No -1 amil baba in Hyderabad ! Best No _ Astrologer in Pakistan, UK, A...
 
Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24Deerfoot Church of Christ Bulletin 4 28 24
Deerfoot Church of Christ Bulletin 4 28 24
 
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...Authentic Black magic, Kala ilam expert in UAE  and Kala ilam specialist in S...
Authentic Black magic, Kala ilam expert in UAE and Kala ilam specialist in S...
 
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
+92343-7800299 No.1 Amil baba in Pakistan amil baba in Lahore amil baba in Ka...
 
St. Louise de Marillac and Poor Children
St. Louise de Marillac and Poor ChildrenSt. Louise de Marillac and Poor Children
St. Louise de Marillac and Poor Children
 
Hire Best Next Js Developer For Your Project
Hire Best Next Js Developer For Your ProjectHire Best Next Js Developer For Your Project
Hire Best Next Js Developer For Your Project
 
Sabbath Cooking seventh-day sabbath.docx
Sabbath Cooking seventh-day sabbath.docxSabbath Cooking seventh-day sabbath.docx
Sabbath Cooking seventh-day sabbath.docx
 
Genesis 1:7 || Meditate the Scripture daily verse by verse
Genesis 1:7  ||  Meditate the Scripture daily verse by verseGenesis 1:7  ||  Meditate the Scripture daily verse by verse
Genesis 1:7 || Meditate the Scripture daily verse by verse
 
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
Famous Kala Jadu, Black magic expert in UK and Kala ilam expert in Saudi Arab...
 
Genesis 1:10 || Meditate the Scripture daily verse by verse
Genesis 1:10  ||  Meditate the Scripture daily verse by verseGenesis 1:10  ||  Meditate the Scripture daily verse by verse
Genesis 1:10 || Meditate the Scripture daily verse by verse
 
Genesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bitGenesis 1:5 - Meditate the Scripture Daily bit by bit
Genesis 1:5 - Meditate the Scripture Daily bit by bit
 
The_Chronological_Life_of_Christ_Part_99_Words_and_Works
The_Chronological_Life_of_Christ_Part_99_Words_and_WorksThe_Chronological_Life_of_Christ_Part_99_Words_and_Works
The_Chronological_Life_of_Christ_Part_99_Words_and_Works
 
St. Louise de Marillac and Abandoned Children
St. Louise de Marillac and Abandoned ChildrenSt. Louise de Marillac and Abandoned Children
St. Louise de Marillac and Abandoned Children
 
English - The Forgotten Books of Eden.pdf
English - The Forgotten Books of Eden.pdfEnglish - The Forgotten Books of Eden.pdf
English - The Forgotten Books of Eden.pdf
 
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verifiedConnaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
Connaught Place, Delhi Call girls :8448380779 Model Escorts | 100% verified
 
St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024St. John's Church Parish Magazine - May 2024
St. John's Church Parish Magazine - May 2024
 
The Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docxThe Revelation Chapter 4 Working Copy.docx
The Revelation Chapter 4 Working Copy.docx
 

David Wei And Changhao Jiang Presentation

  • 1.
  • 2. Adaptive Static Resource Optimization AJAXian Conference 2009 Sep 15, 2009 Boston, MA David Wei and ChanghaoJiang
  • 4. Optimization has to be adaptive!
  • 5.
  • 7.
  • 8. Why we need adaptive packaging? Day 2: Some smart engineers run YSlow and thinks… <Print css tag for feature A> <Print css tag for feature B> <Print css tag for feature C> <print HTML of feature A> <print HTML of feature B> <print HTML of feature C> … “A & B & C are always used; let’s package them together!”
  • 9. Why we need adaptive packaging? Day 2: Awesome! <Print css tag for feature A&B&C> <print HTML of feature A> <print HTML of feature B> <print HTML of feature C> …
  • 10. Why we need adaptive packaging? Day 3: feature C evolves… <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> If (users_signup_for_C()) { <print HTML of feature C>} …
  • 11. Why we need adaptive packaging? Day 3: <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> If (users_signup_for_C()) { <print HTML of feature C>} … A&B are always used, while C is not. ..
  • 12. Why we need adaptive packaging? Day 4: feature C is deprecated <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> // no one uses C { <print HTML of feature C>} …
  • 13. Why we need adaptive packaging? Day 4: we start to send unused bits <Print css tag for feature A & B & C> <print HTML of feature A> <print HTML of feature B> // no one uses C { <print HTML of feature C>} … It is hard to remember we should remove C here.
  • 14. Why we need adaptive packaging? One months later… <Print css tag for feature A & B & C & D & E & F & G…> if (F is used) <print HTML of feature F> <print HTML of feature G> if (F is not used) { <print HTML of feature E>} … Thousands of dead CSS rules in the package.
  • 15.
  • 17.
  • 18. Requirement declaration: lives with HTML generation
  • 19.
  • 20. Static Resource Management Separate Declaration from actual Delivery Back to Day 1: require_static(A_css); <render HTML of feature A> require_static(B_css); <render HTML of feature B> require_static(C_css);<render HTML of feature C> <deliver all required CSS> <print all rendered HTML> Requirement Declaration lives with HTML Global Optimization on Delivery
  • 21. Offline analysis Packager: Global JS/CSS Optimization Online process require_static(A_css); <render HTML of feature A> require_static(B_css); <render HTML of feature B> require_static(C_css); <render HTML of feature C> <deliver all required CSS> <print all rendered HTML> Usage Pattern logs Packaging algorithm “Optimal” packages
  • 22. Packager: models Cost/Benefit tradeoff model: To package two CSS/JS files A & B: Cost: for page requests that only uses A, we waste the bytes of B (bandwidth) Benefit: for page requests that uses both A and B: we save one round trip (latency ) Maximize “Profit” (Benefit – Cost) Future: Users with different network connections have different packaging solutions Usage Pattern logs Packaging algorithm “Optimal” packages
  • 23. Packager: models Potential extensions (and trade-offs): Consider all resources used in user browsing sessions, instead of user page loads first page slower, subsequent pages faster Consider cache probability: new files change more New user slower, old users faster Consider other costs: CSS rules JS executions HTTP header overheads Usage Pattern logs Packaging algorithm “Optimal” packages
  • 24. Packager: algorithm A classic optimization problem: Algorithms: Greedy algorithm Simulated Annealing Clustering algorithms Trade-off between offline computation cost and accuracy: Greedy is good enough for us Usage Pattern logs Packaging algorithm “Optimal” packages
  • 25.
  • 26. Progressive rendering for common JS/CSS/Images
  • 27.
  • 28.
  • 29. Javascript and CSS packaging only (image soon)
  • 30.
  • 31.
  • 34.
  • 35.
  • 36. Human errors are unavoidable Automatic analysis is preferable: require_static(A_css); //forgot to remove the require_static require_static(B_css); <render HTML of feature B> require_static(C_css); <render HTML of feature C> <deliver all required CSS> <print all rendered HTML>
  • 37.
  • 38.

Editor's Notes

  1. Deep integration: Each facebook home page is customized for a particular user, with features developed by many teams– some of them are applications by 3rd party developers, some of them are internal facebook feature – depending on the users’ adoption on the features and applications.Viral Adoption: we don’t know what will be the most popular Facebook feature tomorrowAgile development: our codebase change by hours, released weekly
  2. Deep Integration: each page has many features;Viral adoption: usage pattern changes quicklyAgile development: feature changes fast
  3. Current Assumptions: bandwidth = 1Mbps and latency = 40ms
  4. First thing first: site speed matters.
  5. The # of JS files are increased by 60%, the byte sites are increased by 30%. The # of pkg sent is halved, the byte size is 10% less.find | grep -v .svn | grep -v intern | grep .css$ -cfind | grep -v .svn | grep -v intern | grep .css$ | xargs cat > /tmp/dwei_2008
  6. Developers think that timeeditor.js is a library file – in fact, it is only used in a single production page (career)On the other hand, it turns out that “resume“ function is almost always used in career page, too.
  7. CSS is a similar story
  8. The same trace-base analysis techniques can be use in image spriting too:
  9. The answer is…In retrospection, this is pretty straight forward.
  10. [devrs007] images > find | grep -vsvn -c3407