SlideShare a Scribd company logo
1 of 26
Download to read offline
APACHE SLING & FRIENDS TECH MEETUP
BERLIN, 25-27 SEPTEMBER 2017
Building an Apache Sling Rendering Farm
Bertrand Delacretaz
@bdelacretaz
Sling committer and PMC member

Principal Scientist, Adobe AEM team
slides revision 2017-09-25
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 2
What are we building?setting the stage
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 3
How is Sling used today?
Load

BalancingThe Web
Publishing Instances
Sling instances dedicated to single tenants or “friendly” tenants.
Rendering
+ Caching
Content

Repository
Rendering
+ Caching
Content

Repository
Rendering
+ Caching
Content

Repository
Rendering
+ Caching
Content

Repository
Content

Repository
Authoring
Content Distribution
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 4
A Massive Sling Rendering/Processing Farm?
Content

Repository
Resource

Resolution
Scripting +

Rendering
Resource

Resolution
Resource

Resolution
Resource

Resolution
Scripting +

Rendering
Scripting +

Rendering
Scripting +

Rendering
Load

Balancing
Load

Balancing
Elastic scaling at each stage
Multiple developers (“tenants”) see their own world only
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 5
Federated ServicesThis 2017 after all
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 6
Content

Repository
Resource

Resolver
Scripting and
Rendering
Script
Resolver
HTTP

front-end Sling Engine
Microservices!
Nice and trendy,
but will that
perform?
HTTP
HTTP
HTTP HTTP HTTP
HTTP
Each component is an independent HTTP-based service, aka “religious microservices”
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 7
The Sling PipelineFaithfully serving requests since 2007!
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 8
Content

Repository
Resource

Resolver
Scripting and
Rendering
Script
Resolver
Resource ScriptRequest Output
Sling Request Processing Pipeline
1 2 3 4
Conceptually, the request hits the repository first, to get the Resource.
Scripts and Servlets are equivalent, considering scripts only here.
All in-memory and in-process!
sling:include
5..N
content aggregation!
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 9
Content

Repository
Scripting and
Rendering
Script
Resolver
Scripts
Output
Federated Services Friendly?
Resource

Resolver
Content
Aggregator
Aggregated

Content
Request
Process boundaries
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 10
Reasonably Federated?Can we get isolation AND performance?
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 11
HTTP

front-end
Reasonably Federated Sling Rendering Farm?
Aggregated

Content
Content

Repository
Resource

Resolver
Content
Aggregator
Content Provider

Service
Content Rendering

Service
Scripting and
Rendering
Script
Resolver
Scripts

Repository
Output
It’s still mostly Sling, with the addition of a
(scripted?) content aggregation step.
Federated services provide more deployment and
scaling options.
Sandboxed
Execution
Isolated
Content
Sandboxed
Execution
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 12
Sandboxing & IsolationHow?
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 13
Sandboxing & Isolation?
Scripting and
Rendering
Sandboxed
Execution
Content

Repository
Isolated
Content
Content
Aggregator
Sandboxed
Execution
Repository Access Control
can work but require a dynamic
search path in Sling, see our
experiments. Impacts caching, and
mapping of incoming to resource
paths is needed.Tried and tested.
Repository jails look possible
with probable impact on Sling
internals. Same with multiple
SlingRepository services. New
and more like a blacklist.
Custom, restricted languages
are the safest? HTL (Use-API?),
Handlebars?
Sandboxing Nashorn
(JavaScript) looks possible but not
ideal, see our experiments.
Sandboxing Java is not realistic-
IBM canceled multi tenant JVM
project for example.
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 14
But it’s a VM, right?
Oak
Libraries Sling Engine
JavaVirtual Machine
content
Oak
Libraries Sling Engine
JavaVirtual Machine
content
Oak
Libraries Sling Engine
JavaVirtual Machine
content
Perfect isolation!
Java classes

memory space
Application

memory space
Java classes

memory space
Application

memory space
Java classes

memory space
Application

memory space
But suboptimal use of resources!
(and containers wouldn’t help)
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 15
Sandboxing scripting languages?
<%
var length = 0;
if (request.getRequestParameter("file") != null) {
var file = null;
// store file
var reqPara = request.getRequestParameter("file");
var is = reqPara.getInputStream();
file = Packages.java.io.File.createTempFile("posttest", ".txt");
var fout = new Packages.java.io.FileOutputStream(file);
var c;
while ((c = is.read()) != -1) {
fout.write(c);
}
fout.close();
// read length
length = file.length();
}
%>
OS
Resources
Infinite
Loops
Java classes
& services
Memory

Usage?
Many things need to be limited.

Whitelist approach is much safer -> custom languages?

HTL inherently sandboxed, except its Use-objects
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 16
Containers?
Oak
Libraries Sling Engine
OS container
content
Java classes

memory space
Application

memory space
SMALL!
Shared Memory
Pools, Caches etc.
memory
Oak
Libraries Sling Engine
OS container
content
Java classes

memory space
Application

memory space
SMALL!
Oak
Libraries Sling Engine
OS container
content
Java classes

memory space
Application

memory space
SMALL!
Same problem as multiple JVMs
Sharing caches, compiled scripts etc. can be a pragmatic solution.
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 17
What do we do?
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 18
Hybrid Sling Rendering Farm
Annotated
Aggregated
Content
HTTP

front-end
HTTP

routing
Scripting +
Rendering
Script
Resolver scripts
Shared Services
Custom
Code
Script
Resolver scripts
Tenant-Specific Services
servletscontent
Resource

Resolver
Content
Aggregator
Oak
Libraries
Shared Services
Sandboxed
Execution
New

Component
Content-driven
routing
Isolated

Content
Dynamic
Search Path
Provides the flexibility of Sling via tenant-specific services and dynamic routing.
Uses shared services for the common parts.
Allows for billable options depending on the actual routing.
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 19
Experimentsbuilding blocks that might be reusable
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 20
Resolving new types of scripts Experim
ent
Script
Resolver
Client

GET
Request
Wrapped

AGG
Request
Wrap the request to make it appear as an
AGG (*) request and pass that to the
Sling ServletResolver.
Adapt the return SlingScript to an
InputStream to read its text.
(*) or any other non-existent HTTP verb.
Content

Repository
/apps

/myapp
/AGG.js
AGG.js

script

text
Code at https://github.com/bdelacretaz/sling-adaptto-2017 (ContentBVP.java)
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 21
Resolving a SLING-CONTENT script Experim
ent
Code at https://github.com/bdelacretaz/sling-adaptto-2017 (ContentBVP.java)
String getAggregatorScript(SlingHttpServletRequest r) {
String result = null;
Servlet s =
servletResolver.resolveServlet(
new ChangeMethodRequestWrapper(r, "SLING-CONTENT"));
if(s instanceof SlingScript) {
InputStream is = ((SlingScript)s).getScriptResource()
.adaptTo(InputStream.class); }
if(is != null) {
result = IOUtils.toString(is)
}
}
return result;
}
adaptTo() Bonus Points!
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 22
Content Aggregation with Sling Query Experim
entvar $ = Packages.org.apache.sling.query.SlingQuery.$
var SearchStrategy =
Packages.org.apache.sling.query.api.SearchStrategy
var resourceResolver = resource.getResourceResolver()
var result = {
siblings : $(resource).siblings(),
rootChildren : $(resource).parents().last().children(),
queryResult :
$(resourceResolver)
.searchStrategy(SearchStrategy.QUERY)
.find("nt:base[title=foo]")
} Used in a BindingsValuesProvider?
Or in a custom json renderer servlet which runs this script.
Inherently sandboxed due to custom language.
https://sling.apache.org/documentation/bundles/sling-query.html
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 23
Dynamic scripts/servlet search path Experim
entif(dynamicServletResolver.canResolve(resource)) {
servlet = dynamicServletResolver.resolveServlet(request);
} else {
…existing resolver code
}
A fairly simple change to the SlingServletResolver - should evolve
into a real extension point if desired, and probably get the
request as well.
Tested in SLING-4386 - another multitenant experiment which
provides tenant-specific scripts but no real isolation.
Currently requires disabling the servlet resolution cache.
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 24
Nashorn (JavaScript) sandboxing (Java Delight) Experim
entNashornSandbox {
allow(final Class<?> clazz);
injectGlobalVariable(String variableName, Object object);
setMaxCPUTime(long limitMsec);
Object eval(final String javaScriptCode);
allowPrintFunctions(boolean v);
allowReadFunctions(boolean v);
...more allow functions
// $ARG, $ENV, $EXEC...
allowGlobalsObjects(final boolean v);
}
Uses Nashorn’s ClassFilter to block Java classes
Sandboxing rewrites standard methods + user code- > blacklisting, not ideal
https://github.com/javadelight/delight-nashorn-sandbox (Java Delight Suite)
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 25
CODAwhere to now?
Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 26
CODA
Thank you for attending!
I’m Bertrand Delacretaz (@bdelacretaz)
In-memory nature of Sling is an important
differentiator, in good and bad ways!
Hybrid Rendering Farm promising - do you need it?
Sandboxing is difficult, whitelisting much
preferred, custom languages?
Reusable

experiments?

More Related Content

What's hot

Rh developers fat jar smackdown
Rh developers   fat jar smackdownRh developers   fat jar smackdown
Rh developers fat jar smackdownRed Hat Developers
 
DCSF19 Tips and Tricks of the Docker Captains
DCSF19 Tips and Tricks of the Docker Captains  DCSF19 Tips and Tricks of the Docker Captains
DCSF19 Tips and Tricks of the Docker Captains Docker, Inc.
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Dockerkanedafromparis
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudIdeato
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDocker, Inc.
 
Writing a Gem with native extensions
Writing a Gem with native extensionsWriting a Gem with native extensions
Writing a Gem with native extensionsTristan Penman
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPDana Luther
 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with dockerGiacomo Bagnoli
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Ben Hall
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPChris Tankersley
 
Lessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containersLessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containersBen Hall
 
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldSchalk Cronjé
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90minsLarry Cai
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in descriptionPrzemyslaw Koltermann
 
Hands on Docker - Launch your own LEMP or LAMP stack
Hands on Docker -  Launch your own LEMP or LAMP stackHands on Docker -  Launch your own LEMP or LAMP stack
Hands on Docker - Launch your own LEMP or LAMP stackDana Luther
 
Cloud hybridation leveraging on Docker 1.12
Cloud hybridation leveraging on Docker 1.12Cloud hybridation leveraging on Docker 1.12
Cloud hybridation leveraging on Docker 1.12Ludovic Piot
 

What's hot (20)

Rh developers fat jar smackdown
Rh developers   fat jar smackdownRh developers   fat jar smackdown
Rh developers fat jar smackdown
 
DCSF19 Tips and Tricks of the Docker Captains
DCSF19 Tips and Tricks of the Docker Captains  DCSF19 Tips and Tricks of the Docker Captains
DCSF19 Tips and Tricks of the Docker Captains
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Continuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in CloudContinuous Integration: SaaS vs Jenkins in Cloud
Continuous Integration: SaaS vs Jenkins in Cloud
 
DCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker CaptainsDCEU 18: Tips and Tricks of the Docker Captains
DCEU 18: Tips and Tricks of the Docker Captains
 
Writing a Gem with native extensions
Writing a Gem with native extensionsWriting a Gem with native extensions
Writing a Gem with native extensions
 
Docker in practice
Docker in practiceDocker in practice
Docker in practice
 
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHPHands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
 
Streamline your development environment with docker
Streamline your development environment with dockerStreamline your development environment with docker
Streamline your development environment with docker
 
Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Docker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHPDocker for Developers - Sunshine PHP
Docker for Developers - Sunshine PHP
 
Lessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containersLessons from running potentially malicious code inside Docker containers
Lessons from running potentially malicious code inside Docker containers
 
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
 
Build service with_docker_in_90mins
Build service with_docker_in_90minsBuild service with_docker_in_90mins
Build service with_docker_in_90mins
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
Check the version with fixes. Link in description
Check the version with fixes. Link in descriptionCheck the version with fixes. Link in description
Check the version with fixes. Link in description
 
Docker
DockerDocker
Docker
 
Hands on Docker - Launch your own LEMP or LAMP stack
Hands on Docker -  Launch your own LEMP or LAMP stackHands on Docker -  Launch your own LEMP or LAMP stack
Hands on Docker - Launch your own LEMP or LAMP stack
 
Cloud hybridation leveraging on Docker 1.12
Cloud hybridation leveraging on Docker 1.12Cloud hybridation leveraging on Docker 1.12
Cloud hybridation leveraging on Docker 1.12
 

Similar to Building an Apache Sling Rendering Farm

ABD315_Serverless ETL with AWS Glue
ABD315_Serverless ETL with AWS GlueABD315_Serverless ETL with AWS Glue
ABD315_Serverless ETL with AWS GlueAmazon Web Services
 
Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?Bertrand Delacretaz
 
RESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with DockerRESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with DockerBertrand Delacretaz
 
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereApache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereGanesh Raju
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventJohn Schneider
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Amazon Web Services
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsSadayuki Furuhashi
 
Infra space talk on Apache Spark - Into to CASK
Infra space talk on Apache Spark - Into to CASKInfra space talk on Apache Spark - Into to CASK
Infra space talk on Apache Spark - Into to CASKRob Mueller
 
CRX Best practices
CRX Best practicesCRX Best practices
CRX Best practiceslisui0807
 
Hack Shack workshop: Persist, optimize and accelerate using persistent storag...
Hack Shack workshop: Persist, optimize and accelerate using persistent storag...Hack Shack workshop: Persist, optimize and accelerate using persistent storag...
Hack Shack workshop: Persist, optimize and accelerate using persistent storag...Michael Mattsson
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegelermfrancis
 
Building an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable ScaleBuilding an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable ScaleMerelda
 
H2O PySparkling Water
H2O PySparkling WaterH2O PySparkling Water
H2O PySparkling WaterSri Ambati
 
Apache spark with java 8
Apache spark with java 8Apache spark with java 8
Apache spark with java 8Janu Jahnavi
 
Apache spark with java 8
Apache spark with java 8Apache spark with java 8
Apache spark with java 8Janu Jahnavi
 
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017Amazon Web Services
 
LFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdfLFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdfAmazon Web Services
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Bertrand Delacretaz
 

Similar to Building an Apache Sling Rendering Farm (20)

ABD315_Serverless ETL with AWS Glue
ABD315_Serverless ETL with AWS GlueABD315_Serverless ETL with AWS Glue
ABD315_Serverless ETL with AWS Glue
 
Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?Can we run the Whole Web on Apache Sling?
Can we run the Whole Web on Apache Sling?
 
RESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with DockerRESTful OSGi middleware for NoSQL databases with Docker
RESTful OSGi middleware for NoSQL databases with Docker
 
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data EverywhereApache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
Apache Bigtop and ARM64 / AArch64 - Empowering Big Data Everywhere
 
Continuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:InventContinuous Deployment @ AWS Re:Invent
Continuous Deployment @ AWS Re:Invent
 
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
Continuous Integration and Deployment Best Practices on AWS (ARC307) | AWS re...
 
Plugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGemsPlugin-based software design with Ruby and RubyGems
Plugin-based software design with Ruby and RubyGems
 
Infra space talk on Apache Spark - Into to CASK
Infra space talk on Apache Spark - Into to CASKInfra space talk on Apache Spark - Into to CASK
Infra space talk on Apache Spark - Into to CASK
 
CRX Best practices
CRX Best practicesCRX Best practices
CRX Best practices
 
Hack Shack workshop: Persist, optimize and accelerate using persistent storag...
Hack Shack workshop: Persist, optimize and accelerate using persistent storag...Hack Shack workshop: Persist, optimize and accelerate using persistent storag...
Hack Shack workshop: Persist, optimize and accelerate using persistent storag...
 
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten ZiegelerNew and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
New and cool in OSGi R7 - David Bosschaert & Carsten Ziegeler
 
Building an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable ScaleBuilding an MLOps Stack for Companies at Reasonable Scale
Building an MLOps Stack for Companies at Reasonable Scale
 
H2O PySparkling Water
H2O PySparkling WaterH2O PySparkling Water
H2O PySparkling Water
 
Apache spark with java 8
Apache spark with java 8Apache spark with java 8
Apache spark with java 8
 
Apache spark with java 8
Apache spark with java 8Apache spark with java 8
Apache spark with java 8
 
CQ5 and Sling overview
CQ5 and Sling overviewCQ5 and Sling overview
CQ5 and Sling overview
 
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
High-Throughput Genomics on AWS - LFS309 - re:Invent 2017
 
LFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdfLFS309-High-Throughput Genomics on AWS.pdf
LFS309-High-Throughput Genomics on AWS.pdf
 
Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?Karate, the black belt of HTTP API testing?
Karate, the black belt of HTTP API testing?
 
Function as a Service
Function as a ServiceFunction as a Service
Function as a Service
 

More from Bertrand Delacretaz

VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?Bertrand Delacretaz
 
Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity Bertrand Delacretaz
 
The Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaborationThe Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaborationBertrand Delacretaz
 
How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...Bertrand Delacretaz
 
L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019Bertrand Delacretaz
 
Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?Bertrand Delacretaz
 
State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018Bertrand Delacretaz
 
Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)Bertrand Delacretaz
 
They don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenchesThey don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenchesBertrand Delacretaz
 
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)Bertrand Delacretaz
 
Project and Community Services the Apache Way
Project and Community Services the Apache WayProject and Community Services the Apache Way
Project and Community Services the Apache WayBertrand Delacretaz
 
La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017Bertrand Delacretaz
 
Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017Bertrand Delacretaz
 
Who needs meetings? Asynchronous Decision Making to the rescue
Who needs meetings? Asynchronous Decision Making to the rescueWho needs meetings? Asynchronous Decision Making to the rescue
Who needs meetings? Asynchronous Decision Making to the rescueBertrand Delacretaz
 
Simple software is hard...don't give up!
Simple software is hard...don't give up!Simple software is hard...don't give up!
Simple software is hard...don't give up!Bertrand Delacretaz
 
I will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source personI will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source personBertrand Delacretaz
 
Open Development in the Enterprise, 19 minutes 2016 version
Open Development in the Enterprise, 19 minutes 2016 versionOpen Development in the Enterprise, 19 minutes 2016 version
Open Development in the Enterprise, 19 minutes 2016 versionBertrand Delacretaz
 
Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?Bertrand Delacretaz
 
ApacheCon:Core EU 2015: State of the Feather
ApacheCon:Core EU 2015: State of the FeatherApacheCon:Core EU 2015: State of the Feather
ApacheCon:Core EU 2015: State of the FeatherBertrand Delacretaz
 

More from Bertrand Delacretaz (20)

VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?VanillaJS & the Web Platform, a match made in heaven?
VanillaJS & the Web Platform, a match made in heaven?
 
Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity Surviving large online communities with conciseness and clarity
Surviving large online communities with conciseness and clarity
 
The Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaborationThe Moving House Model, adhocracy and remote collaboration
The Moving House Model, adhocracy and remote collaboration
 
Open Source Changes the World!
Open Source Changes the World!Open Source Changes the World!
Open Source Changes the World!
 
How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...How to convince your left brain (or manager) to follow the Open Source path t...
How to convince your left brain (or manager) to follow the Open Source path t...
 
L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019L'Open Source change le Monde - BlendWebMix 2019
L'Open Source change le Monde - BlendWebMix 2019
 
Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?Shared Neurons - the Secret Sauce of Open Source communities?
Shared Neurons - the Secret Sauce of Open Source communities?
 
State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018State of the Feather - ApacheCon North America 2018
State of the Feather - ApacheCon North America 2018
 
Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)Open Source at Scale: the Apache Software Foundation (2018)
Open Source at Scale: the Apache Software Foundation (2018)
 
They don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenchesThey don't understand me! Tales from the multi-cultural trenches
They don't understand me! Tales from the multi-cultural trenches
 
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
Prise de Décisions Asynchrone, Devoxx France 2018 (avec vidéo)
 
Project and Community Services the Apache Way
Project and Community Services the Apache WayProject and Community Services the Apache Way
Project and Community Services the Apache Way
 
La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017La Fondation Apache - keynote au Paris Open Source Summit 2017
La Fondation Apache - keynote au Paris Open Source Summit 2017
 
Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017Asynchronous Decision Making - FOSS Backstage 2017
Asynchronous Decision Making - FOSS Backstage 2017
 
Who needs meetings? Asynchronous Decision Making to the rescue
Who needs meetings? Asynchronous Decision Making to the rescueWho needs meetings? Asynchronous Decision Making to the rescue
Who needs meetings? Asynchronous Decision Making to the rescue
 
Simple software is hard...don't give up!
Simple software is hard...don't give up!Simple software is hard...don't give up!
Simple software is hard...don't give up!
 
I will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source personI will NOT attend your meeting - I'm an Open Source person
I will NOT attend your meeting - I'm an Open Source person
 
Open Development in the Enterprise, 19 minutes 2016 version
Open Development in the Enterprise, 19 minutes 2016 versionOpen Development in the Enterprise, 19 minutes 2016 version
Open Development in the Enterprise, 19 minutes 2016 version
 
Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?Will the Apache Maturity Model save your project?
Will the Apache Maturity Model save your project?
 
ApacheCon:Core EU 2015: State of the Feather
ApacheCon:Core EU 2015: State of the FeatherApacheCon:Core EU 2015: State of the Feather
ApacheCon:Core EU 2015: State of the Feather
 

Recently uploaded

PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationMarko4394
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书rnrncn29
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书rnrncn29
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 

Recently uploaded (17)

PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
NSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentationNSX-T and Service Interfaces presentation
NSX-T and Service Interfaces presentation
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
『澳洲文凭』买詹姆士库克大学毕业证书成绩单办理澳洲JCU文凭学位证书
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
『澳洲文凭』买拉筹伯大学毕业证书成绩单办理澳洲LTU文凭学位证书
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 

Building an Apache Sling Rendering Farm

  • 1. APACHE SLING & FRIENDS TECH MEETUP BERLIN, 25-27 SEPTEMBER 2017 Building an Apache Sling Rendering Farm Bertrand Delacretaz @bdelacretaz Sling committer and PMC member
 Principal Scientist, Adobe AEM team slides revision 2017-09-25
  • 2. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 2 What are we building?setting the stage
  • 3. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 3 How is Sling used today? Load
 BalancingThe Web Publishing Instances Sling instances dedicated to single tenants or “friendly” tenants. Rendering + Caching Content
 Repository Rendering + Caching Content
 Repository Rendering + Caching Content
 Repository Rendering + Caching Content
 Repository Content
 Repository Authoring Content Distribution
  • 4. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 4 A Massive Sling Rendering/Processing Farm? Content
 Repository Resource
 Resolution Scripting +
 Rendering Resource
 Resolution Resource
 Resolution Resource
 Resolution Scripting +
 Rendering Scripting +
 Rendering Scripting +
 Rendering Load
 Balancing Load
 Balancing Elastic scaling at each stage Multiple developers (“tenants”) see their own world only
  • 5. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 5 Federated ServicesThis 2017 after all
  • 6. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 6 Content
 Repository Resource
 Resolver Scripting and Rendering Script Resolver HTTP
 front-end Sling Engine Microservices! Nice and trendy, but will that perform? HTTP HTTP HTTP HTTP HTTP HTTP Each component is an independent HTTP-based service, aka “religious microservices”
  • 7. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 7 The Sling PipelineFaithfully serving requests since 2007!
  • 8. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 8 Content
 Repository Resource
 Resolver Scripting and Rendering Script Resolver Resource ScriptRequest Output Sling Request Processing Pipeline 1 2 3 4 Conceptually, the request hits the repository first, to get the Resource. Scripts and Servlets are equivalent, considering scripts only here. All in-memory and in-process! sling:include 5..N content aggregation!
  • 9. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 9 Content
 Repository Scripting and Rendering Script Resolver Scripts Output Federated Services Friendly? Resource
 Resolver Content Aggregator Aggregated
 Content Request Process boundaries
  • 10. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 10 Reasonably Federated?Can we get isolation AND performance?
  • 11. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 11 HTTP
 front-end Reasonably Federated Sling Rendering Farm? Aggregated
 Content Content
 Repository Resource
 Resolver Content Aggregator Content Provider
 Service Content Rendering
 Service Scripting and Rendering Script Resolver Scripts
 Repository Output It’s still mostly Sling, with the addition of a (scripted?) content aggregation step. Federated services provide more deployment and scaling options. Sandboxed Execution Isolated Content Sandboxed Execution
  • 12. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 12 Sandboxing & IsolationHow?
  • 13. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 13 Sandboxing & Isolation? Scripting and Rendering Sandboxed Execution Content
 Repository Isolated Content Content Aggregator Sandboxed Execution Repository Access Control can work but require a dynamic search path in Sling, see our experiments. Impacts caching, and mapping of incoming to resource paths is needed.Tried and tested. Repository jails look possible with probable impact on Sling internals. Same with multiple SlingRepository services. New and more like a blacklist. Custom, restricted languages are the safest? HTL (Use-API?), Handlebars? Sandboxing Nashorn (JavaScript) looks possible but not ideal, see our experiments. Sandboxing Java is not realistic- IBM canceled multi tenant JVM project for example.
  • 14. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 14 But it’s a VM, right? Oak Libraries Sling Engine JavaVirtual Machine content Oak Libraries Sling Engine JavaVirtual Machine content Oak Libraries Sling Engine JavaVirtual Machine content Perfect isolation! Java classes
 memory space Application
 memory space Java classes
 memory space Application
 memory space Java classes
 memory space Application
 memory space But suboptimal use of resources! (and containers wouldn’t help)
  • 15. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 15 Sandboxing scripting languages? <% var length = 0; if (request.getRequestParameter("file") != null) { var file = null; // store file var reqPara = request.getRequestParameter("file"); var is = reqPara.getInputStream(); file = Packages.java.io.File.createTempFile("posttest", ".txt"); var fout = new Packages.java.io.FileOutputStream(file); var c; while ((c = is.read()) != -1) { fout.write(c); } fout.close(); // read length length = file.length(); } %> OS Resources Infinite Loops Java classes & services Memory
 Usage? Many things need to be limited.
 Whitelist approach is much safer -> custom languages?
 HTL inherently sandboxed, except its Use-objects
  • 16. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 16 Containers? Oak Libraries Sling Engine OS container content Java classes
 memory space Application
 memory space SMALL! Shared Memory Pools, Caches etc. memory Oak Libraries Sling Engine OS container content Java classes
 memory space Application
 memory space SMALL! Oak Libraries Sling Engine OS container content Java classes
 memory space Application
 memory space SMALL! Same problem as multiple JVMs Sharing caches, compiled scripts etc. can be a pragmatic solution.
  • 17. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 17 What do we do?
  • 18. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 18 Hybrid Sling Rendering Farm Annotated Aggregated Content HTTP
 front-end HTTP
 routing Scripting + Rendering Script Resolver scripts Shared Services Custom Code Script Resolver scripts Tenant-Specific Services servletscontent Resource
 Resolver Content Aggregator Oak Libraries Shared Services Sandboxed Execution New
 Component Content-driven routing Isolated
 Content Dynamic Search Path Provides the flexibility of Sling via tenant-specific services and dynamic routing. Uses shared services for the common parts. Allows for billable options depending on the actual routing.
  • 19. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 19 Experimentsbuilding blocks that might be reusable
  • 20. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 20 Resolving new types of scripts Experim ent Script Resolver Client
 GET Request Wrapped
 AGG Request Wrap the request to make it appear as an AGG (*) request and pass that to the Sling ServletResolver. Adapt the return SlingScript to an InputStream to read its text. (*) or any other non-existent HTTP verb. Content
 Repository /apps
 /myapp /AGG.js AGG.js
 script
 text Code at https://github.com/bdelacretaz/sling-adaptto-2017 (ContentBVP.java)
  • 21. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 21 Resolving a SLING-CONTENT script Experim ent Code at https://github.com/bdelacretaz/sling-adaptto-2017 (ContentBVP.java) String getAggregatorScript(SlingHttpServletRequest r) { String result = null; Servlet s = servletResolver.resolveServlet( new ChangeMethodRequestWrapper(r, "SLING-CONTENT")); if(s instanceof SlingScript) { InputStream is = ((SlingScript)s).getScriptResource() .adaptTo(InputStream.class); } if(is != null) { result = IOUtils.toString(is) } } return result; } adaptTo() Bonus Points!
  • 22. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 22 Content Aggregation with Sling Query Experim entvar $ = Packages.org.apache.sling.query.SlingQuery.$ var SearchStrategy = Packages.org.apache.sling.query.api.SearchStrategy var resourceResolver = resource.getResourceResolver() var result = { siblings : $(resource).siblings(), rootChildren : $(resource).parents().last().children(), queryResult : $(resourceResolver) .searchStrategy(SearchStrategy.QUERY) .find("nt:base[title=foo]") } Used in a BindingsValuesProvider? Or in a custom json renderer servlet which runs this script. Inherently sandboxed due to custom language. https://sling.apache.org/documentation/bundles/sling-query.html
  • 23. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 23 Dynamic scripts/servlet search path Experim entif(dynamicServletResolver.canResolve(resource)) { servlet = dynamicServletResolver.resolveServlet(request); } else { …existing resolver code } A fairly simple change to the SlingServletResolver - should evolve into a real extension point if desired, and probably get the request as well. Tested in SLING-4386 - another multitenant experiment which provides tenant-specific scripts but no real isolation. Currently requires disabling the servlet resolution cache.
  • 24. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 24 Nashorn (JavaScript) sandboxing (Java Delight) Experim entNashornSandbox { allow(final Class<?> clazz); injectGlobalVariable(String variableName, Object object); setMaxCPUTime(long limitMsec); Object eval(final String javaScriptCode); allowPrintFunctions(boolean v); allowReadFunctions(boolean v); ...more allow functions // $ARG, $ENV, $EXEC... allowGlobalsObjects(final boolean v); } Uses Nashorn’s ClassFilter to block Java classes Sandboxing rewrites standard methods + user code- > blacklisting, not ideal https://github.com/javadelight/delight-nashorn-sandbox (Java Delight Suite)
  • 25. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 25 CODAwhere to now?
  • 26. Building an Apache Sling Rendering Farm - Bertrand Delacretaz, adaptTo 2017 26 CODA Thank you for attending! I’m Bertrand Delacretaz (@bdelacretaz) In-memory nature of Sling is an important differentiator, in good and bad ways! Hybrid Rendering Farm promising - do you need it? Sandboxing is difficult, whitelisting much preferred, custom languages? Reusable
 experiments?