Java Developer GraalVM&ReactiveProgramming v1
Java Developer GraalVM&ReactiveProgramming v1
Java Developer GraalVM&ReactiveProgramming v1
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.
Statements in this presentation relating to Oracle’s future plans, expectations, beliefs, intentions and
prospects are “forward-looking statements” and are subject to material risks and uncertainties. A detailed
discussion of these factors and other risks that affect our business is contained in Oracle’s Securities and
Exchange Commission (SEC) filings, including our most recent reports on Form 10-K and Form 10-Q
under the heading “Risk Factors.” These filings are available on the SEC’s website or on Oracle’s website
at http://www.oracle.com/investor. All information in this presentation is current as of September 2019
and Oracle undertakes no duty to update any statement in light of new information or future events.
Java riding at the top of all prog lang. for the last 20 years
There are 12+ Millions Java Developers – What do they want?
How to make the Oracle database relevant for that community?
Clojure
Truffle Languages
GraalVM Compiler
HotSpot VM
GraalVM Native Images
• Instant startup;
• Low memory footprint;
• Works with memory management;
• AOT-compiled using the GraalVM compiler.
Microservice Frameworks: Startup Time
35 ms
Helidon 1030 ms
988 ms
37 ms
Micronaut 2087 ms
2101 ms
16 ms
Quarkus 952 ms
940 ms
31 MB
Helidon 116 MB
106 MB
41 MB
Micronaut 172 MB
180 MB
17 MB
Quarkus 125 MB
121 MB
Thread startup and class initialization during the native image generation
• Must set a flag to allow image building with an incomplete classpath
$ native-image --initialize-at-build-time \ ❶
--allow-incomplete-classpath \ ❷
--no-fallback \
-cp ".:ojdbc8.jar" \
TestConnection
Subscriber Publisher
(User Java code) Send <n> messages (Driver)
data
onSubscribe()
subscribe() onNext()
onError()
onComplete()
Confidential – Oracle Internal/Restricted/Highly Restricted
JDBC Reactive Extensions
• Based on java.util.concurrent.Flow
Reactor
Application
A Reactor DAO
map() executes the SQL statements
filter() and returns a Flux data stream
reduce() Reactor
parallel() DAO class
… streamAllEmployees()
queryAllEmployees()
…
Reactive JDBC
Adapter class
Conversion bw Flow types and
org.reactivestreams types
JDBC Reactive
Extensions
private ReactorDemo() {}
demo.getSumOfAllSalaries()
.doOnSuccess(System.out::println)
.block();
}
}
Copyright © 2019 Oracle and/or its affiliates.
Using JDBC Reactive Extension with RxJava
RxJava
Application
An RxJava DAO
map() executes the SQL statements
filter() and returns a Flowable data stream
reduce() RxJava
blockingGet() DAO class
… streamAllEmployees()
queryAllEmployees()
…
Reactive JDBC
Adapter class
Conversion bw Flow types and
org.reactivestreams types
JDBC Reactive
Extensions
demo.getSumOfAllSalaries()
.doOnSuccess(System.out::println)
.blockingGet();
}
}
Akka Stream
Application
An Akka DAO
Filter() executes the SQL statements
Map() and returns a Sourcedata
runFold() stream
Reactor
toCompletableFuture() DAO class
join()
… streamAllEmployees()
queryAllEmployees()
mapMaterializedValue()
fromPublisher() Reactive JDBC
alsoTo() Adapter class
Conversion bw Flow types and
… org.reactivestreams types
JDBC Reactive
Extensions
return AkkaEmployeeDAO.getInstance()
.streamAllEmployees(materializer)
.map(Employee::getSalary)
.filter(Optional::isPresent)
.map(Optional::get)
.runFold(0,
(sum, salary) -> sum + salary,
materializer);
}
demo.actorSystem.terminate();
}
}
Copyright © 2019 Oracle and/or its affiliates.
Modern Java Database Access: Async/Reactive, Fibers
operators (map, reduce, filters), Implements Java SE
concurrency modeling, reactive stream
monitoring, tracing interface (Flow)
3rd party
Reactive
Full Reactive Streams
Streams JDBC
Library * Reactive
Oracle
User JDBC
Extension
Java
Code (Fibers
Async call with non-blocking ready)
backpressure
Sync/blocking calls
❖ Reactor, RxJava and Akka Streams certified with JDBC Reactive Extensions
❖ Working on the Reactive Relational Database Connectivity (R2DBC) API for the Oracle Database
Copyright © 2019 Oracle and/or its affiliates.
Fibers is the Future of Java Scalability