Upload
planet-cassandra
View
260
Download
0
Embed Size (px)
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.
Citation preview
Astyanax To be or not to be
Puneet Oberai, Netflix
#CassandraSummit2014
Puneet Oberai Senior Software Engineer - Netflix, Inc Previously at Amazon Web Services (AWS) @opuneet
https://github.com/Netflix/astyanax
Image - http://www.artandarchitecture.org.uk/images/conway/3f324eee.html
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
Fluent Query Syntax
Mutation Batch
Fluent Query Syntax Row Query with column slice (reverse sorting)
Recipes
• All Rows Reader
• Distributed Row Lock
• Chunked Object Store
How Does Netflix Use Astyanax
Java Driver Release
• Async interface!
• Cursor support
• Collections
• Flexible retry policies
• And everything else in CQL ..
BUT WHAT ABOUT THRIFT !!?? ���I’M STILL USING IT. ������
No worries, Astyanax still works over thrift J
New features only available via CQL / native protocol
Is this a carrot or a stick?
900+ devs need to refactor their code
Bear and stick is not a good idea!
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
Much better adoption model!
Astyanax Can Use Both Drivers
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
Prepared Statements
• There is no magic here • You “prepare”
• Then you re-use
For generic DAOs this means - prepared statement management.
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 <=?;
But wait! Something is not right with the new model
• Are columns really columns?
• Are rows still rows?
• Are columns really rows?
Simple Schema key validator – int col comparator – int default validator – utf8
Rows Are Now Transposed
Astyanax preserves original semantics
• Astyanax maintains backwards compatibility with the api
• Hence rows are still rows and columns are still columns
Takeaway for Astyanax
Apps really care about high level abstractions
• Time series
• Sliding window • Objects with attribute based indexing
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
http://github.com/Netflix/astyanax
https://jobs.netflix.com
Questions