cassandra summit keynote 2014

63
©2014 DataStax Confidential. Do not distribute without consent. CTO, DataStax Jonathan Ellis Project Chair, Apache Cassandra State of Cassandra 2014

Upload: jbellis

Post on 01-Nov-2014

329 views

Category:

Technology


3 download

DESCRIPTION

Cassandra Summit SF 2014 keynote, covering Cassandra 2.1.

TRANSCRIPT

Page 1: Cassandra summit keynote 2014

©2014 DataStax Confidential. Do not distribute without consent.

CTO, DataStax

Jonathan EllisProject Chair, Apache Cassandra

State of Cassandra 2014

Page 3: Cassandra summit keynote 2014
Page 4: Cassandra summit keynote 2014
Page 5: Cassandra summit keynote 2014

Cluster cluster = Cluster.builder() .addContactPoint("127.0.0.1") .withRetryPolicy( DefaultRetryPolicy.INSTANCE) .withLoadBalancingPolicy( new TokenAwarePolicy( new DCAwareRoundRobinPolicy())) .build();Session session = cluster.connect("demo");

cluster = Cluster(  contact_points=['127.0.0.1'],  load_balancing_policy=TokenAwarePolicy( DCAwareRoundRobinPolicy( local_dc='datacenter1')),  default_retry_policy = RetryPolicy())session = cluster.connect('demo’)

Cluster cluster = Cluster.Builder() .AddContactPoints("127.0.0.1") .WithRetryPolicy(DowngradingConsistencyRetryPolicy.INSTANCE) .WithLoadBalancingPolicy( new TokenAwarePolicy( new RoundRobinPolicy())  .Build();ISession session = cluster.Connect("demo");

Page 6: Cassandra summit keynote 2014

Cassandra’s peer to peer architecture, linear scalability and multi data center active-active deployment enable mission critical eBay features for hundreds of millions users every day.

Feng Qu, principal DBA at eBay Inc

Page 7: Cassandra summit keynote 2014
Page 8: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busy

Page 9: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busy

Page 10: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busy

Page 11: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busyX

Page 12: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busyX

Page 13: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busyX

Page 14: Cassandra summit keynote 2014

Client Coordinator

40%busy

90%busy

30%busyXsuccess

Page 15: Cassandra summit keynote 2014
Page 16: Cassandra summit keynote 2014
Page 17: Cassandra summit keynote 2014
Page 18: Cassandra summit keynote 2014
Page 19: Cassandra summit keynote 2014

“One of the great things about NoSQL is the ability to iterate on one's data model as one's business requires it.”

“Everything in one place is convenient until it fails. If you want to scale and be highly available, use Cassandra.”

Matt AsayMongoDB

Adrian CockcroftBattery Ventures

Page 20: Cassandra summit keynote 2014
Page 21: Cassandra summit keynote 2014
Page 22: Cassandra summit keynote 2014

2.1: Performance

Page 23: Cassandra summit keynote 2014

Read performance, 2.0 vs 2.1

Page 24: Cassandra summit keynote 2014

Reads, post-compaction (2.0)

Page 25: Cassandra summit keynote 2014

Reads, post-compaction (2.1)

Page 26: Cassandra summit keynote 2014

Write performance, 2.0 vs 2.1

Page 27: Cassandra summit keynote 2014

Competitive performance

Page 28: Cassandra summit keynote 2014

Competitive performance

https://github.com/jbellis/YCSB

Page 29: Cassandra summit keynote 2014

2.1: Data modeling

Page 30: Cassandra summit keynote 2014

Lightweight transactions

Page 31: Cassandra summit keynote 2014

Lightweight transactionsINSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ba27e03fd9...', '2011-06-20 13:50:00')IF NOT EXISTS;

Page 32: Cassandra summit keynote 2014

Lightweight transactionsINSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ba27e03fd9...', '2011-06-20 13:50:00')IF NOT EXISTS;

INSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ea24e13ad9...', '2011-06-20 13:50:01')IF NOT EXISTS;

Page 33: Cassandra summit keynote 2014

Lightweight transactionsINSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ba27e03fd9...', '2011-06-20 13:50:00')IF NOT EXISTS;

[applied]----------- True

INSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ea24e13ad9...', '2011-06-20 13:50:01')IF NOT EXISTS;

Page 34: Cassandra summit keynote 2014

Lightweight transactions

[applied] | username | created_date | name -----------+----------+----------------+---------------- False | pmcfadin | 2011-06-20 ... | Patrick McFadin

INSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ba27e03fd9...', '2011-06-20 13:50:00')IF NOT EXISTS;

[applied]----------- True

INSERT INTO users (username, name, email, password, created_date)VALUES ('pmcfadin', 'Patrick McFadin', ['[email protected]'], 'ea24e13ad9...', '2011-06-20 13:50:01')IF NOT EXISTS;

Page 35: Cassandra summit keynote 2014

Static columns (2.0.6)CREATE TABLE bills ( user text, balance int static, expense_id int, amount int, description text, paid boolean, PRIMARY KEY (user, expense_id));

Page 36: Cassandra summit keynote 2014

Static columns + LWTCREATE TABLE bills ( user text, balance int static, expense_id int, amount int, description text, paid boolean, PRIMARY KEY (user, expense_id));

BEGIN BATCH UPDATE bills SET balance = -116 WHERE user='user1' IF balance = 84; INSERT INTO bills (user, expense_id, amount, description, paid) VALUES ('user1', 2, 200, 'hotel room', false);APPLY BATCH;

Page 37: Cassandra summit keynote 2014

Atomic log appends with LWTCREATE TABLE log ( log_name text, seq int static, logged_at timeuuid, entry text, primary key (log_name, logged_at));

INSERT INTO log (log_name, seq) VALUES ('foo', 0);

Page 38: Cassandra summit keynote 2014

Atomic log appends with LWTBEGIN BATCH

UPDATE log SET seq = 1WHERE log_name = 'foo'IF seq = 0;

INSERT INTO log (log_name, logged_at, entry)VALUES ('foo', now(), 'test');

APPLY BATCH;

Page 39: Cassandra summit keynote 2014

User defined typesCREATE 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>>)

SELECT id, name, addresses.city, addresses.phones FROM users;

id | name | addresses.city | addresses.phones--------------------+----------------+-------------------------- 63bf691f | jbellis | Austin | {'512-4567', '512-9999'}

Page 40: Cassandra summit keynote 2014

Collection indexingCREATE TABLE songs ( id uuid PRIMARY KEY, artist text, album text, title text, data blob, tags set<text>);

CREATE INDEX song_tags_idx ON songs(tags);

SELECT * FROM songs WHERE tags CONTAINS 'blues';

id | album | artist | tags | title----------+---------------+-------------------+-----------------------+------------------ 5027b27e | Country Blues | Lightnin' Hopkins | {'acoustic', 'blues'} | Worrying My Mind

Page 41: Cassandra summit keynote 2014

2.1: Operations

Page 42: Cassandra summit keynote 2014

Counters, 2.0

Page 43: Cassandra summit keynote 2014

Counters, 2.0

MemtableMemtableMemtable

A0 1 1

CommitlogCommitlogCommitlog

A0 1 1

1. Node A, increment by 1

Value: 1

Page 44: Cassandra summit keynote 2014

Counters, 2.0

CommitlogCommitlogCommitlog

A0 1 1

A0 1 1

MemtableMemtableMemtable

A0 2 2

2. Node A, increment by 1

Value: 2

MemtableMemtableMemtable

A0 1 1

CommitlogCommitlogCommitlog

A0 1 1

1. Node A, increment by 1

Value: 1

Page 45: Cassandra summit keynote 2014

Counters, 2.0

CommitlogCommitlogCommitlog

A0 1 1

A0 1 1

MemtableMemtableMemtable

A0 2 2

2. Node A, increment by 1

Value: 2

MemtableMemtableMemtable

A0 1 1

CommitlogCommitlogCommitlog

A0 1 1

1. Node A, increment by 1

Value: 1

MemtableMemtableMemtable

A0 3 0

3. Node A, decrement by 2

Value: 0

Commit LogCommit LogCommit Log

A0 1 1

A0 1 1

A0 1 -2

Page 46: Cassandra summit keynote 2014

Counters, 2.1

Page 47: Cassandra summit keynote 2014

Counters, 2.1

MemtableMemtableMemtable

A0 1 1

CommitlogCommitlogCommitlog

A0 1 1

1. Node A, increment by 1

Value: 1

Page 48: Cassandra summit keynote 2014

Counters, 2.1

CommitlogCommitlogCommitlog

A0 1 1

A0 2 2

MemtableMemtableMemtable

A0 2 2

2. Node A, increment by 1

Value: 2

MemtableMemtableMemtable

A0 1 1

CommitlogCommitlogCommitlog

A0 1 1

1. Node A, increment by 1

Value: 1

Page 49: Cassandra summit keynote 2014

Counters, 2.1

CommitlogCommitlogCommitlog

A0 1 1

A0 2 2

MemtableMemtableMemtable

A0 2 2

2. Node A, increment by 1

Value: 2

MemtableMemtableMemtable

A0 1 1

CommitlogCommitlogCommitlog

A0 1 1

1. Node A, increment by 1

Value: 1

MemtableMemtableMemtable

A0 3 0

3. Node A, decrement by 2

Value: 0

Commit LogCommit LogCommit Log

A0 1 1

A0 2 2

A0 3 0

Page 50: Cassandra summit keynote 2014

(low contention)

Page 51: Cassandra summit keynote 2014

(high contention)

Page 52: Cassandra summit keynote 2014

Regular repair

Page 53: Cassandra summit keynote 2014

Regular repair

Page 54: Cassandra summit keynote 2014

Regular repair

Page 55: Cassandra summit keynote 2014

Incremental repair

Page 56: Cassandra summit keynote 2014

Implications for LCS (and STCS)bin/nodetool upgradesstables

tools/bin/sstablerepairedset --is-repaired

bin/nodetool repair

bin/nodetool repair -inc

Page 57: Cassandra summit keynote 2014

The new row cacheCREATE TABLE notifications ( target_user text, notification_id timeuuid, source_id uuid, source_type text, activity text, PRIMARY KEY (target_user, notification_id))WITH CLUSTERING ORDER BY (notification_id DESC) AND caching = 'rows_only' AND rows_per_partition_to_cache = '3';

Page 58: Cassandra summit keynote 2014

The new row cachetarget_user notification_id source_id source_type activity

nick e1bd2bcb- d972b679- photo tom liked

nick 321998c- d972b679- photo jake commented

nick ea1c5d35- 88a049d5- user mike created account

nick 5321998c- 64613f27- photo tom commented

nick 07581439- 076eab7e- user tyler created account

mike 1c34467a- f04e309f- user tom created account

Page 59: Cassandra summit keynote 2014

target_user notification_id source_id source_type activity

nick e1bd2bcb- d972b679- photo tom liked

nick 321998c- d972b679- photo jake commented

nick ea1c5d35- 88a049d5- user mike created account

nick 5321998c- 64613f27- photo tom commented

nick 07581439- 076eab7e- user tyler created account

mike 1c34467a- f04e309f- user tom created account

The new row cache

Page 60: Cassandra summit keynote 2014

The new row cachetarget_user notification_id source_id source_type activity

nick e1bd2bcb- d972b679- photo tom liked

nick 321998c- d972b679- photo jake commented

nick ea1c5d35- 88a049d5- user mike created account

nick 5321998c- 64613f27- photo tom commented

nick 07581439- 076eab7e- user tyler created account

mike 1c34467a- f04e309f- user tom created account

Page 61: Cassandra summit keynote 2014

2.1: Testing & QA

Page 62: Cassandra summit keynote 2014
Page 63: Cassandra summit keynote 2014