Más contenido relacionado
La actualidad más candente (20)
Similar a Serverless Java: JJUG CCC 2019 (20)
Serverless Java: JJUG CCC 2019
- 2. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 2
Serverless Java
Shaun Smith
Director of Product Management
Oracle Cloud Infrastructure—Serverless
@shaunMsmith
May 18, 2019
Challenges and Triumphs
- 3. Copyright © 2019, 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, timing, and pricing of any
features or functionality described for Oracle’s products may change and remains at the
sole discretion of Oracle Corporation.
3
- 4. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 4
Serverless
- 5. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Serverless is an abstraction of infrastructure and its
operations including provisioning, scaling, patching, etc.
FaaS (Functions-as-a-Service) is the compute
component in a serverless platform
5
- 7. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Example Java Function
7
- 8. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Serverless Today
8
- 9. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 9
Interest in Serverless
Source: Google Trends
- 13. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 13
Source: https://jaxenter.com/technologies-dominate-2019-poll-152470.html
- 14. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Peak of Inflated Expectations
Plateau of Productivity
Slope of Enlightenment
Trough of Disillusionment
14
- 15. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Serverless Java?
15
- 16. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 16
https://blog.github.com/2018-11-15-state-of-the-octoverse-top-programming-languages/
Top programming languages by contributors as of September 30, 2018
- 18. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
New Relic: 9.1% of functions are Java 8!?
https://blog.newrelic.com
18
- 19. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Serverless.com: 6.1% of all functions are Java!?
https://serverless.com/blog/2018-serverless-community-survey-huge-growth-usage/
19
- 20. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Serveless.com, Large Companies > 1000: 14.9% Java
https://serverless.com/blog/2018-serverless-community-survey-huge-growth-usage/
20
- 21. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
And the Trend isn’t Great
https://serverless.com/blog/serverless-by-the-numbers-2018-data-report/
21
- 22. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
http://redmonk.com/jgovernor/2016/10/12/when-web-companies-grow-up-they-turn-into-java-shops
22
- 23. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Why isn’t Java popular for Functions?
• FaaS seen as a scripting platform for the web?
• Doesn't fit normal Java development patterns?
• Java not suitable for short-lived “apps”?
• Not supported?
–Google Cloud Functions—N/A
–AWS Lambda—Java support added June 2015
–Oracle Functions—Limited Availability Dec. 2018
–Azure Functions—Java 8 GA on Feb 2019
23
- 24. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Blueprint for Serverless Java
• “Plain old Java”
• Established toolchains
• Ability to build complex applications
• Low latency/high performance
• Java ecosystem
24
- 25. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
www.fnproject.io
25
- 26. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
• Open-source, Container Naive, Serverless Plajorm
• Apache v2 licence
• Run anywhere - Cloud / Datacenter / Laptop
• Fn ♥
• Funcions are containers
26
- 29. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fn Java Function Development Kit (FDK)
• Docker Images
–A build image for repeatable builds
–An optimized runtime image
• JUnit Test Harness
• Maven support
• Input/output coercion
• Flow
• …
29
- 30. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 30
Java Functions Demo!
- 31. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Blueprint for Serverless Java
• “Plain old Java” ✓
• Established toolchains ✓
• Ability to build complex applications
• Low latency/high performance
• JVM ecosystem
31
- 32. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 32
Fn Flow
- 33. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fn Flow
• Provides rich concurrency primitives including fork-join, chaining, delays
and error handling
• Java support based on Java 8 CompletableFuture API
• Build reliable and scalable FaaS applications
For long-running, reliable, scalable functions
- 34. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fn Flow Demo
- 35. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
http://microservices.io/patterns/data/saga.html
- 36. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 36
Fn Flow Demo!
- 37. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Blueprints for Serverless Java
• “Plain old Java” ✓
• Wide choice of good tooling ✓
• Ability to build complex applications ✓
• Low latency/high performance
• Rich JVM ecosystem
37
- 38. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Low Latency/High Performance – Java in Containers
What do we want containerized Java applications to do?
–Respect resource constraints
–Start fast
–Run fast
38
- 39. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Container Friendly Java – Respecting Resource Constraints
• JDK-8179498: attach in linux should be relaive
to /proc/pid/root and namespace aware as jcmd, jstack, etc. fail to
arach (resolved in JDK 10)
• JDK-8193710: jcmd -l and jps commands do not list Java processes
running in Docker containers (resolved in JDK 11)
• JDK-8203357: Container Metrics (resolved in JDK 11.0.1)
• JEP 318: Epsilon: A No-Op Garbage Collector (Experimental in JDK 11)
• …
39
- 40. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fast Startup – Moving Costs to Build-Time
1. Class Data Sharing (CDS)
– Avoid parsing JDK classes on start
2. Application CDS
– Avoid parsing App classes on start
3. AOT compilation
– Compile App classes to native .so libraries (experimental)
40
- 41. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fast Startup – Small Container Images
Small JVM container images means faster startup by reducing:
–Image to host transfer time
–Docker Copy on Write (COW) cache creation
–Docker Overlay FS setup
41
- 42. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fast Startup — Building Smaller Java Container Images
1. Use jlink to remove unused core libraries
2. Start with small base images
3. GraaVM native image - compile Java to a static binary
42
- 43. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fast Startup — Small Base Images
Security-oriented, lightweight Linux distribution
with 4MB base image
Lightweight, fast, simple, free, C standard library
implementation
43
Reduce OS layer size
Project Portola’s goal is to run the JVM on Alpine Linux/Musl
- 44. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fast Startup — Smaller Java Applications
44
Reduce Java Runtime layer size - jlink
Modules JLink flags Mb
JDK 12 Whole JDK! 318.7
openjdk:11-jre-slim 11 (default) NB: openjdk:12-jre-slim not yet available! 217
JRE 12 all (explicit) --add-module $(java --list-modules) 168.3 100.0%
+ --no-header-files --no-man-pages --strip-debug 143.0 85.0%
+ --compress=1 107.8 64.1%
+ --compress=2 83.7 49.7%
Custom JRE 12 base, logging --add-module $(jdeps --print-module-deps func.jar) 47.4 28.2% 100.0%
+ --no-header-files --no-man-pages --strip-debug 41.6 24.7% 87.8%
+ --compress=2 32.0 19.0% 67.5%
OpenJDK (build 12-ea+29) - alpine:3.9 x86_64
318 Mb 168 Mb 47 Mb 32 Mb
- 45. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Fast Startup — Smaller Java Applications
• GraalVM compiles Java source to a single native binary
• Tiny image sizes
• Low VM overhead
45
- 46. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 46
GraalVM
Functions Demo!
- 47. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Blueprint for Serverless Java
• “Plain old Java” ✓
• Wide choice of good tooling ✓
• Ability to build complex applications ✓
• Low latency/high performance ✓
• Rich JVM ecosystem ✓
47
- 48. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 48
Serverless Java?
- 49. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. | 49
Serverless Java? Absolutely!
- 50. Copyright © 2019, Oracle and/or its affiliates. All rights reserved. |
Shaun Smith
fnproject.io
@shaunMsmith
50
Thank you!