27
Disasters of the Century - NoSQL Otávio Santana @otaviojava [email protected] [email protected]

Disasters of the century NoSQL

Embed Size (px)

Citation preview

Page 1: Disasters of the century NoSQL

Disasters of the Century - NoSQL

Otávio Santana@[email protected]@apache.org

Page 2: Disasters of the century NoSQL

KISS

● Avoid complexity● Product First● MVP● Baby Step

Page 3: Disasters of the century NoSQL

Our database is too slow and not big enough!

We need NoSql!

Page 4: Disasters of the century NoSQL

SQL

● know-who

● know-why

● General

Page 5: Disasters of the century NoSQL

SQL

● Explain

● Compose

● Index

● Model

Page 6: Disasters of the century NoSQL

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

Page 7: Disasters of the century NoSQL

Scalability vs Complexity

Scalability

Complexity

key-value

Column

Document

Graph

Page 8: Disasters of the century NoSQL

Benchmarks are not truthful

Page 9: Disasters of the century NoSQL

Emulate● ACID

● Replica

● Duplicate

Page 10: Disasters of the century NoSQL

Model

Page 11: Disasters of the century NoSQL

Validation● Test

● Migration

● TTL

Page 12: Disasters of the century NoSQL

Diversity

● Types

● Unique

● Configuration

Page 13: Disasters of the century NoSQL

Key-value

● Structure● Single shot

Page 14: Disasters of the century NoSQL

Column Family

● Avoid index● Read● Denormalize

Page 15: Disasters of the century NoSQL

Document

● Use index● Write

Page 16: Disasters of the century NoSQL

Graph Database

Page 17: Disasters of the century NoSQL

Slow

● Index● Wildcard

Page 18: Disasters of the century NoSQL

Search Engine

● Analyzers

● Character filter

● Tokenizer

● Token filter

Page 19: Disasters of the century NoSQL

Search Engine

Character filter

Tokenizer Token filter

Page 20: Disasters of the century NoSQL

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

Page 21: Disasters of the century NoSQL

The Current Solution

● Spring Data● Hibernate OGM● TopLink

DAO

Solution Solution

Page 22: Disasters of the century NoSQL

JPA problem for NoSQL

● Saves Async● Async Callback● Time to Live (TTL)● Consistency Level● SQL based● Diversity in NoSQL

Page 23: Disasters of the century NoSQL

JNoSQL

● Mapping API● Communication API● No lock-in● Divide and conquer

DAO

Mapping

Communication

DocumentKey

Column Graph

DIANA

ARTEMIS

JNoSQL

Data Tier

Page 24: Disasters of the century NoSQL

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);

Page 25: Disasters of the century NoSQL

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);

Page 26: Disasters of the century NoSQL

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);

Page 27: Disasters of the century NoSQL

Thank You

Otávio Santana@[email protected]@apache.org