Paris Cassandra Meetup - Overview of New Cassandra Drivers
Upcoming SlideShare
Loading in...5
×
 

Paris Cassandra Meetup - Overview of New Cassandra Drivers

on

  • 1,649 views

 

Statistics

Views

Total Views
1,649
Views on SlideShare
1,614
Embed Views
35

Actions

Likes
0
Downloads
17
Comments
0

2 Embeds 35

https://twitter.com 34
https://si0.twimg.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Paris Cassandra Meetup - Overview of New Cassandra Drivers Paris Cassandra Meetup - Overview of New Cassandra Drivers Presentation Transcript

  • Overview of NewCassandra DriversMichaël FiguièreEngineer & Developer Advocate, DataStax@mfiguiere
  • Past Drivers Architecture Thrift API OO API Thrift RPC Client Library * This is a simplified view of drivers architecture. Details vary from one language to another.©2012 DataStax 2
  • Current Drivers Architecture CQL API Thrift API OO API DB API Thrift RPC Thrift RPC Client Library CQL Driver * This is a simplified view of drivers architecture. Details vary from one language to another.©2012 DataStax 3
  • CQL: the new face of Cassandra • CQL 3 • Simpler Data Model using denormalized Tables • SQL-like query language • Schema definition • CQL Binary Protocol • To be introduced in Cassandra 1.2 (CASSANDRA-2478) • Designed for CQL 3 • Opens doors for Streaming, Notifications, ... • Thrift will keep being supported by Cassandra©2012 DataStax 4
  • New Drivers Architecture DB API CQL API OO API CQL Native Protocol Next Generation Driver * This is a simplified view of drivers architecture. Details vary from one language to another.©2012 DataStax 5
  • Request Pipelining Client Cassandra Without Request Pipelining With Client Cassandra Request Pipelining©2012 DataStax 6
  • Notifications Node Client Node Node Without Notifications With Notifications Node Client Node Node©2012 DataStax 7
  • Java Driver • Reference Implementation • Asynchronous architecture based on Netty • Prepared Statements Support • Automatic Fail-over • Node Discovery • Cassandra Tracing Support • Tunable policies • LoadBalancingPolicy • ReconnectionPolicy •©2012 DataStax RetryPolicy 8
  • Connect and Write Cluster cluster = new Cluster.Builder() .addContactPoints("127.0.0.1", "127.0.0.2") .build(); Session session = cluster.connect(); session.execute( "INSERT INTO user (user_id, name, email) VALUES (12345, johndoe, john@doe.com)" );©2012 DataStax 9
  • Read ResultSet rs = session.execute("SELECT * FROM test"); List<CQLRow> rows = rs.fetchAll(); for (CQLRow row : rows) { String userId = row.getString("user_id"); String name = row.getString("name"); String email = row.getString("email"); }©2012 DataStax 10
  • Asynchronous Read ResultSet.Future future = session.executeAsync("SELECT * FROM test"); ResultSet rs = future.get(); List<CQLRow> rows = rs.fetchAll(); for (CQLRow row : rows) { String userId = row.getString("user_id"); String name = row.getString("name"); String email = row.getString("email"); }©2012 DataStax 11
  • Mapping in Java • JPA • Standard and very popular API • Very relational oriented • Hard for developers to figure out which part is usable • JPA-ish • A mapping API designed for Cassandra • Most annotations borrowed and modified from JPA • Get rid of non relevant components • Add some Cassandra-specific concepts©2012 DataStax 12
  • Object Mapping @Table("user_and_messages") public enum Gender { public class User { @EnumValue("m") @Column("user_id") MALE, private String userId; @EnumValue("f") private String name; FEMALE; } private String email; private Gender gender; }©2012 DataStax 13
  • Sample Data Modeluser_and_messages Table user_id msg_id title body gmason 4 Hello! Give me liberty or give me death gmason 5 Bonjour ! I chopped down the cherry tree ahamilton 7 Hallo ! A government of laws, not men ahamilton 9 ¡Hola I chopped down the cherry tree CQL CREATE TABLE user_and_messages ( user_id varchar, msg_id int, title varchar, body varchar, PRIMARY KEY (user_id, msg_id));©2012 DataStax 14
  • Aggregation user_id msg_id title body gmason 4 Hello! Give me liberty or give me death gmason 5 Bonjour ! I chopped down the cherry tree ahamilton 7 Hallo ! A government of laws, not men ahamilton 9 ¡Hola I chopped down the cherry tree @Table("user_and_messages") public class Message { public class User { private String title; @Column("user_id") private String userId; private String body; } @GroupBy("user_id") private List<Message> messages; }©2012 DataStax 15
  • Inheritance@Table("catalog") @InheritanceValue("tv")@Inheritance({Phone.class, TV.class}) public class TV@InheritanceColumn("product_type") extends Product {public abstract class Product { private float size; @Column("product_id") } private String productId; private float price; private String vendor; private String model;}©2012 DataStax 16
  • Now Available! https://github.com/datastax/java-driver
  • Stay Tuned! blog.datastax.com @mfiguiere