Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra

Successfully reported this slideshow.

Seattle Cassandra Users: An OSS Java Abstraction Layer for Cassandra
Casquatch
Josh Turner, June 26th, 2019
Public
2
Who?
Public
3Public
 Josh Turner
 Principal Engineer @ T-Mobile
 Distributed Data Systems
Lead
 Software Development
Engineering
/...
4
Why?
Public
55
 Moving from Oracle™ to Cassandra
 High Learning Curve
 Complex Configuration
 Duplicated Code
 Missing Enterprise...
66
 Versatile Framework
 Reduces Learning Curve
 Success Internally In T-Mobile
 Because We Can. #UnCarrier
Why share ...
77
 Cassandra Is A Name!
 Researched Nicknames
 Sasquatch Is Our Local Legend
 Casquatch Is Born!
Why Casquatch?
Public
8
What?
Public
9
 Distributed, wide column store,
NoSQL Database
 Masterless Architecture
 Tunable Consistency / AP Design
 Query Lan...
10
 Cassandra Made Easy!
 Java Abstraction Layer For Cassandra
 Pre-tuned For Enterprise Best
Practices
 Object Orient...
11
 Load Balancing / Geo Redundancy
 Connection Pooling
 Reconnection & Retry Policy
 Data Caching
 Workload Filterin...
12
Architecture
Java Application
DSE
Drive
r
Cassandra
Casquatch
POJ
Os
DSE
Object
Mapper
Public
13
 Open Source Only Model
 T-Mobile Open Source Group
 https://opensource.t-mobile.com
 Project Casquatch
 https://g...
14
 We recognize that there is a wide range of
platforms, and T-Mobile can't address them
all. This is why we open source...
15
 03/05/2018 – 1.0 Internal Release
 04/05/2018 – 1.1 Release
 06/22/2018 – 1.2 Release Open
Sourced!
 09/17/2018 – ...
16
How?
Public
1717
 We started with Spring Data
 All the testing went great… Until
production
 We didn’t know what we didn’t
know…
 ...
1818
 Spring Data
 No High Availability
 No Retry
 Non Industry Best Practices
 Casquatch
 Highly Available
 Automa...
1919
 Spring Data - Developer Effort
 ~150 Lines For Basic Configuration
 ~100 Lines Per Table
 ~10 Tables Per App
 C...
2020
 Command Line Interface
 Driven by Table Metadata
 Annotated Objects
 Customizable
Code Generator
Public
2121
 Hosted by Sonatype
 Available in Maven Central
 Include in pom.xml
Maven
Public
2222
 Optional Spring Boot Integration
 Add Import to Application.java
 Dependency Injection
Spring Boot Integration
Pu...
2323
 Skip Spring Boot
 Builder Pattern
 CassandraDriver.builder().withUsern
ame() … .build()
 All properties are avai...
24
SHOW ME!
Public
25Public
 Standard
application.properties
 The Basics
 Credentials, Contact Points,
Keyspace, etc
 The Advanced
 Conn...
26Public
 Skip Spring Boot and Do It Yourself
 The Basics
 Credentials, Contact Points,
Keyspace, etc
 The Advanced
 ...
27Public
 Create a Cassandra Table
 Columns use _ for spaces
 Supports all data types
 Supports UDT
Create Schema:
Cod...
28Public
 Run the code generator
 Read in settings on command line
or from properties file
 Configurable options
 More...
29Public
 Custom Package
 Only Required Imports
Get Some Code: tableName.java
Code For Demonstration Purposes Only
30Public
 Comments
 Full CQL
 Annotated
Get Some Code: tableName.java
Code For Demonstration Purposes Only
31Public
 JavaDoc
 Constructors
 Getters and Setters
Get Some Code: tableName.java
Code For Demonstration Purposes Only
32Public
 Package option creates pom.xml
 Snippet shorted for slide
 Complete Artifact
Get Some Code: pom.xml
Code For ...
33Public
 T getById(Class<T> c, T o) : Get by passing an object instance with the key
populated.
 void save(Class<T> c, ...
34
Sneak Peak!
The Following FunctionalityIs Not Final
Public
35Public
 Run the code generator with a –
dao
 Generate the Data Access Object
 REST APIs
 Deployable Microservice
 U...
36Public
 Swagger UI Integration
 Basic Casquatch APIs exposed
 Wrapped in Request/Response
payload objects
 Simple JS...
3737 Public
DAO - Exists
Code For Demonstration Purposes Only
3838 Public
DAO - Save
Code For Demonstration Purposes Only
3939 Public
DAO - Get
Code For Demonstration Purposes Only
40Public
 Utilizes generic
AbstractCassandraDAO
 Easily extensible
 Adjust URL through annotation
DAO - Implementation
...
41Public
 Thin wrapper
 Consistent Request/Response
objects
 Functionality Mirrors Casquatch
API
DAO - Implementation
C...
ClosingSlides
LET’S
TALK
ClosingSlides

Upcoming SlideShare

Loading in …5

×

  • Be the first to like this

  1. 1. Casquatch Josh Turner, June 26th, 2019 Public
  2. 2. 2 Who? Public
  3. 3. 3Public  Josh Turner  Principal Engineer @ T-Mobile  Distributed Data Systems Lead  Software Development Engineering /turnerjosh /tdl-jturner Who am I & Where do I come from?
  4. 4. 4 Why? Public
  5. 5. 55  Moving from Oracle™ to Cassandra  High Learning Curve  Complex Configuration  Duplicated Code  Missing Enterprise Best Practices Why build it? Public
  6. 6. 66  Versatile Framework  Reduces Learning Curve  Success Internally In T-Mobile  Because We Can. #UnCarrier Why share it? Public
  7. 7. 77  Cassandra Is A Name!  Researched Nicknames  Sasquatch Is Our Local Legend  Casquatch Is Born! Why Casquatch? Public
  8. 8. 8 What? Public
  9. 9. 9  Distributed, wide column store, NoSQL Database  Masterless Architecture  Tunable Consistency / AP Design  Query Language : CQL What is Cassandra? Public
  10. 10. 10  Cassandra Made Easy!  Java Abstraction Layer For Cassandra  Pre-tuned For Enterprise Best Practices  Object Oriented Code Generation  Simple Object Based API  Java Spring Boot Framework Integration What is Casquatch? Public
  11. 11. 11  Load Balancing / Geo Redundancy  Connection Pooling  Reconnection & Retry Policy  Data Caching  Workload Filtering  Security What do I get? Public
  12. 12. 12 Architecture Java Application DSE Drive r Cassandra Casquatch POJ Os DSE Object Mapper Public
  13. 13. 13  Open Source Only Model  T-Mobile Open Source Group  https://opensource.t-mobile.com  Project Casquatch  https://github.com/tmobile/casquatch  JavaDocs  https://tmobile.github.io/casquatch/ Open Source Public
  14. 14. 14  We recognize that there is a wide range of platforms, and T-Mobile can't address them all. This is why we open sourced Casquatch -- we hope the community will be able to expand how Casquatch is used. As with any tool, consult with your IT department before using in production.  All code samples included are for demonstration purposes only.  Licensed under Apache 2.0  https://www.apache.org/licenses/LICENSE-2.0 Open Source Public
  15. 15. 15  03/05/2018 – 1.0 Internal Release  04/05/2018 – 1.1 Release  06/22/2018 – 1.2 Release Open Sourced!  09/17/2018 – 1.3 Release  05/01/2019 – 1.4 Release Project History Public
  16. 16. 16 How? Public
  17. 17. 1717  We started with Spring Data  All the testing went great… Until production  We didn’t know what we didn’t know…  Tried to fix Spring  Decided to build and integrate How did I get here? Public
  18. 18. 1818  Spring Data  No High Availability  No Retry  Non Industry Best Practices  Casquatch  Highly Available  Automatic Retry  Follows Industry Best Practices  Savings  Significant reduction in support and design cost  Highly Reliable Architecture How does it compare? Public
  19. 19. 1919  Spring Data - Developer Effort  ~150 Lines For Basic Configuration  ~100 Lines Per Table  ~10 Tables Per App  Casquatch - Developer Effort  ~10 lines of code  Savings  1100+ lines of code and days of developer time for each application How muchdo I have to write? Public
  20. 20. 2020  Command Line Interface  Driven by Table Metadata  Annotated Objects  Customizable Code Generator Public
  21. 21. 2121  Hosted by Sonatype  Available in Maven Central  Include in pom.xml Maven Public
  22. 22. 2222  Optional Spring Boot Integration  Add Import to Application.java  Dependency Injection Spring Boot Integration Public
  23. 23. 2323  Skip Spring Boot  Builder Pattern  CassandraDriver.builder().withUsern ame() … .build()  All properties are available If You BuildIt… Public
  24. 24. 24 SHOW ME! Public
  25. 25. 25Public  Standard application.properties  The Basics  Credentials, Contact Points, Keyspace, etc  The Advanced  Connection Limits, LoadBalancing, Timeout, SSL, etc  Many More in README.md Spring Boot Configuration: Code For Demonstration Purposes Only
  26. 26. 26Public  Skip Spring Boot and Do It Yourself  The Basics  Credentials, Contact Points, Keyspace, etc  The Advanced  Connection Limits, LoadBalancing, Timeout, SSL, etc  Many More in API Docs Builder Pattern: Code For Demonstration Purposes Only
  27. 27. 27Public  Create a Cassandra Table  Columns use _ for spaces  Supports all data types  Supports UDT Create Schema: Code For Demonstration Purposes Only
  28. 28. 28Public  Run the code generator  Read in settings on command line or from properties file  Configurable options  More in README.md Create Some Code: Code For Demonstration Purposes Only
  29. 29. 29Public  Custom Package  Only Required Imports Get Some Code: tableName.java Code For Demonstration Purposes Only
  30. 30. 30Public  Comments  Full CQL  Annotated Get Some Code: tableName.java Code For Demonstration Purposes Only
  31. 31. 31Public  JavaDoc  Constructors  Getters and Setters Get Some Code: tableName.java Code For Demonstration Purposes Only
  32. 32. 32Public  Package option creates pom.xml  Snippet shorted for slide  Complete Artifact Get Some Code: pom.xml Code For Demonstration Purposes Only
  33. 33. 33Public  T getById(Class<T> c, T o) : Get by passing an object instance with the key populated.  void save(Class<T> c, T o) : Save by passing an object instance.  void delete(Class<T> c, T o): Delete by passing an object instance with the key populated Use The Code: Code For Demonstration Purposes Only
  34. 34. 34 Sneak Peak! The Following FunctionalityIs Not Final Public
  35. 35. 35Public  Run the code generator with a – dao  Generate the Data Access Object  REST APIs  Deployable Microservice  Unit Tested with Mockito Generate a DAO Code For Demonstration Purposes Only
  36. 36. 36Public  Swagger UI Integration  Basic Casquatch APIs exposed  Wrapped in Request/Response payload objects  Simple JSON interface  Clean error messaging and status codes DAO - Swagger Code For Demonstration Purposes Only
  37. 37. 3737 Public DAO - Exists Code For Demonstration Purposes Only
  38. 38. 3838 Public DAO - Save Code For Demonstration Purposes Only
  39. 39. 3939 Public DAO - Get Code For Demonstration Purposes Only
  40. 40. 40Public  Utilizes generic AbstractCassandraDAO  Easily extensible  Adjust URL through annotation DAO - Implementation Code For Demonstration Purposes Only
  41. 41. 41Public  Thin wrapper  Consistent Request/Response objects  Functionality Mirrors Casquatch API DAO - Implementation Code For Demonstration Purposes Only
  42. 42. ClosingSlides LET’S TALK
  43. 43. ClosingSlides

×