cassandra summit 2014: astyanax — to be or not to be

27
Astyanax To be or not to be Puneet Oberai, Netflix #CassandraSummit2014

Upload: planet-cassandra

Post on 05-Dec-2014

261 views

Category:

Technology


0 download

DESCRIPTION

Presenter: Puneet Oberai, Senior Software Engineer at Netflix In this session, we'll cover a quick introduction to the Astyanax Java client driver, powerful features, comparison to Java Driver and what to do with CQL3.

TRANSCRIPT

Page 1: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Astyanax To be or not to be

Puneet Oberai, Netflix

#CassandraSummit2014

Page 2: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Puneet Oberai Senior Software Engineer - Netflix, Inc Previously at Amazon Web Services (AWS) @opuneet

Page 3: Cassandra Summit 2014: Astyanax — To Be or Not To Be

https://github.com/Netflix/astyanax

Image - http://www.artandarchitecture.org.uk/images/conway/3f324eee.html

Page 4: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Top Level Features

•  Load balancing

•  Connection pooling - resilient with failover and retries

•  Pluggable host discovery mechanism

•  Metrics (there are a lot!)

•  Highly configurable and pluggable

Page 5: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Fluent Query Syntax

Mutation Batch

Page 6: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Fluent Query Syntax Row Query with column slice (reverse sorting)

Page 7: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Recipes

•  All Rows Reader

•  Distributed Row Lock

•  Chunked Object Store

Page 8: Cassandra Summit 2014: Astyanax — To Be or Not To Be

How Does Netflix Use Astyanax

Page 9: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Java Driver Release

•  Async interface!

•  Cursor support

•  Collections

•  Flexible retry policies

•  And everything else in CQL ..

Page 10: Cassandra Summit 2014: Astyanax — To Be or Not To Be

BUT WHAT ABOUT THRIFT !!?? ���I’M STILL USING IT. ������

No worries, Astyanax still works over thrift J

Page 11: Cassandra Summit 2014: Astyanax — To Be or Not To Be

New features only available via CQL / native protocol

Page 12: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Is this a carrot or a stick?

Page 13: Cassandra Summit 2014: Astyanax — To Be or Not To Be

900+ devs need to refactor their code

Page 14: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Bear and stick is not a good idea!

Page 15: Cassandra Summit 2014: Astyanax — To Be or Not To Be

No wait! Astyanax has a new adaptor

•  Built on top of Java Driver

•  All your queries are now async

•  Astyanax APIs (structured queries) are supported

•  All Astyanax recipes work

Page 16: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Much better adoption model!

Page 17: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Astyanax Can Use Both Drivers

Page 18: Cassandra Summit 2014: Astyanax — To Be or Not To Be

What About Performance?

If you use prepared statements, you’re good!

More findings on our blog

http://techblog.netflix.com/2013/12/astyanax-update.html

Page 19: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Prepared Statements

•  There is no magic here •  You “prepare”

•  Then you re-use

For generic DAOs this means - prepared statement management.

Page 20: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Astyanax Value Add

Structured Queries Naturally Have Some Query Signature

keyspace.prepareQuery( myCF )!

.withRow( myRowKey )!

.withColumnSlice( start, end)!

.execute();!

Translates to select * from ks.myCF where key=? and column1 >=? and column1 <=?;

Page 21: Cassandra Summit 2014: Astyanax — To Be or Not To Be

But wait! Something is not right with the new model

•  Are columns really columns?

•  Are rows still rows?

•  Are columns really rows?

Page 22: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Simple Schema key validator – int col comparator – int default validator – utf8

Page 23: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Rows Are Now Transposed

Page 24: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Astyanax preserves original semantics

•  Astyanax maintains backwards compatibility with the api

•  Hence rows are still rows and columns are still columns

Page 25: Cassandra Summit 2014: Astyanax — To Be or Not To Be

Takeaway for Astyanax

Apps really care about high level abstractions

•  Time series

•  Sliding window •  Objects with attribute based indexing

Page 26: Cassandra Summit 2014: Astyanax — To Be or Not To Be

So What Should I Use?

•  Astyanax presents a higher level abstraction •  Astyanax has recipes

•  Astyanax is good for structured queries

•  If all you want is CQL3, then use Java Driver

Page 27: Cassandra Summit 2014: Astyanax — To Be or Not To Be

http://github.com/Netflix/astyanax

https://jobs.netflix.com

Questions