cassandra: not just nosql, it's mosql

26
Not just NoSQL, It’s MoSQL Cassandra SF July 11, 2011 Eric Evans [email protected] @jericevans http://blog.sym-link.com

Upload: eric-evans

Post on 15-Jan-2015

7.074 views

Category:

Technology


3 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Cassandra: Not Just NoSQL, It's MoSQL

Not just NoSQL, It’s MoSQL

Cassandra SFJuly 11, 2011

Eric [email protected]

@jericevanshttp://blog.sym-link.com

Page 2: Cassandra: Not Just NoSQL, It's MoSQL

Cassandra Query Language

● Structured query language for Apache Cassandra.

● CQL for short (pronounced /si kw l/).ː ə● SQL alike (best effort).● An alternative to the existing API, not a

replacement (not yet).● Available for use in Cassandra 0.8.0.

Page 3: Cassandra: Not Just NoSQL, It's MoSQL

Wait, aren't you the guy...?

Page 4: Cassandra: Not Just NoSQL, It's MoSQL
Page 5: Cassandra: Not Just NoSQL, It's MoSQL

So, is this a troll?

Page 6: Cassandra: Not Just NoSQL, It's MoSQL

Problem?

Page 7: Cassandra: Not Just NoSQL, It's MoSQL

Naw.(not a troll, honest)

Page 8: Cassandra: Not Just NoSQL, It's MoSQL

But, why?

Page 9: Cassandra: Not Just NoSQL, It's MoSQL

Because the API sucks.

Page 10: Cassandra: Not Just NoSQL, It's MoSQL

“Thrift sucks, ergo the API sucks”

● Generated code (C++ compiler).● Loads of languages, but varying levels of

support.● PHP anyone?

● Upstream alternating between extremes of combativeness and apathy.● Patches ignored, (or refused).● Loads of (serious )bugs ignored for long periods.● Infrequent releases.

Page 11: Cassandra: Not Just NoSQL, It's MoSQL

“Avro Does Not Suck, so...”

1. Avro

2. Something, something, something

3. Profit!

Page 12: Cassandra: Not Just NoSQL, It's MoSQL

And the API still sucks.

Page 13: Cassandra: Not Just NoSQL, It's MoSQL

Brass Tacks

● Unstable● Too tightly coupled to internal APIs

● Too difficult to use● Not enough abstraction (and passing the buck to

3rd-party API maintainers is weak)● Poor mental fit for query/data models

Page 14: Cassandra: Not Just NoSQL, It's MoSQL

Back to the drawing board

● RPC (Thrift, Avro, Protobuf, etc)● REST● Query language● Etc, etc

Page 15: Cassandra: Not Just NoSQL, It's MoSQL

Back to the drawing board

● RPC (Thrift, Avro, Protobuf, etc)● Easy to implement● Performant

● REST● Query language● Etc, etc

Page 16: Cassandra: Not Just NoSQL, It's MoSQL

Back to the drawing board

● RPC (Thrift, Avro, Protobuf, etc)● Easy to implement● Performant

● REST● Little need for client abstraction

● Query language● Etc, etc

Page 17: Cassandra: Not Just NoSQL, It's MoSQL

Back to the drawing board

● RPC (Thrift, Avro, Protobuf, etc)● Easy to implement● Performant

● REST● Little need for client abstraction

● Query language● Little need for client abstraction!● Reads well; What you see is what you get● The Devil we all know

● Etc, etc

Page 18: Cassandra: Not Just NoSQL, It's MoSQL

Grok This

firstname = Column(name="firstname", value="Eric", timestamp=time)

firstcosc = ColumnOrSuperColumn(column=firstname)

lastname = Column(name="lastname", value="Evans", timestamp=time)

lastcosc = ColumnOrSuperColumn(column=lastname)

mutations = []

mutations.append(Mutation(column_or_supercolumn=firstcosc))

mutations.append(Mutation(column_or_supercolumn=lastcosc))

client.batch_mutate(mutation_map={"eevans": {"table": mutations}}, consistency_level=ConsistencyLevel.ONE)

Page 19: Cassandra: Not Just NoSQL, It's MoSQL

What about this?

UPDATE tableSET firstname=Eric, lastname=Evans WHERE KEY=eevans

Page 20: Cassandra: Not Just NoSQL, It's MoSQL

Grok This

parent = ColumnParent(column_family="table")colnames = ["firstname", "lastname"]predicate = SlicePredicate(column_names=colnames)row = client.get_slice(key="eevans", column_parent=parent, predicate=predicate, consistency_level=CL.ONE)

Page 21: Cassandra: Not Just NoSQL, It's MoSQL

And this?

SELECT firstname, lastnameFROM table WHERE KEY = eevans

Page 22: Cassandra: Not Just NoSQL, It's MoSQL

Lessons Learned

● Know when to take a step back● Listen to your users; Read between the lines● Beware quick/easy consensus● Just because it's old doesn't mean it's bad● Just because it's the brunt of jokes, doesn't

make it wrong (works for Thrift and SQL)

Page 23: Cassandra: Not Just NoSQL, It's MoSQL

Language

● Versioned specification (http://semver.og)● Major – Breaking changes, (rare to never)● Minor – Backward compatible changes● Patch – Bug fixes

Page 24: Cassandra: Not Just NoSQL, It's MoSQL

Drivers

● Maintained and distributed by us● Separate development cycles; Separately

versioned● Support a language version, not a Cassandra

version!● Minimal, low-level (not the place for an ORM)● Idiomatic● [email protected]

Page 25: Cassandra: Not Just NoSQL, It's MoSQL

More Info

● Docs (doc/cql/CQL.html)● http://www.datastax.com/docs/0.8/api/using_cql● http://caqel.deadcafe.org (live demo!)● cqlsh (interactive shell shipped w/ Python

driver)

Page 26: Cassandra: Not Just NoSQL, It's MoSQL