SlideShare uma empresa Scribd logo
1 de 18
Baixar para ler offline
Caching for the Mobile Web and
Macklemore's Thrift Shop
by @rubikzube
Sometimes I make poor decisions
The rest of the time
● I work on shutterstock.mobi
● Eventually needs to handle 100k
visits per day around the world
● Uses a handful of web servers
● That means serious caching
Caching means better performance
for users and servers
1. Make fewer requests
2. Fetch smaller resources
3. Travel shorter distances
4. Use generic pages that are cacheable
Don’t kill the servers
Do serve fast pages
Start by hunting for easy wins
● Use yslow and pagespeed to find ways to make fewer
requests and to fetch smaller resources
● Try to score in the high 80s - low 90s
● Minifying, concatenating, and gzipping is only the
first step
I’m, I’m hunting,
looking for a come up,
this is f*cking awesome
HTTP basics are important too
● HTTP is a core protocol of the internet
● HTTP headers determine how content will be cached
on the browser AND along the network
● If HTTP headers are set properly the browser will
travel shorter distances
Imma take your
grandpa’s style
Caching involves more than
a browser and a server
Reverse
Proxies
Web
Servers
Wireless
Towers
Optional
CDNs
Internet
Routers
Mobile
Device w/
Radio
Web
Browser
billions millions 100’s 100k’s a few handfula few
Peep game, come take a look
through my telescope
If headers are set correctly,
the network serves the pages
This isn’t a beer or basketball
Less hops is better
Reverse
Proxies
Web
Servers
Wireless
Towers
Optional
CDNs
Internet
Routers
Mobile
Device w/
Radio
Web
Browser
billions millions 100’s 100k’s a few handfula few
A brief example
● Cache-Control: public, max-age=31536000
● Date: Tue, 17 Sep 2013 01:59:24 GMT
● Expires: Wed, 17 Sep 2014 01:59:24 GMT
● Server: nginx
● ETag: "151472-1379361363000"
Savin' my money and I'm hella
happy that's a bargain, b*tch
Keep pages generic where possible
● Separate user-specific content from public pages at
the request level to make pages generic and
cacheable
Dressed in all pink
except my gator shoes,
those are green
Generic
User-Specific
The overall effect
Generic pages loaded from the network.
User-specific content follows from the
web server via AJAX.
Reverse
Proxies
Web
Servers
Wireless
Towers
Optional
CDNs
Internet
Routers
Mobile
Device w/
Radio
Web
Browser
billions millions 100’s 100k’s a few handfula few
● Any request caches generic pages in the network,
creating a pull effect
● The more users there are, the faster the site appears
to respond
● For layering in user-specific content via AJAX
○ Use different domains
○ Use the same domain and scope user-specific content (and
cookies) to a subdirectory
More generic pages means more caching
Don’t send cookies with generic pages.
EVER.
● Sending cookies with generic pages signals that the
response is not generic and should not be cached
Having the same one as six other people
in this club is a hella don’t
Everyone go visit TMZ right now
Raise your hand if you can identify
why it’s slow in this diagram
Reverse
Proxies
Web
Servers
Wireless
Towers
Optional
CDNs
Internet
Routers
Mobile
Device w/
Radio
Web
Browser
billions millions 100’s 100k’s a few handfula few
If the first page load is slow in the the forest,
and no one is around
● On first page load, there are too many variations in
mobile network connectivity to perceive whether the
site itself is slow
● I submit don’t optimize the first page load
● I submit the most important page load is the second
What you know about rockin' a wolf on your noggin?
What you knowin' about wearin' a fur fox skin?
Optimize for the second load
● Serve all JS/CSS/Icons for the site on every page with a
year-long cache expiry
● First Load: 297.3K 16 requests
● Homepage: 7.7K 1 request
● Login: 5.4K 1 request
● Search: 28.0K 1 request + images
As for performance impact:
Browsers get better all the time,
the network doesn’t
Questions?
Special shout out to @ShutterTech!
Keepin’ me honest since 2011

Mais conteúdo relacionado

Mais procurados (6)

Martin Splitt "A short history of the web"
Martin Splitt "A short history of the web"Martin Splitt "A short history of the web"
Martin Splitt "A short history of the web"
 
CouchDB: replicated data store for distributed proxy server
CouchDB: replicated data store for distributed proxy serverCouchDB: replicated data store for distributed proxy server
CouchDB: replicated data store for distributed proxy server
 
[SoftServe IT Academy] - JavaScript Storages
[SoftServe IT Academy] - JavaScript Storages[SoftServe IT Academy] - JavaScript Storages
[SoftServe IT Academy] - JavaScript Storages
 
JMeter performance and scalability in Moodle Montana Moot 2014
JMeter performance and scalability in Moodle Montana Moot 2014JMeter performance and scalability in Moodle Montana Moot 2014
JMeter performance and scalability in Moodle Montana Moot 2014
 
Presentation slam the server with jMeter
Presentation slam the server with jMeterPresentation slam the server with jMeter
Presentation slam the server with jMeter
 
Caching in WordPress
Caching in WordPressCaching in WordPress
Caching in WordPress
 

Destaque

Commercial Portfolio
Commercial PortfolioCommercial Portfolio
Commercial Portfolio
knphoto
 
Residential Portfolio
Residential PortfolioResidential Portfolio
Residential Portfolio
knphoto
 
Distributed scrum
Distributed scrumDistributed scrum
Distributed scrum
Jozua Velle
 
Looking at geo tagging
Looking at geo taggingLooking at geo tagging
Looking at geo tagging
raamt
 
Bouwplaatsveiligheid
BouwplaatsveiligheidBouwplaatsveiligheid
Bouwplaatsveiligheid
smid_jan
 
GIORNO 12
GIORNO 12GIORNO 12
GIORNO 12
4246sud
 
giorno 6
giorno 6giorno 6
giorno 6
4246sud
 
giorno 5
giorno 5giorno 5
giorno 5
4246sud
 

Destaque (20)

Western Art & Architecture Summer/Fall 2011
Western Art & Architecture Summer/Fall 2011Western Art & Architecture Summer/Fall 2011
Western Art & Architecture Summer/Fall 2011
 
Commercial Portfolio
Commercial PortfolioCommercial Portfolio
Commercial Portfolio
 
Cowboys & Indians Magazine
Cowboys & Indians MagazineCowboys & Indians Magazine
Cowboys & Indians Magazine
 
Cabin in Big Sky
Cabin in Big SkyCabin in Big Sky
Cabin in Big Sky
 
Log Home Living
Log Home LivingLog Home Living
Log Home Living
 
What's new in Team Foundation Server 2013
What's new in Team Foundation Server 2013What's new in Team Foundation Server 2013
What's new in Team Foundation Server 2013
 
Big Sky Journal HOME 2009
Big Sky Journal HOME 2009Big Sky Journal HOME 2009
Big Sky Journal HOME 2009
 
Residential Portfolio
Residential PortfolioResidential Portfolio
Residential Portfolio
 
Distributed scrum
Distributed scrumDistributed scrum
Distributed scrum
 
Brexit 24062016 jp
Brexit 24062016 jpBrexit 24062016 jp
Brexit 24062016 jp
 
Hecho relevante inkemia
Hecho relevante inkemiaHecho relevante inkemia
Hecho relevante inkemia
 
Looking at geo tagging
Looking at geo taggingLooking at geo tagging
Looking at geo tagging
 
DevOps
DevOpsDevOps
DevOps
 
BHV
BHVBHV
BHV
 
Enough with the Ninja Shit
Enough with the Ninja ShitEnough with the Ninja Shit
Enough with the Ninja Shit
 
Bouwplaatsveiligheid
BouwplaatsveiligheidBouwplaatsveiligheid
Bouwplaatsveiligheid
 
GIORNO 12
GIORNO 12GIORNO 12
GIORNO 12
 
giorno 6
giorno 6giorno 6
giorno 6
 
Application Lifecycle Management with Team Foundation Server
Application Lifecycle Management with Team Foundation ServerApplication Lifecycle Management with Team Foundation Server
Application Lifecycle Management with Team Foundation Server
 
giorno 5
giorno 5giorno 5
giorno 5
 

Semelhante a Caching for the Mobile Web and Macklemore's Thrift Shop

Website Performance
Website PerformanceWebsite Performance
Website Performance
Hugo Fonseca
 
Geographic Distribution for Global Web Application Performance
Geographic Distribution for Global Web Application PerformanceGeographic Distribution for Global Web Application Performance
Geographic Distribution for Global Web Application Performance
kkjjkevin03
 
Large-Scale Web Scraping: An Ultimate Guide
Large-Scale Web Scraping: An Ultimate GuideLarge-Scale Web Scraping: An Ultimate Guide
Large-Scale Web Scraping: An Ultimate Guide
Data Scraping and Data Extraction
 
NU Web Steering Committee - Oct 11 - Web Performance
NU Web Steering Committee - Oct 11 - Web PerformanceNU Web Steering Committee - Oct 11 - Web Performance
NU Web Steering Committee - Oct 11 - Web Performance
Lee Roberson
 

Semelhante a Caching for the Mobile Web and Macklemore's Thrift Shop (20)

A Look at the Performance of SAP's Modern UIs
A Look at the Performance of SAP's Modern UIsA Look at the Performance of SAP's Modern UIs
A Look at the Performance of SAP's Modern UIs
 
Web performance optimization - MercadoLibre
Web performance optimization - MercadoLibreWeb performance optimization - MercadoLibre
Web performance optimization - MercadoLibre
 
Website Performance
Website PerformanceWebsite Performance
Website Performance
 
Fine tuning Hybrid Mobile App
Fine tuning Hybrid Mobile AppFine tuning Hybrid Mobile App
Fine tuning Hybrid Mobile App
 
Geographic Distribution for Global Web Application Performance
Geographic Distribution for Global Web Application PerformanceGeographic Distribution for Global Web Application Performance
Geographic Distribution for Global Web Application Performance
 
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
Web Performance in the Age of HTTP/2 - FEDay Conference, Guangzhou, China 19/...
 
20 tips for website performance
20 tips for website performance20 tips for website performance
20 tips for website performance
 
Web performance
Web performanceWeb performance
Web performance
 
PrairieDevCon 2014 - Web Doesn't Mean Slow
PrairieDevCon 2014 -  Web Doesn't Mean SlowPrairieDevCon 2014 -  Web Doesn't Mean Slow
PrairieDevCon 2014 - Web Doesn't Mean Slow
 
10 things you can do to speed up your web app today stir trek edition
10 things you can do to speed up your web app today   stir trek edition10 things you can do to speed up your web app today   stir trek edition
10 things you can do to speed up your web app today stir trek edition
 
Web performance optimization for modern web applications
Web performance optimization for modern web applicationsWeb performance optimization for modern web applications
Web performance optimization for modern web applications
 
Improving frontend performance
Improving frontend performanceImproving frontend performance
Improving frontend performance
 
Breaking the Speed Limit: Faster Websites Win
Breaking the Speed Limit: Faster Websites WinBreaking the Speed Limit: Faster Websites Win
Breaking the Speed Limit: Faster Websites Win
 
Guide 4 - How To Dramatically Speed Up Your Website Using A Caching Plugin.pdf
Guide 4 - How To Dramatically Speed Up Your Website Using A Caching Plugin.pdfGuide 4 - How To Dramatically Speed Up Your Website Using A Caching Plugin.pdf
Guide 4 - How To Dramatically Speed Up Your Website Using A Caching Plugin.pdf
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
Site Speed Hacks: Open West 2015
Site Speed Hacks: Open West 2015Site Speed Hacks: Open West 2015
Site Speed Hacks: Open West 2015
 
Large-Scale Web Scraping: An Ultimate Guide
Large-Scale Web Scraping: An Ultimate GuideLarge-Scale Web Scraping: An Ultimate Guide
Large-Scale Web Scraping: An Ultimate Guide
 
NU Web Steering Committee - Oct 11 - Web Performance
NU Web Steering Committee - Oct 11 - Web PerformanceNU Web Steering Committee - Oct 11 - Web Performance
NU Web Steering Committee - Oct 11 - Web Performance
 
Boston Web Performance Meetup: The Render Chain and You
Boston Web Performance Meetup: The Render Chain and YouBoston Web Performance Meetup: The Render Chain and You
Boston Web Performance Meetup: The Render Chain and You
 
Make Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speedMake Drupal Run Fast - increase page load speed
Make Drupal Run Fast - increase page load speed
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 

Caching for the Mobile Web and Macklemore's Thrift Shop

  • 1. Caching for the Mobile Web and Macklemore's Thrift Shop by @rubikzube
  • 2. Sometimes I make poor decisions
  • 3. The rest of the time ● I work on shutterstock.mobi ● Eventually needs to handle 100k visits per day around the world ● Uses a handful of web servers ● That means serious caching
  • 4. Caching means better performance for users and servers 1. Make fewer requests 2. Fetch smaller resources 3. Travel shorter distances 4. Use generic pages that are cacheable Don’t kill the servers Do serve fast pages
  • 5. Start by hunting for easy wins ● Use yslow and pagespeed to find ways to make fewer requests and to fetch smaller resources ● Try to score in the high 80s - low 90s ● Minifying, concatenating, and gzipping is only the first step I’m, I’m hunting, looking for a come up, this is f*cking awesome
  • 6. HTTP basics are important too ● HTTP is a core protocol of the internet ● HTTP headers determine how content will be cached on the browser AND along the network ● If HTTP headers are set properly the browser will travel shorter distances Imma take your grandpa’s style
  • 7. Caching involves more than a browser and a server Reverse Proxies Web Servers Wireless Towers Optional CDNs Internet Routers Mobile Device w/ Radio Web Browser billions millions 100’s 100k’s a few handfula few Peep game, come take a look through my telescope
  • 8. If headers are set correctly, the network serves the pages This isn’t a beer or basketball Less hops is better Reverse Proxies Web Servers Wireless Towers Optional CDNs Internet Routers Mobile Device w/ Radio Web Browser billions millions 100’s 100k’s a few handfula few
  • 9. A brief example ● Cache-Control: public, max-age=31536000 ● Date: Tue, 17 Sep 2013 01:59:24 GMT ● Expires: Wed, 17 Sep 2014 01:59:24 GMT ● Server: nginx ● ETag: "151472-1379361363000" Savin' my money and I'm hella happy that's a bargain, b*tch
  • 10. Keep pages generic where possible ● Separate user-specific content from public pages at the request level to make pages generic and cacheable Dressed in all pink except my gator shoes, those are green
  • 12. The overall effect Generic pages loaded from the network. User-specific content follows from the web server via AJAX. Reverse Proxies Web Servers Wireless Towers Optional CDNs Internet Routers Mobile Device w/ Radio Web Browser billions millions 100’s 100k’s a few handfula few
  • 13. ● Any request caches generic pages in the network, creating a pull effect ● The more users there are, the faster the site appears to respond ● For layering in user-specific content via AJAX ○ Use different domains ○ Use the same domain and scope user-specific content (and cookies) to a subdirectory More generic pages means more caching
  • 14. Don’t send cookies with generic pages. EVER. ● Sending cookies with generic pages signals that the response is not generic and should not be cached Having the same one as six other people in this club is a hella don’t
  • 15. Everyone go visit TMZ right now Raise your hand if you can identify why it’s slow in this diagram Reverse Proxies Web Servers Wireless Towers Optional CDNs Internet Routers Mobile Device w/ Radio Web Browser billions millions 100’s 100k’s a few handfula few
  • 16. If the first page load is slow in the the forest, and no one is around ● On first page load, there are too many variations in mobile network connectivity to perceive whether the site itself is slow ● I submit don’t optimize the first page load ● I submit the most important page load is the second What you know about rockin' a wolf on your noggin? What you knowin' about wearin' a fur fox skin?
  • 17. Optimize for the second load ● Serve all JS/CSS/Icons for the site on every page with a year-long cache expiry ● First Load: 297.3K 16 requests ● Homepage: 7.7K 1 request ● Login: 5.4K 1 request ● Search: 28.0K 1 request + images As for performance impact: Browsers get better all the time, the network doesn’t
  • 18. Questions? Special shout out to @ShutterTech! Keepin’ me honest since 2011