SlideShare a Scribd company logo
APACHE SLING & FRIENDS TECH MEETUP
BERLIN, 26-28 SEPTEMBER 2016
Can we run the whole Web on Apache Sling?
Bertrand Delacretaz & Chetan Mehrotra
@bdelacretaz - @chetanmeh
Sling committers and PMC members
CQ/AEM core team members, Adobe
slides revision 2016-09-26
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
The Whole Web ??2
Are you guys crazy?

(yes, but not that much)
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 3
Where’s Sling going? 

from
SERVERSto
SYSTEMS
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 4
httpd
mod_lua script
mod_proxy
haproxy
etcd -> config
MongoDB
processor selector
more pools…
more pools…
fileserver pool
slingshot pool
default pool
more pools…
etcd
monitoring / metrics
REDDR - Resource Driven Dynamic Routing

Sling resource/script resolution drives routing
1 2
3
4
1
2
3
4
Request to Sling Processor Selector
Response with a single word: fileserver
+Header: Sling-Processor-Role:fileserver
haproxy routes to fileserver pool
Rebuild haproxy config on changes
Sling
instances
announce
themselves
to etcd:

-IP address

-Port

-Role



Pools are
actually
haproxy
“backends”
fun!
client

request
port 80
port 81
Sling-Processor-Role
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 5
REDDRREsource-Driven Dynamic Routing
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 6
REDDR routing to fileserver instances pool
httpd
mod_lua script
mod_proxy
haproxy
etcd -> config
processor selector
fileserver pool1 2
3
4
0
1
2
3
4
Request to Sling Processor Selector
Response with a single word: fileserver
+Header: Sling-Processor-Role:fileserver
haproxy routes to fileserver pool
0 Client request
.routing script engine +

select based on resource
type and parent types.

Default servlets and 

scripts disabled.
Select backend pool based
on Sling-Processor-Role

header, using haproxy “acl”
generated from etcd
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 7
Dynamic Registration of Sling Instances

regenerate haproxy config based on etc data
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 8
haproxy
etcd -> config
more pools…
more pools…
fileserver pool
slingshot pool
default pool
more pools…
etcd
haproxy config is rebuilt via event-driven
confd + reload.sh script
Sling instances announce themselves to etcd:

-IP address

-Port

-Role
Dynamic wiring of Sling instances
in the haproxy pools
1
2
1
2
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 9
Building customised Sling Docker images

with just a provisioning model + trivial Dockerfile
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 10
base/pom.xml
base/src/main/docker/Dockerfile
base/src/main/docker/slingroot/announce.sh
base/src/main/docker/slingroot/start.sh
base/src/main/docker/slingroot/wait-for-it.sh
default-processor/pom.xml
default-processor/src/main/docker/Dockerfile
default-processor/src/main/provisioning/composum-browser.txt
default-processor/src/main/provisioning/default-processor.txt
default-processor/src/main/provisioning/launchpad.txt
default-processor/src/main/provisioning/…
Base and default-processor images
FROM ch.x42.at16.base
COPY ${project.build.finalName}.jar /opt/sling/launchpad.jar
Dockerfile for default-processor
Custom
Sling Docker im
ages
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 11
DYNAMIC CLUSTER DEMO
A Big Sling Cluster…on my laptop
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 12
httpd
mod_lua script
mod_proxy
haproxy
etcd -> config
MongoDB
processor selector
more pools…
more pools…
fileserver pool
slingshot pool
default pool
more pools…
etcd
monitoring / metrics
REDDR - Resource Driven Dynamic Routing

Sling resource/script resolution drives routing
1 2
3
4
1
2
3
4
Request to Sling Processor Selector
Response with a single word: fileserver
+Header: Sling-Processor-Role:fileserver
haproxy routes to fileserver pool
Rebuild haproxy config on changes
Sling
instances
announce
themselves
to etcd:

-IP address

-Port

-Role



Pools are
actually
haproxy
“backends”
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 13
“Background Worker” Sling instance
minimal, disposable, focused
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Asset worker pool
default pool
MongoDB
ActiveMQ
5
2
1
3
4
1
2
3
4
Request to Sling Frontend server
Write to NodeStore
Add job to message queue
Pick up of job by one of the worker
5 Write back of Job result
Worker Profile
• Tailor made Sling instance
• Min required bundles
• Low footprint
• JCR API used mostly for CRUD
• No observation
• Disposable
• Take post processing load off
frontend servers
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 15
Repository Etiquette
be precise while talking to repository and thou shall not be troubled!
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Choose the right nodetype
Avoid nt:unstructured
• Orderable children
• Limits writes
Prefer oak:Unstructured
OAK-657
+ dashboard (nt:unstructured)
- role_observer - projects-outdoors
- role_editor - projects-editor
+ gadgets (nt:unstructured)
+ team
+ asset
+ dashboard (oak:Unstructured)
- role_observer - projects-outdoors
- role_editor - projects-editor
+ gadgets (oak:Unstructured)
+ team
+ asset
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Choose the right nodetype
Avoid nt:resource with
nt:file
• Referenceable
• 1 nt:resource = 1 entry in uuid index
• 1M Files = 1M entry in uuid index
Prefer oak:Resource
+ book.jpg (nt:file)
- jcr:createdBy - admin
+ jcr:content (nt:resource)
- jcr:lastModifiedBy - admin
- jcr:mimeType - image/jpeg
- jcr:uuid - "dafe0c9c-1872-4397"
OAK-4567
+ book.jpg (nt:file)
- jcr:createdBy - admin
+ jcr:content (oak:Resource)
- jcr:lastModifiedBy - admin
- jcr:mimeType - image/jpeg
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Query Precisely
• Use specific nodetype
• Relativize property names
wrt root of micro tree
• Include path restrictions
• Use union if nodetypes differ
SELECT *
FROM [nt:base] AS a
WHERE
a.[type] = 'image'
SELECT *
FROM [dam:Asset] AS a
WHERE ISDESCENDANTNODE([/content/dam])
AND a.[jcr:content/metadata/type] = 'image'
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Observe Precisely
▪ Observation costs resources
▪ Use JackrabbitEventFilter to filter on
▪ Multiple paths
▪ Nodetypes
▪ In works* filtering based on
▪ Property names
▪ Node names
*OAK-4796
JackrabbitEventFilter eventFilter
= new JackrabbitEventFilter()
.setAbsPath(paths[0])
.setNodeTypes(new String[]{"dam:Asset"})
.setEventTypes(Event.NODE_ADDED)
.setIsDeep(true);

eventFilter.setAdditionalPaths("/content/en");
JackrabbitObservationManager om =
(JackrabbitObservationManager)session.getWorkspace()
.getObservationManager();
om.addEventListener(this, eventFilter);
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Define your own types
▪ Nodetype/mixin are content annotation
▪ Repository uses them to
▪ Enforce structure
▪ Determine index rules
▪ Filter observation events
▪ Bundle Nodes* (new stuff!)
*OAK-1312
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Prefer Lucene Property Indexes
▪ Property Indexes
▪ Cause conflict in index data
▪ Causes commit root to be ‘/’
▪ Stored as nodes
▪ Good for sparse and full sync case
foo=bar bar=/a/b
Commit Root
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Prefer Lucene Property Indexes …
▪ Lucene Property Indexes
▪ Async indexing
▪ No impact on commit root
▪ Compact storage
▪ Multi restriction evaluation
▪ Are not they async?
▪ In works near real time indexing*
*OAK-4412
foo=bar
Commit Root
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
FUTURE PERFORMANCE-RELATED Oak FEATURES
work in progress!
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Mongo
Segment NSDocument NS
Sling
Segment NSDocument NS
Sling
Segment NS as Local Secondary Store
▪ Segment NS act a local copy
of remote repository like a
local git repo

▪ Updated via Observation

▪ Handles read call for “not so
recently modified” Nodes

▪ Reduces read latency

▪ Configured to store certain
path. Defaults to ‘/’ *OAK-4180
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016
Bundle Multiple JCR Node in one Document
*OAK-1312
+ book.jpg (nt:file)
+ jcr:content
- jcr:data
Bundling Pattern
+ jcr:system/documentstore/bundlor
+ nt:file
- pattern - [jcr:content]
{
"_id": "2:/test/book.jpg",
"_commitRoot": {"r1560bfe1650-0-1": "0"},
":pattern": {"r1560bfe1650-0-1": "["str:jcr:content"]"},
"jcr:primaryType": {"r1560bfe1650-0-1": ""nt:file""}
"jcr:content/jcr:data": {"r1560bfe1650-0-1": ""bar""},
}
▪ Store subtree aggregates of specific
nodes in same NodeDocument
▪ JCR Node to Mongo mapping
▪ 1 JCR Node = 1 Mongo Doc
▪ 1 dam:Asset ~ 20 JCR Node
▪ 1M Assets = 20M Mongo Doc
▪ Nodetype as content annotation hint
to optimize storage
▪ Benefits
▪ Lower size of _id index
▪ Less number of queries to read the micro
tree
Bundled NodeDocument
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 26
CODA
The Whole Web, really?
Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 27
CODA
Thank you for attending!
Chetan Mehrotra (@chetanmeh)
Bertrand Delacretaz (@bdelacretaz)
REDDR enables (extreme)
scaling driven by Sling
resource/script resolution.
Building customized Sling
instances is easy: provisioning
model + trivial Dockerfile.
From servers to systems! Precise and focused repository
types and operations improve
performance.

More Related Content

PDF
RESTful OSGi middleware for NoSQL databases with Docker
PDF
Dockerを利用したローカル環境から本番環境までの構築設計
PPTX
Running High Performance & Fault-tolerant Elasticsearch Clusters on Docker
PDF
開放運算&GPU技術研究班
PDF
2012 09-08-josug-jeff
PPT
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
PDF
Continuous Integration: SaaS vs Jenkins in Cloud
PDF
Amazon EC2 Container Service in Action
RESTful OSGi middleware for NoSQL databases with Docker
Dockerを利用したローカル環境から本番環境までの構築設計
Running High Performance & Fault-tolerant Elasticsearch Clusters on Docker
開放運算&GPU技術研究班
2012 09-08-josug-jeff
Running High Performance and Fault Tolerant Elasticsearch Clusters on Docker
Continuous Integration: SaaS vs Jenkins in Cloud
Amazon EC2 Container Service in Action

What's hot (20)

PDF
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
PPTX
Real World Lessons on the Pain Points of Node.js Applications
PDF
JCR In 10 Minutes
PPTX
Why you’re going to fail running java on docker!
PDF
Docker composeで開発環境をメンバに配布せよ
PPTX
[오픈소스컨설팅] Linux Network Troubleshooting
PPTX
Running Docker in Development & Production (#ndcoslo 2015)
PDF
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
PDF
Kubernetes Walk Through from Technical View
PDF
Data Analytics Service Company and Its Ruby Usage
PDF
실시간 서비스 플랫폼 개발 사례
PDF
The secret of programming language development and future
PDF
Move Over, Rsync
PDF
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
PDF
Everything as a code
PDF
Docker Online Meetup #3: Docker in Production
ODP
Dynamic Languages Web Frameworks Indicthreads 2009
PDF
Docker workshop 0507 Taichung
PDF
9 steps to install and configure postgre sql from source on linux
PDF
Tutorial ceph-2
2017-03-11 02 Денис Нелюбин. Docker & Ansible - лучшие друзья DevOps
Real World Lessons on the Pain Points of Node.js Applications
JCR In 10 Minutes
Why you’re going to fail running java on docker!
Docker composeで開発環境をメンバに配布せよ
[오픈소스컨설팅] Linux Network Troubleshooting
Running Docker in Development & Production (#ndcoslo 2015)
[OpenInfra Days Korea 2018] Day 1 - T4-7: "Ceph 스토리지, PaaS로 서비스 운영하기"
Kubernetes Walk Through from Technical View
Data Analytics Service Company and Its Ruby Usage
실시간 서비스 플랫폼 개발 사례
The secret of programming language development and future
Move Over, Rsync
How and Why Prometheus' New Storage Engine Pushes the Limits of Time Series D...
Everything as a code
Docker Online Meetup #3: Docker in Production
Dynamic Languages Web Frameworks Indicthreads 2009
Docker workshop 0507 Taichung
9 steps to install and configure postgre sql from source on linux
Tutorial ceph-2
Ad

Viewers also liked (15)

PDF
I will NOT attend your meeting - I'm an Open Source person
PPTX
Oak Lucene Indexes
PDF
Automated self-testing and health check of CQ and Sling instances
PDF
Taming your CQ/AEM instances with the Apache Sling Health Checks
PPTX
EVOLVE'16 | Deploy | Abhishek Dwevedi | Overview of the Core AEM Technology
ODP
Server-side OSGi with Apache Sling (OSGiDevCon 2011)
PDF
It's just a Web server - a plea for simplicity
PDF
Modern operations with Apache Sling (2014 adaptTo version)
PDF
Hosting huge amount of binaries in JCR
PPTX
Into the TarPit: A TarMK Deep Dive
ODP
JCR and ModeShape
PDF
OpenCms Days 2016: Next generation content repository
PDF
The Zero Bullshit Architecture
PDF
Introduction to JCR
PDF
Apache Jackrabbit Oak - Scale your content repository to the cloud
I will NOT attend your meeting - I'm an Open Source person
Oak Lucene Indexes
Automated self-testing and health check of CQ and Sling instances
Taming your CQ/AEM instances with the Apache Sling Health Checks
EVOLVE'16 | Deploy | Abhishek Dwevedi | Overview of the Core AEM Technology
Server-side OSGi with Apache Sling (OSGiDevCon 2011)
It's just a Web server - a plea for simplicity
Modern operations with Apache Sling (2014 adaptTo version)
Hosting huge amount of binaries in JCR
Into the TarPit: A TarMK Deep Dive
JCR and ModeShape
OpenCms Days 2016: Next generation content repository
The Zero Bullshit Architecture
Introduction to JCR
Apache Jackrabbit Oak - Scale your content repository to the cloud
Ad

Similar to Can we run the Whole Web on Apache Sling? (20)

PDF
Spark Summit EU 2015: Lessons from 300+ production users
PDF
Running Spark In Production in the Cloud is Not Easy with Nayur Khan
PDF
Postgres the hardway
PPTX
PUT is the new rename()
PDF
10 things i wish i'd known before using spark in production
PPTX
MongoDB – Sharded cluster tutorial - Percona Europe 2017
PPTX
Sharded cluster tutorial
PPTX
MongoDB - Sharded Cluster Tutorial
PDF
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
PDF
apachecamelk-april2019-190409093034.pdf
PDF
Building an Apache Sling Rendering Farm
PPTX
Apache Camel K - Copenhagen v2
PPTX
Apache Camel K - Copenhagen
KEY
Practical Use of MongoDB for Node.js
PDF
Apache Camel v3, Camel K and Camel Quarkus
PPT
AWS (Hadoop) Meetup 30.04.09
PDF
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
PPTX
MongoDB vs Scylla: Production Experience from Both Dev & Ops Standpoint at Nu...
KEY
SD, a P2P bug tracking system
PDF
Fisl - Deployment
Spark Summit EU 2015: Lessons from 300+ production users
Running Spark In Production in the Cloud is Not Easy with Nayur Khan
Postgres the hardway
PUT is the new rename()
10 things i wish i'd known before using spark in production
MongoDB – Sharded cluster tutorial - Percona Europe 2017
Sharded cluster tutorial
MongoDB - Sharded Cluster Tutorial
SouJava May 2020: Apache Camel 3 - the next generation of enterprise integration
apachecamelk-april2019-190409093034.pdf
Building an Apache Sling Rendering Farm
Apache Camel K - Copenhagen v2
Apache Camel K - Copenhagen
Practical Use of MongoDB for Node.js
Apache Camel v3, Camel K and Camel Quarkus
AWS (Hadoop) Meetup 30.04.09
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
MongoDB vs Scylla: Production Experience from Both Dev & Ops Standpoint at Nu...
SD, a P2P bug tracking system
Fisl - Deployment

More from Bertrand Delacretaz (20)

PDF
VanillaJS & the Web Platform, a match made in heaven?
PDF
Surviving large online communities with conciseness and clarity
PDF
Repoinit: a mini-language for content repository initialization
PDF
The Moving House Model, adhocracy and remote collaboration
PDF
GraphQL in Apache Sling - but isn't it the opposite of REST?
PDF
Open Source Changes the World!
PDF
How to convince your left brain (or manager) to follow the Open Source path t...
PDF
L'Open Source change le Monde - BlendWebMix 2019
PDF
Shared Neurons - the Secret Sauce of Open Source communities?
PDF
Sling and Serverless, Best Friends Forever?
PDF
Serverless - introduction et perspectives concrètes
PDF
State of the Feather - ApacheCon North America 2018
PDF
Karate, the black belt of HTTP API testing?
PDF
Open Source at Scale: the Apache Software Foundation (2018)
PDF
They don't understand me! Tales from the multi-cultural trenches
PDF
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
PDF
Project and Community Services the Apache Way
PDF
La Fondation Apache - keynote au Paris Open Source Summit 2017
PDF
Asynchronous Decision Making - FOSS Backstage 2017
PDF
Who needs meetings? Asynchronous Decision Making to the rescue
VanillaJS & the Web Platform, a match made in heaven?
Surviving large online communities with conciseness and clarity
Repoinit: a mini-language for content repository initialization
The Moving House Model, adhocracy and remote collaboration
GraphQL in Apache Sling - but isn't it the opposite of REST?
Open Source Changes the World!
How to convince your left brain (or manager) to follow the Open Source path t...
L'Open Source change le Monde - BlendWebMix 2019
Shared Neurons - the Secret Sauce of Open Source communities?
Sling and Serverless, Best Friends Forever?
Serverless - introduction et perspectives concrètes
State of the Feather - ApacheCon North America 2018
Karate, the black belt of HTTP API testing?
Open Source at Scale: the Apache Software Foundation (2018)
They don't understand me! Tales from the multi-cultural trenches
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Project and Community Services the Apache Way
La Fondation Apache - keynote au Paris Open Source Summit 2017
Asynchronous Decision Making - FOSS Backstage 2017
Who needs meetings? Asynchronous Decision Making to the rescue

Recently uploaded (20)

PDF
Uptota Investor Deck - Where Africa Meets Blockchain
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PPTX
1402_iCSC_-_RESTful_Web_APIs_--_Josef_Hammer.pptx
PDF
Introduction to the IoT system, how the IoT system works
PPT
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
PDF
Slides PDF: The World Game (s) Eco Economic Epochs.pdf
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PDF
SlidesGDGoCxRAIS about Google Dialogflow and NotebookLM.pdf
PPTX
IPCNA VIRTUAL CLASSES INTERMEDIATE 6 PROJECT.pptx
PPTX
t_and_OpenAI_Combined_two_pressentations
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PDF
Session 1 (Week 1)fghjmgfdsfgthyjkhfdsadfghjkhgfdsa
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPT
Ethics in Information System - Management Information System
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PPTX
E -tech empowerment technologies PowerPoint
PPTX
newyork.pptxirantrafgshenepalchinachinane
PDF
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
Uptota Investor Deck - Where Africa Meets Blockchain
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
1402_iCSC_-_RESTful_Web_APIs_--_Josef_Hammer.pptx
Introduction to the IoT system, how the IoT system works
415456121-Jiwratrwecdtwfdsfwgdwedvwe dbwsdjsadca-EVN.ppt
Slides PDF: The World Game (s) Eco Economic Epochs.pdf
artificialintelligenceai1-copy-210604123353.pptx
SlidesGDGoCxRAIS about Google Dialogflow and NotebookLM.pdf
IPCNA VIRTUAL CLASSES INTERMEDIATE 6 PROJECT.pptx
t_and_OpenAI_Combined_two_pressentations
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Session 1 (Week 1)fghjmgfdsfgthyjkhfdsadfghjkhgfdsa
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Ethics in Information System - Management Information System
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
E -tech empowerment technologies PowerPoint
newyork.pptxirantrafgshenepalchinachinane
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
Exploring VPS Hosting Trends for SMBs in 2025
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf

Can we run the Whole Web on Apache Sling?

  • 1. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 26-28 SEPTEMBER 2016 Can we run the whole Web on Apache Sling? Bertrand Delacretaz & Chetan Mehrotra @bdelacretaz - @chetanmeh Sling committers and PMC members CQ/AEM core team members, Adobe slides revision 2016-09-26
  • 2. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 The Whole Web ??2 Are you guys crazy?
 (yes, but not that much)
  • 3. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 3 Where’s Sling going? 
 from SERVERSto SYSTEMS
  • 4. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 4 httpd mod_lua script mod_proxy haproxy etcd -> config MongoDB processor selector more pools… more pools… fileserver pool slingshot pool default pool more pools… etcd monitoring / metrics REDDR - Resource Driven Dynamic Routing
 Sling resource/script resolution drives routing 1 2 3 4 1 2 3 4 Request to Sling Processor Selector Response with a single word: fileserver +Header: Sling-Processor-Role:fileserver haproxy routes to fileserver pool Rebuild haproxy config on changes Sling instances announce themselves to etcd:
 -IP address
 -Port
 -Role
 
 Pools are actually haproxy “backends” fun! client
 request port 80 port 81 Sling-Processor-Role
  • 5. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 5 REDDRREsource-Driven Dynamic Routing
  • 6. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 6 REDDR routing to fileserver instances pool httpd mod_lua script mod_proxy haproxy etcd -> config processor selector fileserver pool1 2 3 4 0 1 2 3 4 Request to Sling Processor Selector Response with a single word: fileserver +Header: Sling-Processor-Role:fileserver haproxy routes to fileserver pool 0 Client request .routing script engine +
 select based on resource type and parent types.
 Default servlets and 
 scripts disabled. Select backend pool based on Sling-Processor-Role
 header, using haproxy “acl” generated from etcd
  • 7. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 7 Dynamic Registration of Sling Instances
 regenerate haproxy config based on etc data
  • 8. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 8 haproxy etcd -> config more pools… more pools… fileserver pool slingshot pool default pool more pools… etcd haproxy config is rebuilt via event-driven confd + reload.sh script Sling instances announce themselves to etcd:
 -IP address
 -Port
 -Role Dynamic wiring of Sling instances in the haproxy pools 1 2 1 2
  • 9. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 9 Building customised Sling Docker images
 with just a provisioning model + trivial Dockerfile
  • 10. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 10 base/pom.xml base/src/main/docker/Dockerfile base/src/main/docker/slingroot/announce.sh base/src/main/docker/slingroot/start.sh base/src/main/docker/slingroot/wait-for-it.sh default-processor/pom.xml default-processor/src/main/docker/Dockerfile default-processor/src/main/provisioning/composum-browser.txt default-processor/src/main/provisioning/default-processor.txt default-processor/src/main/provisioning/launchpad.txt default-processor/src/main/provisioning/… Base and default-processor images FROM ch.x42.at16.base COPY ${project.build.finalName}.jar /opt/sling/launchpad.jar Dockerfile for default-processor Custom Sling Docker im ages
  • 11. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 11 DYNAMIC CLUSTER DEMO A Big Sling Cluster…on my laptop
  • 12. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 12 httpd mod_lua script mod_proxy haproxy etcd -> config MongoDB processor selector more pools… more pools… fileserver pool slingshot pool default pool more pools… etcd monitoring / metrics REDDR - Resource Driven Dynamic Routing
 Sling resource/script resolution drives routing 1 2 3 4 1 2 3 4 Request to Sling Processor Selector Response with a single word: fileserver +Header: Sling-Processor-Role:fileserver haproxy routes to fileserver pool Rebuild haproxy config on changes Sling instances announce themselves to etcd:
 -IP address
 -Port
 -Role
 
 Pools are actually haproxy “backends”
  • 13. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 13 “Background Worker” Sling instance minimal, disposable, focused
  • 14. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Asset worker pool default pool MongoDB ActiveMQ 5 2 1 3 4 1 2 3 4 Request to Sling Frontend server Write to NodeStore Add job to message queue Pick up of job by one of the worker 5 Write back of Job result Worker Profile • Tailor made Sling instance • Min required bundles • Low footprint • JCR API used mostly for CRUD • No observation • Disposable • Take post processing load off frontend servers
  • 15. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 15 Repository Etiquette be precise while talking to repository and thou shall not be troubled!
  • 16. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Choose the right nodetype Avoid nt:unstructured • Orderable children • Limits writes Prefer oak:Unstructured OAK-657 + dashboard (nt:unstructured) - role_observer - projects-outdoors - role_editor - projects-editor + gadgets (nt:unstructured) + team + asset + dashboard (oak:Unstructured) - role_observer - projects-outdoors - role_editor - projects-editor + gadgets (oak:Unstructured) + team + asset
  • 17. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Choose the right nodetype Avoid nt:resource with nt:file • Referenceable • 1 nt:resource = 1 entry in uuid index • 1M Files = 1M entry in uuid index Prefer oak:Resource + book.jpg (nt:file) - jcr:createdBy - admin + jcr:content (nt:resource) - jcr:lastModifiedBy - admin - jcr:mimeType - image/jpeg - jcr:uuid - "dafe0c9c-1872-4397" OAK-4567 + book.jpg (nt:file) - jcr:createdBy - admin + jcr:content (oak:Resource) - jcr:lastModifiedBy - admin - jcr:mimeType - image/jpeg
  • 18. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Query Precisely • Use specific nodetype • Relativize property names wrt root of micro tree • Include path restrictions • Use union if nodetypes differ SELECT * FROM [nt:base] AS a WHERE a.[type] = 'image' SELECT * FROM [dam:Asset] AS a WHERE ISDESCENDANTNODE([/content/dam]) AND a.[jcr:content/metadata/type] = 'image'
  • 19. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Observe Precisely ▪ Observation costs resources ▪ Use JackrabbitEventFilter to filter on ▪ Multiple paths ▪ Nodetypes ▪ In works* filtering based on ▪ Property names ▪ Node names *OAK-4796 JackrabbitEventFilter eventFilter = new JackrabbitEventFilter() .setAbsPath(paths[0]) .setNodeTypes(new String[]{"dam:Asset"}) .setEventTypes(Event.NODE_ADDED) .setIsDeep(true);
 eventFilter.setAdditionalPaths("/content/en"); JackrabbitObservationManager om = (JackrabbitObservationManager)session.getWorkspace() .getObservationManager(); om.addEventListener(this, eventFilter);
  • 20. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Define your own types ▪ Nodetype/mixin are content annotation ▪ Repository uses them to ▪ Enforce structure ▪ Determine index rules ▪ Filter observation events ▪ Bundle Nodes* (new stuff!) *OAK-1312
  • 21. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Prefer Lucene Property Indexes ▪ Property Indexes ▪ Cause conflict in index data ▪ Causes commit root to be ‘/’ ▪ Stored as nodes ▪ Good for sparse and full sync case foo=bar bar=/a/b Commit Root
  • 22. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Prefer Lucene Property Indexes … ▪ Lucene Property Indexes ▪ Async indexing ▪ No impact on commit root ▪ Compact storage ▪ Multi restriction evaluation ▪ Are not they async? ▪ In works near real time indexing* *OAK-4412 foo=bar Commit Root
  • 23. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 FUTURE PERFORMANCE-RELATED Oak FEATURES work in progress!
  • 24. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Mongo Segment NSDocument NS Sling Segment NSDocument NS Sling Segment NS as Local Secondary Store ▪ Segment NS act a local copy of remote repository like a local git repo
 ▪ Updated via Observation
 ▪ Handles read call for “not so recently modified” Nodes
 ▪ Reduces read latency
 ▪ Configured to store certain path. Defaults to ‘/’ *OAK-4180
  • 25. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 Bundle Multiple JCR Node in one Document *OAK-1312 + book.jpg (nt:file) + jcr:content - jcr:data Bundling Pattern + jcr:system/documentstore/bundlor + nt:file - pattern - [jcr:content] { "_id": "2:/test/book.jpg", "_commitRoot": {"r1560bfe1650-0-1": "0"}, ":pattern": {"r1560bfe1650-0-1": "["str:jcr:content"]"}, "jcr:primaryType": {"r1560bfe1650-0-1": ""nt:file""} "jcr:content/jcr:data": {"r1560bfe1650-0-1": ""bar""}, } ▪ Store subtree aggregates of specific nodes in same NodeDocument ▪ JCR Node to Mongo mapping ▪ 1 JCR Node = 1 Mongo Doc ▪ 1 dam:Asset ~ 20 JCR Node ▪ 1M Assets = 20M Mongo Doc ▪ Nodetype as content annotation hint to optimize storage ▪ Benefits ▪ Lower size of _id index ▪ Less number of queries to read the micro tree Bundled NodeDocument
  • 26. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 26 CODA The Whole Web, really?
  • 27. Can we run the whole Web on Apache Sling? Bertrand Delacretaz, Chetan Mehrotra, adaptTo() 2016 27 CODA Thank you for attending! Chetan Mehrotra (@chetanmeh) Bertrand Delacretaz (@bdelacretaz) REDDR enables (extreme) scaling driven by Sling resource/script resolution. Building customized Sling instances is easy: provisioning model + trivial Dockerfile. From servers to systems! Precise and focused repository types and operations improve performance.