SlideShare a Scribd company logo
AI Industrial Summit - SOFIA, BULGARIA - A High-Speed Data Ingestion Microservice in Java Using MQTT, AMQP, and STOMP
14 | SEP | 2024
AI Industrial Summit 2024
02
THANKS FOR
SUPPORT US TODAY
Platinum Sponsor Platinum Sponsor
Silver Sponsor Partner
A High-Speed Data Ingestion Microservice
in Java Using MQTT, AMQP, and STOMP
AI Industrial Summit 2024
Juarez Barbosa Junior @juarezjunior
Senior Principal Java Developer Evangelist
ORACLE
Copyright © 2024, Oracle and/or its affiliates
Juarez Barbosa Junior
Senior Principal Java Developer Evangelist @ Oracle
• Speaking from Dublin, Ireland
• 28 years of experience in SW Engineering & DevRel
• Oracle, Microsoft, IBM, Nokia, Unisys, Accenture, startups
• Microsoft Azure Developer Relations Lead
• IBM Watson Tech Evangelist & Cloud Rockstar
• IBM Mobile Tech Evangelist & Global Thought Leader
• Nokia Developers Global Champion
• Java, Python, Cloud, DevOps, SRE, Cloud-native, IoT, AI, Blockchain,
Rust
• Speaker at conferences
• Oracle CloudWorld, Oracle Code, Microsoft Ignite & TechX, jPrime,
JCON, DevConf.cz, GeeCon, DevOpsDays, DeveloperWeek, DevOps
Institute, CloudLand, DWX, The Developer’s Conference (TDC),
Sec4Dev, JSNation, NodeConf, Conf42, Shift Conf, Global Azure,
Open-Source Lisbon, CodeFrenzy, Mêlée Numérique, React Summit,
Test.js Summit, Porto TechHub Conf, Pyjamas, MiTechCon, Data
Science Summit, OpenSourceNorth, WeAreDevelopers, Global
Software Architecture Summit, JavaForumNord, JavaCro, JUGs,
OUGs, GDGs, meetups, hackathons, and customer engagements.
@juarezjunior
@juarezjunior
Agenda
• Java App Dev with the Oracle Database
• Oracle JDBC - Support for the Latest Java Versions
• Overview of Oracle DB Access with Java
• Oracle JDBC – Sync and Async
• Classic Java Platform Threads
• Project Loom – Virtual Threads
• Virtual Threads - JEPs 425, 436, 444
• Demo # 1: Virtual vs Platform Threads
• Reactive JDBC - Synchronous vs Asynchronous JDBC
• Reactive Streams Ingestion (RSI)
• Demo # 2: Reactive Streams Ingestion (RSI)
• From Sync to Reactive JDBC: Oracle R2DBC
• Demo # 3: Oracle R2DBC with Project Reactor
• Pipelined Database Operations, Oracle AI Vector Search
• Demo #4: Structured Concurrency + Pipelined Database
Operations + AI Vector Search
• Live Labs/Free Oracle Cloud Account/Oracle ACE Program
Copyright © 2024, Oracle and/or its affiliates
Java App
Dev with
Oracle
Database
Copyright © 2024, Oracle and/or its affiliates
Overview of Oracle DB Access with Java
Copyright © 2024, Oracle and/or its affiliates
Copyright © 2024, Oracle and/or its affiliates
Oracle JDBC - Support for the Latest Java Versions
• Java 11 - native support, compiled with it
• Java 17 - certified
• JDBC Standards - 4.2 and 4.3
• GraalVM - native image instrumentation
• Reactive Streams - Java Flow API support
• Project Loom - Virtual Threads support
• Data access is crucial in mission-critical apps
Oracle JDBC Reactive Extensions
(Flow API)
Copyright © 2024, Oracle and/or its affiliates
SQL Execution (OraclePreparedStatement):
Publisher<Boolean> executeAsyncOracle()
Publisher<Long> executeUpdateAsyncOracle()
Publisher<Long> executeBatchAsyncOracle()
Publisher<OracleResultSet>
executeQueryAsyncOracle()
Row Fetching (OracleResultSet):
Publisher<T>
publisherOracle(Function<OracleRow, T> f)
LOB I/O (OracleBlob):
Publisher<byte[]> publisherOracle(long
position)
Subscriber<byte[]> subscriberOracle(long
position)
LOB I/O (OracleClob):
Publisher<String> publisherOracle(long
position)
Subscriber<String> subscriberOracle(long
position)
Connection Closing
(OracleConnection):
Publisher<Success>
closeAsyncOracle()
Transaction Closing
(OracleConnection):
Publisher<Success>
commitAsyncOracle()
Publisher<Success>
rollbackAsyncOracle()
Connection Creation
(OracleConnectionBuilder):
Publisher<OracleConnection>
buildConnectionPublisherOracle()
Introduction to JDBC Reactive
Extensions with the Oracle
Database 23c Free — Developer
Release
Oracle JDBC – Async and Sync
• Project Loom - Virtual Threads
• Synchronous database access with lightweight threads
• Standard JDBC + Virtual Threads
• Client application call stack may use blocking, synchronous code
• Libraries must be compatible with Virtual Threads
• Oracle instrumented the Oracle JDBC driver to support Virtual Threads
• Reactive Programming
• Asynchronous database access with non-blocking network I/O
• Oracle Reactive Streams Ingestion (RSI) + Oracle R2DBC + Oracle JDBC Reactive
Extensions (Flow)
• Reactive Streams Libraries: Reactor, RxJava, Akka, Vert.x
Copyright © 2024, Oracle and/or its affiliates
Classic Java Platform Threads
• Database access with blocking threads
• A JDBC call blocks a thread for 100s of milliseconds
(thread-per-request style)
• Thread count increases linearly with the number
of JDBC calls
• Performance degrades as the number of threads
increases
• 1 MB of stack memory per thread typically
• Scheduling many platform threads is expensive
• Preemptive scheduling vs time-slicing
Copyright © 2024, Oracle and/or its affiliates
Virtual Threads - JEPs 425, 436, 444
• Virtual Threads – JEPs (JDK Enhancement Proposals)
• Lightweight (user mode) threads that dramatically reduce the effort of writing,
maintaining, and observing high-throughput concurrent applications
• Enable applications written in the simple thread-per-request style to scale with near-
optimal hardware utilization
• Enable easy troubleshooting, debugging, and profiling of virtual threads with existing JDK
tools
• Do not remove the traditional implementation of threads
• Do not alter the basic concurrency model of Java
• Enable existing code that uses Java threads (java.lang.Thread) to adopt virtual threads with
minimal change
Copyright © 2024, Oracle and/or its affiliates
Virtual Threads - JEPs 425, 436, 444
• Virtual Threads – JEPs (JDK Enhancement Proposals)
• Virtual threads typically employ a small set of platform threads used as carrier threads
• Code executing in a virtual thread is not aware of the underlying carrier thread
• The currentThread() method will always return the Thread object for the virtual thread
• Virtual threads do not have a thread name by default. The getName() method returns the
empty string if a thread name is not set
• Virtual threads have a fixed thread priority that cannot be changed
• Virtual threads are daemon threads so do not prevent the shutdown sequence from
beginning (low-priority ones).
Copyright © 2024, Oracle and/or its affiliates
Virtual
Threads -
JEPs 425,
436, 444
• JDK Enhancement Proposals
• JEP 425: Virtual Threads (Preview)
• JEP 436: Virtual Threads (Second Preview)
• JEP 444: Virtual Threads
• java.lang.Thread
• final Boolean - isVirtual()
• static Thread.Builder.OfVirtual - ofVirtual()
• static Thread.Builder.OfPlatform - ofPlatform()
• static Thread - startVirtualThread(Runnable task)
• java.lang.Thread.Builder
• java.util.concurrent.Executors
• static ExecutorService -
newVirtualThreadPerTaskExecutor()
Copyright © 2024, Oracle and/or its affiliates
Virtual Threads - JEPs 425, 436, 444
• java.lang.Thread.Builder
• Thread defines a
Thread.Builder API for
creating and starting
both platform and virtual
threads. The following
are examples that use
the builder:
Copyright © 2024, Oracle and/or its affiliates
Copyright © 2022, Oracle and/or its affiliates
Demo # 1: Virtual vs Platform Threads
âš« Virtual Threads vs Platform Threads
âš« JEP 425 Virtual Threads (Preview)
âš« JEP 436 (Second Preview)
âš« JEP 444 (JDK 21)
âš« Oracle JDBC Driver instrumented to support Virtual Threads
âš« Intrinsic locks replaced with ReentrantLock to avoid thread pinning
âš« Verifiable comparison of OS/HW resources consumption
(Platform Threads versus Virtual Threads)
âš« Introduction to Oracle JDBC Driver Support for Virtual Threads
Copyright © 2024, Oracle and/or its affiliates
Reactive JDBC - Sync vs Async JDBC
Setup
Blocking
Handle Result
Setup
Non-Blocking
Handle Result
Synchronous JDBC Setup
Blocking
Handle Result
Setup
Non-Blocking
Handle Result
Setup
Non-Blocking
Handle Result
Reactive JDBC
Database
Setup
Blocking
Handle Result
Database
Copyright © 2022, Oracle and/or its affiliates
Reactive Streams Ingestion (RSI)
âš« Java Library for Reactive Streams Ingestion
âš« Streaming capability: Ingest data in an unblocking, and
reactive way from a large group of clients
âš« Group records through RAC (Real App Clusters),
and Shard affinity using native UCP (Universal Connection
Pool)
âš« Optimize CPU allocation while decoupling record
Processing from I/O
âš« Fastest insert method for the Oracle Database through
Direct Path Insert, bypassing SQL and writing directly into the DB files
Copyright © 2024, Oracle and/or its affiliates
Demo #2: RSI - Architecture
Copyright © 2024, Oracle and/or its affiliates
Demo #2: RSI - Project Structure
Copyright © 2024, Oracle and/or its affiliates
Demo # 2: Reactive Streams Ingestion (RSI)
Container
Pipelines,
Jenkins, etc.
Build
Test
Push
Push Docker
images to
Registry
Cloud
Infrastructur
e Registry
Container
Engine for
Kubernetes
Pull images
from Registry
Deploy
images to
production
Kubernetes
worker nodes
Containers
running
microservices
deployed over
Kubernetes
ORACLE CLOUD INFRASTRUCTURE
ATP, ADW, ATP-D,
AFDW-D
Memoptimized
Rowstore
RSI Runtime: Non-
blocking, optimized library
for streaming data
through Direct Path, Shard
& RAC/FAN support.
HTTP / REST Engine over
Helidon
Define build
for CI/CD
toolchain
gRPC / AMQP / MQTT
Engines
Microservices
Files / Logs
IoT
Devices
/
Apps
cv
MQTT
gRPC
AMQP
HTTP / REST
JDBC
Direct Path
INSERT
Record
Streaming
over
multiple
protocols.
Virtual Threads or Reactive?
• Oracle JDBC supports both!
• Want Virtual Threads?
• The Oracle JDBC driver is Virtual Thread compatible
• Pipelined Database Operations
• Want Reactive?
• Oracle R2DBC, Oracle RSI, Oracle JDBC Reactive Extensions
• Pipelined Database Operations
Copyright © 2024, Oracle and/or its affiliates
Virtual Threads or Reactive?
• Benefits of Virtual Threads:
• Easier to read and write
• Easier to debug
• Integration with JDK tools
• Do not alter the basic concurrency model of Java
• Now available in JDK 21 / 22
• Limitations of Virtual Threads:
• Some libraries/frameworks are not
compatible yet
Copyright © 2024, Oracle and/or its affiliates
Benefits of Reactive:
• Reactive Libraries (Reactor, RxJava, Akka, Vert.x)
• Stream-like API with a functional style
• Low-level concurrency is handled for you
(locks, atomics, queues)
Limitations of Reactive:
• Steep learning curve
• Harder to read and write
• Harder to debug
From Sync to Reactive JDBC: Oracle
R2DBC
• Oracle Reactive Relational Database Connectivity (R2DBC)
• Oracle R2DBC Driver is a Java library that supports reactive
programming with the Oracle Database
• It implements the R2DBC Service Provider Interface (SPI) as
specified by the Reactive Relational Database Connectivity
(R2DBC) spec
• The R2DBC SPI exposes Reactive Streams as an abstraction
for remote database operations
• The sample code uses Project Reactor. It could use RxJava,
Akka, or any Reactive Streams library
• Runs on Java 11+
• Oracle RDBC 1.2.0, Apache v2.0 (OSS)
Copyright © 2024, Oracle and/or its affiliates
R2DBC – Reactive Relational DB Connectivity
Copyright © 2024, Oracle and/or its affiliates
Demo # 3: Oracle R2DBC
static String queryJdbc(java.sql.Connection connection) throws
SQLException {
try (java.sql.Statement statement = connection.createStatement()) {
ResultSet resultSet =
statement.executeQuery("SELECT * FROM CUSTOMERS");
if (resultSet.next())
return resultSet.getString(1);
else
throw new NoSuchElementException("Query returned zero rows");
}
}
static Publisher<String> queryR2dbc(io.r2dbc.spi.Connection
connection) {
return Flux.from(connection.createStatement(
"SELECT * FROM CUSTOMERS")
.execute())
.flatMap(result ->
result.map(row -> row.get(0, String.class)))
.switchIfEmpty(Flux.error(
new NoSuchElementException("Query returned zero rows")));
}
Copyright © 2024, Oracle and/or its affiliates
Pipelined Database Operations
Before Pipelined Database Operations
The server must complete the processing
of the request and sending the response
before accepting another request
The client and server have idle time
The Java app sends
a request
The server sends
the response
The Java app
receives
the response
Copyright © 2024, Oracle and/or its affiliates
Pipelined Database Operations
With Pipelining
No-Blocking Requests and Responses
Send multiple requests from client to server
without waiting for responses
Application can asynchronously perform
other operations
The server processes the requests in order
and sends the responses back to the client
when ready, in the same order they
were received
Benefits
Improved response time and throughput
Particularly useful when network latency is high
Copyright © 2024, Oracle and/or its affiliates
Pipelined Database Operations
Performance Improvements depending on the CPU load, the workload
profiles on the server side, and the network latency between client and server
• Up to 90% improvement for queries only workload over a fast network
• Up to 90x improvement for queries only workload over a slow network
• Up to 24% improvement for OLTP workload over a fast network
• Up to 7x improvement for OLTP workload over a slow network
• Up to 100+x improvement for DML workload
The Oracle JDBC Driver 23ai supports Pipelined Database Operations through:
• The Oracle JDBC Reactive Extensions
• Reactive Streams libraries
• Java Virtual Threads
• Structured Concurrency
• The Standard JDBC Batching API
Copyright © 2024, Oracle and/or its affiliates
JDBC Reactive Extensions and Pipelined DB Operations
Copyright © 2024, Oracle and/or its affiliates
R2DBC and Pipelined Database Operations
Copyright © 2024, Oracle and/or its affiliates
Structured Concurrency and Java Virtual Threads
Structured concurrency treats groups of related tasks running in different threads as a single unit of work,
thereby streamlining error handling and cancellation, improving reliability, and enhancing observability.
• The StructuredTaskScope class enables you
coordinate a group of concurrent subtasks as a unit.
With a StructuredTaskScope instance, you fork each
subtask, which runs them in their own individual
thread. After, you join them as a unit.
• As a result, the StructuredTaskScope ensures that
the subtasks are completed before the main task
continues.
• Alternatively, you can specify that the application
continues when one subtask succeeds.
New | Oracle Database 23ai
Next-Generation Converged Database Services
Over 300 major new features plus thousands of enhancements
Available on OCI and Azure
Major focus on
• AI for Data features
• Developer/Analyst features
• Mission-Critical features
Addresses data management pain points that have frustrated customers forever
Copyright © 2024, Oracle and/or its affiliates
Oracle Database 23ai - AI for Data
Algorithmic AI AI Vector Search Augmented Generative AI (LLMs)
Distributed AI AI Storage AI Developer Tools
Copyright © 2024, Oracle and/or its affiliates
Oracle Database 23ai - Dev for Data
JSON Relational
Duality Views
Property Graph Views
JavaScript
Stored Procedures
Data Intent
Language
Lock-free Consistent Updates,
Long-running Transactions
True
Cache
Copyright © 2024, Oracle and/or its affiliates
Oracle Database 23ai - Mission-Critical Data
RAFT Replication for
Globally Distributed Database
In-Database
Firewall
Real-Time SQL Plan
Management
RAC, Exadata, Data Guard
Simplicity and Scalability
Analytic SQL
Simplicity and Scalability
Priority
Transactions
Copyright © 2024, Oracle and/or its affiliates
Free | Oracle Database 23ai For Developers
Oracle Always Free ADB
Available on OCI
ADB Free Container Image
Available for download
Oracle Database Free
Available as RPM, Docker
Image, VBox VM
Copyright © 2024, Oracle and/or its affiliates | Confidential - Internal
Very Low Cost Supported Developer Edition of ADB, BaseDB, ExaDB-D, and ExaDB-C@C
Copyright © 2024, Oracle and/or its affiliates
LLMs, Oracle DB 23ai, Oracle AI Vector Search and
Vector Embeddings
1- Gather and pre-process
the target dataset
(Texts/Documents
Images, Audio)
3-The LLM learns patterns and
relationships within the data.
LLM
2- Feed LLM with
the pre-processed
data. 33
42
16
21
50
33
42
16
21
50
4-The LLM generates
Embedding Vectors
• GPT-4
• Cohere Command-R
• Llama 3
• Others
Copyright © 2024, Oracle and/or its affiliates
LLMs, Oracle DB 23ai, Oracle AI Vector Search and
Vector Embeddings
LLM
33
42
16
21
50
33
42
16
21
50
5- Embedding Vectors stored in Oracle database
along with the original texts.
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + Oracle AI Vector Search
Combining Structured Concurrency + Pipelined Database Operations +
Oracle AI Vector Search
• Create a database table
• Populate the database
• Update the database table with vector embeddings
• Perform vector similarity searches
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + Oracle AI Vector Search
Text +
Vector
Embeddings
2- Update the Text table with
corresponding Vector
Embedding from Oracle
Cloud’s
Generative AI service
1- Stream text from a
book about animals
into a table
3- Perform similarities
Searches for search
terms
Demo code @ https://tinyurl.com/nbjmczjr
Oracle Database 23ai FREE
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + AI Vector Search
Create and populate the DB table
loadTable(Connection): loads a database table with text data.
Stream Text from book URL
Concurrent batch inserts with StructuredTaskScope
Pipeline batch insert (id, Text) into the table
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + AI Vector Search
Update the Table with Embeddings
updateTable(Connection): store vector Embeddings for the text data.
Pipeline row fetches ( id, Text) from table where Embeddings IS NULL
Request Embeddings from Oracle Cloud's Generative AI service
Pipeline batch update with Embeddings
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + AI Vector Search
Perform Similarities Search 1/2
Perform vector similarity searches
with the following prompts:
• Predatory behavior of cats
• Location of bears
• Best climate for dogs
• Animals in ancient times
• Beautiful birds
• Deadly fish
• Where the wild things are
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + AI Vector Search
Perform Similarities Search 2/2
searchTableText(Connection, List):
Perform a similarity search against vector embeddings
Convert Search Terms to Vector Embeddings
Pipeline queries with VECTOR_DISTANCE on Virtual Threads as it allows for concurrent progress of
MANY statements from one (1) JDBC connection
SELECT text
FROM example
ORDER BY VECTOR_DISTANCE(embedding, ?, COSINE)
FETCH APPROX FIRST 1 ROW ONLY
Return Similarity Search Results
Copyright © 2024, Oracle and/or its affiliates
Demo #4: Structured Concurrency + Pipelined Database
Operations + AI Vector Search
Perform Similarities Search 2/2
Copyright © 2024, Oracle and/or its affiliates
Technical References
• JDK 22
• The Arrival of JDK 22 - https://blogs.oracle.com/java/post/the-arrival-of-java-22
• Virtual Threads
• JEP 444 Virtual Threads - https://openjdk.org/jeps/444
• JEP 480 Structured Concurrency (Third Preview) - https://openjdk.org/jeps/480
• Introduction to Oracle JDBC Driver Support for Virtual Threads - https://bit.ly/3UlNJWP
• Reactive Streams Ingestion Library
• Getting Started with the Java library for Reactive Streams Ingestion (RSI) - https://bit.ly/3rEiRnC
• A High-Speed Data Ingestion Solution in Java Using MQTT, AMQP, and STOMP -
https://medium.com/oracledevs/a-high-speed-data-ingestion-microservice-in-java-using-mqtt-
amqp-and-stomp-135724223ae1
• R2DBC
• Getting Started with Reactive Relational Database Connectivity and the Oracle R2DBC Driver –
http://rb.gy/95u5f8
• Pipelined Database Operations - https://rb.gy/k57g3r
• Generative AI Service - Oracle Cloud Infrastructure (OCI) – https://rb.gy/a9k69e
• What’s in Oracle Database 23ai for Java Developers?
• https://www.oracle.com/a/tech/docs/database/whats-in-oracledb23ai-for-java-developers.pdf
AI Industrial Summit - SOFIA, BULGARIA - A High-Speed Data Ingestion Microservice in Java Using MQTT, AMQP, and STOMP
Oracle LiveLabs
Showcasing how Oracle’s solutions can
solve your business problems
500+
free workshops,
available or in
development
3.5 million
people have already visited
LiveLabs
developer.oracle.com/livelabs
learn something new …at your pace!
600+
events run
using LiveLabs
workshops
3 membership tiers
Connect: @oracleace facebook.com/OracleACEs
aceprogram_ww@oracle.com
500+ technical experts &
community leaders helping peers globally
The Oracle ACE Program recognizes & rewards individuals for
their technical & community contributions to the Oracle community
Nominate
yourself or a candidate:
ace.oracle.com/nominate
Learn more - ace.oracle.com
blogs.oracle.com/ace
Create your FREE
Cloud Account
• Go to
https://signup.cloud.oracle.com/
Copyright © 2024, Oracle and/or its affiliates
Juarez Junior
@juarezjunior
AI Industrial Summit 2024
08
NEXT CONFERENCE
Data Saturday Sofia 2024
05 | October | 2024
Free Ticket
Labs building, Sofia Tech Park

More Related Content

Similar to AI Industrial Summit - SOFIA, BULGARIA - A High-Speed Data Ingestion Microservice in Java Using MQTT, AMQP, and STOMP (20)

PDF
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
Juarez Junior
 
PDF
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
Juarez Junior
 
PDF
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
Juarez Junior
 
PDF
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
Juarez Junior
 
PDF
DWX23 - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, and STO...
Juarez Junior
 
PDF
CloudLand - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, and...
Juarez Junior
 
PDF
DeveloperWeek Latin America 2023 - A High-Speed Data Ingestion Service in Jav...
Juarez Junior
 
PDF
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
Juarez Junior
 
PDF
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Juarez Junior
 
PDF
JCON OpenBlend Slovenia 2023 - A High-Speed Data Ingestion Service in Java Us...
Juarez Junior
 
PDF
DSS_A Solid Foundation for GenAI Apps - Exploring Architectural Blueprints fo...
Juarez Junior
 
PDF
Quarkus Club_Java Virtual Threads & Pipelined Database Operations
Juarez Junior
 
PDF
Full Steam Ahead, R2DBC!
VMware Tanzu
 
PPTX
R2DBC Reactive Relational Database Connectivity
Maarten Smeets
 
PDF
TDC Connections 2023 - A High-Speed Data Ingestion Service in Java Using MQTT...
Juarez Junior
 
PDF
ADBA (Asynchronous Database Access)
Logico
 
PDF
OSN-Blazingly Fast GenAI App Development With Java and Spring AI
Juarez Junior
 
PDF
Presente e Futuro: Java EE.next()
Bruno Borges
 
PPTX
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Getting value from IoT, Integration and Data Analytics
 
PDF
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
VMware Tanzu
 
TDC Connections 2023 - Revolutionize Java DB AppDev with Reactive Streams and...
Juarez Junior
 
DeveloperWeek Europe 2023 - Revolutionize Java DB AppDev with Reactive Stream...
Juarez Junior
 
Cloud Conference Day - A High-Speed Data Ingestion Service in Java Using MQTT...
Juarez Junior
 
BarcelonaJUG - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, ...
Juarez Junior
 
DWX23 - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, and STO...
Juarez Junior
 
CloudLand - A High-Speed Data Ingestion Service in Java Using MQTT, AMQP, and...
Juarez Junior
 
DeveloperWeek Latin America 2023 - A High-Speed Data Ingestion Service in Jav...
Juarez Junior
 
Melee Numerique 2022 - Revolutionize Java DB App Dev with Reactive Streams an...
Juarez Junior
 
Oracle CloudWorld 2023 - A High-Speed Data Ingestion Service in Java Using MQ...
Juarez Junior
 
JCON OpenBlend Slovenia 2023 - A High-Speed Data Ingestion Service in Java Us...
Juarez Junior
 
DSS_A Solid Foundation for GenAI Apps - Exploring Architectural Blueprints fo...
Juarez Junior
 
Quarkus Club_Java Virtual Threads & Pipelined Database Operations
Juarez Junior
 
Full Steam Ahead, R2DBC!
VMware Tanzu
 
R2DBC Reactive Relational Database Connectivity
Maarten Smeets
 
TDC Connections 2023 - A High-Speed Data Ingestion Service in Java Using MQTT...
Juarez Junior
 
ADBA (Asynchronous Database Access)
Logico
 
OSN-Blazingly Fast GenAI App Development With Java and Spring AI
Juarez Junior
 
Presente e Futuro: Java EE.next()
Bruno Borges
 
Databasecentricapisonthecloudusingplsqlandnodejscon3153oow2016 160922021655
Getting value from IoT, Integration and Data Analytics
 
The Making of the Oracle R2DBC Driver and How to Take Your Code from Synchron...
VMware Tanzu
 

More from Juarez Junior (20)

PDF
WeAreDevelopers Berlin - Blazingly Fast GenAI App Development With Java and S...
Juarez Junior
 
PDF
WeAreDevelopers Berlin - LangChain4J - A Guide for Impatient Developers
Juarez Junior
 
PDF
Build Stuff Lithuania - Blazingly Fast GenAI App Development With Java and Sp...
Juarez Junior
 
PDF
DUBJUG-Simplifying Data Access with Jakarta Data for Domain-Driven Design
Juarez Junior
 
PDF
Cloud Lunch and Learn -Microsoft Semantic Kernel for Java
Juarez Junior
 
PDF
Compass AI Budapest -The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
Juarez Junior
 
PDF
GSAS - Global Software Architecture Summit - GenAI-Architectural-Blueprints
Juarez Junior
 
PDF
BaselOne_Langchain4J - A Guide for Impatient Developers
Juarez Junior
 
PDF
DeveloperWeek USA - A Solid Foundation for GenAI Apps - Exploring Architectur...
Juarez Junior
 
PDF
I Love Tech Romania - Blazingly Fast GenAI App Development With Java and Spri...
Juarez Junior
 
PDF
I Love Tech Romania - The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
Juarez Junior
 
PDF
DUBJUG_Blazingly Fast GenAI App Development With Java and Spring AI.pdf
Juarez Junior
 
PDF
DUBJUG_Creating GenAI Apps in Java with SD4J and the ONNX Runtime
Juarez Junior
 
PDF
I Love Tech Romania - A High-Speed Data Ingestion Microservice in Java Using ...
Juarez Junior
 
PDF
DevTalks Cluj Romania - A Solid Foundation for GenAI Apps.pdf
Juarez Junior
 
PDF
Quarkus Club_Revolutionize Java Database App Development with Reactive Stream...
Juarez Junior
 
PDF
TDC - The Developers Conference - The Trinity in GenAI - Spring AI, LangChain...
Juarez Junior
 
PDF
TDC - The Developers Conference - Creating GenAI Apps in Java with SD4J and t...
Juarez Junior
 
PDF
TDC - The Developers Conference - An Introduction to Machine Learning in Java...
Juarez Junior
 
PDF
SouJava - Blazingly Fast GenAI App Development With Java and Spring AI
Juarez Junior
 
WeAreDevelopers Berlin - Blazingly Fast GenAI App Development With Java and S...
Juarez Junior
 
WeAreDevelopers Berlin - LangChain4J - A Guide for Impatient Developers
Juarez Junior
 
Build Stuff Lithuania - Blazingly Fast GenAI App Development With Java and Sp...
Juarez Junior
 
DUBJUG-Simplifying Data Access with Jakarta Data for Domain-Driven Design
Juarez Junior
 
Cloud Lunch and Learn -Microsoft Semantic Kernel for Java
Juarez Junior
 
Compass AI Budapest -The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
Juarez Junior
 
GSAS - Global Software Architecture Summit - GenAI-Architectural-Blueprints
Juarez Junior
 
BaselOne_Langchain4J - A Guide for Impatient Developers
Juarez Junior
 
DeveloperWeek USA - A Solid Foundation for GenAI Apps - Exploring Architectur...
Juarez Junior
 
I Love Tech Romania - Blazingly Fast GenAI App Development With Java and Spri...
Juarez Junior
 
I Love Tech Romania - The Trinity in GenAI - Spring AI, LangChain4J and OpenAI
Juarez Junior
 
DUBJUG_Blazingly Fast GenAI App Development With Java and Spring AI.pdf
Juarez Junior
 
DUBJUG_Creating GenAI Apps in Java with SD4J and the ONNX Runtime
Juarez Junior
 
I Love Tech Romania - A High-Speed Data Ingestion Microservice in Java Using ...
Juarez Junior
 
DevTalks Cluj Romania - A Solid Foundation for GenAI Apps.pdf
Juarez Junior
 
Quarkus Club_Revolutionize Java Database App Development with Reactive Stream...
Juarez Junior
 
TDC - The Developers Conference - The Trinity in GenAI - Spring AI, LangChain...
Juarez Junior
 
TDC - The Developers Conference - Creating GenAI Apps in Java with SD4J and t...
Juarez Junior
 
TDC - The Developers Conference - An Introduction to Machine Learning in Java...
Juarez Junior
 
SouJava - Blazingly Fast GenAI App Development With Java and Spring AI
Juarez Junior
 
Ad

Recently uploaded (20)

PDF
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
PDF
AI Image Enhancer: Revolutionizing Visual Quality”
docmasoom
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PPTX
Employee salary prediction using Machine learning Project template.ppt
bhanuk27082004
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PPT
Activate_Methodology_Summary presentatio
annapureddyn
 
PDF
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
PDF
How Agentic AI Networks are Revolutionizing Collaborative AI Ecosystems in 2025
ronakdubey419
 
PDF
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
PPTX
Presentation about Database and Database Administrator
abhishekchauhan86963
 
PPTX
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PDF
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
PDF
Salesforce Pricing Update 2025: Impact, Strategy & Smart Cost Optimization wi...
GetOnCRM Solutions
 
PDF
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PDF
Step-by-Step Guide to Install SAP HANA Studio | Complete Installation Tutoria...
SAP Vista, an A L T Z E N Company
 
MiniTool Power Data Recovery Crack New Pre Activated Version Latest 2025
imang66g
 
AI Image Enhancer: Revolutionizing Visual Quality”
docmasoom
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
Employee salary prediction using Machine learning Project template.ppt
bhanuk27082004
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Activate_Methodology_Summary presentatio
annapureddyn
 
10 posting ideas for community engagement with AI prompts
Pankaj Taneja
 
How Agentic AI Networks are Revolutionizing Collaborative AI Ecosystems in 2025
ronakdubey419
 
Enhancing Healthcare RPM Platforms with Contextual AI Integration
Cadabra Studio
 
Presentation about Database and Database Administrator
abhishekchauhan86963
 
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
Adobe Illustrator Crack Full Download (Latest Version 2025) Pre-Activated
imang66g
 
Salesforce Pricing Update 2025: Impact, Strategy & Smart Cost Optimization wi...
GetOnCRM Solutions
 
How to Download and Install ADT (ABAP Development Tools) for Eclipse IDE | SA...
SAP Vista, an A L T Z E N Company
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
Step-by-Step Guide to Install SAP HANA Studio | Complete Installation Tutoria...
SAP Vista, an A L T Z E N Company
 
Ad

AI Industrial Summit - SOFIA, BULGARIA - A High-Speed Data Ingestion Microservice in Java Using MQTT, AMQP, and STOMP

  • 2. 14 | SEP | 2024 AI Industrial Summit 2024 02 THANKS FOR SUPPORT US TODAY Platinum Sponsor Platinum Sponsor Silver Sponsor Partner
  • 3. A High-Speed Data Ingestion Microservice in Java Using MQTT, AMQP, and STOMP AI Industrial Summit 2024 Juarez Barbosa Junior @juarezjunior Senior Principal Java Developer Evangelist ORACLE Copyright © 2024, Oracle and/or its affiliates
  • 4. Juarez Barbosa Junior Senior Principal Java Developer Evangelist @ Oracle • Speaking from Dublin, Ireland • 28 years of experience in SW Engineering & DevRel • Oracle, Microsoft, IBM, Nokia, Unisys, Accenture, startups • Microsoft Azure Developer Relations Lead • IBM Watson Tech Evangelist & Cloud Rockstar • IBM Mobile Tech Evangelist & Global Thought Leader • Nokia Developers Global Champion • Java, Python, Cloud, DevOps, SRE, Cloud-native, IoT, AI, Blockchain, Rust • Speaker at conferences • Oracle CloudWorld, Oracle Code, Microsoft Ignite & TechX, jPrime, JCON, DevConf.cz, GeeCon, DevOpsDays, DeveloperWeek, DevOps Institute, CloudLand, DWX, The Developer’s Conference (TDC), Sec4Dev, JSNation, NodeConf, Conf42, Shift Conf, Global Azure, Open-Source Lisbon, CodeFrenzy, MĂŞlĂ©e NumĂ©rique, React Summit, Test.js Summit, Porto TechHub Conf, Pyjamas, MiTechCon, Data Science Summit, OpenSourceNorth, WeAreDevelopers, Global Software Architecture Summit, JavaForumNord, JavaCro, JUGs, OUGs, GDGs, meetups, hackathons, and customer engagements. @juarezjunior @juarezjunior
  • 5. Agenda • Java App Dev with the Oracle Database • Oracle JDBC - Support for the Latest Java Versions • Overview of Oracle DB Access with Java • Oracle JDBC – Sync and Async • Classic Java Platform Threads • Project Loom – Virtual Threads • Virtual Threads - JEPs 425, 436, 444 • Demo # 1: Virtual vs Platform Threads • Reactive JDBC - Synchronous vs Asynchronous JDBC • Reactive Streams Ingestion (RSI) • Demo # 2: Reactive Streams Ingestion (RSI) • From Sync to Reactive JDBC: Oracle R2DBC • Demo # 3: Oracle R2DBC with Project Reactor • Pipelined Database Operations, Oracle AI Vector Search • Demo #4: Structured Concurrency + Pipelined Database Operations + AI Vector Search • Live Labs/Free Oracle Cloud Account/Oracle ACE Program Copyright © 2024, Oracle and/or its affiliates
  • 6. Java App Dev with Oracle Database Copyright © 2024, Oracle and/or its affiliates
  • 7. Overview of Oracle DB Access with Java Copyright © 2024, Oracle and/or its affiliates
  • 8. Copyright © 2024, Oracle and/or its affiliates Oracle JDBC - Support for the Latest Java Versions • Java 11 - native support, compiled with it • Java 17 - certified • JDBC Standards - 4.2 and 4.3 • GraalVM - native image instrumentation • Reactive Streams - Java Flow API support • Project Loom - Virtual Threads support • Data access is crucial in mission-critical apps
  • 9. Oracle JDBC Reactive Extensions (Flow API) Copyright © 2024, Oracle and/or its affiliates SQL Execution (OraclePreparedStatement): Publisher<Boolean> executeAsyncOracle() Publisher<Long> executeUpdateAsyncOracle() Publisher<Long> executeBatchAsyncOracle() Publisher<OracleResultSet> executeQueryAsyncOracle() Row Fetching (OracleResultSet): Publisher<T> publisherOracle(Function<OracleRow, T> f) LOB I/O (OracleBlob): Publisher<byte[]> publisherOracle(long position) Subscriber<byte[]> subscriberOracle(long position) LOB I/O (OracleClob): Publisher<String> publisherOracle(long position) Subscriber<String> subscriberOracle(long position) Connection Closing (OracleConnection): Publisher<Success> closeAsyncOracle() Transaction Closing (OracleConnection): Publisher<Success> commitAsyncOracle() Publisher<Success> rollbackAsyncOracle() Connection Creation (OracleConnectionBuilder): Publisher<OracleConnection> buildConnectionPublisherOracle() Introduction to JDBC Reactive Extensions with the Oracle Database 23c Free — Developer Release
  • 10. Oracle JDBC – Async and Sync • Project Loom - Virtual Threads • Synchronous database access with lightweight threads • Standard JDBC + Virtual Threads • Client application call stack may use blocking, synchronous code • Libraries must be compatible with Virtual Threads • Oracle instrumented the Oracle JDBC driver to support Virtual Threads • Reactive Programming • Asynchronous database access with non-blocking network I/O • Oracle Reactive Streams Ingestion (RSI) + Oracle R2DBC + Oracle JDBC Reactive Extensions (Flow) • Reactive Streams Libraries: Reactor, RxJava, Akka, Vert.x Copyright © 2024, Oracle and/or its affiliates
  • 11. Classic Java Platform Threads • Database access with blocking threads • A JDBC call blocks a thread for 100s of milliseconds (thread-per-request style) • Thread count increases linearly with the number of JDBC calls • Performance degrades as the number of threads increases • 1 MB of stack memory per thread typically • Scheduling many platform threads is expensive • Preemptive scheduling vs time-slicing Copyright © 2024, Oracle and/or its affiliates
  • 12. Virtual Threads - JEPs 425, 436, 444 • Virtual Threads – JEPs (JDK Enhancement Proposals) • Lightweight (user mode) threads that dramatically reduce the effort of writing, maintaining, and observing high-throughput concurrent applications • Enable applications written in the simple thread-per-request style to scale with near- optimal hardware utilization • Enable easy troubleshooting, debugging, and profiling of virtual threads with existing JDK tools • Do not remove the traditional implementation of threads • Do not alter the basic concurrency model of Java • Enable existing code that uses Java threads (java.lang.Thread) to adopt virtual threads with minimal change Copyright © 2024, Oracle and/or its affiliates
  • 13. Virtual Threads - JEPs 425, 436, 444 • Virtual Threads – JEPs (JDK Enhancement Proposals) • Virtual threads typically employ a small set of platform threads used as carrier threads • Code executing in a virtual thread is not aware of the underlying carrier thread • The currentThread() method will always return the Thread object for the virtual thread • Virtual threads do not have a thread name by default. The getName() method returns the empty string if a thread name is not set • Virtual threads have a fixed thread priority that cannot be changed • Virtual threads are daemon threads so do not prevent the shutdown sequence from beginning (low-priority ones). Copyright © 2024, Oracle and/or its affiliates
  • 14. Virtual Threads - JEPs 425, 436, 444 • JDK Enhancement Proposals • JEP 425: Virtual Threads (Preview) • JEP 436: Virtual Threads (Second Preview) • JEP 444: Virtual Threads • java.lang.Thread • final Boolean - isVirtual() • static Thread.Builder.OfVirtual - ofVirtual() • static Thread.Builder.OfPlatform - ofPlatform() • static Thread - startVirtualThread(Runnable task) • java.lang.Thread.Builder • java.util.concurrent.Executors • static ExecutorService - newVirtualThreadPerTaskExecutor() Copyright © 2024, Oracle and/or its affiliates
  • 15. Virtual Threads - JEPs 425, 436, 444 • java.lang.Thread.Builder • Thread defines a Thread.Builder API for creating and starting both platform and virtual threads. The following are examples that use the builder: Copyright © 2024, Oracle and/or its affiliates
  • 16. Copyright © 2022, Oracle and/or its affiliates Demo # 1: Virtual vs Platform Threads âš« Virtual Threads vs Platform Threads âš« JEP 425 Virtual Threads (Preview) âš« JEP 436 (Second Preview) âš« JEP 444 (JDK 21) âš« Oracle JDBC Driver instrumented to support Virtual Threads âš« Intrinsic locks replaced with ReentrantLock to avoid thread pinning âš« Verifiable comparison of OS/HW resources consumption (Platform Threads versus Virtual Threads) âš« Introduction to Oracle JDBC Driver Support for Virtual Threads
  • 17. Copyright © 2024, Oracle and/or its affiliates Reactive JDBC - Sync vs Async JDBC Setup Blocking Handle Result Setup Non-Blocking Handle Result Synchronous JDBC Setup Blocking Handle Result Setup Non-Blocking Handle Result Setup Non-Blocking Handle Result Reactive JDBC Database Setup Blocking Handle Result Database
  • 18. Copyright © 2022, Oracle and/or its affiliates Reactive Streams Ingestion (RSI) âš« Java Library for Reactive Streams Ingestion âš« Streaming capability: Ingest data in an unblocking, and reactive way from a large group of clients âš« Group records through RAC (Real App Clusters), and Shard affinity using native UCP (Universal Connection Pool) âš« Optimize CPU allocation while decoupling record Processing from I/O âš« Fastest insert method for the Oracle Database through Direct Path Insert, bypassing SQL and writing directly into the DB files
  • 19. Copyright © 2024, Oracle and/or its affiliates Demo #2: RSI - Architecture
  • 20. Copyright © 2024, Oracle and/or its affiliates Demo #2: RSI - Project Structure
  • 21. Copyright © 2024, Oracle and/or its affiliates Demo # 2: Reactive Streams Ingestion (RSI) Container Pipelines, Jenkins, etc. Build Test Push Push Docker images to Registry Cloud Infrastructur e Registry Container Engine for Kubernetes Pull images from Registry Deploy images to production Kubernetes worker nodes Containers running microservices deployed over Kubernetes ORACLE CLOUD INFRASTRUCTURE ATP, ADW, ATP-D, AFDW-D Memoptimized Rowstore RSI Runtime: Non- blocking, optimized library for streaming data through Direct Path, Shard & RAC/FAN support. HTTP / REST Engine over Helidon Define build for CI/CD toolchain gRPC / AMQP / MQTT Engines Microservices Files / Logs IoT Devices / Apps cv MQTT gRPC AMQP HTTP / REST JDBC Direct Path INSERT Record Streaming over multiple protocols.
  • 22. Virtual Threads or Reactive? • Oracle JDBC supports both! • Want Virtual Threads? • The Oracle JDBC driver is Virtual Thread compatible • Pipelined Database Operations • Want Reactive? • Oracle R2DBC, Oracle RSI, Oracle JDBC Reactive Extensions • Pipelined Database Operations Copyright © 2024, Oracle and/or its affiliates
  • 23. Virtual Threads or Reactive? • Benefits of Virtual Threads: • Easier to read and write • Easier to debug • Integration with JDK tools • Do not alter the basic concurrency model of Java • Now available in JDK 21 / 22 • Limitations of Virtual Threads: • Some libraries/frameworks are not compatible yet Copyright © 2024, Oracle and/or its affiliates Benefits of Reactive: • Reactive Libraries (Reactor, RxJava, Akka, Vert.x) • Stream-like API with a functional style • Low-level concurrency is handled for you (locks, atomics, queues) Limitations of Reactive: • Steep learning curve • Harder to read and write • Harder to debug
  • 24. From Sync to Reactive JDBC: Oracle R2DBC • Oracle Reactive Relational Database Connectivity (R2DBC) • Oracle R2DBC Driver is a Java library that supports reactive programming with the Oracle Database • It implements the R2DBC Service Provider Interface (SPI) as specified by the Reactive Relational Database Connectivity (R2DBC) spec • The R2DBC SPI exposes Reactive Streams as an abstraction for remote database operations • The sample code uses Project Reactor. It could use RxJava, Akka, or any Reactive Streams library • Runs on Java 11+ • Oracle RDBC 1.2.0, Apache v2.0 (OSS) Copyright © 2024, Oracle and/or its affiliates R2DBC – Reactive Relational DB Connectivity
  • 25. Copyright © 2024, Oracle and/or its affiliates Demo # 3: Oracle R2DBC static String queryJdbc(java.sql.Connection connection) throws SQLException { try (java.sql.Statement statement = connection.createStatement()) { ResultSet resultSet = statement.executeQuery("SELECT * FROM CUSTOMERS"); if (resultSet.next()) return resultSet.getString(1); else throw new NoSuchElementException("Query returned zero rows"); } } static Publisher<String> queryR2dbc(io.r2dbc.spi.Connection connection) { return Flux.from(connection.createStatement( "SELECT * FROM CUSTOMERS") .execute()) .flatMap(result -> result.map(row -> row.get(0, String.class))) .switchIfEmpty(Flux.error( new NoSuchElementException("Query returned zero rows"))); }
  • 26. Copyright © 2024, Oracle and/or its affiliates Pipelined Database Operations Before Pipelined Database Operations The server must complete the processing of the request and sending the response before accepting another request The client and server have idle time The Java app sends a request The server sends the response The Java app receives the response
  • 27. Copyright © 2024, Oracle and/or its affiliates Pipelined Database Operations With Pipelining No-Blocking Requests and Responses Send multiple requests from client to server without waiting for responses Application can asynchronously perform other operations The server processes the requests in order and sends the responses back to the client when ready, in the same order they were received Benefits Improved response time and throughput Particularly useful when network latency is high
  • 28. Copyright © 2024, Oracle and/or its affiliates Pipelined Database Operations Performance Improvements depending on the CPU load, the workload profiles on the server side, and the network latency between client and server • Up to 90% improvement for queries only workload over a fast network • Up to 90x improvement for queries only workload over a slow network • Up to 24% improvement for OLTP workload over a fast network • Up to 7x improvement for OLTP workload over a slow network • Up to 100+x improvement for DML workload The Oracle JDBC Driver 23ai supports Pipelined Database Operations through: • The Oracle JDBC Reactive Extensions • Reactive Streams libraries • Java Virtual Threads • Structured Concurrency • The Standard JDBC Batching API
  • 29. Copyright © 2024, Oracle and/or its affiliates JDBC Reactive Extensions and Pipelined DB Operations
  • 30. Copyright © 2024, Oracle and/or its affiliates R2DBC and Pipelined Database Operations
  • 31. Copyright © 2024, Oracle and/or its affiliates Structured Concurrency and Java Virtual Threads Structured concurrency treats groups of related tasks running in different threads as a single unit of work, thereby streamlining error handling and cancellation, improving reliability, and enhancing observability. • The StructuredTaskScope class enables you coordinate a group of concurrent subtasks as a unit. With a StructuredTaskScope instance, you fork each subtask, which runs them in their own individual thread. After, you join them as a unit. • As a result, the StructuredTaskScope ensures that the subtasks are completed before the main task continues. • Alternatively, you can specify that the application continues when one subtask succeeds.
  • 32. New | Oracle Database 23ai Next-Generation Converged Database Services Over 300 major new features plus thousands of enhancements Available on OCI and Azure Major focus on • AI for Data features • Developer/Analyst features • Mission-Critical features Addresses data management pain points that have frustrated customers forever Copyright © 2024, Oracle and/or its affiliates
  • 33. Oracle Database 23ai - AI for Data Algorithmic AI AI Vector Search Augmented Generative AI (LLMs) Distributed AI AI Storage AI Developer Tools Copyright © 2024, Oracle and/or its affiliates
  • 34. Oracle Database 23ai - Dev for Data JSON Relational Duality Views Property Graph Views JavaScript Stored Procedures Data Intent Language Lock-free Consistent Updates, Long-running Transactions True Cache Copyright © 2024, Oracle and/or its affiliates
  • 35. Oracle Database 23ai - Mission-Critical Data RAFT Replication for Globally Distributed Database In-Database Firewall Real-Time SQL Plan Management RAC, Exadata, Data Guard Simplicity and Scalability Analytic SQL Simplicity and Scalability Priority Transactions Copyright © 2024, Oracle and/or its affiliates
  • 36. Free | Oracle Database 23ai For Developers Oracle Always Free ADB Available on OCI ADB Free Container Image Available for download Oracle Database Free Available as RPM, Docker Image, VBox VM Copyright © 2024, Oracle and/or its affiliates | Confidential - Internal Very Low Cost Supported Developer Edition of ADB, BaseDB, ExaDB-D, and ExaDB-C@C
  • 37. Copyright © 2024, Oracle and/or its affiliates LLMs, Oracle DB 23ai, Oracle AI Vector Search and Vector Embeddings 1- Gather and pre-process the target dataset (Texts/Documents Images, Audio) 3-The LLM learns patterns and relationships within the data. LLM 2- Feed LLM with the pre-processed data. 33 42 16 21 50 33 42 16 21 50 4-The LLM generates Embedding Vectors • GPT-4 • Cohere Command-R • Llama 3 • Others
  • 38. Copyright © 2024, Oracle and/or its affiliates LLMs, Oracle DB 23ai, Oracle AI Vector Search and Vector Embeddings LLM 33 42 16 21 50 33 42 16 21 50 5- Embedding Vectors stored in Oracle database along with the original texts.
  • 39. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + Oracle AI Vector Search Combining Structured Concurrency + Pipelined Database Operations + Oracle AI Vector Search • Create a database table • Populate the database • Update the database table with vector embeddings • Perform vector similarity searches
  • 40. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + Oracle AI Vector Search Text + Vector Embeddings 2- Update the Text table with corresponding Vector Embedding from Oracle Cloud’s Generative AI service 1- Stream text from a book about animals into a table 3- Perform similarities Searches for search terms Demo code @ https://tinyurl.com/nbjmczjr Oracle Database 23ai FREE
  • 41. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + AI Vector Search Create and populate the DB table loadTable(Connection): loads a database table with text data. Stream Text from book URL Concurrent batch inserts with StructuredTaskScope Pipeline batch insert (id, Text) into the table
  • 42. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + AI Vector Search Update the Table with Embeddings updateTable(Connection): store vector Embeddings for the text data. Pipeline row fetches ( id, Text) from table where Embeddings IS NULL Request Embeddings from Oracle Cloud's Generative AI service Pipeline batch update with Embeddings
  • 43. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + AI Vector Search Perform Similarities Search 1/2 Perform vector similarity searches with the following prompts: • Predatory behavior of cats • Location of bears • Best climate for dogs • Animals in ancient times • Beautiful birds • Deadly fish • Where the wild things are
  • 44. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + AI Vector Search Perform Similarities Search 2/2 searchTableText(Connection, List): Perform a similarity search against vector embeddings Convert Search Terms to Vector Embeddings Pipeline queries with VECTOR_DISTANCE on Virtual Threads as it allows for concurrent progress of MANY statements from one (1) JDBC connection SELECT text FROM example ORDER BY VECTOR_DISTANCE(embedding, ?, COSINE) FETCH APPROX FIRST 1 ROW ONLY Return Similarity Search Results
  • 45. Copyright © 2024, Oracle and/or its affiliates Demo #4: Structured Concurrency + Pipelined Database Operations + AI Vector Search Perform Similarities Search 2/2
  • 46. Copyright © 2024, Oracle and/or its affiliates Technical References • JDK 22 • The Arrival of JDK 22 - https://blogs.oracle.com/java/post/the-arrival-of-java-22 • Virtual Threads • JEP 444 Virtual Threads - https://openjdk.org/jeps/444 • JEP 480 Structured Concurrency (Third Preview) - https://openjdk.org/jeps/480 • Introduction to Oracle JDBC Driver Support for Virtual Threads - https://bit.ly/3UlNJWP • Reactive Streams Ingestion Library • Getting Started with the Java library for Reactive Streams Ingestion (RSI) - https://bit.ly/3rEiRnC • A High-Speed Data Ingestion Solution in Java Using MQTT, AMQP, and STOMP - https://medium.com/oracledevs/a-high-speed-data-ingestion-microservice-in-java-using-mqtt- amqp-and-stomp-135724223ae1 • R2DBC • Getting Started with Reactive Relational Database Connectivity and the Oracle R2DBC Driver – http://rb.gy/95u5f8 • Pipelined Database Operations - https://rb.gy/k57g3r • Generative AI Service - Oracle Cloud Infrastructure (OCI) – https://rb.gy/a9k69e • What’s in Oracle Database 23ai for Java Developers? • https://www.oracle.com/a/tech/docs/database/whats-in-oracledb23ai-for-java-developers.pdf
  • 48. Oracle LiveLabs Showcasing how Oracle’s solutions can solve your business problems 500+ free workshops, available or in development 3.5 million people have already visited LiveLabs developer.oracle.com/livelabs learn something new …at your pace! 600+ events run using LiveLabs workshops
  • 49. 3 membership tiers Connect: @oracleace facebook.com/OracleACEs [email protected] 500+ technical experts & community leaders helping peers globally The Oracle ACE Program recognizes & rewards individuals for their technical & community contributions to the Oracle community Nominate yourself or a candidate: ace.oracle.com/nominate Learn more - ace.oracle.com blogs.oracle.com/ace
  • 50. Create your FREE Cloud Account • Go to https://signup.cloud.oracle.com/ Copyright © 2024, Oracle and/or its affiliates
  • 52. AI Industrial Summit 2024 08 NEXT CONFERENCE Data Saturday Sofia 2024 05 | October | 2024 Free Ticket Labs building, Sofia Tech Park