SlideShare a Scribd company logo
1 of 29
Download to read offline
@mlteal | #loopconf | 2018
The Balancing Act of
Caching in WordPress
“[Cache] rules everything around me”
@mlteal | #loopconf | 2018
Maura Teal (@mlteal)
Software Engineer at Pagely.
Previously Sr Dev at Time Inc.
Emoji and meme enthusiast:
github.com/mlteal/custom-emoji
@mlteal | #loopconf | 2018
@mlteal | #loopconf | 2018
Caching?
• Data stored “closer” to the end user*
• *or closer to where it will be utilized often
@mlteal | #loopconf | 2018
Caching?
• Object Caching (storage in memory):
• Memcached
• Redis
• …
@mlteal | #loopconf | 2018
Caching what?
• Object Caching (storage in memory):
• Memcached
• Redis
• Alternative storage mechanisms:
• Database storage (Transients)
• Custom tables/meta
• Local (browser level) storage
@mlteal | #loopconf | 2018
Data is not forever
@mlteal | #loopconf | 2018
Quick Win
*
*Basic blogs 💻
@mlteal | #loopconf | 2018
*Except logged-in content
@mlteal | #loopconf | 2018
*Except frequently-changing content
@mlteal | #loopconf | 2018
@mlteal | #loopconf | 2018
What to Cache
@mlteal | #loopconf | 2018
WP’s Caching API’s
• wp_cache_set( $key, $data, $group, $expire );
• wp_cache_get( $key, $group, $force, $found );
@mlteal | #loopconf | 2018
Transients API
• get_transient( $key );
• set_transient( $key, $value, $expires );
• delete_transient( $key );
@mlteal | #loopconf | 2018
WP’s Caching API’s
get_my_data() {

$data = get_transient( ‘my_transient_name’ );
if ( false === $data ) { // Transient was expired/hasn’t been set.
$data = fetch_my_data(); // Pull data from original source.
set_transient( ‘my_transient_name’, $data,
2 * HOUR_IN_SECONDS );
}
return $data; 

}
@mlteal | #loopconf | 2018
Do I need to cache more?
@mlteal | #loopconf | 2018
Do I need to cache more?
• Performance indicators 

(Speed, CPU & memory use)
• Traffic indicators

(Any expected upticks?)
• Use of external API’s
• Content and access goals
@mlteal | #loopconf | 2018
Do I need to cache more?
• Performance indicators 

(Speed, CPU & memory use)
@mlteal | #loopconf | 2018
Do I need to cache more?
• Traffic indicators

(Any expected upticks?)
@mlteal | #loopconf | 2018
Do I need to cache more?
• Use of external API’s
@mlteal | #loopconf | 2018
Browser Cache API
@mlteal | #loopconf | 2018
Browser Cache API
• Fully frontend-focused solution.
• Store data directly in browser's cache.
• Use sparingly. With great power…
• Depending on the API, not fully supported across
browsers.
@mlteal | #loopconf | 2018
Browser Cache API
caches.open('my-cache').then((cache) => {
  // do something with cache...
});
@mlteal | #loopconf | 2018
Browser Cache API: 

Further Reading
• https://developer.mozilla.org/en-US/docs/Web/API/
Cache
• https://developers.google.com/web/fundamentals/
instant-and-offline/web-storage/cache-api
• https://davidwalsh.name/cache
@mlteal | #loopconf | 2018
Lessons Learned at Scale
• Cache warming is real
• There is such a thing as caching too much
• Significantly reducing load is great, but still need
to handle clearing or refreshing data without
bringing the site down!
@mlteal | #loopconf | 2018
Lessons Learned at Scale
• Load test before big events
• Knowledge is power—anyone working at scale
should load test
@mlteal | #loopconf | 2018
Lessons Learned at Scale
• Expired != deleted
• Unless there’s a specific garbage collection
process in place, cached data, especially transients
in the DB, have a way of hanging around.
@mlteal | #loopconf | 2018
Lessons Learned at Scale
• Cache all you want, but you still need to write
performant code
@mlteal | #loopconf | 2018
Maura Teal
@mlteal

More Related Content

What's hot

Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...
Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...
Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...Databricks
 
With Automated ML, is Everyone an ML Engineer?
With Automated ML, is Everyone an ML Engineer?With Automated ML, is Everyone an ML Engineer?
With Automated ML, is Everyone an ML Engineer?Dan Sullivan, Ph.D.
 
High Performance Computing in web application
High Performance Computing in web applicationHigh Performance Computing in web application
High Performance Computing in web applicationreza Habibi
 
MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...
MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...
MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...MongoDB
 
Java driver for mongo db
Java driver for mongo dbJava driver for mongo db
Java driver for mongo dbAbhay Pai
 
Reporting Solution for ASP.NET Application with Telerik reporting
Reporting Solution for ASP.NET Application with Telerik reportingReporting Solution for ASP.NET Application with Telerik reporting
Reporting Solution for ASP.NET Application with Telerik reportingLohith Goudagere Nagaraj
 
It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...
It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...
It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...Shawn Jones
 
Growing with elastic search
Growing with elastic searchGrowing with elastic search
Growing with elastic searchDevi A S L
 
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...DataStax Academy
 

What's hot (11)

Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...
Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...
Zipline: Airbnb’s Machine Learning Data Management Platform with Nikhil Simha...
 
With Automated ML, is Everyone an ML Engineer?
With Automated ML, is Everyone an ML Engineer?With Automated ML, is Everyone an ML Engineer?
With Automated ML, is Everyone an ML Engineer?
 
High Performance Computing in web application
High Performance Computing in web applicationHigh Performance Computing in web application
High Performance Computing in web application
 
MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...
MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...
MongoDB .local Houston 2019: Building an IoT Streaming Analytics Platform to ...
 
intern
internintern
intern
 
Java driver for mongo db
Java driver for mongo dbJava driver for mongo db
Java driver for mongo db
 
Reporting Solution for ASP.NET Application with Telerik reporting
Reporting Solution for ASP.NET Application with Telerik reportingReporting Solution for ASP.NET Application with Telerik reporting
Reporting Solution for ASP.NET Application with Telerik reporting
 
It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...
It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...
It’s All About The Cards: Sharing on Social Media Encouraged HTML Metadata G...
 
Growing with elastic search
Growing with elastic searchGrowing with elastic search
Growing with elastic search
 
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
DataStax & O'Reilly Media: Large Scale Data Analytics with Spark and Cassandr...
 
Apache Flink
Apache FlinkApache Flink
Apache Flink
 

Similar to Balancing Act of Caching LoopConf 2018

Building CI from scratch
Building CI from scratchBuilding CI from scratch
Building CI from scratchArtem Nikitin
 
Max Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based Websites
Max Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based WebsitesMax Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based Websites
Max Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based WebsitesMax Prin
 
TechSEO Boost 2017: SEO Best Practices for JavaScript T-Based Websites
TechSEO Boost 2017: SEO Best Practices for JavaScript T-Based WebsitesTechSEO Boost 2017: SEO Best Practices for JavaScript T-Based Websites
TechSEO Boost 2017: SEO Best Practices for JavaScript T-Based WebsitesCatalyst
 
from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018Chun-Yu Tseng
 
Polymer & PWA: Understanding the “why”
Polymer & PWA: Understanding the “why”Polymer & PWA: Understanding the “why”
Polymer & PWA: Understanding the “why”Ashrith Kulai
 
Techniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudTechniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudAkshay Mathur
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtNick Santamaria
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Jeremy Likness
 
EM12c: Capacity Planning with OEM Metrics
EM12c: Capacity Planning with OEM MetricsEM12c: Capacity Planning with OEM Metrics
EM12c: Capacity Planning with OEM MetricsMaaz Anjum
 
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...DataKitchen
 
In-Memory Stream Processing with Hazelcast Jet @MorningAtLohika
In-Memory Stream Processing with Hazelcast Jet @MorningAtLohikaIn-Memory Stream Processing with Hazelcast Jet @MorningAtLohika
In-Memory Stream Processing with Hazelcast Jet @MorningAtLohikaNazarii Cherkas
 
Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Mikael Svenson
 
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...Tieturi Oy
 
aip_developer_overview_icar_2014
aip_developer_overview_icar_2014aip_developer_overview_icar_2014
aip_developer_overview_icar_2014Matthew Vaughn
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nlbartzon
 

Similar to Balancing Act of Caching LoopConf 2018 (20)

Building CI from scratch
Building CI from scratchBuilding CI from scratch
Building CI from scratch
 
Max Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based Websites
Max Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based WebsitesMax Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based Websites
Max Prin - TechSEO Boost 2017 - SEO Best Practices For JavaScript-Based Websites
 
TechSEO Boost 2017: SEO Best Practices for JavaScript T-Based Websites
TechSEO Boost 2017: SEO Best Practices for JavaScript T-Based WebsitesTechSEO Boost 2017: SEO Best Practices for JavaScript T-Based Websites
TechSEO Boost 2017: SEO Best Practices for JavaScript T-Based Websites
 
from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018from ai.backend import python @ pycontw2018
from ai.backend import python @ pycontw2018
 
Practical HTML5
Practical HTML5Practical HTML5
Practical HTML5
 
Monitoring your API
Monitoring your APIMonitoring your API
Monitoring your API
 
Polymer & PWA: Understanding the “why”
Polymer & PWA: Understanding the “why”Polymer & PWA: Understanding the “why”
Polymer & PWA: Understanding the “why”
 
Techniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloudTechniques for scaling application with security and visibility in cloud
Techniques for scaling application with security and visibility in cloud
 
DrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an AfterthoughtDrupalSouth 2015 - Performance: Not an Afterthought
DrupalSouth 2015 - Performance: Not an Afterthought
 
Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!Single Page Applications: Your Browser is the OS!
Single Page Applications: Your Browser is the OS!
 
EM12c: Capacity Planning with OEM Metrics
EM12c: Capacity Planning with OEM MetricsEM12c: Capacity Planning with OEM Metrics
EM12c: Capacity Planning with OEM Metrics
 
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
Open Data Science Conference Big Data Infrastructure – Introduction to Hadoop...
 
In-Memory Stream Processing with Hazelcast Jet @MorningAtLohika
In-Memory Stream Processing with Hazelcast Jet @MorningAtLohikaIn-Memory Stream Processing with Hazelcast Jet @MorningAtLohika
In-Memory Stream Processing with Hazelcast Jet @MorningAtLohika
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
App_Engine_PPT.ppt
App_Engine_PPT.pptApp_Engine_PPT.ppt
App_Engine_PPT.ppt
 
Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013Nsc 2013 06-17 - random rants on 2013
Nsc 2013 06-17 - random rants on 2013
 
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
 
aip_developer_overview_icar_2014
aip_developer_overview_icar_2014aip_developer_overview_icar_2014
aip_developer_overview_icar_2014
 
Web fundamentals
Web fundamentalsWeb fundamentals
Web fundamentals
 
Lessons learned while building Omroep.nl
Lessons learned while building Omroep.nlLessons learned while building Omroep.nl
Lessons learned while building Omroep.nl
 

Recently uploaded

ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 

Recently uploaded (20)

ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

Balancing Act of Caching LoopConf 2018

  • 1. @mlteal | #loopconf | 2018 The Balancing Act of Caching in WordPress “[Cache] rules everything around me”
  • 2. @mlteal | #loopconf | 2018 Maura Teal (@mlteal) Software Engineer at Pagely. Previously Sr Dev at Time Inc. Emoji and meme enthusiast: github.com/mlteal/custom-emoji
  • 4. @mlteal | #loopconf | 2018 Caching? • Data stored “closer” to the end user* • *or closer to where it will be utilized often
  • 5. @mlteal | #loopconf | 2018 Caching? • Object Caching (storage in memory): • Memcached • Redis • …
  • 6. @mlteal | #loopconf | 2018 Caching what? • Object Caching (storage in memory): • Memcached • Redis • Alternative storage mechanisms: • Database storage (Transients) • Custom tables/meta • Local (browser level) storage
  • 7. @mlteal | #loopconf | 2018 Data is not forever
  • 8. @mlteal | #loopconf | 2018 Quick Win * *Basic blogs 💻
  • 9. @mlteal | #loopconf | 2018 *Except logged-in content
  • 10. @mlteal | #loopconf | 2018 *Except frequently-changing content
  • 12. @mlteal | #loopconf | 2018 What to Cache
  • 13. @mlteal | #loopconf | 2018 WP’s Caching API’s • wp_cache_set( $key, $data, $group, $expire ); • wp_cache_get( $key, $group, $force, $found );
  • 14. @mlteal | #loopconf | 2018 Transients API • get_transient( $key ); • set_transient( $key, $value, $expires ); • delete_transient( $key );
  • 15. @mlteal | #loopconf | 2018 WP’s Caching API’s get_my_data() {
 $data = get_transient( ‘my_transient_name’ ); if ( false === $data ) { // Transient was expired/hasn’t been set. $data = fetch_my_data(); // Pull data from original source. set_transient( ‘my_transient_name’, $data, 2 * HOUR_IN_SECONDS ); } return $data; 
 }
  • 16. @mlteal | #loopconf | 2018 Do I need to cache more?
  • 17. @mlteal | #loopconf | 2018 Do I need to cache more? • Performance indicators 
 (Speed, CPU & memory use) • Traffic indicators
 (Any expected upticks?) • Use of external API’s • Content and access goals
  • 18. @mlteal | #loopconf | 2018 Do I need to cache more? • Performance indicators 
 (Speed, CPU & memory use)
  • 19. @mlteal | #loopconf | 2018 Do I need to cache more? • Traffic indicators
 (Any expected upticks?)
  • 20. @mlteal | #loopconf | 2018 Do I need to cache more? • Use of external API’s
  • 21. @mlteal | #loopconf | 2018 Browser Cache API
  • 22. @mlteal | #loopconf | 2018 Browser Cache API • Fully frontend-focused solution. • Store data directly in browser's cache. • Use sparingly. With great power… • Depending on the API, not fully supported across browsers.
  • 23. @mlteal | #loopconf | 2018 Browser Cache API caches.open('my-cache').then((cache) => {   // do something with cache... });
  • 24. @mlteal | #loopconf | 2018 Browser Cache API: 
 Further Reading • https://developer.mozilla.org/en-US/docs/Web/API/ Cache • https://developers.google.com/web/fundamentals/ instant-and-offline/web-storage/cache-api • https://davidwalsh.name/cache
  • 25. @mlteal | #loopconf | 2018 Lessons Learned at Scale • Cache warming is real • There is such a thing as caching too much • Significantly reducing load is great, but still need to handle clearing or refreshing data without bringing the site down!
  • 26. @mlteal | #loopconf | 2018 Lessons Learned at Scale • Load test before big events • Knowledge is power—anyone working at scale should load test
  • 27. @mlteal | #loopconf | 2018 Lessons Learned at Scale • Expired != deleted • Unless there’s a specific garbage collection process in place, cached data, especially transients in the DB, have a way of hanging around.
  • 28. @mlteal | #loopconf | 2018 Lessons Learned at Scale • Cache all you want, but you still need to write performant code
  • 29. @mlteal | #loopconf | 2018 Maura Teal @mlteal