Cassandra Summit 2015

Post on 14-Apr-2017

248 views 0 download

Transcript of Cassandra Summit 2015

CTO, DataStax

Jonathan EllisProject Chair, Apache Cassandra™

“”

After two years of working with Cassandra’s CQL driver, [JDBC] feels like a step backwards.

Java Python C# C++

Ruby Go PHP node.js

Jonah Grimes

Operational Database Magic Quadrant

Legacy Post Relational

Ope

ratio

nal

Anal

ytic

al

client

server

client

router

2002

X

Armin Ronacher

client

p1

p1

p1

Apr 2011 Oct 2012 Dec 2012 Sep 2013 Sep 2014 Sep 2015

outages

AWS RE:Boot 2014. 218 Cassandra nodes rebooted. 22 nodes didn’t come back and got replaced. Zero Netflix downtime.

Christos Kalantzis Director of Engineering

“”

2013: 3 nodes

2015: 300 nodes

Geolocated

Active-Active — Stable State

Geolocated

Regional Load Balancers Regional Load Balancers

100%

Active-Active — Failover

Geolocated

Regional Load Balancers Regional Load Balancers

HDFS

64MB Blocks

[I]t seems like HBase is very buggy where 50% of sampled failures are catastrophic, and Cassandra is well engineered.

“”

Murat Demirbas SUNY Buffalo

mmap, fsync, fadvise

commitlog, sstables

compaction, streaming

write-mostly read-mostly

balanced op/analytic

Cassandra 2.2 and 3.0

Windows Support

JSONUDF

Role-based authz

Commitlog Compression

New Storage Engine

New Hints Architecture

Materialized Views

DTCS

Message Coalescing

3.0

Windows Support

DTCS

UDF

Role-based authz

Commitlog Compression

New Storage Engine

New Hints Architecture

Materialized Views

JSON

Message Coalescing

2.2 3.0(July) (Expected in October)

JSONCREATE TABLE users ( id uuid PRIMARY KEY, name text, state text, birth_date int);

INSERT INTO users (id, name, state, birth_date)VALUES(now(), 'Joe User', 'TX', 1982);

INSERT INTO users JSON'{"id": "1a4f88e2-6dc8-4edd-9e16-a7ba9c941f8d", "name": "Joe User", "state": "TX", "birth_date": 1982}';

CollectionsCREATE TABLE example (    id int PRIMARY KEY,    tupleval tuple<int, text>,    numbers set<int>,    words list<text>);

INSERT INTO example (id, tupleval, numbers, words)VALUES (0, (1, 'foo'), {1, 2, 3, 6}, ['the', 'quick', 'brown', 'fox']);

INSERT INTO example JSON'{"id": 0, "tupleval": [1, "foo"], "numbers": [1, 2, 3, 6], "words": ["the", "quick", "brown", "fox"]}';

User-defined typesCREATE TYPE address (number int, street text);

CREATE TABLE users ( id int PRIMARY KEY, street_address frozen<address>);

INSERT INTO users (id, street_address)VALUES (1, {number: 123, street: 'Cassandra Ave'});

INSERT INTO users JSON'{"id": 1, "street_address": {"number": 1, "street": "Cassandra Ave"}}';

Deeper NestingCREATE TYPE address ( street text, city text, zip_code int, phones set<text>);

CREATE TABLE users ( id uuid PRIMARY KEY, name text, addresses map<text, frozen<address>>);

Deeper NestingINSERT INTO users JSON '{"id": "0514e410-2a9f-11e5-a2cb-0800200c9a66", "name": "jellis", "addresses": {"home": {"street": "9920 Cassandra Ave", "city": "Austin", "zip_code": 78700, "phones": ["1238614789"]}}}';

Role-based AuthorizationCREATE ROLE accounting;

GRANT all ON invoices TO accounting;GRANT select ON expenses TO accounting;GRANT select ON payroll TO accounting;

GRANT accounting TO josie;GRANT accounting TO jay;

User-defined Functions (UDF)CREATE FUNCTION my_sin (input double)RETURNS double LANGUAGE javaAS ’ return input == null ? null : Double.valueOf(Math.sin(input.doubleValue()));’;

SELECT key, my_sin(value) FROM my_table WHERE key IN (1, 2, 3);

UDF AggregationCREATE AGGREGATE avg (int)SFUNC avgStateSTYPE tuple<long, int>FINALFUNC avgFinal;

CREATE FUNCTION avgState (state frozen<tuple<bigint, int>>, i int)RETURNS frozen<tuple<bigint, int>>, intLANGUAGE JAVA AS ’ // (state[0] + i, state[1] + 1) state.setLong(0, state.getLong(0) + i.intValue()); state.setInt(1, state.getInt(1) + 1); return state;’;

CREATE FUNCTION avgFinal (state frozen<tuple<bigint, int>>)RETURNS doubleLANGUAGE JAVA AS ’ double r = state.getLong(0) / state.getInt(1); return Double.valueOf(r);’;

Commitlog Compression2.2

2.1

Ope

ratio

ns/s

Time

DateTieredCompactionStrategyRe

ads/

s

DTCS

STCS

LCS

2.5TB

DateTieredCompactionStrategyW

rites

/s

DTCS

STCS

LCS

3.0 Preview

New Storage Engine

Workloads

Byt

es

Hinted Handoff Improvements

client

p1

p1

p1

X

Hinted Handoff Improvements

client

p1

p1

p1

Hint

Hinted Handoff Improvements

client

p1

p1

p1

Handoff

SSTable-based Hints

Hint

Compacted

Tombstone

Memtable

CommitlogSSTableCommitlogSSTable

Memtable

File-based Hints

Hint

.168.101

Hint

Hint

Hint

Hint

Hint

Hint

Hint

.168.104

Hint

Hint

Hint

Hint

Hint

Hint

Hint

Hint

.168.112

Hint

Hint

Hint

Hint

Hint

Hint

Hint

Hint

File-based Hints.168.104

Hint

Hint

Hint

Hint

Hint

Hint

Hint

Hint

.168.112

Hint

Hint

Hint

Hint

Hint

Hint

Hint

Hint

3.0

2.2

2.2 Hints vs 3.0O

pera

tions

/s

Time

Materialized ViewsCREATE TABLE songs (  id uuid PRIMARY KEY,  title text,  album text,  artist text);

CREATE MATERIALIZED VIEW songs_by_album ASSELECT * FROM songsWHERE album IS NOT NULLPRIMARY KEY (album, id);

SELECT * FROM songs_by_albumWHERE album = ‘Tres Hombres’;

IndexesCREATE TABLE songs (  id uuid PRIMARY KEY,  title text,  album text,  artist text);

CREATE INDEX songs_by_album on songs(album);

SELECT * FROM songsWHERE album = ‘Tres Hombres’;

Local Indexes

client

title artist album

La Grange

ZZ Top Tres Hombres

title artist album

Outside... Back Door Slam

Roll Away

title artist album

Waitin... ZZ Top Tres Hombres

Materialized Views

client

album id

Tres Hombres

a3e64f8f

Tres Hombres

8a172618

album id

Roll Away 2b09185b

Stress: raw vs 1 MV vs 5 MVO

pera

tions

/s

Time

raw

1 MV

5 MV

mvbench, 4 denormalizationsMV

Manual

Ope

ratio

ns/s

Time

Beyond 3.0

3.x Development Process

3.0 releases

3.0 rc1: Out now

3.0 GA

October

December

3.1

3.2

January

February

3.3

3.0 releases

3.0 rc1: Out now

3.0 GA

October

December

3.1

3.0.1

3.2

3.0.2

January

February

3.3

3.0.3

Compatibility

3.03.13.2

DataStax Training for Apache Cassandra™