Upload
otavio-goncalves-de-santana
View
351
Download
4
Embed Size (px)
Citation preview
Disasters of the Century - NoSQL
Otávio Santana@[email protected]@apache.org
KISS
● Avoid complexity● Product First● MVP● Baby Step
Our database is too slow and not big enough!
We need NoSql!
SQL
● know-who
● know-why
● General
SQL
● Explain
● Compose
● Index
● Model
SQL Key-value Document Column Graph
Table Bucket Collection Column Family
Vertex and Edge
Row Key/value pair
Document Column Vertex
Column Key/value pair
Key/value pair
Vertex and Edge property
Relationship Link Edge
Scalability vs Complexity
Scalability
Complexity
key-value
Column
Document
Graph
Benchmarks are not truthful
Emulate● ACID
● Replica
● Duplicate
Model
Validation● Test
● Migration
● TTL
Diversity
● Types
● Unique
● Configuration
Key-value
● Structure● Single shot
Column Family
● Avoid index● Read● Denormalize
Document
● Use index● Write
Graph Database
Slow
● Index● Wildcard
Search Engine
● Analyzers
● Character filter
● Tokenizer
● Token filter
Search Engine
Character filter
Tokenizer Token filter
Commandments
1. Keep it simple2. Don't follow the Hype3. SQL still in shape4. Understand NoSQL5. Don't trust in Benchmarks6. Never emulate7. Models are differents8. Improving tests9. Diversity
10. Search Engine
The Current Solution
● Spring Data● Hibernate OGM● TopLink
DAO
Solution Solution
JPA problem for NoSQL
● Saves Async● Async Callback● Time to Live (TTL)● Consistency Level● SQL based● Diversity in NoSQL
JNoSQL
● Mapping API● Communication API● No lock-in● Divide and conquer
DAO
Mapping
Communication
DocumentKey
Column Graph
DIANA
ARTEMIS
JNoSQL
Data Tier
Communication Issue
ODocument document = new ODocument(“collection”);document.field(name, value);
JsonObject jsonObject = JsonObject.create();jsonObject.put(name, value);
BaseDocument baseDocument = new BaseDocument();baseDocument.addAttribute(name, value);
Document document = new Document();document.append(name, value);
Communication Issue
ODocument document = new ODocument(“collection”);document.field(name, value);
JsonObject jsonObject = JsonObject.create();jsonObject.put(name, value);
BaseDocument baseDocument = new BaseDocument();baseDocument.addAttribute(name, value);
Document document = new Document();document.append(name, value);
DiversityColumnEntity entity = ColumnEntity.of(COLUMN_FAMILY);Column id = Column.of("id", 10L);entity.add(id);entity.add(Column.of("version", 0.001));entity.add(Column.of("name", "Diana"));entity.add(Column.of("options", Arrays.asList(1, 2, 3)));
//mutiple implementationcolumnEntityManager.save(entity);ColumnQuery query = select().from(COLUMN_FAMILY).where(ColumnCondition.eq(id)).build();Optional<ColumnEntity> result = columnEntityManager.singleResult(query);
//cassandra onlyList<ColumnEntity> entities = columnEntityManagerCassandra.cql("select * from newKeySpace.newColumnFamily where id=10;");columnEntityManagerCassandra.insert(entity, ConsistencyLevel.ALL);
Thank You
Otávio Santana@[email protected]@apache.org