SlideShare a Scribd company logo
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

PDF
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
PPTX
Dynamic components using SPA concepts in AEM
PDF
Adobe Experience Manager Core Components
PDF
AEM Best Practices for Component Development
PDF
AEM Sightly Deep Dive
PDF
Build single page applications using AngularJS on AEM
PPTX
Introduction to Sightly and Sling Models
PPTX
AEM 6.0 - Author UI Customization & Features
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
Dynamic components using SPA concepts in AEM
Adobe Experience Manager Core Components
AEM Best Practices for Component Development
AEM Sightly Deep Dive
Build single page applications using AngularJS on AEM
Introduction to Sightly and Sling Models
AEM 6.0 - Author UI Customization & Features

What's hot (20)

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

Similar to Sling Dynamic Include (20)

PDF
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
PPTX
User Interface Patterns and Nuxeo
PPT
World Wide Web(WWW)
PPT
Jagmohancrawl
ODP
When dynamic becomes static - the next step in web caching techniques
PPTX
Real world RESTful service development problems and solutions
PDF
Introduction tomcat7 servlet3
PDF
A JCR View of the World - adaptTo() 2012 Berlin
PDF
Web 2.0 And Ajax
PDF
12 core technologies you should learn, love, and hate to be a 'real' technocrat
PPT
adative websites
PPTX
Online Test Engine
PPT
introduction to Web system
PDF
Evolving Archetecture
PDF
Talking Heads - writing an API does not need to be a "psycho killer"
PDF
REST and REST-fulness
PDF
Esigate dev meeting 25 03_2013
PPT
Ajax workshop
PDF
Adapt to2012 oak - the new repository
PPTX
web.pptx
Dynamic Components using Single-Page-Application Concepts in AEM/CQ
User Interface Patterns and Nuxeo
World Wide Web(WWW)
Jagmohancrawl
When dynamic becomes static - the next step in web caching techniques
Real world RESTful service development problems and solutions
Introduction tomcat7 servlet3
A JCR View of the World - adaptTo() 2012 Berlin
Web 2.0 And Ajax
12 core technologies you should learn, love, and hate to be a 'real' technocrat
adative websites
Online Test Engine
introduction to Web system
Evolving Archetecture
Talking Heads - writing an API does not need to be a "psycho killer"
REST and REST-fulness
Esigate dev meeting 25 03_2013
Ajax workshop
Adapt to2012 oak - the new repository
web.pptx
Ad

More from Tomasz Rękawek (9)

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

Recently uploaded (20)

PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Chapter 3 Spatial Domain Image Processing.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Electronic commerce courselecture one. Pdf
PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Weekly Chronicles - August'25 Week I
“AI and Expert System Decision Support & Business Intelligence Systems”
Empathic Computing: Creating Shared Understanding
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Chapter 3 Spatial Domain Image Processing.pdf
The AUB Centre for AI in Media Proposal.docx
Review of recent advances in non-invasive hemoglobin estimation
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Reach Out and Touch Someone: Haptics and Empathic Computing
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
Mobile App Security Testing_ A Comprehensive Guide.pdf

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