SlideShare une entreprise Scribd logo
1  sur  44
Télécharger pour lire hors ligne
ACCELERATED ORM FOR JAVA 8
AN OPEN SOURCE SOLUTION
Per-Åke Minborg
BIO
PER-ÅKE MINBORG
• Chalmers, Master of Science
• Java >15 years
• Speaker at Meetups and Javaforums around the globe
• Java 8 and OpenSource blogger
• Recently with project Speedment
• Code_n Big Data award 2014
• 33-list winner 2015 (NyTeknik and Affärsvärlden)
PROBLEM
• Long response times is the most common IT problem at work
• The amount of data is increasing every day
SOLUTIONS
New Ground
Application developer
HW supplier
DBA
Architect
Carpenter
Painter
Ground
Buy faster better
more HW -expensive
Optimize database –minor effect
Extreme performance –migration project
speedment.org
SPEEDMENTS CURRENT IMPLEMENTATIONS
• Trouble Ticket Solution
• Web Application
• Train Infotainment Plattform
• Energy Measurment Tracking
• Database Consolidation Layer
THE JAVA DEVELOPER BEHIND THE STEERING WHEEL!
A Database application development tool in Java – a modern ORM (Object Relational Mapping)
• The hot new solution
• Fast to develop applications
• Extreme database speed
• Reactive Programming
DO YOU RECOGNIZE THE FOLLOWING?
When coding it is complex to connect to a database…..
…then you use an ORM
Source: ZeroTurnaround 2014
SOME PROS OF USING AN ORM:
• You can work with a relational database as if it were object oriented.
• Increased productivity.
• Provides a certain degree of abstraction (you can replace your DBMS).
SOME CONS OF USING AN ORM:
• Slows down the application
• You can not access all Java 8 features
• You must still write SQL, HQL, et. al
IT STARTED WITH A PROBLEM
TECHNOLOGY EVOLUTION
• Memory size exponentially doubles each 18:th month
• The number of CPU-cores [N] is increasing moderately
• Performance per CPU-core [P(N)] is increasing moderately
• P = N*P(N) is increasing exponentially
• No one will use magnetic disks for performance applications
• "Cloud" deployment is popular
JVM
NEW SOLUTION
MOV
CQRS
In-
Memory
Copy
Relational
Database
WHAT IS DIFFERENT WITH THE SOLUTION?
• Everything(*) is always in-memory(**) (in the JVM)
• We never have to check if an object is in cache
• We can organize objects knowing that we have them all
• We do not even have to look at individual objects -> O(1)
• Everything is Java 8. No legacy!
Size
Time
O(1)
O(n)
WORK FLOW
1. Database 2. Speedment GUI 3. IDE
SUPPORT FOR DATA FROM
• RDBMS
• NoSQL Databases
• Other "Data Sources" like files
SCALE UP IN LOCAL MEMORY
• JVM can exceed physical RAM
• Compression
• Deduplication
• Layered storage engines
(On-Heap, Off-Heap, SSD, Disk, SQL)
• Lazy load
~24 GB
>1 TB
>4 TB
∞
On-Heap
Off-
Heap
SSD
SQL
100 MTPS
20 MTPS
1 MTPS
0,001 MTPS
Database Size:
(After Compression)
Transaction Speed:
SCALE OUT WITH HAZELCAST
• Set up a cluster in the Cloud
• Scale out your existing database
• Set up Terabytes of RAM
PROPERTIES:
• The API will remain the same regardless of selected Storage Engine
• Massively concurrent and lock free
• Scale with CPU performance and number of cores
• Eventually consistent
• Transaction safe, if you want
PROPERTIES:
• The database ”owns” the data
• Data is reflected into Materialized Object Views (MOVs)
• MOVs and application resides in the same JVM
• Most operations are O(1)
• persons.byName(“Bob") -> Map<PK,Person> with 1000 persons in 100 ns (30 m)
• TCP/IP RTT 100 us -> +1000 "finds" per TCP RT.
• In-memory DBs with zero query latency are snails by definition
SPEED IN TWO DIMENSIONS
1) Speed development
2) Speed Execution
EXECUTION SPEED
Server
ApplicationDatabase
1
Query: 1 s
Server
Application
Database
in-memory
2
Query: 0 s
JVM
Server
ApplicationDatabase
3
Data
copy
3 days
0 s
SPEEDMENT ORM API
• Embrace Java 8 paradigm with stream(), filter(), sort(), limit() etc.
• Forget about SQL, JQL et. al
SPEEDMENT ORM API, GENERATED CODE
• Everything is interfaces!
• Completely pluggable architecture
• Default classes that implements the interfaces are generated
• Write (possibly several) custom entity implementations
• Override or create your own Managers
• Expand the existing code generation with your own custom code (pluggable)
•”Write code that writes code”
SPEEDMENT ORM API
• MOVs are Map<PK, Entity> and are immutable (in user-land)
• Entities are immutables
• You can then get mutable Beans/Builders (They are Interfaces too)
•API remains the same regardless of Storage Engine
•Dynamic joins -> Maps with Maps with Maps with... (TBI)
CODE EXAMPLES
INITIALIZATION
new HelloSpeedment().start();
PERSISTENCE
Hare harry = HareManager.get().builder()
.setName("Harry")
.setColor("Gray")
.setAge(3);
HareManager.get().persist(harry);
QUERYING
List<Hare> oldHares = HareManager.get()
.stream()
.filter(h -> h.getAge() > 8)
.collect(toList());
OPTIMISED KEY-VALUE LOOK-UP
Optional<Hare> harry = HareManager.get()
.stream()
.filter(h -> "Harry".equals(h.getName()))
.findAny();
ENTITIES ARE LINKED
Optional<Carrot> carrot = HareManager.get()
.stream()
.filter(h -> "Harry".equals(h.getName()))
// Carrot is a foreign key.
.flatmap(h -> h.findCarrots())
.findAny();
MULTI-THREADING
HareManager.get().parallelStream()
.filter(h -> HumanManager.get().stream()
.filter(n -> h.getName().equals(n.getName()))
.anyMatch()
).forEach(System.out::println);
REACTIVE PROGRAMMING
HareManager.get().onInsert(…)
CONFIGURATION
• Groovy script like Gradle
• Config file is placed at the same location as the POM
dbms {
schema {
table {
name = ”hare";
column {
name = "name";
}
}
}
}
API ("ENTITY" INTERFACES)
public interface Hare {
String getName();
interface Bean extends Hare {
void setName(String name);
}
}
API ("ENTITY" INTERFACES)
• A Hare implementing class needs only to implement one method.
• Implementation is completely hidden
• An entity does not need to inherit from a class "Entity" or similar
API (DEFAULT "ENTITY" IMPLEMENTATION)
public class HareImpl implements Hare {
private final name;
public HareImpl(Hare template) {
name = template.getName();
}
public String getName() { return name; }
}
API (CUSTOM "ENTITY" IMPLEMENTATION)
public class HarryHareImpl implements Hare{
public HarryHareImpl(Hare template) {
}
public String getName() { return “Harry”; }
}
API (MANAGER INTERFACE)
public interface HareManager
extends Manager<Hare> {
Hare.Bean toBean(Hare template);
Stream<Hare> stream();
Stream<Hare> byName(String name);
API (MANAGER INTERFACE)
void persist(Hare hare);
void remove(Hare hare);
// More...
}
EASE OF USE:
• Single Maven dependency in POM
• Maven targets
• Works with Gradle
• GUI to automatically derive the groovy config file from existing databases
OPEN SOURCE LICENSE
• Apache 2.0 License
• www.speedment.org
CONCLUSIONS
• Code generation, No boiler plate code
• Expand the code generation
• Focus on the problem at hand!
• Forget about the database
• Use Java 8
• Install your own implementations, if you like
• Insane application speed!
ARE YOU:
• Tired of legacy ORMs?
• In love with Java 8?
• A First mover that likes new exotic Exceptions?
• Cheer leader?
• A person that wish that null pointers were Optional ?
JOIN THE HARE!
WE ARE WHERE YOU ARE!
• www.speedment.org
• GitHub: https://github.com/speedment/speedment-orm
• Twitter: @Pminborg
• Mail: minborg@speedment.org
• Blog: minborgsjavapot.blogspot.com
• Innovation House Palo Alto
• Järntorget, Gothenburg

Contenu connexe

Tendances

Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflowsBeyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
DataWorks Summit
 

Tendances (20)

Groovy concurrency
Groovy concurrencyGroovy concurrency
Groovy concurrency
 
Druid at naver.com - part 1
Druid at naver.com - part 1Druid at naver.com - part 1
Druid at naver.com - part 1
 
Data Analytics Service Company and Its Ruby Usage
Data Analytics Service Company and Its Ruby UsageData Analytics Service Company and Its Ruby Usage
Data Analytics Service Company and Its Ruby Usage
 
Using apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at DatadogUsing apache spark for processing trillions of records each day at Datadog
Using apache spark for processing trillions of records each day at Datadog
 
Tale of ISUCON and Its Bench Tools
Tale of ISUCON and Its Bench ToolsTale of ISUCON and Its Bench Tools
Tale of ISUCON and Its Bench Tools
 
Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...
Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...
Getting Started with Apache Cassandra and Apache Zeppelin (DuyHai DOAN, DataS...
 
Hadoop engineering bo_f_final
Hadoop engineering bo_f_finalHadoop engineering bo_f_final
Hadoop engineering bo_f_final
 
The Future of Apache Storm
The Future of Apache StormThe Future of Apache Storm
The Future of Apache Storm
 
Document Similarity with Cloud Computing
Document Similarity with Cloud ComputingDocument Similarity with Cloud Computing
Document Similarity with Cloud Computing
 
Spark on Mesos-A Deep Dive-(Dean Wampler and Tim Chen, Typesafe and Mesosphere)
Spark on Mesos-A Deep Dive-(Dean Wampler and Tim Chen, Typesafe and Mesosphere)Spark on Mesos-A Deep Dive-(Dean Wampler and Tim Chen, Typesafe and Mesosphere)
Spark on Mesos-A Deep Dive-(Dean Wampler and Tim Chen, Typesafe and Mesosphere)
 
Real-time streaming and data pipelines with Apache Kafka
Real-time streaming and data pipelines with Apache KafkaReal-time streaming and data pipelines with Apache Kafka
Real-time streaming and data pipelines with Apache Kafka
 
To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...
To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...
To scale or not to scale: Key/Value, Document, SQL, JPA – What’s right for my...
 
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflowsBeyond unit tests: Deployment and testing for Hadoop/Spark workflows
Beyond unit tests: Deployment and testing for Hadoop/Spark workflows
 
Leverage Mesos for running Spark Streaming production jobs by Iulian Dragos a...
Leverage Mesos for running Spark Streaming production jobs by Iulian Dragos a...Leverage Mesos for running Spark Streaming production jobs by Iulian Dragos a...
Leverage Mesos for running Spark Streaming production jobs by Iulian Dragos a...
 
Real-Time Streaming with Apache Spark Streaming and Apache Storm
Real-Time Streaming with Apache Spark Streaming and Apache StormReal-Time Streaming with Apache Spark Streaming and Apache Storm
Real-Time Streaming with Apache Spark Streaming and Apache Storm
 
Leveraging the Power of Solr with Spark: Presented by Johannes Weigend, QAware
Leveraging the Power of Solr with Spark: Presented by Johannes Weigend, QAwareLeveraging the Power of Solr with Spark: Presented by Johannes Weigend, QAware
Leveraging the Power of Solr with Spark: Presented by Johannes Weigend, QAware
 
CaffeOnSpark Update: Recent Enhancements and Use Cases
CaffeOnSpark Update: Recent Enhancements and Use CasesCaffeOnSpark Update: Recent Enhancements and Use Cases
CaffeOnSpark Update: Recent Enhancements and Use Cases
 
How to Make Norikra Perfect
How to Make Norikra PerfectHow to Make Norikra Perfect
How to Make Norikra Perfect
 
Distributed Applications with Apache Zookeeper
Distributed Applications with Apache ZookeeperDistributed Applications with Apache Zookeeper
Distributed Applications with Apache Zookeeper
 
Why your Spark job is failing
Why your Spark job is failingWhy your Spark job is failing
Why your Spark job is failing
 

Similaire à Speedment - Reactive programming for Java8

OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
Enkitec
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
MongoDB APAC
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
Enkitec
 

Similaire à Speedment - Reactive programming for Java8 (20)

Java days gbg online
Java days gbg onlineJava days gbg online
Java days gbg online
 
SAP Open Source meetup/Speedment - Palo Alto 2015
SAP Open Source meetup/Speedment - Palo Alto 2015SAP Open Source meetup/Speedment - Palo Alto 2015
SAP Open Source meetup/Speedment - Palo Alto 2015
 
Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)Exploring Java Heap Dumps (Oracle Code One 2018)
Exploring Java Heap Dumps (Oracle Code One 2018)
 
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data PlatformsCassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
Cassandra Summit 2014: Apache Spark - The SDK for All Big Data Platforms
 
Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014
Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014
Johnny Miller – Cassandra + Spark = Awesome- NoSQL matters Barcelona 2014
 
Introduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processingIntroduction to Apache Flink - Fast and reliable big data processing
Introduction to Apache Flink - Fast and reliable big data processing
 
Osd ctw spark
Osd ctw sparkOsd ctw spark
Osd ctw spark
 
OGG Architecture Performance
OGG Architecture PerformanceOGG Architecture Performance
OGG Architecture Performance
 
20170126 big data processing
20170126 big data processing20170126 big data processing
20170126 big data processing
 
Edward King SPEDDEXES 2014
Edward King SPEDDEXES 2014Edward King SPEDDEXES 2014
Edward King SPEDDEXES 2014
 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
 
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
Cloudera Impala - Las Vegas Big Data Meetup Nov 5th 2014
 
VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right VMworld 2013: Virtualizing Databases: Doing IT Right
VMworld 2013: Virtualizing Databases: Doing IT Right
 
0bbleedingedge long-140614012258-phpapp02 lynn-langit
0bbleedingedge long-140614012258-phpapp02 lynn-langit0bbleedingedge long-140614012258-phpapp02 lynn-langit
0bbleedingedge long-140614012258-phpapp02 lynn-langit
 
Bleeding Edge Databases
Bleeding Edge DatabasesBleeding Edge Databases
Bleeding Edge Databases
 
JS Essence
JS EssenceJS Essence
JS Essence
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Oracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture PerformanceOracle GoldenGate Architecture Performance
Oracle GoldenGate Architecture Performance
 
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
Oracle GoldenGate Presentation from OTN Virtual Technology Summit - 7/9/14 (PDF)
 
Big data week presentation
Big data week presentationBig data week presentation
Big data week presentation
 

Plus de Speedment, Inc.

Plus de Speedment, Inc. (10)

How to generate customized java 8 code from your database
How to generate customized java 8 code from your databaseHow to generate customized java 8 code from your database
How to generate customized java 8 code from your database
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
SenchaCon Roadshow Irvine 2017
SenchaCon Roadshow Irvine 2017SenchaCon Roadshow Irvine 2017
SenchaCon Roadshow Irvine 2017
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
 
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
JavaOne2016 - Microservices: Terabytes in Microseconds [CON4516]
 
Speed-up Your Big Data Applications with Sencha and Speedment
Speed-up Your Big Data Applications with Sencha and SpeedmentSpeed-up Your Big Data Applications with Sencha and Speedment
Speed-up Your Big Data Applications with Sencha and Speedment
 
Speedment & Sencha at Oracle Open World 2015
Speedment & Sencha at Oracle Open World 2015Speedment & Sencha at Oracle Open World 2015
Speedment & Sencha at Oracle Open World 2015
 
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
Java one2015 - Work With Hundreds of Hot Terabytes in JVMsJava one2015 - Work With Hundreds of Hot Terabytes in JVMs
Java one2015 - Work With Hundreds of Hot Terabytes in JVMs
 
eXtreme Tuesday Club at Pivotal Labs ft. Speemdnet / San Francisco - SEP 2015
eXtreme Tuesday Club at Pivotal Labs ft. Speemdnet / San Francisco - SEP 2015eXtreme Tuesday Club at Pivotal Labs ft. Speemdnet / San Francisco - SEP 2015
eXtreme Tuesday Club at Pivotal Labs ft. Speemdnet / San Francisco - SEP 2015
 

Dernier

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
shinachiaurasa2
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Dernier (20)

Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Speedment - Reactive programming for Java8

  • 1. ACCELERATED ORM FOR JAVA 8 AN OPEN SOURCE SOLUTION Per-Åke Minborg
  • 2. BIO PER-ÅKE MINBORG • Chalmers, Master of Science • Java >15 years • Speaker at Meetups and Javaforums around the globe • Java 8 and OpenSource blogger • Recently with project Speedment • Code_n Big Data award 2014 • 33-list winner 2015 (NyTeknik and Affärsvärlden)
  • 3. PROBLEM • Long response times is the most common IT problem at work • The amount of data is increasing every day
  • 4. SOLUTIONS New Ground Application developer HW supplier DBA Architect Carpenter Painter Ground Buy faster better more HW -expensive Optimize database –minor effect Extreme performance –migration project speedment.org
  • 5. SPEEDMENTS CURRENT IMPLEMENTATIONS • Trouble Ticket Solution • Web Application • Train Infotainment Plattform • Energy Measurment Tracking • Database Consolidation Layer
  • 6. THE JAVA DEVELOPER BEHIND THE STEERING WHEEL! A Database application development tool in Java – a modern ORM (Object Relational Mapping) • The hot new solution • Fast to develop applications • Extreme database speed • Reactive Programming
  • 7. DO YOU RECOGNIZE THE FOLLOWING? When coding it is complex to connect to a database….. …then you use an ORM Source: ZeroTurnaround 2014
  • 8. SOME PROS OF USING AN ORM: • You can work with a relational database as if it were object oriented. • Increased productivity. • Provides a certain degree of abstraction (you can replace your DBMS).
  • 9. SOME CONS OF USING AN ORM: • Slows down the application • You can not access all Java 8 features • You must still write SQL, HQL, et. al
  • 10. IT STARTED WITH A PROBLEM
  • 11. TECHNOLOGY EVOLUTION • Memory size exponentially doubles each 18:th month • The number of CPU-cores [N] is increasing moderately • Performance per CPU-core [P(N)] is increasing moderately • P = N*P(N) is increasing exponentially • No one will use magnetic disks for performance applications • "Cloud" deployment is popular
  • 13. WHAT IS DIFFERENT WITH THE SOLUTION? • Everything(*) is always in-memory(**) (in the JVM) • We never have to check if an object is in cache • We can organize objects knowing that we have them all • We do not even have to look at individual objects -> O(1) • Everything is Java 8. No legacy! Size Time O(1) O(n)
  • 14. WORK FLOW 1. Database 2. Speedment GUI 3. IDE
  • 15. SUPPORT FOR DATA FROM • RDBMS • NoSQL Databases • Other "Data Sources" like files
  • 16. SCALE UP IN LOCAL MEMORY • JVM can exceed physical RAM • Compression • Deduplication • Layered storage engines (On-Heap, Off-Heap, SSD, Disk, SQL) • Lazy load ~24 GB >1 TB >4 TB ∞ On-Heap Off- Heap SSD SQL 100 MTPS 20 MTPS 1 MTPS 0,001 MTPS Database Size: (After Compression) Transaction Speed:
  • 17. SCALE OUT WITH HAZELCAST • Set up a cluster in the Cloud • Scale out your existing database • Set up Terabytes of RAM
  • 18. PROPERTIES: • The API will remain the same regardless of selected Storage Engine • Massively concurrent and lock free • Scale with CPU performance and number of cores • Eventually consistent • Transaction safe, if you want
  • 19. PROPERTIES: • The database ”owns” the data • Data is reflected into Materialized Object Views (MOVs) • MOVs and application resides in the same JVM • Most operations are O(1) • persons.byName(“Bob") -> Map<PK,Person> with 1000 persons in 100 ns (30 m) • TCP/IP RTT 100 us -> +1000 "finds" per TCP RT. • In-memory DBs with zero query latency are snails by definition
  • 20. SPEED IN TWO DIMENSIONS 1) Speed development 2) Speed Execution
  • 21. EXECUTION SPEED Server ApplicationDatabase 1 Query: 1 s Server Application Database in-memory 2 Query: 0 s JVM Server ApplicationDatabase 3 Data copy 3 days 0 s
  • 22. SPEEDMENT ORM API • Embrace Java 8 paradigm with stream(), filter(), sort(), limit() etc. • Forget about SQL, JQL et. al
  • 23. SPEEDMENT ORM API, GENERATED CODE • Everything is interfaces! • Completely pluggable architecture • Default classes that implements the interfaces are generated • Write (possibly several) custom entity implementations • Override or create your own Managers • Expand the existing code generation with your own custom code (pluggable) •”Write code that writes code”
  • 24. SPEEDMENT ORM API • MOVs are Map<PK, Entity> and are immutable (in user-land) • Entities are immutables • You can then get mutable Beans/Builders (They are Interfaces too) •API remains the same regardless of Storage Engine •Dynamic joins -> Maps with Maps with Maps with... (TBI)
  • 27. PERSISTENCE Hare harry = HareManager.get().builder() .setName("Harry") .setColor("Gray") .setAge(3); HareManager.get().persist(harry);
  • 28. QUERYING List<Hare> oldHares = HareManager.get() .stream() .filter(h -> h.getAge() > 8) .collect(toList());
  • 29. OPTIMISED KEY-VALUE LOOK-UP Optional<Hare> harry = HareManager.get() .stream() .filter(h -> "Harry".equals(h.getName())) .findAny();
  • 30. ENTITIES ARE LINKED Optional<Carrot> carrot = HareManager.get() .stream() .filter(h -> "Harry".equals(h.getName())) // Carrot is a foreign key. .flatmap(h -> h.findCarrots()) .findAny();
  • 31. MULTI-THREADING HareManager.get().parallelStream() .filter(h -> HumanManager.get().stream() .filter(n -> h.getName().equals(n.getName())) .anyMatch() ).forEach(System.out::println);
  • 33. CONFIGURATION • Groovy script like Gradle • Config file is placed at the same location as the POM dbms { schema { table { name = ”hare"; column { name = "name"; } } } }
  • 34. API ("ENTITY" INTERFACES) public interface Hare { String getName(); interface Bean extends Hare { void setName(String name); } }
  • 35. API ("ENTITY" INTERFACES) • A Hare implementing class needs only to implement one method. • Implementation is completely hidden • An entity does not need to inherit from a class "Entity" or similar
  • 36. API (DEFAULT "ENTITY" IMPLEMENTATION) public class HareImpl implements Hare { private final name; public HareImpl(Hare template) { name = template.getName(); } public String getName() { return name; } }
  • 37. API (CUSTOM "ENTITY" IMPLEMENTATION) public class HarryHareImpl implements Hare{ public HarryHareImpl(Hare template) { } public String getName() { return “Harry”; } }
  • 38. API (MANAGER INTERFACE) public interface HareManager extends Manager<Hare> { Hare.Bean toBean(Hare template); Stream<Hare> stream(); Stream<Hare> byName(String name);
  • 39. API (MANAGER INTERFACE) void persist(Hare hare); void remove(Hare hare); // More... }
  • 40. EASE OF USE: • Single Maven dependency in POM • Maven targets • Works with Gradle • GUI to automatically derive the groovy config file from existing databases
  • 41. OPEN SOURCE LICENSE • Apache 2.0 License • www.speedment.org
  • 42. CONCLUSIONS • Code generation, No boiler plate code • Expand the code generation • Focus on the problem at hand! • Forget about the database • Use Java 8 • Install your own implementations, if you like • Insane application speed!
  • 43. ARE YOU: • Tired of legacy ORMs? • In love with Java 8? • A First mover that likes new exotic Exceptions? • Cheer leader? • A person that wish that null pointers were Optional ? JOIN THE HARE!
  • 44. WE ARE WHERE YOU ARE! • www.speedment.org • GitHub: https://github.com/speedment/speedment-orm • Twitter: @Pminborg • Mail: minborg@speedment.org • Blog: minborgsjavapot.blogspot.com • Innovation House Palo Alto • Järntorget, Gothenburg