Crea il TUO database con LevelDB e Node.js

Matteo Collina
Matteo CollinaSoftware Architect at nearform
Problemi con il Database?

@matteocollina	


http://500px.com/photo/27874937
Chiami un consulente?

http://500px.com/photo/22823315
Costruisci il TUO
database con
Costruisci il TUO
database con

Level*
* Not a Database

Storia
Storia dei DB
•

1960s: Dai nastri ai dischi per raggiungere accesso condiviso e interattività	


•

Late 1960s: Navigational Databases, links	


•

Early 1970s: Modello relazionale, content	


•

Late 1970s: SQL	


•

Early 1980s: Un database sul mio Desktop	


•

Late 1980s: Object Oriented Database	


•

2000s: velocità e scalabilità, NoSQL	


•

Early 2010s: non perdiamo una bella astrazione, NewSQLs
La tirannia delle
belle astrazioni
Che cos’è un DB?
Uno strumento per interagire
con dati strutturati, all’esterno del
core della nostra Applicazione
Core DB features
•

Persistenza	


•

Prestazione	


•

Semplificazione dell’accesso ai dati
complessi
•

Small Core, vibrant community	


•

Extreme modularity	


•

Reimplement everything in Javascript
Il Node.js dei DB?
•

Small Core: LevelUp - http://npm.im/levelup	


•

TUTTO è un modulo, scaricabile da NPM	


•

Sperimentazione di molti aspetti sia della teorica che
della pratica dei database e dei sistemi distribuiti	


•

Soluzioni specifiche
Crea il TUO database con LevelDB e Node.js
http://500px.com/photo/50810860
LevelDB
•

Open-source, embedded key/value store di Google	


•

Chiavi ordinate	


•

Valori compressi da Snappy	


•

Operazioni basilari: Get(), Put(), Del()	


•

Batch() Atomica	


•

Iterazioni bi-direzionali
LevelDB
LevelUP
•

Ispirato da LevelDB	


•

Supportato da un a key/value store per dati arbitrari, ordinati per
chiave	


•

put(), get(), del()	


•

Scritture atomiche via batch()	


•

ReadStream: l’ingrediente segreto	


•

WriteStream: per comodità	


•

Encoding: UTF-8, HEX, Binary, JSON, Typewise, your encoding.
ReadStream
•

La primitiva essenziale per tutte le feature più
complesse, ad esempio LevelGraph la usa per realizzare i
JOIN.	


•

E’ la primitiva fondamentale per accedere ai dati ordinati. 	


•

E’ possibile limitare il range tramite start e end
ReadStream
db.createReadStream({ start: 'Bol', end: 'Bolxff' })
.on('data', function (entry) {
console.log(entry.key)
})
!

// → Bologna
// → Bolzano
Key Structure
•

L’ordinamento e il recupero delle chiavi richiede un key
design	


•

Le chiavi sono un descrittore gerarchico del contenuto:
'countries~Ireland'
'countries~Italy'
...
'towns~Italy~Bologna'
'towns~Italy~Bolzano'
...
'streets~Italy~Bologna~Via Indipendenza'
'streets~Italy~Bologna~Via Rizzoli'
http://npm.im/levelmeup
levelmeup @ nodeconf.eu
BDFL: @rvagg
Level* Committers
RocksDB
•

Rilasciato Open Source il 14 Novembre 2013.	


•

Il 14 Novembre 2013 è già disponibile il “driver” per
LevelUp, http://npm.im/rocksdb	


•

RocksDB è un fork di LevelDB per gestire terabyte di
dati
@matteocollina
LevelGraph
LevelGraph
db.join([{ subject: db.v(“a"), predicate: “friend",object: db.v(“x") }, {
subject: db.v(“x"), predicate: “friend", object: db.v(“y") }],
function(err, results) {
// this will print all the 'friend of a friend triples..'
});
- Francesco Fullone - Enrico Zimuel - Federico Galassi - Matteo Collina -

JavaScript
best practices

http://www.jsbestpractices.it/
@matteocollina	

@rvagg
1 of 30

Recommended

Tile server by
Tile serverTile server
Tile serverFederico Russo
460 views16 slides
MongoDB - Back to Basics 2017 - Introduzione a NoSQL by
MongoDB - Back to Basics 2017 - Introduzione a NoSQLMongoDB - Back to Basics 2017 - Introduzione a NoSQL
MongoDB - Back to Basics 2017 - Introduzione a NoSQLMassimo Brignoli
202 views27 slides
The usability of open data by
The usability of open dataThe usability of open data
The usability of open dataMatteo Collina
3.8K views24 slides
No. la sottile arte di trovare il tempo dove non esite. by
No. la sottile arte di trovare il tempo dove non esite.No. la sottile arte di trovare il tempo dove non esite.
No. la sottile arte di trovare il tempo dove non esite.Matteo Collina
10.3K views43 slides
Making things that works with us by
Making things that works with usMaking things that works with us
Making things that works with usMatteo Collina
22K views70 slides
Making things that works with us codemotion by
Making things that works with us   codemotionMaking things that works with us   codemotion
Making things that works with us codemotionMatteo Collina
3.8K views69 slides

More Related Content

Viewers also liked

Enter the app era with ruby on rails (rubyday) by
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)Matteo Collina
5K views61 slides
CI-18n by
CI-18nCI-18n
CI-18nMatteo Collina
3.7K views9 slides
Enter the app era with ruby on rails by
Enter the app era with ruby on railsEnter the app era with ruby on rails
Enter the app era with ruby on railsMatteo Collina
4.5K views60 slides
The internet of things - Rails Girls Galway by
The internet of things - Rails Girls GalwayThe internet of things - Rails Girls Galway
The internet of things - Rails Girls GalwayMatteo Collina
4K views24 slides
Making things that works with us - First Italian Internet of Things Day by
Making things that works with us - First Italian Internet of Things DayMaking things that works with us - First Italian Internet of Things Day
Making things that works with us - First Italian Internet of Things DayMatteo Collina
4.6K views53 slides
Designing and developing mobile web applications with Mockup, Sencha Touch an... by
Designing and developing mobile web applications with Mockup, Sencha Touch an...Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...Matteo Collina
6.9K views34 slides

Viewers also liked(14)

Enter the app era with ruby on rails (rubyday) by Matteo Collina
Enter the app era with ruby on rails (rubyday)Enter the app era with ruby on rails (rubyday)
Enter the app era with ruby on rails (rubyday)
Matteo Collina5K views
Enter the app era with ruby on rails by Matteo Collina
Enter the app era with ruby on railsEnter the app era with ruby on rails
Enter the app era with ruby on rails
Matteo Collina4.5K views
The internet of things - Rails Girls Galway by Matteo Collina
The internet of things - Rails Girls GalwayThe internet of things - Rails Girls Galway
The internet of things - Rails Girls Galway
Matteo Collina4K views
Making things that works with us - First Italian Internet of Things Day by Matteo Collina
Making things that works with us - First Italian Internet of Things DayMaking things that works with us - First Italian Internet of Things Day
Making things that works with us - First Italian Internet of Things Day
Matteo Collina4.6K views
Designing and developing mobile web applications with Mockup, Sencha Touch an... by Matteo Collina
Designing and developing mobile web applications with Mockup, Sencha Touch an...Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...
Matteo Collina6.9K views
Designing and developing mobile web applications with Mockup, Sencha Touch an... by Matteo Collina
Designing and developing mobile web applications with Mockup, Sencha Touch an...Designing and developing mobile web applications with Mockup, Sencha Touch an...
Designing and developing mobile web applications with Mockup, Sencha Touch an...
Matteo Collina4.2K views
Building a multi protocol broker for the internet of things using nodejs by Matteo Collina
Building a multi protocol broker for the internet of things using nodejsBuilding a multi protocol broker for the internet of things using nodejs
Building a multi protocol broker for the internet of things using nodejs
Matteo Collina11.4K views
No. la sottile arte di trovare il tempo dove non esite - codemotion 2015 by Matteo Collina
No. la sottile arte di trovare il tempo dove non esite - codemotion 2015No. la sottile arte di trovare il tempo dove non esite - codemotion 2015
No. la sottile arte di trovare il tempo dove non esite - codemotion 2015
Matteo Collina2.6K views
L'universo dietro alle App by Matteo Collina
L'universo dietro alle AppL'universo dietro alle App
L'universo dietro alle App
Matteo Collina3.7K views
Operational transformation by Matteo Collina
Operational transformationOperational transformation
Operational transformation
Matteo Collina7.7K views
Exposing M2M to the REST of us by Matteo Collina
Exposing M2M to the REST of usExposing M2M to the REST of us
Exposing M2M to the REST of us
Matteo Collina33.5K views
Making things that work with us - Distill by Matteo Collina
Making things that work with us - DistillMaking things that work with us - Distill
Making things that work with us - Distill
Matteo Collina22.7K views
Making your washing machine talk with a power plant by Matteo Collina
Making your washing machine talk with a power plantMaking your washing machine talk with a power plant
Making your washing machine talk with a power plant
Matteo Collina22.9K views

Similar to Crea il TUO database con LevelDB e Node.js

Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL by
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLBack to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLMongoDB
1.9K views27 slides
Back to Basics, webinar 1: Introduzione a NoSQL by
Back to Basics, webinar 1: Introduzione a NoSQLBack to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQLMongoDB
2.6K views38 slides
Azure Synapse: data lake & modern data warehouse dalla A alla Z by
Azure Synapse: data lake &  modern data warehouse dalla A alla ZAzure Synapse: data lake &  modern data warehouse dalla A alla Z
Azure Synapse: data lake & modern data warehouse dalla A alla ZRoberto Messora
75 views29 slides
iot Saturday 2019 - PoC iot in 1 ora by
iot Saturday 2019 - PoC iot in 1 oraiot Saturday 2019 - PoC iot in 1 ora
iot Saturday 2019 - PoC iot in 1 oraAlessio Biasiutti
33 views34 slides
PoC IoT in 1 ora by
PoC IoT in 1 oraPoC IoT in 1 ora
PoC IoT in 1 oraAlessio Biasiutti
70 views34 slides
SQL Saturday 2019 - Event Processing with Spark by
SQL Saturday 2019 - Event Processing with SparkSQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with SparkAlessio Biasiutti
48 views49 slides

Similar to Crea il TUO database con LevelDB e Node.js(20)

Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL by MongoDB
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQLBack to Basics webinar 1 IT 17 - Introduzione ai NoSQL
Back to Basics webinar 1 IT 17 - Introduzione ai NoSQL
MongoDB1.9K views
Back to Basics, webinar 1: Introduzione a NoSQL by MongoDB
Back to Basics, webinar 1: Introduzione a NoSQLBack to Basics, webinar 1: Introduzione a NoSQL
Back to Basics, webinar 1: Introduzione a NoSQL
MongoDB2.6K views
Azure Synapse: data lake & modern data warehouse dalla A alla Z by Roberto Messora
Azure Synapse: data lake &  modern data warehouse dalla A alla ZAzure Synapse: data lake &  modern data warehouse dalla A alla Z
Azure Synapse: data lake & modern data warehouse dalla A alla Z
Roberto Messora75 views
SQL Saturday 2019 - Event Processing with Spark by Alessio Biasiutti
SQL Saturday 2019 - Event Processing with SparkSQL Saturday 2019 - Event Processing with Spark
SQL Saturday 2019 - Event Processing with Spark
Creare un Information Radiator con Delphi by Marco Breveglieri
Creare un Information Radiator con DelphiCreare un Information Radiator con Delphi
Creare un Information Radiator con Delphi
Marco Breveglieri630 views
Koha 19 4_cavaggion by Hyperborea
Koha 19 4_cavaggionKoha 19 4_cavaggion
Koha 19 4_cavaggion
Hyperborea451 views
Couchbase Meetup - "Introduzione a NoSQL e Couchbase" by Franco Caporale
Couchbase Meetup - "Introduzione a NoSQL e Couchbase"Couchbase Meetup - "Introduzione a NoSQL e Couchbase"
Couchbase Meetup - "Introduzione a NoSQL e Couchbase"
Franco Caporale792 views
Infinispan codemotion - Codemotion Rome 2015 by Codemotion
Infinispan codemotion - Codemotion Rome 2015Infinispan codemotion - Codemotion Rome 2015
Infinispan codemotion - Codemotion Rome 2015
Codemotion1.2K views
JBoss Data Grid Tech Lab by Ugo Landini
JBoss Data Grid Tech LabJBoss Data Grid Tech Lab
JBoss Data Grid Tech Lab
Ugo Landini1.7K views
Curriculum di Marco Bruni by Marco Bruni
Curriculum di Marco BruniCurriculum di Marco Bruni
Curriculum di Marco Bruni
Marco Bruni1.2K views
Sencha touch: Sviluppare un'app - 4° parte by Giuseppe Toto
Sencha touch: Sviluppare un'app - 4° parteSencha touch: Sviluppare un'app - 4° parte
Sencha touch: Sviluppare un'app - 4° parte
Giuseppe Toto1.7K views
Realizzare Accessori iOS con Bluetooth Low Energy e Arduino by fibasile
Realizzare Accessori iOS con Bluetooth Low Energy e ArduinoRealizzare Accessori iOS con Bluetooth Low Energy e Arduino
Realizzare Accessori iOS con Bluetooth Low Energy e Arduino
fibasile7K views

Crea il TUO database con LevelDB e Node.js