+ All Categories
Home > Technology > Cassandra data access

Cassandra data access

Date post: 25-May-2015
Category:
Upload: techblog
View: 2,471 times
Download: 4 times
Share this document with a friend
Description:
from Netherlands Cassandra Users Meet Up 28 May 2013
Popular Tags:
21
Cassandra Data Access in Java
Transcript
Page 1: Cassandra data access

*

Cassandra Data Access in Java

Page 2: Cassandra data access

*

eBuddy use of Cassandra

Page 3: Cassandra data access

*

XMS

Page 4: Cassandra data access

*

● User Data Service● User Discovery Service● Persistent Session Store● Message History● Location-based Discovery

Cassandra ineBuddy Messaging Platform

Page 5: Cassandra data access

*

● Current size of data● 1,4 TiB total (replication of 3x); 467 GiB actual data

● 12 million sessions (11 million users plus groups)

● Almost a billion rows in one column family(inverse social graph)

Some Statistics

Page 6: Cassandra data access

*

Data Access - Overview

Page 7: Cassandra data access

*

Design Objectives

● Data Source Agnostic● Testable● Thread Safe● Strong Typing● Supports “transactions”, i.e. units of work in batch● Efficient Mapping to Application Domain Model● Follows Familiar Patterns (e.g. Spring JDBC Template)

Page 8: Cassandra data access

*

Data Access in Layers

Page 9: Cassandra data access

*

“Operations” Layer

Page 10: Cassandra data access

*

Writing

● Use Generic Typing

● Has Interface(for testability, etc.)

● Handles Exceptions

Page 11: Cassandra data access

*

Reading● Use Mappers

Page 12: Cassandra data access

*

Serializers● Constructed with serializers that convert to types needed by data access layer

Page 13: Cassandra data access

*

Reading

Page 14: Cassandra data access

*

Data Access Layer

Page 15: Cassandra data access

*

Data Access Object● Data Access Object (DAO) is singleton● Transforms from data model to domain model● Operations object configured with serializers to convert from data model to domain model

● Defines the mappers for read operations

Page 16: Cassandra data access

*

Next Steps

Page 17: Cassandra data access

*

CQL3

DataStax:"We believe that CQL3 is a simpler and overall better API for Cassandra than the thrift API is. Therefore, new projects/applications are encouraged to use CQL3"

At eBuddy, we are still using the Thrift API and the Java Hector library.

We are currently looking at CQL3 and whether we want to use it going forward and whether we will "upgrade" existing code.

Page 18: Cassandra data access

*

Structured Data

● Object Mapping Frameworks● Mapped vs. Embedded Objects

● Nested Properties ("path" access)

Page 19: Cassandra data access

*

Object Mapping Frameworks

● Simple mapper frameworks with (some) JPA support● Hector Object Mapper ● Kundera

● Firebrand (not JPA) ● has most features,

e.g supports both embedded and mapped object graphs

https://github.com/impetus-opensource/Kundera

http://github.com/hector-client/hector

http://firebrandocm.org

Page 20: Cassandra data access

*

Hierarchical Properties

● Use DynamicComposites to model keys that have a variable number of components

put(“accounts|msn|x.y.z|sign_in”, “0”);put(“accounts|msn|x.y.z|key”, “value”);

get(“accounts”) --> retrieved as a map:

{"accounts": { "msn": { "x.y.z": { "sign_in": "0", "key": "value" } } } }

● Use a slice query to retrieve properties using partial path:

Page 21: Cassandra data access

*

Questions?

XMSUnlimited messaging. Better. Free.

We're Hiring!

Download XMS now:


Recommended