SlideShare a Scribd company logo
NoSQL Endgame
Otávio Santana
Platform.sh
Thodoris Bais
ABN Amro & Utrecht JUG
Werner Keil
CATMedia
Werner Keil Thodoris Bais
Jakarta EE Specification Committee Member Expert Group Member JSR-385
Let’s meet
@thodorisbais@wernerkeil
Otavio Santana
Developer Relations Engineer, Platform.sh
Let’s meet
@otaviojava
@thodorisbais@wernerkeil
ABN Amro Bank
Financial sector
Amsterdam
Agile organization
20,000
3000+
400+
Total number of employeesEnterprise bank
Headquarters Development Teams
DevOps / Hybrid cloud Applications
@otaviojava
5
5 trends in 2020
New digital trends create new technical
challenges
@thodorisbais@wernerkeil @otaviojava
• Develop with agility
• Operate at any scale
• Deliver the performance and
availability required to meet the
demands of Digital Economy
businesses
What are the technical challenges?
8
• Handle large volumes of data at high-speed with a scale-out architecture
• Store unstructured, semi-structured, or structured data
• Enable easy updates to schemas and fields
• Developer-friendly
• Take full advantage of the cloud to deliver zero downtime
Advantages of NoSQL
Why this talk
Tons of persistence frameworks
Which one performs best for your case?
JVM can cope with heavy loads
Would normally take ages to
compare
NoSQL
01 Database
02 Doesn't use structure
03 Not Transaction
04 Base
Four different types05
Key-Value stores
AmazonS3
Apollo
Ares
Aphrodite
Sun
War
Love Beauty
AmazonDynamo
Hazelcast
Redis
Column-Oriented
Apollo
Aphrodite
Ares
Kratos
Duty
Duty
Duty
Dead Gods
Love, happy
Sun
War
13
Color
weapon
Sword
Row-key ColumnsHBase
Scylla
SimpleDB
Cassandra
DynamoDB
Clouddata
Document stores
{
"name":"Diana",
"duty":[
"Hunt",
"Moon",
"Nature"
],
"siblings":{
"Apollo":"brother"
}
}
ApacheCouchDB
MongoDB
Couchbase
Graph databases
Apollo Ares
Kratos
was killed by was killed by
killed killed
Neo4j
InfoGrid
Sones
HyperGraphDB
Multi-Model
01
02
03
04
OrientDB (graph, document)
Couchbase (key value, document)
Elasticsearch (document, graph)
ArangoDB (document, graph, key-value)
SQL vs NoSQL
SQL KEY-VALUE COLUMN DOCUMENTS GRAPH
Table Bucket Column family Collection
Row Key/value pair Column Documents Vertex
Column Key/value pair Key/value pair Vertex and
Edge property
Relationship Link Edge
BASE vs ACID
• Basically Available
• Soft state
• Eventual consistency
• Atomicity
• Consistency
• Isolation
• Durability
CAP
Scalability vs Complexity
Scalability
Complexity
key-value
Column
Document
Graph
Relational Application NoSQL Application
Logic Tier Logic Tier
DAO DAO
JPAJPAJPAJPA
JDBC JDBCJDBCJDBC
Data Tier
APIAPI API
Data Tier
Our comparison model
JPA problem for NoSQL
01
02
03
04
05
06
Saves Async
Async Callback
Time to Live (TTL)
Consistency Level
SQL based
Diversity in NoSQL
Annotated Entities
01
02
03
Mapped Superclass
Entity
Column
@Entity("god")
public class God {
@Column
private String name;
@Column
private long age;
@Column
private Set<String> powers;
}
Template
God artemis = ...;
DocumentTemplate template = …
template.insert(artemis);
template.update(artemis);
DocumentQuery query = ...
List<God> gods = template.select(query);
Repository
interface GodRepository extends MongoRepository<God, String> {
List<God> findByNameAndAge (String name, Integer age);
}
Repository
@Inject
@Database(DatabaseType.COLUMN)
private GodRepository godRepository;
@Inject
@Database(DatabaseType.KEY_VALUE)
private GodRepository godRepository;
Repository with Queries
interface PersonRepository extends Repository<Person, Long> {
@Query("select * from Person")
Optional<Person> findByQuery();
@Query("select * from Person where id = @id")
Optional<Person> findByQuery(@Param("id") String id);
}
Diversity
@Entity("god")
public class God {
@Column
private String name;
@UDT("weapon")
@Column
private Weapon weapon;
}
interface GodRepository extends
CassandraRepository<God, String> {
@CQL("select * from God where name = ?")
List<God> findByName(String name);
}
List<Movie> movies = documentTemplate.query("select * from Movie
where year > 2012");
List<Person> people = columnTemplate.query("select * from Person
where age = 25");
Optional<God> god = keyValueTemplate.query("get 'Ullr'");
List<City> cities = graphTemplate.query("g.V().hasLabel('City')");
Query by Text
Micronaut Data
NoSQL?
Repository
public class AnimalRepository {
List<Animal> findByType(String type) {…}
public Animal insert(Animal animal) {…}
}
Entity
public class City {
private String name;
public City(String name) {
this.name = name;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
}
Query by Text
public void save(City city) {
try (Session s = driver.session()) {
String statement = "MERGE (c:City {id:$name.id}) ON CREATE SET c+=$name";
s.writeTransaction(tx -> tx.run(statement, singletonMap("name" ,city.asMap())));
}
}
public Stream<City> findByName(String name) {
try (Session s = driver.session()) {
String statement = "MATCH (c:City) WHERE c.name contains $name RETURN c";
return s.readTransaction(tx -> tx.run(statement, singletonMap("name", name)))
.list(record -> new City(record.get("c").asMap())).stream();
}
}
GORM
NoSQL?
Entity
@Entity
class User {
ObjectId id
String emailAddress
String password
String fullname
Date dateCreated
Date lastUpdated
static constraints = {
emailAddress email: true
password nullable: true
fullname blank: false
}
}}
@Document(collection = "gods")
public class God { … }
interface GodRepository extends
MongoRepository<God, String> { … }
What about the Controller?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
spring.data.mongodb.database=mythology
spring.data.mongodb.port=27017
Logistics Domain
Our example
MovieEntity
MovieRepository
PersonEntity
Roles
…
Other reactive dependencies
…
<dependency>
<groupId>org.neo4j.springframework.data</groupId>
<artifactId>spring-data-neo4j-rx-spring-boot-starter</artifactId>
<version>1.1.1</version>
</dependency>
org.neo4j.driver.uri=bolt://localhost:7687
org.neo4j.driver.authentication.username=neo4j
org.neo4j.driver.authentication.password=secret
Logistics Domain
Repository
public interface MovieRepository extends
ReactiveNeo4jRepository<MovieEntity, String> {
Mono<MovieEntity> findOneByTitle(String title);
}
Entities
@Node("Person")
public class PersonEntity {
@Id
private final String name;
private final Integer born;
}
@Node("Movie")
public class MovieEntity {
@Id
private final String title;
@Property("tagline")
private final String description;
@Relationship(type = "ACTED_IN", direction = INCOMING)
private Map<PersonEntity, Roles> actorsAndRoles =
new HashMap<>();
@Relationship(type = "DIRECTED", direction = INCOMING)
private List<PersonEntity> directors = new ArrayList<>();
}
Relationships
@RelationshipProperties
public class Roles {
private final List<String> roles;
public Roles(List<String> roles) {
this.roles = roles;
}
}
What happened to
?
Entity
@Entity
public class Editor {
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
private String editorId;
private String editorName;
@OneToMany(mappedBy = "editor", cascade = CascadeType.PERSIST)
private Set<Author> assignedAuthors = new HashSet<>();
// constructors, getters and setters...
}
Operations
private void persistTestData(EntityManagerFactory entityManagerFactory, Editor editor)
throws Exception {
TransactionManager transactionManager =
com.arjuna.ats.jta.TransactionManager.transactionManager();
transactionManager.begin();
EntityManager entityManager = entityManagerFactory.createEntityManager();
entityManager.persist(editor);
entityManager.close();
transactionManager.commit();
}
Warning
“In most cases, multi-document transaction incurs a greater
performance cost over single document writes, and the availability of
multi-document transactions should not be a replacement for
effective schema design. For many scenarios, the denormalized data
model (embedded documents and arrays) will continue to be optimal
for your data and use cases. That is, for many scenarios, modeling
your data appropriately will minimize the need for multi-document
transactions.”
Documentation
Entity
@Entity(name = "book")
@Indexed
@Analyzer(impl = StandardAnalyzer.class)
public class Book {
@Id
@DocumentId
private Long isbn;
@Column
@Field(analyze = Analyze.NO)
private String name;
@Column
@Field
private String author;
@Column
@Field
private String category;
}
Operations
EntityManagerFactory managerFactory =
Persistence.createEntityManagerFactory("hibernate");
EntityManager manager = managerFactory.createEntityManager();
manager.getTransaction().begin();
Book cleanCode = getBook(1L, "Clean Code", "Robert Cecil Martin");
manager.merge(cleanCode);
manager.getTransaction().commit();
Book book = manager.find(Book.class, 1L);
Warning
“Cassandra does not use RDBMS ACID transactions with
rollback or locking mechanisms...
As a non-relational database, Cassandra does not support joins
or foreign keys, and consequently does not offer consistency in
the ACID sense.”
DataStax Documentation
Conclusions
@thodorisbais@wernerkeil @otaviojava
Conclusions
Still in Progress ❌
Supports a huge number of NoSQL
database systems
✅
Loosely coupled code makes switching between
different NoSQL vendors just a matter of configuration
✅
Removes boiler-plate code and
provides a cleaner, more readable DAO
✅
Conclusions
Switching between different NoSQL
vendors not so easy
❌
Micronaut Data does not support NoSQL
databases yet
❌
Still in Progress ❌
Often faster with a lower footprint and polyglot
language support for Java, Kotlin and Groovy
✅
Conclusions
Provides a cleaner and more readable DAO
implementation
✅
Works with Grails, Micronaut or Spring Boot, polyglot
language support for Java and Groovy
✅
Removes a lot of boiler-plate code ✅
Only 3 to 4 of the most popular NoSQL databases are supported
out of the box, others require more effort or won’t work yet ❌
Conclusions
Provides a cleaner and more readable DAO
implementation
✅
Loosely coupled code makes switching between
different NoSQL vendors just a matter of configuration
✅
Removes a lot of boiler-plate code ✅
Only half a dozen popular NoSQL databases are supported out of
the box, others require more effort or won’t work yet ❌
Conclusions
Using a mapper for all scenarios is not a
recommended approach
❌
Some JPA concepts are not easily mapped to
the NoSQL world (e.g. transactions)
❌
No error-safe way to run the query language and hydrate DTOs
from the result ❌
Outdated, no release since 2018 ❌
▪ GitHub repositories
▪ https://github.com/JNOSQL/nosql-endgame
▪ Project page
▪ http://jnosql.org
@thodorisbais@wernerkeil
Links
5
6
• Flaticon.com
• Michael Simons
• Jean Tessier
Credits
@thodorisbais@wernerkeil
Thank You !
@thodorisbais@wernerkeil @otaviojava

More Related Content

PPTX
EclipseCon 2021 NoSQL Endgame
PPTX
NoSQL Endgame JCON Conference 2020
PPTX
NoSQL Endgame LWJUG 2021
PPTX
OrientDB vs Neo4j - and an introduction to NoSQL databases
PPTX
Moving from SQL Server to MongoDB
PPTX
NoSQL Endgame Percona Live Online 2020
PPTX
Benefits of Using MongoDB Over RDBMS (At An Evening with MongoDB Minneapolis ...
PPS
MongoDB crud
EclipseCon 2021 NoSQL Endgame
NoSQL Endgame JCON Conference 2020
NoSQL Endgame LWJUG 2021
OrientDB vs Neo4j - and an introduction to NoSQL databases
Moving from SQL Server to MongoDB
NoSQL Endgame Percona Live Online 2020
Benefits of Using MongoDB Over RDBMS (At An Evening with MongoDB Minneapolis ...
MongoDB crud

What's hot (20)

PDF
MongoDB .local Chicago 2019: Practical Data Modeling for MongoDB: Tutorial
PDF
FITC presents: Mobile & offline data synchronization in Angular JS
PDF
Electron, databases, and RxDB
PDF
Scalability and Real-time Queries with Elasticsearch
PDF
Combine Spring Data Neo4j and Spring Boot to quickl
PDF
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
PDF
Migrating from RDBMS to MongoDB
PPTX
Couchbase Data Platform | Big Data Demystified
PDF
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
PPTX
Updates from Cassandra Summit 2016 & SASI Indexes
PPTX
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
PPT
Why is data independence (still) so important? Optiq and Apache Drill.
PPTX
Transitioning from SQL to MongoDB
PPTX
Mongodb - NoSql Database
PPT
Distributed Interactive Computing Environment (DICE)
PDF
OrientDB introduction - NoSQL
PDF
SDEC2011 NoSQL Data modelling
PPTX
Joins and Other MongoDB 3.2 Aggregation Enhancements
PPTX
Data Management 3: Bulletproof Data Management
ODP
Mongo indexes
MongoDB .local Chicago 2019: Practical Data Modeling for MongoDB: Tutorial
FITC presents: Mobile & offline data synchronization in Angular JS
Electron, databases, and RxDB
Scalability and Real-time Queries with Elasticsearch
Combine Spring Data Neo4j and Spring Boot to quickl
MongoDB .local San Francisco 2020: From SQL to NoSQL -- Changing Your Mindset
Migrating from RDBMS to MongoDB
Couchbase Data Platform | Big Data Demystified
MongoDB .local Toronto 2019: MongoDB Atlas Search Deep Dive
Updates from Cassandra Summit 2016 & SASI Indexes
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Why is data independence (still) so important? Optiq and Apache Drill.
Transitioning from SQL to MongoDB
Mongodb - NoSql Database
Distributed Interactive Computing Environment (DICE)
OrientDB introduction - NoSQL
SDEC2011 NoSQL Data modelling
Joins and Other MongoDB 3.2 Aggregation Enhancements
Data Management 3: Bulletproof Data Management
Mongo indexes
Ad

Similar to NoSQL Endgame DevoxxUA Conference 2020 (20)

PPTX
NoSQL Endgame - Java2Days 2020 Virtual
PPTX
JakartaData-JCon.pptx
PDF
Grails and Neo4j
PDF
GR8Conf 2011: Neo4j Plugin
PDF
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
PDF
Leveraging your Knowledge of ORM Towards Performance-based NoSQL Technology
PPTX
ГАННА КАПЛУН «noSQL vs SQL: порівняння використання реляційних та нереляційни...
PDF
NoSQL Databases
PPTX
Database for cloud
PPTX
Big data technology unit 3
PPTX
NoSql evaluation
PDF
Considerations for using NoSQL technology on your next IT project - Akmal Cha...
PPTX
Yes, Sql!
PPTX
Navigating NoSQL in cloudy skies
PPTX
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
PDF
Beyond Relational Databases
PDF
NoSQL, no Limits, lots of Fun!
PPTX
Relational databases vs Non-relational databases
PDF
SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
DOCX
Know what is NOSQL
NoSQL Endgame - Java2Days 2020 Virtual
JakartaData-JCon.pptx
Grails and Neo4j
GR8Conf 2011: Neo4j Plugin
JPoint'15 Mom, I so wish Hibernate for my NoSQL database...
Leveraging your Knowledge of ORM Towards Performance-based NoSQL Technology
ГАННА КАПЛУН «noSQL vs SQL: порівняння використання реляційних та нереляційни...
NoSQL Databases
Database for cloud
Big data technology unit 3
NoSql evaluation
Considerations for using NoSQL technology on your next IT project - Akmal Cha...
Yes, Sql!
Navigating NoSQL in cloudy skies
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
Beyond Relational Databases
NoSQL, no Limits, lots of Fun!
Relational databases vs Non-relational databases
SQL? NoSQL? NewSQL?!? What’s a Java developer to do? - JDC2012 Cairo, Egypt
Know what is NOSQL
Ad

More from Thodoris Bais (20)

PDF
You Graduated Now What ECE UoWM 2021
PDF
Be the Leader of Your Own Career Global Summit for Java Devs 21
PDF
How to grow an amazing community - JavaLand 2021
PPTX
Securing eHealth, eGovernment and eBanking with Java - IT-Tage 2020 Conference
PPTX
Securing eHealth, eGovernment and eBanking with Java - JCON Conference
PDF
Be the Leader of Your Own Career JCON Conference 2020
PPTX
Utrecht JUG meetup September 2020
PPTX
How JSR 385 could have Saved the Mars Climate Orbiter Java Global Summit 2020
PDF
Developer Career: Own it - SouJava April 2020
PPTX
Securing eHealth and eGovernment with Java - AllTheTalksOnline 2020
PDF
How to pitch an innovative idea in a corporate environment
PPTX
Utrecht JUG meetup February 2020
PDF
Developer Career: Own it - Adorsys 2020
PDF
How JSR 385 could have Saved the Mars Climate Orbiter Adorsys 2020
PPTX
Utrecht JUG Meetup January 2020
PDF
Developer Career: Own it - Java2Days 2019
PPTX
Securing eHealth and eGovernment with Java - Java2Days 2019
PPTX
Utrecht JUG meetup December 2019 Speaker Incubator
PDF
How JSR 385 could have Saved the Mars Climate Orbiter DevoxxUA 2019
PDF
How JSR 385 could have Saved the Mars Climate Orbiter JFall 2019
You Graduated Now What ECE UoWM 2021
Be the Leader of Your Own Career Global Summit for Java Devs 21
How to grow an amazing community - JavaLand 2021
Securing eHealth, eGovernment and eBanking with Java - IT-Tage 2020 Conference
Securing eHealth, eGovernment and eBanking with Java - JCON Conference
Be the Leader of Your Own Career JCON Conference 2020
Utrecht JUG meetup September 2020
How JSR 385 could have Saved the Mars Climate Orbiter Java Global Summit 2020
Developer Career: Own it - SouJava April 2020
Securing eHealth and eGovernment with Java - AllTheTalksOnline 2020
How to pitch an innovative idea in a corporate environment
Utrecht JUG meetup February 2020
Developer Career: Own it - Adorsys 2020
How JSR 385 could have Saved the Mars Climate Orbiter Adorsys 2020
Utrecht JUG Meetup January 2020
Developer Career: Own it - Java2Days 2019
Securing eHealth and eGovernment with Java - Java2Days 2019
Utrecht JUG meetup December 2019 Speaker Incubator
How JSR 385 could have Saved the Mars Climate Orbiter DevoxxUA 2019
How JSR 385 could have Saved the Mars Climate Orbiter JFall 2019

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Empathic Computing: Creating Shared Understanding
Building Integrated photovoltaic BIPV_UPV.pdf
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Review of recent advances in non-invasive hemoglobin estimation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Electronic commerce courselecture one. Pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
Unlocking AI with Model Context Protocol (MCP)
Empathic Computing: Creating Shared Understanding

NoSQL Endgame DevoxxUA Conference 2020