SlideShare a Scribd company logo
1 of 102
Download to read offline
Maciek Próchniak
Algebraic topology
hocolim
Group cohomology
Monads
GWT
TouK
Camel
OSGi
CQRS
Scala
OrientDB
Poland, Egypt?
USA is scared :)
scalable database
OrientDB
scalable language
Scala
" ... a general purpose programming language
designed to express common programming patterns
in a concise, elegant, and type-safe way"
Scala about Scala
Potential client about Scala
"tiny market share and require a
very specific type of developers, which is more
likely to be found in an academic, rather than
business environment"
OrientDB about OrientDB
"... an Open Source NoSQL DBMS with both the
features of Document and Graph DBMSs.
"... written in Java and it's amazing fast: can store
up to 150,000 records per second on common
hardware"
Potential client about OrientDB
"OrientDB is another experimental product which
is closely tied to European academia,
much like Scala"
"Moreover, choosing a document-oriented
database for a typical business/commercial
application is simply
an architectural mistake."
Really?
Oracle
MySQL
PostgreSQL
Mongo
Couch
Riak
Neo4J
Oracle
MySQL
PostgreSQL
Mongo
Couch
Riak
Neo4J
?
Oracle
MySQL
PostgreSQL
Mongo
Couch
Riak
Neo4J
OrientDB
What's the real difference?
● Architecture
● Data model
● Data access
What's the real difference?
● Architecture
● Data model
● Data access
Consistency
Partition
tolerance
Availability
P - do you really need it?
NoSQL is about scalability?
● Replication
● Sharding
- TBD
Need more consistency?
● Transactions
● Optimistic locking
● MVCC
NoSQL written in Java
● No additional software
● We all know how to tune JVM
... Don't we?
Architecture
Architecture - in memory
Architecture - embedded
Architecture - remote server
HTTP
Binary
memory/local/remote
Impact: testability
Unit
Functional
Integration
H2/??
Mock
DevBase
Impact: testability
Unit
Functional
Integration
memory:/local:
mock/memory:
local:/remote:
What's the real difference?
● Architecture
● Data model
● Data access
Meet our domain
Customer
Address
Customer
Email
Address
Branch
Email
How would you model that?
Address
Email
Branch Customer
1..*1..*
1..*
Aggregate - consistency boundary
Aggregate: A collection of objects that are
bound together by a root entity, otherwise
known as an aggregate root.
Aggregate
The aggregate root guarantees the
consistency of changes being made within the
aggregate by forbidding external objects from
holding references to its members.
Data model
Customer
Address
Customer
Email
Modification
Customer
Address
Customer
Email
Customer in OrientDB
When document is not enough
Data model
Customer
Address
Customer
Email
Customer
Modification
Address
Customer
Email
Graph - direct links
Customer Customer
Customer Customer
Documents
connected into
Graph
Connections in OrientDB
New possibilities
Europe
Poland France Romania
Warsaw Lublin Cracow Łódź
New possibilities
2012
Jan Feb March
1 2 3 4
OrientDB data model can
reflect your domain model
better than document
or relational bases
What's the real difference?
● Architecture
● Data model
● Data access
Let's get our hands dirty
Scala
● implicit conversions, parameters
● typeclasses
● for-comprehension
● infix notation
● case classes
Connecting - classic template
Connecting - classic - PROS
● Everybody knows it
● Simple
● Can easily do DI
● AOP
Composability?
Side effects?
Making DB interaction explicit
● Type constructor
trait WithConnection[T]
Making DB interaction explicit
● Trivial interaction
def pt[T](a:T) : WithConnection[T]
Making DB interaction explicit
● Composing interactions
def fmap[T](a:WithConnection[T],
map:T=>WithConnection[H]) :
WithConnection[H]
Example
Example
for-comprehension
Composition
for-comprehension
Don't want to scary you...
... but I smell a monad here!
Scala - loading documents
Browsing documents - POJSON
Browsing documents - POJSON
Updating records
update customer set name = 'Maciej'
where name = 'Maciek'
update customer add friends = #8:2
update customer put contactDetail =
'email2', 'mp@touk.pl'
Updating records - lens like
Updating records - lens like
Developers
know
SQL
ExtendedSQL
select from customer
where name = 'maciek'
select labels[0] from customer
where name = 'maciek'
select address.street from customer
where contactDetails.email = 'mproch@g.pl'
ExtendedSQL
select from customers where trucks
contains (capacity = 2)
select from suppliers where
trucks[capacity = 5].size() > 3
OrientDB
NotSoNoSQL
Scala queries
Graph queries
Developers
know
SQL
Traverse command
traverse customer.friends from #8:0
while $depth < 3
select from (
traverse customer.friends from
#8:0 while $depth < 10 )
where label contains nice
Traverse performance
Local operation - no joins
Constant lookup time
Traverse with scala predicates
Traverse with scala predicates
What about higher level access?
● ORM anybody?
● No need for partial updates, dirty checking?
JSON under the hood
Pluggable serialization strategies:
● Jackson
● Lift-Json
● ...
Scala serializer
Typesafe queries?
Scala
Language
Intergration
Connectivity
Kit
Lifted embedding
Lifted embedding - meta
Lifted embedding - meta
Lifted embedding - meta
Lifted embedding - query
Lifted embedding - query
Can we do better?
Direct embedding - meta
Direct embedding - query
Direct embedding - query
Type safety?
Functional Programming patterns
help to create
flexible, robust data access code
Call for action!
● Try it!
● Use it
● Find bugs ;)
● Spread the word
https://github.com/nuvolabase/orientdb/
https://github.com/mproch/scala-orientdb
https://github.com/mproch/slick-orientdb
Take away:
● OrientDB data model can reflect your
domain model better than document or
relational bases
● Functional Programming patterns can help
create flexible, robust data access code
‫ﺷﻜﺮا‬
mpr@touk.pl
http://touk.pl
http://mproch.blogspot.
com
http://www.flickr.com/photos/prawnpie/133328694/

More Related Content

What's hot

GRDDL: The Why, What, How, and Where
GRDDL: The Why, What, How, and WhereGRDDL: The Why, What, How, and Where
GRDDL: The Why, What, How, and Where
Chimezie Ogbuji
 
Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...
Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...
Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...
MongoDB
 

What's hot (20)

Multi-model databases and node.js
Multi-model databases and node.jsMulti-model databases and node.js
Multi-model databases and node.js
 
Polyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model DatabasesPolyglot Persistence vs Multi-Model Databases
Polyglot Persistence vs Multi-Model Databases
 
GRDDL: The Why, What, How, and Where
GRDDL: The Why, What, How, and WhereGRDDL: The Why, What, How, and Where
GRDDL: The Why, What, How, and Where
 
MongoDB vs OrientDB
MongoDB vs OrientDBMongoDB vs OrientDB
MongoDB vs OrientDB
 
MongoDB World 2019: Raiders of the Anti-patterns: A Journey Towards Fixing Sc...
MongoDB World 2019: Raiders of the Anti-patterns: A Journey Towards Fixing Sc...MongoDB World 2019: Raiders of the Anti-patterns: A Journey Towards Fixing Sc...
MongoDB World 2019: Raiders of the Anti-patterns: A Journey Towards Fixing Sc...
 
Introduction To NHibernate
Introduction To NHibernateIntroduction To NHibernate
Introduction To NHibernate
 
NoSQL and MapReduce
NoSQL and MapReduceNoSQL and MapReduce
NoSQL and MapReduce
 
An Intro to NoSQL Databases
An Intro to NoSQL DatabasesAn Intro to NoSQL Databases
An Intro to NoSQL Databases
 
A3 from sql to orm
A3 from sql to ormA3 from sql to orm
A3 from sql to orm
 
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
MongoDB World 2019: MongoDB in Data Science: How to Build a Scalable Product ...
 
An E-commerce App in action built on top of a Multi-model Database
An E-commerce App in action built on top of a Multi-model DatabaseAn E-commerce App in action built on top of a Multi-model Database
An E-commerce App in action built on top of a Multi-model Database
 
A2 from soap to rest
A2 from soap to restA2 from soap to rest
A2 from soap to rest
 
Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...
Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...
Replacing Traditional Technologies with MongoDB: A Single Platform for All Fi...
 
MongoDB Atlas Workshop - Singapore
MongoDB Atlas Workshop - SingaporeMongoDB Atlas Workshop - Singapore
MongoDB Atlas Workshop - Singapore
 
Overhauling a database engine in 2 months
Overhauling a database engine in 2 monthsOverhauling a database engine in 2 months
Overhauling a database engine in 2 months
 
XRX Presentation to Minnesota OTUG
XRX Presentation to Minnesota OTUGXRX Presentation to Minnesota OTUG
XRX Presentation to Minnesota OTUG
 
Backbone using Extensible Database APIs over HTTP
Backbone using Extensible Database APIs over HTTPBackbone using Extensible Database APIs over HTTP
Backbone using Extensible Database APIs over HTTP
 
Mongo db 3.4 Overview
Mongo db 3.4 OverviewMongo db 3.4 Overview
Mongo db 3.4 Overview
 
MongoDB + Pylons FTW: Scalable Web apps with Python & NoSQL
MongoDB + Pylons FTW: Scalable Web apps with Python & NoSQLMongoDB + Pylons FTW: Scalable Web apps with Python & NoSQL
MongoDB + Pylons FTW: Scalable Web apps with Python & NoSQL
 
Towards Semantic Modeling of Network Physical Devices
Towards Semantic Modeling of Network Physical DevicesTowards Semantic Modeling of Network Physical Devices
Towards Semantic Modeling of Network Physical Devices
 

Viewers also liked

Open Source Solution
Open Source SolutionOpen Source Solution
Open Source Solution
ittishait
 

Viewers also liked (12)

TypeSafe NoSQL @ TopConf 2012
TypeSafe NoSQL @ TopConf 2012TypeSafe NoSQL @ TopConf 2012
TypeSafe NoSQL @ TopConf 2012
 
Type Driven Development @ BoosterConf 2013
Type Driven Development @ BoosterConf 2013Type Driven Development @ BoosterConf 2013
Type Driven Development @ BoosterConf 2013
 
Activiti - BPMN 2.0 nadchodzi
Activiti - BPMN 2.0 nadchodziActiviti - BPMN 2.0 nadchodzi
Activiti - BPMN 2.0 nadchodzi
 
Open Source Solution
Open Source SolutionOpen Source Solution
Open Source Solution
 
A Parts Of Speech
A Parts Of SpeechA Parts Of Speech
A Parts Of Speech
 
Engaging your most profitable customers - Mobile and Social Product Management
Engaging your most profitable customers - Mobile and Social Product Management Engaging your most profitable customers - Mobile and Social Product Management
Engaging your most profitable customers - Mobile and Social Product Management
 
Jenis Penilaian Bahasa
Jenis Penilaian BahasaJenis Penilaian Bahasa
Jenis Penilaian Bahasa
 
Jenis Penilaian Bahasa
Jenis Penilaian BahasaJenis Penilaian Bahasa
Jenis Penilaian Bahasa
 
CQRS, ES, Scala @ Confitura 2012
CQRS, ES, Scala @ Confitura 2012CQRS, ES, Scala @ Confitura 2012
CQRS, ES, Scala @ Confitura 2012
 
DSL - DYI
DSL - DYIDSL - DYI
DSL - DYI
 
Camel-Drools - Javarsovia 2010
Camel-Drools - Javarsovia 2010Camel-Drools - Javarsovia 2010
Camel-Drools - Javarsovia 2010
 
Type Driven Development @ Confitura 2014
Type Driven Development @ Confitura 2014Type Driven Development @ Confitura 2014
Type Driven Development @ Confitura 2014
 

Similar to Scalable database, Scalable language @ JDC 2013

A meta language for mdx queries in e log business
A meta language for mdx queries in e log businessA meta language for mdx queries in e log business
A meta language for mdx queries in e log business
Laura Po
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
ArangoDB Database
 

Similar to Scalable database, Scalable language @ JDC 2013 (20)

Confluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & LearnConfluent & MongoDB APAC Lunch & Learn
Confluent & MongoDB APAC Lunch & Learn
 
MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개MongoDB 4.0 새로운 기능 소개
MongoDB 4.0 새로운 기능 소개
 
Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDB
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
 
Webinar: Enterprise Data Management in the Era of MongoDB and Data Lakes
Webinar: Enterprise Data Management in the Era of MongoDB and Data LakesWebinar: Enterprise Data Management in the Era of MongoDB and Data Lakes
Webinar: Enterprise Data Management in the Era of MongoDB and Data Lakes
 
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and SparkVital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
 
MongoDB Schema Design: Practical Applications and Implications
MongoDB Schema Design: Practical Applications and ImplicationsMongoDB Schema Design: Practical Applications and Implications
MongoDB Schema Design: Practical Applications and Implications
 
A meta language for mdx queries in e log business
A meta language for mdx queries in e log businessA meta language for mdx queries in e log business
A meta language for mdx queries in e log business
 
Svccg nosql 2011_v4
Svccg nosql 2011_v4Svccg nosql 2011_v4
Svccg nosql 2011_v4
 
Embracing Database Diversity with Kafka and Debezium
Embracing Database Diversity with Kafka and DebeziumEmbracing Database Diversity with Kafka and Debezium
Embracing Database Diversity with Kafka and Debezium
 
Couch db
Couch dbCouch db
Couch db
 
Mongo db
Mongo dbMongo db
Mongo db
 
Fyp presentation 2 (SQL Converter)
Fyp presentation 2 (SQL Converter)Fyp presentation 2 (SQL Converter)
Fyp presentation 2 (SQL Converter)
 
CouchDB
CouchDBCouchDB
CouchDB
 
Couch db
Couch dbCouch db
Couch db
 
01 nosql and multi model database
01   nosql and multi model database01   nosql and multi model database
01 nosql and multi model database
 
Which Questions We Should Have
Which Questions We Should HaveWhich Questions We Should Have
Which Questions We Should Have
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
 
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and AtlasData Con LA 2022 - What's new with MongoDB 6.0 and Atlas
Data Con LA 2022 - What's new with MongoDB 6.0 and Atlas
 
Jump Start on Apache Spark 2.2 with Databricks
Jump Start on Apache Spark 2.2 with DatabricksJump Start on Apache Spark 2.2 with Databricks
Jump Start on Apache Spark 2.2 with Databricks
 

Recently uploaded

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
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
 
%+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 Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 

Recently uploaded (20)

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
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
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
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?
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
%+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...
 
%+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...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%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
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 

Scalable database, Scalable language @ JDC 2013