SlideShare a Scribd company logo
1 of 15
Download to read offline
APACHE SLING & FRIENDS TECH MEETUP
BERLIN, 26-28 SEPTEMBER 2012
Sling Dynamic Include
declarative caching of partially personalized pages
Tomasz Rękawek
adaptTo() 2012
 Our CQ site contains a lot of static pages
 Therefore they can be cached
 Unfortunatelly, there is one small dynamic
component
 Current user info
 Latest news
 Random article
 External content
 ...
2
Introduction
adaptTo() 2012 3
Geometrixx example – userinfo component
adaptTo() 2012
 Dispatcher is great in caching static pages
 However, even a small dynamic component
makes it useless
 We want to cache the almost whole page
 Selected component should be included
dynamically, directly from the CQ
4
Problem
adaptTo() 2012
 Dispatcher should cache site with some
static placeholder
 We replace placeholder with the dynamic
content after dispatcher serves the site
 Helpful Sling feature: we can render only a
part of the page using it URL
5
Solution
http://localhost:4503/content/geometrixx/en/_jcr_content/userinfo.html
adaptTo() 2012
 So, we can place some include tag which
will be replaced with the component
 Include tag types available on different
service layers between dispatcher and the
client:
6
Solution
CQ instance Dispatcher Apache Content delivery network Browser
Server side
includes
Edge site
includes
AJAX
adaptTo() 2012
 AJAX is a common solution here
 Drawbacks
 problems with components containing JS
 may not work (smoothly or at all) on mobiles
 not SEO friendly
 slows down the site
 flickering components
7
AJAX
adaptTo() 2012
 Advantages over AJAX
 Transparent for the browser / search engine
 Drawbacks
 requires developers to have configured
additional servers (Apache or Varnish)
 developers should be aware of the environment
 components should be written in a special way
8
SSI/ESI
adaptTo() 2012
 Java servlet filter
 It affects components with specific
resource types only
 Replaces it with:
 SSI
 ESI
 AJAX include markup
9
Sling Dynamic Include
adaptTo() 2012 10
SDI – how does it work?
Filter the include sub-request
/content/…/_jcr_content/carousel.html
<!--include
/content/…/carousel.nocache.html-->
Content
Pass it
Get page
Content
Component content
Filter the request
Request
component
/content/…/_jcr_content/carousel.nocache.html
httpd SDI
adaptTo() 2012
 Approach transparent for the components
 and developers as well
 Configured using OSGi console
 can be disabled on the author / developers
instances
 include tag type can be easy changed
 Support for the nonexisting resources
11
SDI – advantages
adaptTo() 2012
 Nonexisting (or synthetic) resource – resource without
any JCR node
 JSP file excerpt:
<cq:include
path="footer"
resourceType="foundation/components/footer"/>
 But footer node doesn’t exist
 Component is rendered normally, because it doesn’t
need any data
 However, requesting
http://.../_jcr_content/footer.html will return 404
 SDI is able to recognize nonexisting resources and
render them 12
Nonexisting resources
adaptTo() 2012 13
Performance comparison
0
200
400
600
800
1000
1200
1400
1 2 3 4 5 6 7 8 9 10
Dispatcher+SDI
Cache disabled
Concurrent requests
Request/s
 Number of requests per second vs number of concurrent
requests
 Geometrixx site
 SDI includes userinfo component
 8 threads: 1265 req/s with and 131 req/s without SDI
 Basically, it’s a difference between rendering the whole page
and a small part of it
adaptTo() 2012
 SDI is available on our Github
 https://github.com/Cognifide
 Any questions?
14
Q&A
adaptTo() 2012 15
Thanks

More Related Content

What's hot

Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev Tricks
Gabriel Walt
 
User interface customization for aem6 circuit
User interface customization for aem6 circuitUser interface customization for aem6 circuit
User interface customization for aem6 circuit
Damien Antipa
 
The New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
The New Way of Developing with AEM 6.0 | Sightly | Beautiful MarkupThe New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
The New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
Senol Tas
 

What's hot (20)

SPA Editing with Sling to the rescue - adaptTo() 2021
SPA Editing with Sling to the rescue - adaptTo() 2021 SPA Editing with Sling to the rescue - adaptTo() 2021
SPA Editing with Sling to the rescue - adaptTo() 2021
 
AEM GEMS Session SAML authentication in AEM
AEM GEMS Session SAML authentication in AEMAEM GEMS Session SAML authentication in AEM
AEM GEMS Session SAML authentication in AEM
 
AEM 6.1 User Interface Customization
AEM 6.1 User Interface CustomizationAEM 6.1 User Interface Customization
AEM 6.1 User Interface Customization
 
12 hot features to engage and save time with aem 6.2
12 hot features to engage and save time with aem 6.212 hot features to engage and save time with aem 6.2
12 hot features to engage and save time with aem 6.2
 
Three WEM Dev Tricks
Three WEM Dev TricksThree WEM Dev Tricks
Three WEM Dev Tricks
 
CIRCUIT 2015 - Content API's For AEM Sites
CIRCUIT 2015 - Content API's For AEM SitesCIRCUIT 2015 - Content API's For AEM Sites
CIRCUIT 2015 - Content API's For AEM Sites
 
AEM Sightly Template Language
AEM Sightly Template LanguageAEM Sightly Template Language
AEM Sightly Template Language
 
AEM target Integration
AEM target IntegrationAEM target Integration
AEM target Integration
 
10 reasons to migrate from AEM 5 to 6.1
10 reasons to migrate from AEM 5 to 6.110 reasons to migrate from AEM 5 to 6.1
10 reasons to migrate from AEM 5 to 6.1
 
Accelerate Your Next AEM Project
Accelerate Your Next AEM ProjectAccelerate Your Next AEM Project
Accelerate Your Next AEM Project
 
User interface customization for aem6 circuit
User interface customization for aem6 circuitUser interface customization for aem6 circuit
User interface customization for aem6 circuit
 
Web Apps atop a Content Repository
Web Apps atop a Content RepositoryWeb Apps atop a Content Repository
Web Apps atop a Content Repository
 
Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM Maximize the power of OSGi in AEM
Maximize the power of OSGi in AEM
 
Zend Framework Quick Start Walkthrough
Zend Framework Quick Start WalkthroughZend Framework Quick Start Walkthrough
Zend Framework Quick Start Walkthrough
 
CQ Provisionning & Authoring
CQ Provisionning & AuthoringCQ Provisionning & Authoring
CQ Provisionning & Authoring
 
Sling Component Filters in CQ5
Sling Component Filters in CQ5 Sling Component Filters in CQ5
Sling Component Filters in CQ5
 
Sling Models Overview
Sling Models OverviewSling Models Overview
Sling Models Overview
 
Aem best practices
Aem best practicesAem best practices
Aem best practices
 
Sightly - AEM6 UI Development using JS and JAVA
Sightly - AEM6 UI Development using JS and JAVASightly - AEM6 UI Development using JS and JAVA
Sightly - AEM6 UI Development using JS and JAVA
 
The New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
The New Way of Developing with AEM 6.0 | Sightly | Beautiful MarkupThe New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
The New Way of Developing with AEM 6.0 | Sightly | Beautiful Markup
 

Similar to Sling Dynamic Include

Introduction to spring
Introduction to springIntroduction to spring
Introduction to spring
odedns
 

Similar to Sling Dynamic Include (20)

Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...Web components are the future of the web - Take advantage of new web technolo...
Web components are the future of the web - Take advantage of new web technolo...
 
Web Components: Introduction and Practical Use Cases
Web Components: Introduction and Practical Use CasesWeb Components: Introduction and Practical Use Cases
Web Components: Introduction and Practical Use Cases
 
SPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager SitesSPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager Sites
 
micro-frontends-with-vuejs
micro-frontends-with-vuejsmicro-frontends-with-vuejs
micro-frontends-with-vuejs
 
Building reusable components as micro frontends with glimmer js and webcompo...
Building reusable components as micro frontends  with glimmer js and webcompo...Building reusable components as micro frontends  with glimmer js and webcompo...
Building reusable components as micro frontends with glimmer js and webcompo...
 
Leveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in GutenbergLeveraging the Power of Custom Elements in Gutenberg
Leveraging the Power of Custom Elements in Gutenberg
 
Moduarlity patterns with OSGi
Moduarlity patterns with OSGiModuarlity patterns with OSGi
Moduarlity patterns with OSGi
 
Marrying together the worlds of ADF and HTML5 & AngularJS - Oracle OpenWorld ...
Marrying together the worlds of ADF and HTML5 & AngularJS - Oracle OpenWorld ...Marrying together the worlds of ADF and HTML5 & AngularJS - Oracle OpenWorld ...
Marrying together the worlds of ADF and HTML5 & AngularJS - Oracle OpenWorld ...
 
Vitali zaidman Do You Need Server Side Rendering? What Are The Alternatives?
Vitali zaidman Do You Need Server Side Rendering? What Are The Alternatives?Vitali zaidman Do You Need Server Side Rendering? What Are The Alternatives?
Vitali zaidman Do You Need Server Side Rendering? What Are The Alternatives?
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 
Apache Shindig, from Server Side Portlets to Open Social Gadgets
Apache Shindig, from Server Side Portlets to Open Social GadgetsApache Shindig, from Server Side Portlets to Open Social Gadgets
Apache Shindig, from Server Side Portlets to Open Social Gadgets
 
Umbraco Cape Town Meetup Presentation
Umbraco Cape Town Meetup PresentationUmbraco Cape Town Meetup Presentation
Umbraco Cape Town Meetup Presentation
 
Drupalcon Mumbai
Drupalcon MumbaiDrupalcon Mumbai
Drupalcon Mumbai
 
Pre rendering media sites with nuxt.js & netlify
Pre rendering media sites with nuxt.js & netlifyPre rendering media sites with nuxt.js & netlify
Pre rendering media sites with nuxt.js & netlify
 
Web Components: back to the future
Web Components: back to the futureWeb Components: back to the future
Web Components: back to the future
 
Marrying HTML5 and Angular to ADF - Oracle OpenWorld 2014 Preview
Marrying HTML5 and Angular to ADF - Oracle OpenWorld 2014 PreviewMarrying HTML5 and Angular to ADF - Oracle OpenWorld 2014 Preview
Marrying HTML5 and Angular to ADF - Oracle OpenWorld 2014 Preview
 
What's new in SharePoint Server 2013 (End user - Admin – Developer)
What's new in SharePoint Server 2013 (End user - Admin – Developer)What's new in SharePoint Server 2013 (End user - Admin – Developer)
What's new in SharePoint Server 2013 (End user - Admin – Developer)
 
five Sling features you should know
five Sling features you should knowfive Sling features you should know
five Sling features you should know
 
Introduction to spring
Introduction to springIntroduction to spring
Introduction to spring
 

More from Tomasz Rękawek

More from Tomasz Rękawek (9)

Radio ad blocker
Radio ad blockerRadio ad blocker
Radio ad blocker
 
Deep-dive into cloud-native AEM deployments based on Kubernetes
Deep-dive into cloud-native AEM deployments based on KubernetesDeep-dive into cloud-native AEM deployments based on Kubernetes
Deep-dive into cloud-native AEM deployments based on Kubernetes
 
Emulating Game Boy in Java
Emulating Game Boy in JavaEmulating Game Boy in Java
Emulating Game Boy in Java
 
Zero downtime deployments for the Sling-based apps using Docker
Zero downtime deployments for the Sling-based apps using DockerZero downtime deployments for the Sling-based apps using Docker
Zero downtime deployments for the Sling-based apps using Docker
 
CRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migrationCRX2Oak - all the secrets of repository migration
CRX2Oak - all the secrets of repository migration
 
SlingQuery
SlingQuerySlingQuery
SlingQuery
 
Code metrics
Code metricsCode metrics
Code metrics
 
Inter-Sling communication with message queue
Inter-Sling communication with message queueInter-Sling communication with message queue
Inter-Sling communication with message queue
 
Shooting rabbits with sling
Shooting rabbits with slingShooting rabbits with sling
Shooting rabbits with sling
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 

Sling Dynamic Include

  • 1. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 26-28 SEPTEMBER 2012 Sling Dynamic Include declarative caching of partially personalized pages Tomasz Rękawek
  • 2. adaptTo() 2012  Our CQ site contains a lot of static pages  Therefore they can be cached  Unfortunatelly, there is one small dynamic component  Current user info  Latest news  Random article  External content  ... 2 Introduction
  • 3. adaptTo() 2012 3 Geometrixx example – userinfo component
  • 4. adaptTo() 2012  Dispatcher is great in caching static pages  However, even a small dynamic component makes it useless  We want to cache the almost whole page  Selected component should be included dynamically, directly from the CQ 4 Problem
  • 5. adaptTo() 2012  Dispatcher should cache site with some static placeholder  We replace placeholder with the dynamic content after dispatcher serves the site  Helpful Sling feature: we can render only a part of the page using it URL 5 Solution http://localhost:4503/content/geometrixx/en/_jcr_content/userinfo.html
  • 6. adaptTo() 2012  So, we can place some include tag which will be replaced with the component  Include tag types available on different service layers between dispatcher and the client: 6 Solution CQ instance Dispatcher Apache Content delivery network Browser Server side includes Edge site includes AJAX
  • 7. adaptTo() 2012  AJAX is a common solution here  Drawbacks  problems with components containing JS  may not work (smoothly or at all) on mobiles  not SEO friendly  slows down the site  flickering components 7 AJAX
  • 8. adaptTo() 2012  Advantages over AJAX  Transparent for the browser / search engine  Drawbacks  requires developers to have configured additional servers (Apache or Varnish)  developers should be aware of the environment  components should be written in a special way 8 SSI/ESI
  • 9. adaptTo() 2012  Java servlet filter  It affects components with specific resource types only  Replaces it with:  SSI  ESI  AJAX include markup 9 Sling Dynamic Include
  • 10. adaptTo() 2012 10 SDI – how does it work? Filter the include sub-request /content/…/_jcr_content/carousel.html <!--include /content/…/carousel.nocache.html--> Content Pass it Get page Content Component content Filter the request Request component /content/…/_jcr_content/carousel.nocache.html httpd SDI
  • 11. adaptTo() 2012  Approach transparent for the components  and developers as well  Configured using OSGi console  can be disabled on the author / developers instances  include tag type can be easy changed  Support for the nonexisting resources 11 SDI – advantages
  • 12. adaptTo() 2012  Nonexisting (or synthetic) resource – resource without any JCR node  JSP file excerpt: <cq:include path="footer" resourceType="foundation/components/footer"/>  But footer node doesn’t exist  Component is rendered normally, because it doesn’t need any data  However, requesting http://.../_jcr_content/footer.html will return 404  SDI is able to recognize nonexisting resources and render them 12 Nonexisting resources
  • 13. adaptTo() 2012 13 Performance comparison 0 200 400 600 800 1000 1200 1400 1 2 3 4 5 6 7 8 9 10 Dispatcher+SDI Cache disabled Concurrent requests Request/s  Number of requests per second vs number of concurrent requests  Geometrixx site  SDI includes userinfo component  8 threads: 1265 req/s with and 131 req/s without SDI  Basically, it’s a difference between rendering the whole page and a small part of it
  • 14. adaptTo() 2012  SDI is available on our Github  https://github.com/Cognifide  Any questions? 14 Q&A