SlideShare a Scribd company logo
1 of 25
Download to read offline
APACHE SLING & FRIENDS TECH MEETUP
2 - 4 SEPTEMBER 2019
From 0 to HERO in under 10 seconds
Radu Cotescu, Karl Pauls - Adobe
rev. 7.20190901
2
Mr. Scripting
3
▪ Computer Scientist @ Adobe, Basel,
Switzerland
▪ Member of the Apache Software
Foundation
▪ Apache Sling PMC member
▪ Maintainer of HTL for Apache Sling
▪ Initiator of the Apache Sling Validation
Framework
Mr. Classloader
4
▪ Computer Scientist @ Adobe, Basel,
Switzerland
▪ Member of the Apache Software
Foundation
▪ Apache Sling and Apache Felix PMC
(VP) member
▪ Co-Author of OSGi in Action
5
Apache Sling Scripting Reloaded[0]
6
Wait, is this 2018 again?!?!
Core principles:
1. pack scripts into OSGi bundles
2. define the resource types as versioned capabilities, with
versioned requirements (Java APIs, other resource types to
which scripts delegate or which scripts extend)
3. allow the platform to do what it’s made to: wire things
7
Apache Sling Scripting Bundle Tracker[1]
What:
1. add-on module to which bundles that provide scripts have to
be wired explicitly
2. reuses the already established mechanisms for registering
servlets in Apache Sling
3. allows building light-weight instances that can be thrown into
production with very little warm-up, when using precompiled
scripts
8
Apache Sling Scripting Bundle Tracker[1]
4. provides the mechanism for deploying truly versionable
scripts, with explicit dependencies, by relying on the OSGi
framework
5. removes the need of a separate ScriptCache
6. removes additional pressure on the persistence layer
7. simplifies instance and application upgrades
8. Maven plugin for generating requirements and capabilities
9
Apache Sling Scripting Bundle Tracker[1]
If there’s something cool from 2018
10
11
From 0 to HERO in under 10 seconds
And in 2019 the buzzwords are…
However, it’s 2019
12
Microservices Cloud Native DevOps Stateless XaaS
A container should be:
✓immutable
✓reasonably lightweight, which implies
✓small disk footprint
✓small memory footprint
✓blazing fast start-up time
✓horizontally scalable (remember Kubernetes?), therefore
preferably stateless
13
If Sling would be a Docker image […]
1. Sprinkle Apache Sling Feature Model to taste:
1. no configurations on disk
2. lightweight launcher (no caching of artifacts)
2. Mix a bit of jlink to create a custom JRE:
1. use jdeps to figure out the dependencies
2. try to avoid java.desktop, if possible
3. Base your image on alpine
[…] under 100 MB […]
14
1. Use a customised Sling setup – minimum number of bundles
▪ JCR-less Sling (we know, it’s heresy) - the Resource Provider
API can be used to expose Resources from anywhere
https://xkcd.com/644/
[…] and completely stateless
15
2. /content exposed through remote Resources
3. Precompiled component scripts served through bundles
(separation of concerns [1])
4. Immutable deployment
▪ Feature Model only
[…] and completely stateless
16
/**
* A {@code RemoteStorageProvider} is responsible for retrieving the {@link RemoteResourceReference}s
* corresponding to a certain Sling path.
*/
@ProviderType
public interface RemoteStorageProvider {
@Nullable
RemoteResourceReference findResource(@NotNull String slingPath, @NotNull Map<String, Object> authenticationInfo);
@Nullable
File getFile(@NotNull RemoteResourceReference reference, @NotNull Map<String, Object> authenticationInfo);
@Nullable
Directory getDirectory(@NotNull RemoteResourceReference reference, @NotNull Map<String, Object> authenticationInfo);
}
RemoteStorageProvider API
17
▪ Experimental! API to have different remote resources hooked
into Sling via ResourceProviders:
▪ 1:1 mapping between a ResourceProvider and a
RemoteStorageProvider
▪ Provides a Resource tree based on files and folders, with a
special .sling.json file for defining properties
▪ Includes an in-memory caching layer and event handling
(optional); should probably delegate this to Redis
RemoteStorageProvider API
18
RemoteStorageProvider API
19
Putting it all together
20
21
Demo*
*or how we can embarrass ourselves if things don’t work
✓ stateless Docker container
✓ 75 MB JCR-less Sling web application including the JRE
✓ less than 200 MB memory footprint
✓ less than 10 seconds elapsed before first rendering*
✓ 0 dynamically generated classes (no compilers)
* on a crazy expensive 2018 MacBook Pro ; good luck deploying servers so powerful in production!
So what was this demo about?
22
OSGi RFP 196 [2]
▪ Provides a way to use an OSGi framework with custom
classloaders (a.k.a. OSGi Connect/PojoSR)
Graal/Substrate VM
▪ Ahead-of-Time (AOT) Java code compilation
Together with the precompiled bundled scripts it should be
possible to perform an AOT compilation of our Sling application
as a native image
Where do we go from here?
23
24
Q&A
[0] – https://adapt.to/2018/en/schedule/apache-sling-scripting-reloaded.html
[1] - https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker
[2] - https://github.com/osgi/design/blob/master/rfps/rfp-0196-OSGiConnect.pdf
Assets licensed from https://stock.adobe.com/
Our diagrams were designed with https://whimsical.co/flowcharts/
Code available after the talk at https://github.com/apache/sling-whiteboard/tree/master/it-is-cloudy-here
Resources
25

More Related Content

Recently uploaded

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfIdiosysTechnologies1
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 

Recently uploaded (20)

Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Best Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdfBest Web Development Agency- Idiosys USA.pdf
Best Web Development Agency- Idiosys USA.pdf
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 

Featured

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

From 0 to HERO in under 10 seconds

  • 1. APACHE SLING & FRIENDS TECH MEETUP 2 - 4 SEPTEMBER 2019 From 0 to HERO in under 10 seconds Radu Cotescu, Karl Pauls - Adobe rev. 7.20190901
  • 2. 2
  • 3. Mr. Scripting 3 ▪ Computer Scientist @ Adobe, Basel, Switzerland ▪ Member of the Apache Software Foundation ▪ Apache Sling PMC member ▪ Maintainer of HTL for Apache Sling ▪ Initiator of the Apache Sling Validation Framework
  • 4. Mr. Classloader 4 ▪ Computer Scientist @ Adobe, Basel, Switzerland ▪ Member of the Apache Software Foundation ▪ Apache Sling and Apache Felix PMC (VP) member ▪ Co-Author of OSGi in Action
  • 6. 6 Wait, is this 2018 again?!?!
  • 7. Core principles: 1. pack scripts into OSGi bundles 2. define the resource types as versioned capabilities, with versioned requirements (Java APIs, other resource types to which scripts delegate or which scripts extend) 3. allow the platform to do what it’s made to: wire things 7 Apache Sling Scripting Bundle Tracker[1]
  • 8. What: 1. add-on module to which bundles that provide scripts have to be wired explicitly 2. reuses the already established mechanisms for registering servlets in Apache Sling 3. allows building light-weight instances that can be thrown into production with very little warm-up, when using precompiled scripts 8 Apache Sling Scripting Bundle Tracker[1]
  • 9. 4. provides the mechanism for deploying truly versionable scripts, with explicit dependencies, by relying on the OSGi framework 5. removes the need of a separate ScriptCache 6. removes additional pressure on the persistence layer 7. simplifies instance and application upgrades 8. Maven plugin for generating requirements and capabilities 9 Apache Sling Scripting Bundle Tracker[1]
  • 10. If there’s something cool from 2018 10
  • 11. 11 From 0 to HERO in under 10 seconds
  • 12. And in 2019 the buzzwords are… However, it’s 2019 12 Microservices Cloud Native DevOps Stateless XaaS
  • 13. A container should be: ✓immutable ✓reasonably lightweight, which implies ✓small disk footprint ✓small memory footprint ✓blazing fast start-up time ✓horizontally scalable (remember Kubernetes?), therefore preferably stateless 13 If Sling would be a Docker image […]
  • 14. 1. Sprinkle Apache Sling Feature Model to taste: 1. no configurations on disk 2. lightweight launcher (no caching of artifacts) 2. Mix a bit of jlink to create a custom JRE: 1. use jdeps to figure out the dependencies 2. try to avoid java.desktop, if possible 3. Base your image on alpine […] under 100 MB […] 14
  • 15. 1. Use a customised Sling setup – minimum number of bundles ▪ JCR-less Sling (we know, it’s heresy) - the Resource Provider API can be used to expose Resources from anywhere https://xkcd.com/644/ […] and completely stateless 15
  • 16. 2. /content exposed through remote Resources 3. Precompiled component scripts served through bundles (separation of concerns [1]) 4. Immutable deployment ▪ Feature Model only […] and completely stateless 16
  • 17. /** * A {@code RemoteStorageProvider} is responsible for retrieving the {@link RemoteResourceReference}s * corresponding to a certain Sling path. */ @ProviderType public interface RemoteStorageProvider { @Nullable RemoteResourceReference findResource(@NotNull String slingPath, @NotNull Map<String, Object> authenticationInfo); @Nullable File getFile(@NotNull RemoteResourceReference reference, @NotNull Map<String, Object> authenticationInfo); @Nullable Directory getDirectory(@NotNull RemoteResourceReference reference, @NotNull Map<String, Object> authenticationInfo); } RemoteStorageProvider API 17
  • 18. ▪ Experimental! API to have different remote resources hooked into Sling via ResourceProviders: ▪ 1:1 mapping between a ResourceProvider and a RemoteStorageProvider ▪ Provides a Resource tree based on files and folders, with a special .sling.json file for defining properties ▪ Includes an in-memory caching layer and event handling (optional); should probably delegate this to Redis RemoteStorageProvider API 18
  • 20. Putting it all together 20
  • 21. 21 Demo* *or how we can embarrass ourselves if things don’t work
  • 22. ✓ stateless Docker container ✓ 75 MB JCR-less Sling web application including the JRE ✓ less than 200 MB memory footprint ✓ less than 10 seconds elapsed before first rendering* ✓ 0 dynamically generated classes (no compilers) * on a crazy expensive 2018 MacBook Pro ; good luck deploying servers so powerful in production! So what was this demo about? 22
  • 23. OSGi RFP 196 [2] ▪ Provides a way to use an OSGi framework with custom classloaders (a.k.a. OSGi Connect/PojoSR) Graal/Substrate VM ▪ Ahead-of-Time (AOT) Java code compilation Together with the precompiled bundled scripts it should be possible to perform an AOT compilation of our Sling application as a native image Where do we go from here? 23
  • 25. [0] – https://adapt.to/2018/en/schedule/apache-sling-scripting-reloaded.html [1] - https://github.com/apache/sling-org-apache-sling-scripting-bundle-tracker [2] - https://github.com/osgi/design/blob/master/rfps/rfp-0196-OSGiConnect.pdf Assets licensed from https://stock.adobe.com/ Our diagrams were designed with https://whimsical.co/flowcharts/ Code available after the talk at https://github.com/apache/sling-whiteboard/tree/master/it-is-cloudy-here Resources 25