SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Downloaden Sie, um offline zu lesen
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
1
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 2
Java in Serverless Land
Matthew Gilliard
Twitter: @MaximumGilliard
Fn Project // Container Native Group
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fn Project is a Serverless platform. But what is that?
• Create applications without thinking about Infrastructure.
• Unit of deployment is a Function
• Hence: Functions-as-a-Service or FaaS
3
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
…and what is a Function?
• Short-lived
• Ephemeral / Event-driven
• Stateless
4
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java in Serverless Land
5
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Java is…
• the No. 1 programming language
• No. 3 in Serverless
… why?
Source: serverless.com
6
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Is it actually possible to use Java on Serverless?
• Is FaaS more than just a “scripting language” for the web?
• Can Java development habits be used for FaaS?
• Can the JVM effectively run short-lived apps?
7
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
• Is it actually possible to use Java on Serverless? Yes!
• Is FaaS more than just a “scripting language” for the web? Yes!
• Can Java development habits be used for FaaS? Yes!
• Can the JVM effectively run short-lived apps? Yes!
8
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 9
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
What does ”Grown-up” Java development look like?
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
10
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fn Project
11
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fn Project – an Open-Source FaaS platform
• Fully open (Apache 2.0) with commercial backing from Oracle
• Run anywhere - Datacenter / laptop / rPi
• Functions are containers
• Fn ♥ Java
12
http://fnproject.io
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Demo
13
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
14
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
15
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fn Flow
16
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
What is Fn Flow?
• Fn Flow lets you build reliable and scalable applications out of functions
• Fn Flow supports rich concurrency options
• Fn Flow lets regular functions define workflows
• Fn Flow functions are written purely as code
17
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 18
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fn Flow Under the Hood
• Inspired by the CompletionStage API from JDK 8:
19
public class CompletableFuture<T>
implements Future<T>, CompletionStage<T>
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 20
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 21
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 22
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 23
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 24
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
CompletionStage – What’s going on?
A workflow of asynchronous actions
is constructed in memory
and completed asynchronously using the ForkJoinPool.
25
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Fn Flow – What’s going on?
A workflow of asynchronous functions
is constructed in the Flow Server
and completed asynchronously using the FaaS.
26
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
CompletionStage API
A workflow of asynchronous actions
is constructed in memory
and completed asynchronously using the ForkJoinPool.
27
A workflow of asynchronous functions
is constructed in the Flow Server
and completed asynchronously using the FaaS.
Fn Flow
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
28
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
29
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Effective JVM for containers
30
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively
Remember: Fn functions are just containers
We want:
• Fast Startup
• Small Images
• Respect the environment
31
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Fast Startup
Technique: Share memory between JVMs
32
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Fast Startup
Technique: Share memory between JVMs
Shared image layers => Shared memory:
• libc, libjava.so & friends can be shared between JVMs by using a common
base image
33
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Fast Startup
Technique: Move startup activities to build time, and cache the results
34
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Fast Startup
Technique: Move startup activities to build time, and cache the results
• CDS – pre-compute classloading for core classes
35
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Fast Startup
Technique: Move startup activities to build time, and cache the results
• CDS – pre-compute classloading for core classes
• AppCDS – same, but for application classes
36
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Fast Startup
Technique: Move startup activities to build time, and cache the results
• CDS – pre-compute classloading for core classes
• AppCDS – same, but for application classes
• AOT compilation – compile bytecode to native in advance
37
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Small Container images
• OS components
• JDK
• Application Code
• JVM
38
Technique: Shrink images to enable faster download and startup
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Small Container images
• OS components
• JDK
• Application Code
• JVM
39
Technique: Shrink images to enable faster download and startup
Project Portola – JVM build for Alpine Linux
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Small Container images
• OS components
• JDK
• Application Code
• JVM
40
Technique: Shrink images to enable faster download and startup
Project Portola – JVM build for Alpine Linux
jlink – Removes parts of the JDK you don’t need
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Small Container images
• OS components
• JDK
• Application Code
• JVM
41
Technique: Shrink images to enable faster download and startup
Project Portola – JVM build for Alpine Linux
jlink – Removes parts of the JDK you don’t need
Your code - Use fewer and smaller dependencies
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Small Container images
• OS components
• JDK
• Application Code
• JVM
42
Technique: Shrink images to enable faster download and startup
Project Portola – JVM build for Alpine Linux
jlink – Removes parts of the JDK you don’t need
Your code - Use fewer and smaller dependencies
SubstrateVM – New lightweight VM from Oracle Labs
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Respecting the environment
Technique: Ensure that the JVMs Ergonomics chooses appropriate settings:
43
• Memory
– Heap size
– GC region sizes
– JIT code cache sizes
• CPU
– ThreadPool sizes
– Runtime.availableProcessors()
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Using the JVM effectively – Respecting the environment
Technique: Ensure that the JVMs Ergonomics chooses appropriate settings:
44
Starting with JDK8 and improving through 9, 10 and
11 – the JDK supports this automatically.
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
45
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Program using plain Java
Strong acceptance of Open-Source
Huge number of available tools and libraries
Complex applications
Use the JVM effectively
1
2
3
4
5
46
Copyright © 2018, Oracle and/or its affiliates. All rights reserved. |
Thank You for Listening!
Check out Fn Project: http://fnproject.io
I’ve been Matthew Gilliard
Twitter: @MaximumGilliard
47

Weitere ähnliche Inhalte

Was ist angesagt?

Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Bruno Borges
 
Oracle Ravello Presentation 7Dec16 v1
Oracle Ravello Presentation 7Dec16 v1Oracle Ravello Presentation 7Dec16 v1
Oracle Ravello Presentation 7Dec16 v1
Kurt Liu
 

Was ist angesagt? (20)

Tecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na NuvemTecnologias Oracle em Docker Containers On-premise e na Nuvem
Tecnologias Oracle em Docker Containers On-premise e na Nuvem
 
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and MorePolyglot! A Lightweight Cloud Platform for Java SE, Node, and More
Polyglot! A Lightweight Cloud Platform for Java SE, Node, and More
 
Oracle - Continuous Delivery NYC meetup, June 07, 2018
Oracle - Continuous Delivery NYC meetup, June 07, 2018Oracle - Continuous Delivery NYC meetup, June 07, 2018
Oracle - Continuous Delivery NYC meetup, June 07, 2018
 
JDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDKJDK 8 and JDK 8 Updates in OpenJDK
JDK 8 and JDK 8 Updates in OpenJDK
 
Oracle Ravello Presentation 7Dec16 v1
Oracle Ravello Presentation 7Dec16 v1Oracle Ravello Presentation 7Dec16 v1
Oracle Ravello Presentation 7Dec16 v1
 
Functions and DevOps
Functions and DevOpsFunctions and DevOps
Functions and DevOps
 
GraphPipe - Blazingly Fast Machine Learning Inference by Vish Abrams
GraphPipe - Blazingly Fast Machine Learning Inference by Vish AbramsGraphPipe - Blazingly Fast Machine Learning Inference by Vish Abrams
GraphPipe - Blazingly Fast Machine Learning Inference by Vish Abrams
 
Oracle ADF Architecture TV - Design - Designing for Internationalization
Oracle ADF Architecture TV - Design - Designing for InternationalizationOracle ADF Architecture TV - Design - Designing for Internationalization
Oracle ADF Architecture TV - Design - Designing for Internationalization
 
How to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based MicroservicesHow to Thrive on REST/WebSocket-Based Microservices
How to Thrive on REST/WebSocket-Based Microservices
 
HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016HTTP/2 in the Java Platform -- Java Champions call February 2016
HTTP/2 in the Java Platform -- Java Champions call February 2016
 
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with OracleMobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
Mobile Mumbo Jumbo - Demystifying the World of Enterprise Mobility with Oracle
 
Open source applied - Real world use cases (Presented at Open Source 101)
Open source applied - Real world use cases (Presented at Open Source 101)Open source applied - Real world use cases (Presented at Open Source 101)
Open source applied - Real world use cases (Presented at Open Source 101)
 
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Javantura v6 - JDK 11 & JDK 12 - Dalibor TopicJavantura v6 - JDK 11 & JDK 12 - Dalibor Topic
Javantura v6 - JDK 11 & JDK 12 - Dalibor Topic
 
Elastic-Engineering
Elastic-EngineeringElastic-Engineering
Elastic-Engineering
 
Building and Deploying Cloud Native Applications
Building and Deploying Cloud Native ApplicationsBuilding and Deploying Cloud Native Applications
Building and Deploying Cloud Native Applications
 
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
EclipseLink: Beyond Relational and NoSQL to Polyglot and HTML5
 
Container Native Development Tools - Talk by Mickey Boxell
Container Native Development Tools - Talk by Mickey BoxellContainer Native Development Tools - Talk by Mickey Boxell
Container Native Development Tools - Talk by Mickey Boxell
 
Introducing Java 8
Introducing Java 8Introducing Java 8
Introducing Java 8
 
Building Cloud Native Applications with Oracle Autonomous Database.
Building Cloud Native Applications with Oracle Autonomous Database.Building Cloud Native Applications with Oracle Autonomous Database.
Building Cloud Native Applications with Oracle Autonomous Database.
 
Oracle ADF Architecture TV - Design - Project Dependencies
Oracle ADF Architecture TV - Design - Project DependenciesOracle ADF Architecture TV - Design - Project Dependencies
Oracle ADF Architecture TV - Design - Project Dependencies
 

Ähnlich wie Java and Serverless - A Match Made In Heaven, Part 1

Ähnlich wie Java and Serverless - A Match Made In Heaven, Part 1 (20)

Randstad Docker meetup - Serverless
Randstad Docker meetup - ServerlessRandstad Docker meetup - Serverless
Randstad Docker meetup - Serverless
 
Serverless Kotlin
Serverless KotlinServerless Kotlin
Serverless Kotlin
 
Diagnose Your Microservices
Diagnose Your MicroservicesDiagnose Your Microservices
Diagnose Your Microservices
 
Serverless Java Challenges & Triumphs
Serverless Java Challenges & TriumphsServerless Java Challenges & Triumphs
Serverless Java Challenges & Triumphs
 
Delivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with OracleDelivering Mobile Apps to the Field with Oracle
Delivering Mobile Apps to the Field with Oracle
 
Coding from Application Container Cloud to Oracle JET
Coding from Application Container Cloud to Oracle JETCoding from Application Container Cloud to Oracle JET
Coding from Application Container Cloud to Oracle JET
 
Java 101
Java 101Java 101
Java 101
 
JDK 10 Java Module System
JDK 10 Java Module SystemJDK 10 Java Module System
JDK 10 Java Module System
 
JDK versions and OpenJDK
JDK versions and OpenJDKJDK versions and OpenJDK
JDK versions and OpenJDK
 
Java 10 and beyond: Keeping up with the language and planning for the future
Java 10 and beyond: Keeping up with the language and planning for the futureJava 10 and beyond: Keeping up with the language and planning for the future
Java 10 and beyond: Keeping up with the language and planning for the future
 
Introducing Fn Project
Introducing Fn ProjectIntroducing Fn Project
Introducing Fn Project
 
Open Source Applied - Real World Use Cases
Open Source Applied - Real World Use CasesOpen Source Applied - Real World Use Cases
Open Source Applied - Real World Use Cases
 
Oracle Modern AppDev Approach to Cloud & Container Native App
Oracle Modern AppDev Approach to Cloud & Container Native AppOracle Modern AppDev Approach to Cloud & Container Native App
Oracle Modern AppDev Approach to Cloud & Container Native App
 
Microservices and Container
Microservices and ContainerMicroservices and Container
Microservices and Container
 
Delivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JETDelivering Mobile Apps to the Field with Oracle JET
Delivering Mobile Apps to the Field with Oracle JET
 
B3 getting started_with_cloud_native_development
B3 getting started_with_cloud_native_developmentB3 getting started_with_cloud_native_development
B3 getting started_with_cloud_native_development
 
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav TulachJDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
JDD2015: Towards the Fastest (J)VM on the Planet! - Jaroslav Tulach
 
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...
Increased Developer Productivity for IoT with Java and Reactive Blocks (Oracl...
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
Migrate Oracle WebLogic Applications onto a Containerized Cloud Data Center
Migrate Oracle WebLogic Applications onto a Containerized Cloud Data CenterMigrate Oracle WebLogic Applications onto a Containerized Cloud Data Center
Migrate Oracle WebLogic Applications onto a Containerized Cloud Data Center
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 

Java and Serverless - A Match Made In Heaven, Part 1

  • 1. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 1
  • 2. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 2 Java in Serverless Land Matthew Gilliard Twitter: @MaximumGilliard Fn Project // Container Native Group
  • 3. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Fn Project is a Serverless platform. But what is that? • Create applications without thinking about Infrastructure. • Unit of deployment is a Function • Hence: Functions-as-a-Service or FaaS 3
  • 4. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | …and what is a Function? • Short-lived • Ephemeral / Event-driven • Stateless 4
  • 5. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Java in Serverless Land 5
  • 6. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Java is… • the No. 1 programming language • No. 3 in Serverless … why? Source: serverless.com 6
  • 7. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • Is it actually possible to use Java on Serverless? • Is FaaS more than just a “scripting language” for the web? • Can Java development habits be used for FaaS? • Can the JVM effectively run short-lived apps? 7
  • 8. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | • Is it actually possible to use Java on Serverless? Yes! • Is FaaS more than just a “scripting language” for the web? Yes! • Can Java development habits be used for FaaS? Yes! • Can the JVM effectively run short-lived apps? Yes! 8
  • 9. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 9
  • 10. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | What does ”Grown-up” Java development look like? Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 10
  • 11. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Fn Project 11
  • 12. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Fn Project – an Open-Source FaaS platform • Fully open (Apache 2.0) with commercial backing from Oracle • Run anywhere - Datacenter / laptop / rPi • Functions are containers • Fn ♥ Java 12 http://fnproject.io
  • 13. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Demo 13
  • 14. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 14
  • 15. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 15
  • 16. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Fn Flow 16
  • 17. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | What is Fn Flow? • Fn Flow lets you build reliable and scalable applications out of functions • Fn Flow supports rich concurrency options • Fn Flow lets regular functions define workflows • Fn Flow functions are written purely as code 17
  • 18. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 18
  • 19. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Fn Flow Under the Hood • Inspired by the CompletionStage API from JDK 8: 19 public class CompletableFuture<T> implements Future<T>, CompletionStage<T>
  • 20. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 20
  • 21. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 21
  • 22. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 22
  • 23. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 23
  • 24. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | 24
  • 25. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | CompletionStage – What’s going on? A workflow of asynchronous actions is constructed in memory and completed asynchronously using the ForkJoinPool. 25
  • 26. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Fn Flow – What’s going on? A workflow of asynchronous functions is constructed in the Flow Server and completed asynchronously using the FaaS. 26
  • 27. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | CompletionStage API A workflow of asynchronous actions is constructed in memory and completed asynchronously using the ForkJoinPool. 27 A workflow of asynchronous functions is constructed in the Flow Server and completed asynchronously using the FaaS. Fn Flow
  • 28. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 28
  • 29. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 29
  • 30. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Effective JVM for containers 30
  • 31. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively Remember: Fn functions are just containers We want: • Fast Startup • Small Images • Respect the environment 31
  • 32. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Fast Startup Technique: Share memory between JVMs 32
  • 33. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Fast Startup Technique: Share memory between JVMs Shared image layers => Shared memory: • libc, libjava.so & friends can be shared between JVMs by using a common base image 33
  • 34. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Fast Startup Technique: Move startup activities to build time, and cache the results 34
  • 35. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Fast Startup Technique: Move startup activities to build time, and cache the results • CDS – pre-compute classloading for core classes 35
  • 36. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Fast Startup Technique: Move startup activities to build time, and cache the results • CDS – pre-compute classloading for core classes • AppCDS – same, but for application classes 36
  • 37. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Fast Startup Technique: Move startup activities to build time, and cache the results • CDS – pre-compute classloading for core classes • AppCDS – same, but for application classes • AOT compilation – compile bytecode to native in advance 37
  • 38. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Small Container images • OS components • JDK • Application Code • JVM 38 Technique: Shrink images to enable faster download and startup
  • 39. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Small Container images • OS components • JDK • Application Code • JVM 39 Technique: Shrink images to enable faster download and startup Project Portola – JVM build for Alpine Linux
  • 40. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Small Container images • OS components • JDK • Application Code • JVM 40 Technique: Shrink images to enable faster download and startup Project Portola – JVM build for Alpine Linux jlink – Removes parts of the JDK you don’t need
  • 41. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Small Container images • OS components • JDK • Application Code • JVM 41 Technique: Shrink images to enable faster download and startup Project Portola – JVM build for Alpine Linux jlink – Removes parts of the JDK you don’t need Your code - Use fewer and smaller dependencies
  • 42. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Small Container images • OS components • JDK • Application Code • JVM 42 Technique: Shrink images to enable faster download and startup Project Portola – JVM build for Alpine Linux jlink – Removes parts of the JDK you don’t need Your code - Use fewer and smaller dependencies SubstrateVM – New lightweight VM from Oracle Labs
  • 43. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Respecting the environment Technique: Ensure that the JVMs Ergonomics chooses appropriate settings: 43 • Memory – Heap size – GC region sizes – JIT code cache sizes • CPU – ThreadPool sizes – Runtime.availableProcessors()
  • 44. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Using the JVM effectively – Respecting the environment Technique: Ensure that the JVMs Ergonomics chooses appropriate settings: 44 Starting with JDK8 and improving through 9, 10 and 11 – the JDK supports this automatically.
  • 45. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 45
  • 46. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Program using plain Java Strong acceptance of Open-Source Huge number of available tools and libraries Complex applications Use the JVM effectively 1 2 3 4 5 46
  • 47. Copyright © 2018, Oracle and/or its affiliates. All rights reserved. | Thank You for Listening! Check out Fn Project: http://fnproject.io I’ve been Matthew Gilliard Twitter: @MaximumGilliard 47