SlideShare ist ein Scribd-Unternehmen logo
1 von 15
CACHING IN KENTICO
Chris Bass, Wakefly Kentico Evangelist
HOW MANY TYPES OF CACHING
ARE IN KENTICO 11?
• Output Caching (Full Page HTML Caching)
• Partial Caching (Web Part HTML Caching)
• Content Caching (Data Source Caching)
• File Caching (Attachments, Media Items, etc.)
• Page Info Caching (PageInfoProvider)
• Progressive Caching (Concurrent User Result Caching)
CACHE PRINCIPLES
• https://docs.kentico.com/display/K11/Configuring+cachi
ng
• Caching in Kentico consists primarily of trading W3WP
process memory for end-user performance. The more
you store in the process memory, the faster data will be
served to end-users, but the more RAM Kentico needs
to keep up.
• Kentico handles caching internally through a one-way
linked list of key-values. When one is cleared, anything
down the one-way path from it will be cleared as well.
• Kentico recommends using all levels of caching, setting
progressively higher timeouts as you get more granular,
so even when the full-page cache is expired, individual
content with higher tolerances for caching can still be
cached.
CACHE DEPENDENCIES
• Kentico allows creation of “Dummy Keys”
– cache entries which don’t have useful
data, but are in the key-value list, such
that editing them clears all the cache
down the line from them.
• A full list is here:
• https://docs.kentico.com/display/K11/Setti
ng+cache+dependencies
• For all of Kentico’s internal dependencies,
Kentico clears them when a change is
made through the UI or API.
• To clear your own, call
CacheHelper.TouchKey(“mycustomdata|
mycustomkey”);
• Example keys:
• node|sitename|/home
• node|sitename|/home|en-us
• node|sitename|/|childnodes
• nodes|sitename|cms.menuitem|all
• documentid|56|attachments
• cms.user|byid|53
• template|12
• cms.form|all
• mycustomdata|mycustomkey
• You’d have to touch this one yourself to
clear things that depend on it
OUTPUT CACHING
• https://docs.kentico.com/display/K11/Caching+page+output
• Caches the full, processed HTML output that is sent to the client for a page.
• To Enable: System -> Performance --> Output Caching
• “Enable output caching”
• Then you also need to enable it per-page in Properties -> Generic (or at a parent page to
inherit)
• Recommendation: Don’t set “Allow file system cache”. When the app restarts, the file
system cache is decoupled from the in-memory cache and will continue serving
outdated content, and you’ll have to manually go to System->Clear Cache in order to
fix it.
FLUSHING THE OUTPUT CACHE
• If you edit the Page (Page tab, Form tab, Properties tab) or the Template.
• If a user viewing the page performs a Postback (submitting a form, for example)
• Unsure about Ajax postbacks, but I’d suspect so.
• This makes Output cache mostly useless for pages with Forms or dynamic controls
• If any of the global output cache variables (In Settings) are touched, ALL relevant
pages’ caches are flushed.
• By placing an “Output cache dependencies” web part on a page, you can set manual
cache dependencies per page.
• Manually in the CMS Desk (System -> Clear Cache) or restarting IIS
OUTPUT CACHING: CACHE VARIABLES
• https://docs.kentico.com/display/K11/Caching+page+output#Cachingpageoutput-Cachingmultipleoutputversionsofpages
• Cache Variables let you globally dictate keys on which Kentico will split a page’s output cache.
• You can enable or disable separate output caches for:
• username - every logged in user (public users share the same output cache).
• sitename - every site in the system (leave checked unless your sites all have identical content on pages with the same path).
• lang - each language version of pages.
• browser - different types of web browsers detected by Kentico.
• cookielevel - the cookie level preferences of visitors.
• deviceprofile - the device profiles detected for visitors.
• domain - the website domain name (check to disable output cache sharing between different domain aliases of sites).
• viewmode - the page view modes used by Kentico, such as design, edit, preview or live site. Currently, the system only uses
caching for the live site view mode, so I believe this cache variable is unused.
• The output cache always creates separate cache items based on the:
• Page path (including the virtual directory and extension)
• Protocol in the request URL
OUTPUT CACHING: SUBSTITUTION MACROS
• https://docs.kentico.com/display/K11/Using+output+cache+substitutions
• Even when cached, you can set specific custom Macro methods to be
executable every page load.
• To do so, create a Module file in App_Code, and create a single macro-
parsing method that attaches to the
ResponseOutputFilter.OnResolveSubstitution event (using OnInit).
• The method to the right would handle the {~ TimeStamp ~} substitution
macro.
• Using this substitution macro would resolve with the current time, even
if the page was otherwise cached. If you just did a standard macro, like
{% DateTime.Now %}, it would display the timestamp as of when the
page was first cached.
private void ResolveCustomOutputSubstitutions(object sender,
SubstitutionEventArgs e)
{
// Checks that the substitution expression is not resolved yet
if (!e.Match)
{
// Branches according to the expression text of the substitution
macro
// You can define any number of substitution macros by adding
further cases
switch (e.Expression.ToLower())
{
// Handles the {~TimeStamp~} substitution macro
case "timestamp":
// Flags the substitution expression as resolved
e.Match = true;
// Returns the current time as the result of the substitution
e.Result = DateTime.Now.ToString();
break;
}
}
PARTIAL CACHING
• When you want to cache parts of a page, but not all of it, as full HTML output, you can cache individual
web parts.
• Other good uses are for master page content, or want to use different cache intervals or dependencies
that are different than the full-page cache.
• Similar to full-page caching, you need to enable it in Settings -> Performance and then configure it on the
web part instance (Performance category).
• Cache is cleared:
• When the properties of the web part are configured.
• On Postback on a page with the web part
• Editable web parts clear their cache when the content of their page is updated.
• When you configure Partial Cache Dependencies (Performance category), those will also clear it.
• Manually, in System -> Clear Cache or IIS restart
• Not suitable for lists with filters or other web parts whose output-content changes often.
CONTENT CACHING
• https://docs.kentico.com/display/K11/Caching+the+data+of+page+components
• Even if the display of a page cannot be cached for one reason or another, the data source (SQL, the
CMS tree, etc) often can.
• Any web part in Kentico with its own data source, such as repeaters, Data Source controls, and
navigation web parts, will have Content caching properties exposed. You can also expose content
caching on custom web parts, but you will need to code the cache key and caching logic yourself.
• Because Kentico uses dummy cache keys, any pages using the same template (and so, same web
part) will share content, so even the first load of a page might be partially cached already.
• Similar to Output caching, you must configure it globally and locally: System -> Performance ->
“Cache Content”, and per-template, on the web part.
• The default cache key is unique per web part, but you can give a Cache Item Name on the web part
to share data between different web parts. Keep in mind if you do this, you should make any
important variables part of the cache name, so if the page has different content, it’ll not try to use
the same key.
FILE CACHING
• https://docs.kentico.com/display/K11/Caching+files+and+resources
• This refers to things such as the CSS Stylesheets, Javascript, and attachments served by Kentico.
• Two types – client-side, server-side.
• Client: System -> Performance, Client cache. This setting applies to dynamic files, such as the CSS stylesheets.
• Physical files served through GetResource use a web.config key that defaults to one week, CMSPhysicalFilesCacheMinutes.
• Files served directly instead of through Kentico, just use IIS.
• Enabling “Allow client cache revalidation” makes browsers re-validate the cache each time by requesting the last-updated time
as a header – it’ll ensure users are less likely to see out-of-date content, but forces an extra (small) request each time.
• Server:
• For files in the database, the cache holds the entire file as well as metadata.
• This is why we don’t store large files in the database (also it’s inefficient)
• For files in the File system (or in both places), only the metadata is cached, the file itself uses the IIS settings.
• System -> Performance -> Cache Files (minutes)
• The system always caches files for at least one minute, as DoS protection.
• If you’re using Azure/Amazon S3 for separated file storage, you need to manually clear the file caches.
(uncommon, but be aware)
PAGE INFO CACHING
• https://docs.kentico.com/display/K11/Configuring+caching#Configuringcaching-Pageinfocaching
• Basic info about documents is always cached on viewing a page:
• alias path
• ID and name
• document metadata and other properties
• SKU information (for products)
• workflow information
• This cache is managed automatically, cleared when the appropriate info is edited, and can be
accessed by using PageInfoProvider, instead of DocumentInfoProvider.
• The length is configurable: System -> Performance -> Cache Page info (minutes).
• Kentico mysteriously warns: “Do NOT set the value lower than 10 minutes”.
• Presumably because gremlins?
• Just use it always when possible.
PROGRESSIVE CACHING
• To Enable/Disable: System -> Performance
• “Use progressive caching”
• If checked, Kentico will connect the threads of uncached data access so that multiple
users concurrently accessing one dataset will share a single thread rather than calling
the same data multiple times.
• This supposedly leads to better performance if the website is under extremely heavy
loads, but probably slows down an individual user’s access to the data.
• There’s no documentation on how long a thread waits for other “similar” threads to
compound before executing the request.
• It’s unlikely to have much effect if you’re doing other caching, but for an existing site
that is uncached but having heavy load, this may help until more thorough caching can
be done.
FINAL NOTES
• There’s also the ability to cache individual macros:
• https://docs.kentico.com/display/K11/Caching+the+results+of+macros
• And here is documentation on how to implement caching in your custom code:
• https://docs.kentico.com/display/K11/Caching+in+custom+code
• Here are some example scenarios from Kentico and best practices:
• https://docs.kentico.com/display/K11/Caching+best+practices+for+typical+projects
• Here is how you can debug Kentico’s cache in the CMS Desk:
• https://docs.kentico.com/display/K11/Debugging+cache
• Don’t forget to do minification/compression for your CSS/JS:
• https://docs.kentico.com/display/K11/Using+code+minification+and+compression
• And finally, some more generic notes on optimizing your performance:
• https://docs.kentico.com/display/K11/Optimizing+website+performance
THANKS FOR STAYING AWAKE

Weitere ähnliche Inhalte

Was ist angesagt?

Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702Jess Coburn
 
PostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter TuningPostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter TuningAshnikbiz
 
Building the Perfect SharePoint 2010 Farm - Sharing the Point South America
Building the Perfect SharePoint 2010 Farm - Sharing the Point South AmericaBuilding the Perfect SharePoint 2010 Farm - Sharing the Point South America
Building the Perfect SharePoint 2010 Farm - Sharing the Point South AmericaMichael Noel
 
MySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesMySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesLenz Grimmer
 
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...Maaz Anjum
 
SharePoint 2010 Virtualization - Hungarian SharePoint User Group
SharePoint 2010 Virtualization - Hungarian SharePoint User GroupSharePoint 2010 Virtualization - Hungarian SharePoint User Group
SharePoint 2010 Virtualization - Hungarian SharePoint User GroupMichael Noel
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningLenz Grimmer
 
Weblogic server administration
Weblogic server administrationWeblogic server administration
Weblogic server administrationbispsolutions
 
Get More Out of MongoDB with TokuMX
Get More Out of MongoDB with TokuMXGet More Out of MongoDB with TokuMX
Get More Out of MongoDB with TokuMXTim Callaghan
 

Was ist angesagt? (14)

Cloud computing 3702
Cloud computing 3702Cloud computing 3702
Cloud computing 3702
 
PostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter TuningPostgreSQL Hangout Parameter Tuning
PostgreSQL Hangout Parameter Tuning
 
Building the Perfect SharePoint 2010 Farm - Sharing the Point South America
Building the Perfect SharePoint 2010 Farm - Sharing the Point South AmericaBuilding the Perfect SharePoint 2010 Farm - Sharing the Point South America
Building the Perfect SharePoint 2010 Farm - Sharing the Point South America
 
MySQL Backup and Security Best Practices
MySQL Backup and Security Best PracticesMySQL Backup and Security Best Practices
MySQL Backup and Security Best Practices
 
Les 13 memory
Les 13 memoryLes 13 memory
Les 13 memory
 
Les 12 fl_db
Les 12 fl_dbLes 12 fl_db
Les 12 fl_db
 
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
 
SharePoint 2010 Virtualization - Hungarian SharePoint User Group
SharePoint 2010 Virtualization - Hungarian SharePoint User GroupSharePoint 2010 Virtualization - Hungarian SharePoint User Group
SharePoint 2010 Virtualization - Hungarian SharePoint User Group
 
Les 09 diag
Les 09 diagLes 09 diag
Les 09 diag
 
MySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery PlanningMySQL Server Backup, Restoration, and Disaster Recovery Planning
MySQL Server Backup, Restoration, and Disaster Recovery Planning
 
Weblogic server administration
Weblogic server administrationWeblogic server administration
Weblogic server administration
 
Les 17 sched
Les 17 schedLes 17 sched
Les 17 sched
 
Get More Out of MongoDB with TokuMX
Get More Out of MongoDB with TokuMXGet More Out of MongoDB with TokuMX
Get More Out of MongoDB with TokuMX
 
Oracle Web Logic server
Oracle Web Logic serverOracle Web Logic server
Oracle Web Logic server
 

Ähnlich wie Caching in Kentico 11

Sharepoint Performance - part 2
Sharepoint Performance - part 2Sharepoint Performance - part 2
Sharepoint Performance - part 2Regroove
 
Accelerating Rails with edge caching
Accelerating Rails with edge cachingAccelerating Rails with edge caching
Accelerating Rails with edge cachingMichael May
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Jess Coburn
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeFastly
 
Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeMichael May
 
Html5 cache mechanism & local storage
Html5 cache mechanism & local storageHtml5 cache mechanism & local storage
Html5 cache mechanism & local storageSendhil Kumar Kannan
 
Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and ScalabilityAlachisoft
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Studyhernanibf
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 cachingShih-yi Wei
 
Sitecore Personalization on websites cached on CDN servers
Sitecore Personalization on websites cached on CDN serversSitecore Personalization on websites cached on CDN servers
Sitecore Personalization on websites cached on CDN serversAnindita Bhattacharya
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails applicationArrrrCamp
 
Best practices para publicar un WebSite con SharePoint Server 2010
Best practices para publicar un WebSite con SharePoint Server 2010Best practices para publicar un WebSite con SharePoint Server 2010
Best practices para publicar un WebSite con SharePoint Server 2010Juan Andrés Valenzuela
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)Michael Collier
 

Ähnlich wie Caching in Kentico 11 (20)

Mini-Training: To cache or not to cache
Mini-Training: To cache or not to cacheMini-Training: To cache or not to cache
Mini-Training: To cache or not to cache
 
Chapter 23
Chapter 23Chapter 23
Chapter 23
 
Sharepoint Performance - part 2
Sharepoint Performance - part 2Sharepoint Performance - part 2
Sharepoint Performance - part 2
 
Accelerating Rails with edge caching
Accelerating Rails with edge cachingAccelerating Rails with edge caching
Accelerating Rails with edge caching
 
Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11Orlando DNN Usergroup Pres 12/06/11
Orlando DNN Usergroup Pres 12/06/11
 
Rails Caching: Secrets From the Edge
Rails Caching: Secrets From the EdgeRails Caching: Secrets From the Edge
Rails Caching: Secrets From the Edge
 
Rails Caching Secrets from the Edge
Rails Caching Secrets from the EdgeRails Caching Secrets from the Edge
Rails Caching Secrets from the Edge
 
Caching in drupal
Caching in drupalCaching in drupal
Caching in drupal
 
Html5 cache mechanism & local storage
Html5 cache mechanism & local storageHtml5 cache mechanism & local storage
Html5 cache mechanism & local storage
 
Four Ways to Improve ASP .NET Performance and Scalability
 Four Ways to Improve ASP .NET Performance and Scalability Four Ways to Improve ASP .NET Performance and Scalability
Four Ways to Improve ASP .NET Performance and Scalability
 
Cache
CacheCache
Cache
 
Drupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case StudyDrupal Performance - SerBenfiquista.com Case Study
Drupal Performance - SerBenfiquista.com Case Study
 
Django book15 caching
Django book15 cachingDjango book15 caching
Django book15 caching
 
Sitecore Personalization on websites cached on CDN servers
Sitecore Personalization on websites cached on CDN serversSitecore Personalization on websites cached on CDN servers
Sitecore Personalization on websites cached on CDN servers
 
Azure appfabric caching intro and tips
Azure appfabric caching intro and tipsAzure appfabric caching intro and tips
Azure appfabric caching intro and tips
 
Chapter 8 part1
Chapter 8   part1Chapter 8   part1
Chapter 8 part1
 
Caching your rails application
Caching your rails applicationCaching your rails application
Caching your rails application
 
Evolve18 | Ameeth Palla | Optimizing Your Assets Implementation
Evolve18 | Ameeth Palla | Optimizing Your Assets ImplementationEvolve18 | Ameeth Palla | Optimizing Your Assets Implementation
Evolve18 | Ameeth Palla | Optimizing Your Assets Implementation
 
Best practices para publicar un WebSite con SharePoint Server 2010
Best practices para publicar un WebSite con SharePoint Server 2010Best practices para publicar un WebSite con SharePoint Server 2010
Best practices para publicar un WebSite con SharePoint Server 2010
 
More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)More Cache for Less Cash (DevLink 2014)
More Cache for Less Cash (DevLink 2014)
 

Kürzlich hochgeladen

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.pptxHampshireHUG
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Kürzlich hochgeladen (20)

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
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Caching in Kentico 11

  • 1. CACHING IN KENTICO Chris Bass, Wakefly Kentico Evangelist
  • 2. HOW MANY TYPES OF CACHING ARE IN KENTICO 11? • Output Caching (Full Page HTML Caching) • Partial Caching (Web Part HTML Caching) • Content Caching (Data Source Caching) • File Caching (Attachments, Media Items, etc.) • Page Info Caching (PageInfoProvider) • Progressive Caching (Concurrent User Result Caching)
  • 3. CACHE PRINCIPLES • https://docs.kentico.com/display/K11/Configuring+cachi ng • Caching in Kentico consists primarily of trading W3WP process memory for end-user performance. The more you store in the process memory, the faster data will be served to end-users, but the more RAM Kentico needs to keep up. • Kentico handles caching internally through a one-way linked list of key-values. When one is cleared, anything down the one-way path from it will be cleared as well. • Kentico recommends using all levels of caching, setting progressively higher timeouts as you get more granular, so even when the full-page cache is expired, individual content with higher tolerances for caching can still be cached.
  • 4. CACHE DEPENDENCIES • Kentico allows creation of “Dummy Keys” – cache entries which don’t have useful data, but are in the key-value list, such that editing them clears all the cache down the line from them. • A full list is here: • https://docs.kentico.com/display/K11/Setti ng+cache+dependencies • For all of Kentico’s internal dependencies, Kentico clears them when a change is made through the UI or API. • To clear your own, call CacheHelper.TouchKey(“mycustomdata| mycustomkey”); • Example keys: • node|sitename|/home • node|sitename|/home|en-us • node|sitename|/|childnodes • nodes|sitename|cms.menuitem|all • documentid|56|attachments • cms.user|byid|53 • template|12 • cms.form|all • mycustomdata|mycustomkey • You’d have to touch this one yourself to clear things that depend on it
  • 5. OUTPUT CACHING • https://docs.kentico.com/display/K11/Caching+page+output • Caches the full, processed HTML output that is sent to the client for a page. • To Enable: System -> Performance --> Output Caching • “Enable output caching” • Then you also need to enable it per-page in Properties -> Generic (or at a parent page to inherit) • Recommendation: Don’t set “Allow file system cache”. When the app restarts, the file system cache is decoupled from the in-memory cache and will continue serving outdated content, and you’ll have to manually go to System->Clear Cache in order to fix it.
  • 6. FLUSHING THE OUTPUT CACHE • If you edit the Page (Page tab, Form tab, Properties tab) or the Template. • If a user viewing the page performs a Postback (submitting a form, for example) • Unsure about Ajax postbacks, but I’d suspect so. • This makes Output cache mostly useless for pages with Forms or dynamic controls • If any of the global output cache variables (In Settings) are touched, ALL relevant pages’ caches are flushed. • By placing an “Output cache dependencies” web part on a page, you can set manual cache dependencies per page. • Manually in the CMS Desk (System -> Clear Cache) or restarting IIS
  • 7. OUTPUT CACHING: CACHE VARIABLES • https://docs.kentico.com/display/K11/Caching+page+output#Cachingpageoutput-Cachingmultipleoutputversionsofpages • Cache Variables let you globally dictate keys on which Kentico will split a page’s output cache. • You can enable or disable separate output caches for: • username - every logged in user (public users share the same output cache). • sitename - every site in the system (leave checked unless your sites all have identical content on pages with the same path). • lang - each language version of pages. • browser - different types of web browsers detected by Kentico. • cookielevel - the cookie level preferences of visitors. • deviceprofile - the device profiles detected for visitors. • domain - the website domain name (check to disable output cache sharing between different domain aliases of sites). • viewmode - the page view modes used by Kentico, such as design, edit, preview or live site. Currently, the system only uses caching for the live site view mode, so I believe this cache variable is unused. • The output cache always creates separate cache items based on the: • Page path (including the virtual directory and extension) • Protocol in the request URL
  • 8. OUTPUT CACHING: SUBSTITUTION MACROS • https://docs.kentico.com/display/K11/Using+output+cache+substitutions • Even when cached, you can set specific custom Macro methods to be executable every page load. • To do so, create a Module file in App_Code, and create a single macro- parsing method that attaches to the ResponseOutputFilter.OnResolveSubstitution event (using OnInit). • The method to the right would handle the {~ TimeStamp ~} substitution macro. • Using this substitution macro would resolve with the current time, even if the page was otherwise cached. If you just did a standard macro, like {% DateTime.Now %}, it would display the timestamp as of when the page was first cached. private void ResolveCustomOutputSubstitutions(object sender, SubstitutionEventArgs e) { // Checks that the substitution expression is not resolved yet if (!e.Match) { // Branches according to the expression text of the substitution macro // You can define any number of substitution macros by adding further cases switch (e.Expression.ToLower()) { // Handles the {~TimeStamp~} substitution macro case "timestamp": // Flags the substitution expression as resolved e.Match = true; // Returns the current time as the result of the substitution e.Result = DateTime.Now.ToString(); break; } }
  • 9. PARTIAL CACHING • When you want to cache parts of a page, but not all of it, as full HTML output, you can cache individual web parts. • Other good uses are for master page content, or want to use different cache intervals or dependencies that are different than the full-page cache. • Similar to full-page caching, you need to enable it in Settings -> Performance and then configure it on the web part instance (Performance category). • Cache is cleared: • When the properties of the web part are configured. • On Postback on a page with the web part • Editable web parts clear their cache when the content of their page is updated. • When you configure Partial Cache Dependencies (Performance category), those will also clear it. • Manually, in System -> Clear Cache or IIS restart • Not suitable for lists with filters or other web parts whose output-content changes often.
  • 10. CONTENT CACHING • https://docs.kentico.com/display/K11/Caching+the+data+of+page+components • Even if the display of a page cannot be cached for one reason or another, the data source (SQL, the CMS tree, etc) often can. • Any web part in Kentico with its own data source, such as repeaters, Data Source controls, and navigation web parts, will have Content caching properties exposed. You can also expose content caching on custom web parts, but you will need to code the cache key and caching logic yourself. • Because Kentico uses dummy cache keys, any pages using the same template (and so, same web part) will share content, so even the first load of a page might be partially cached already. • Similar to Output caching, you must configure it globally and locally: System -> Performance -> “Cache Content”, and per-template, on the web part. • The default cache key is unique per web part, but you can give a Cache Item Name on the web part to share data between different web parts. Keep in mind if you do this, you should make any important variables part of the cache name, so if the page has different content, it’ll not try to use the same key.
  • 11. FILE CACHING • https://docs.kentico.com/display/K11/Caching+files+and+resources • This refers to things such as the CSS Stylesheets, Javascript, and attachments served by Kentico. • Two types – client-side, server-side. • Client: System -> Performance, Client cache. This setting applies to dynamic files, such as the CSS stylesheets. • Physical files served through GetResource use a web.config key that defaults to one week, CMSPhysicalFilesCacheMinutes. • Files served directly instead of through Kentico, just use IIS. • Enabling “Allow client cache revalidation” makes browsers re-validate the cache each time by requesting the last-updated time as a header – it’ll ensure users are less likely to see out-of-date content, but forces an extra (small) request each time. • Server: • For files in the database, the cache holds the entire file as well as metadata. • This is why we don’t store large files in the database (also it’s inefficient) • For files in the File system (or in both places), only the metadata is cached, the file itself uses the IIS settings. • System -> Performance -> Cache Files (minutes) • The system always caches files for at least one minute, as DoS protection. • If you’re using Azure/Amazon S3 for separated file storage, you need to manually clear the file caches. (uncommon, but be aware)
  • 12. PAGE INFO CACHING • https://docs.kentico.com/display/K11/Configuring+caching#Configuringcaching-Pageinfocaching • Basic info about documents is always cached on viewing a page: • alias path • ID and name • document metadata and other properties • SKU information (for products) • workflow information • This cache is managed automatically, cleared when the appropriate info is edited, and can be accessed by using PageInfoProvider, instead of DocumentInfoProvider. • The length is configurable: System -> Performance -> Cache Page info (minutes). • Kentico mysteriously warns: “Do NOT set the value lower than 10 minutes”. • Presumably because gremlins? • Just use it always when possible.
  • 13. PROGRESSIVE CACHING • To Enable/Disable: System -> Performance • “Use progressive caching” • If checked, Kentico will connect the threads of uncached data access so that multiple users concurrently accessing one dataset will share a single thread rather than calling the same data multiple times. • This supposedly leads to better performance if the website is under extremely heavy loads, but probably slows down an individual user’s access to the data. • There’s no documentation on how long a thread waits for other “similar” threads to compound before executing the request. • It’s unlikely to have much effect if you’re doing other caching, but for an existing site that is uncached but having heavy load, this may help until more thorough caching can be done.
  • 14. FINAL NOTES • There’s also the ability to cache individual macros: • https://docs.kentico.com/display/K11/Caching+the+results+of+macros • And here is documentation on how to implement caching in your custom code: • https://docs.kentico.com/display/K11/Caching+in+custom+code • Here are some example scenarios from Kentico and best practices: • https://docs.kentico.com/display/K11/Caching+best+practices+for+typical+projects • Here is how you can debug Kentico’s cache in the CMS Desk: • https://docs.kentico.com/display/K11/Debugging+cache • Don’t forget to do minification/compression for your CSS/JS: • https://docs.kentico.com/display/K11/Using+code+minification+and+compression • And finally, some more generic notes on optimizing your performance: • https://docs.kentico.com/display/K11/Optimizing+website+performance