A presentation about the problems you'll face when dealing with the relational model and highly customizable general-purpose projects, with a look at the NoSQL word focusing on a real solution, a graph database.
34. Pages
main structure of a web site
organized as a tree
a way to express our contents
usually composed by a series of
containers ( that we'll refer to as
boxes )
48. The Page-Box Binding Storage
Data can change its structure fastly, according to the domain model.
We need a technology supporting this fast change.
Since we have N box type, to compose a page we should
look for a few tables.
We need a technology supporting this kind of lookups.
57. so we know we're gonna face
a few well-known problems...
58. Data Mapping
Data Structure RDBMS
id 10
name tom
parent_id 19
we have to find a way to re-organize the data-structre to insert our
tree inside a table.
But is really different! Tree find a node in O(nlogn)
66. Overnormalized
Users List
LEFT JOIN LEFT JOIN
LEFT JOIN
LEFT JOIN
LEFT JOIN
LEFT JOIN LEFT JOIN
67. Overnormalized
LEFT JOIN LEFT JOIN
LEFT JOIN
LEFT JOINList
Users LEFT JOIN
LEFT JOIN LEFT JOIN
LEFT JOIN
LEFT JOIN LEFT JOIN
LEFT JOIN
LEFT JOIN
LEFT JOIN LEFT JOIN
LEFT JOIN
LEFT JOIN LEFT JOIN
LEFT JOIN
What if you need to show only a single primary address?
78. Written in: C/C++
Main point: Blazing fast
Protocol: Telnet-like
Disk-backed in-memory database,
but since 2.0, it can swap to disk.
Master-slave replication
Simple keys and values,
but complex operations like
ZREVRANGEBYSCORE
INCR
Values can be set to expire (as in a cache)
$ redis-cli set mykey "my binary safe value" => OK
$ redis-cli get mykey => my binary safe value
79. Best used:
rapidly changing data
with a foreseeable
database size (should fit
mostly in memory)
For example:
analytics
real-time data collection
caching
MQ
log
http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
82. very fast
Object != key -> value
Not reliable
Can I haz otha nozql?
83. Written in: C++
Main point: Retains some friendly properties
of SQL
Protocol: Custom, binary (BSON)
Master/slave replication
speaks JavaScript
Built-in sharding
Performance over features
After crash, it needs to repair tables
> j = { name : 'david', surname : 'funaro' };
{ "name" : "david", "surname" : "funaro" }
> db.things.save(t);
> db.things.find();
{ "_id" : ObjectId("4c2209f9f3924d31102bd84a"), "name" : "mongo" }
84. Best used:
you need dynamic queries
you prefer to define indexes,
not map/reduce functions
you need good performance
on a big DB
For example:
all things that you would do
with MySQL or PostgreSQL,
but having predefined
columns really holds you back
http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
88. Written in: Erlang
Main point: DB consistency, ease of use
Protocol: HTTP, some say REST
Bi-directional replication => master-master
conflict detection ( 409 Conflict )
MVCC: write operations do not block reads
Previous versions of documents are
available
Crash-only (reliable) design
Needs compacting from time to time
Views: embedded map/reduce
jQuery library included
curl -d '{"keys":["bar"]}' -X POST http://host:port/foo/_all_docs?include_docs=true
89. Best used:
accumulating occasionally-
changing data
pre-defined queries
versioning is king
For example:
CRM/CMS systems
API
http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis
93. Reliable
Document Oriented
Schema Free
Navigate Object
Can I haz otha nozql?
94. Why do we so hardly
need a GraphDB
like OrientDB?
95. "GraphDBs don't avoid relations but they embrace them in
a way that they are not a computational problem
anymore, by making them explicit instead of implicit
through joins."
Claudio Martella
( http://blog.acaro.org/entry/somebody-is-going-to-hate-me-nosparql )
136. "My only friend, the end"
David Funaro
@ingdavidino
davidfunaro.com
137. "My only friend, the end"
David Funaro Alessandro Nadalin
@ingdavidino @_odino_
davidfunaro.com odino.org
138. "My only friend, the end"
David Funaro Alessandro Nadalin
@ingdavidino @_odino_
davidfunaro.com odino.org
139. "My only friend, the end"
David Funaro Alessandro Nadalin
@ingdavidino @_odino_
http://davidfunaro.com http://odino.org
http://joind.in/talk/view/3008