Adding a new technology to your development process can be challenging, and the distributed nature of Apache Cassandra can make it daunting. However the drivers, utilities and tooling now available for Apache Cassandra make this process as familiar as possible to developers, with a few minor caveats. After all, it is still a distributed system.
In this presentation, we will do several quick iterations through a simple Java project, demonstrating the following:
• Creating and modifying a data model
• Writing some code working with this model
• Using your local environment for single and multi-node cluster tests
• Integration testing with Jenkins
• Sending it off to production
New and existing users will leave this presentation with the necessary knowledge to make their next Apache Cassandra-based project a success.
Cassandra Day Atlanta 2015: Software Development with Apache Cassandra: A Walkthrough
1. CASSANDRA DAY ATLANTA 2015
SOFTWARE DEVELOPMENT
WITH CASSANDRA:
A WALKTHROUGH
Nate McCall
@zznate
#CassandraDays
Co-Founder & Sr.Technical Consultant
Licensed under a Creative Commons Attribution-NonCommercial 3.0 New Zealand License
2. AboutThe Last Pickle.
Work with clients to deliver and improve
Apache Cassandra based solutions.
Based in New Zealand & USA.
14. Writing Code:
ORM?
maybe - only if it’s very simple
more later…
http://www.datastax.com/documentation/developer/java-driver/2.1/java-driver/reference/crudOperations.html
20. Writing Code - Java Driver:
Four rules for Writing Code
• one Cluster for physical cluster
• one Session per app per keyspace
• use PreparedStatements
• use Batches to reduce network IO
21. Writing Code - Java Driver:
Configuration is Similar to
Other DB Drivers
(with caveats**)
http://www.datastax.com/documentation/developer/java-driver/2.1/common/drivers/reference/clusterConfiguration_c.html
22. Writing Cluster - Java Driver - Configuration:
Major Difference:
it’s a Cluster!
23. Writing Code - Java Driver - Configuration:
Two groups of configurations
• policies
• connections
27. Writing Code - Java Driver:
A note about
User Defined Types (UTDs)
28. Writing Code - Java Driver - Using UDTs:
Wait.
- serialized as blobs !!?!
- new version already being discussed*
- will be a painful migration path
* https://issues.apache.org/jira/browse/CASSANDRA-7423
29. Writing Code:
Metrics API
for your own code
https://github.com/apache/cassandra/blob/cassandra-2.1/src/java/org/apache/cassandra/metrics/ColumnFamilyMetrics.java
https://dropwizard.github.io/metrics/3.1.0/
30. Writing Code - Instrumentation via Metrics API:
Run Riemann
locally
http://riemann.io/
46. Writing Code:
LoggingVerbosity
can be changed
dynamically**
** since 0.4rc1
http://www.datastax.com/documentation/cassandra/2.0/cassandra/configuration/configLoggingLevels_r.html
81. Testing - Integration - Best Practices:
Vagrant vs. CCMBridge?
• choice of style, really
• developer integration with CM
• what else is in the architecture?
86. Summary:
• Go slowly with bite sized chunks
• Segment your tests and use build profiles
• Monitor and Instrument
• Use reference implementation drivers
• Control your environments
• Verify any assumptions about failures