Develop scalable applications with DataStax Drivers for Apache Cassandra and DataStax Enterprise
Alex Popescu & Bulat Shakirzyanov
© DataStax, All Rights Reserved.
1 Overview of DataStax drivers
2 Load balancing
3 Fault tolerance
4 Address resolution
5 Sneak peek at upcoming features
2
© DataStax, All Rights Reserved.
Goals of DataStax Drivers• Consistent set of features across languages
• Asynchronous execution
• Automatic cluster discovery
• Connection pools and automatic reconnection
• Load balancing
• Fault tolerant
• Address resolution
• Flexible to the core • Consistent terminology
• Cluster -> Session -> PreparedStatement & Statement -> Future or ResultSet
5
Application Driver
Load Balancing
Application Thread
NodePool
SessionPool
Pool
Pool
Application Thread
Application Thread
Client Cluster
Node
Node
Node
Load Balancing
Policy
Datacenter
Datacenter
DataCenter Aware Balancing
Node
Node
NodeClient
Node
Node
Node
Client
Client
Client
Client
Client
Local nodes are queried first, if none are available, the request could be sent to a remote node.
Token Aware BalancingRoute request directly to Replicas
Node
Node
ReplicaNode
Client
Replica
Replica
Uses prepared statement metadata to get the token
Possible Failures
Coordinator
Node Replica
Replica
ReplicaNode
Business Logic
Driver
Application
Invalid Requests
Network Timeouts
Server Errors
Application Driver
Automatic Retry of Server Errors
Application Thread
NodePool
SessionPool
Pool
Pool
Application Thread
Application Thread
Client Cluster
Node
Node
Node
Load Balancing
Policy
Datacenter Datacenter
Multiple Addresses
Node
NodeNode
Node
Client Client
Node
NodeNode
Node
Client Client
Within Datacenter:Private IPs
Across Datacenters:Public IPs
Application Driver
Address ResolutionApplication
Thread NodePool
Cluster
Pool
Pool
Pool
Application Thread
Application Thread
Client Cluster
Node
Node
Node
Address Resolution
Policy
Control Connection
Session