Tracing allows you to see the path a query takes through the Cassandra cluster. It shows details like which nodes are queried, how long each step takes, and can help identify performance bottlenecks. The tracing information can be accessed via the Java driver, cqlsh, or DevCenter and provides a detailed timeline of query execution. Reviewing traces is recommended during development to catch unexpected query behavior.
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Ā
Software Development with Apache Cassandra
1. CASSANDRA DAY DALLAS 2015
SOFTWARE DEVELOPMENT
WITH CASSANDRA:
A WALKTHROUGH
Nate McCall
@zznate
Co-Founder & Sr.Technical Consultant
http://www.slideshare.net/zznate/soft-dev-withcassandraawalkthrough
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,Australia & USA.
15. Writing Code - Java Driver:
Use the Java Driver
ā¢ Reference implementation
ā¢ Well written, extensive coverage
ā¢ Open source
ā¢ Dedicated development resources
https://github.com/datastax/java-driver/
16. Writing Code - Java Driver:
Existing Spring Users:
Spring Data
Integration
http://projects.spring.io/spring-data-cassandra/
17. 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
18. Writing Code - Java Driver:
Conļ¬guration is Similar to
Other DB Drivers
(with caveats**)
http://www.datastax.com/documentation/developer/java-driver/2.1/common/drivers/reference/clusterConļ¬guration_c.html
19. Writing Cluster - Java Driver - Conļ¬guration:
Major Difference:
itās a Cluster!
20. Writing Code - Java Driver - Conļ¬guration:
Two groups of conļ¬gurations
ā¢ policies
ā¢ connections
60. Writing Code - Java Driver - Inserts and Updates:
LWT:
INSERT INTO vehicle
(vehicle_id, make, model, vin)
VALUES
('VHE-101', 'Toyota','Tercel','1234f')
IF NOT EXISTS;
61. Writing Code - Java Driver - Inserts and Updates:
LWT:
UPDATE vehicle
SET
vin = '123fa'
WHERE
vehichle_id = 'VHE-101'
IF vin = '1234f';
62. Writing Code:
ORM?
Great for basic
CRUD operations
http://www.datastax.com/documentation/developer/java-driver/2.1/java-driver/reference/crudOperations.html
67. Writing Code - Java Driver:
A note about
User Deļ¬ned Types (UTDs)
68. 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
97. 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/
98. Writing Code - Instrumentation via Metrics API:
Run Riemann
locally
http://riemann.io/
115. Writing Code:
LoggingVerbosity
can be changed
dynamically**
** since 0.4rc1
http://www.datastax.com/documentation/cassandra/2.0/cassandra/conļ¬guration/conļ¬gLoggingLevels_r.html
132. Managing Environments - Running Cassandra:
Mesos?
Compelling features, but not quite there
(though it won't be long)
http://mesosphere.github.io/cassandra-mesos/docs/
http://www.datastax.com/2015/08/a-match-made-in-heaven-cassandra-and-mesos
133. Summary:
ā¢ Cluster-level defaults, override in queries
ā¢ Follow existing patterns (it's not that different)
ā¢ Segment your tests and use build proļ¬les
ā¢ Monitor and Instrument
ā¢ Use reference implementation drivers
ā¢ Control your environments
ā¢ Verify any assumptions about failures