Working with multi-workload clusters
There are several different ways to query the data stored in DataStax Enterprise (DSE), above and beyond that of Apache Cassandra™. These access patterns are enabled by what are known as workloads in DSE. The DataStax drivers can query clusters with different workload types. Below are the different workloads that DSE offers to extend a multi-model experience to developers.
When developing an application, each workload type requires different techniques to effectively leverage the use case covered by the workload.
Before creating applications, study and understand the DSE deployment architecture. Developers need to know which datacenters make up a DSE cluster and the supported workloads to direct the different types of queries to the appropriate datacenter.
For example, to use a solr_query in the application, the target datacenter must have DSE Search enabled. To execute graph traversals from the application, the connected datacenter must have DSE Graph enabled. Transactional queries can typically be made against any datacenter, as this core functionality is present for all workloads.
The DataStax drivers expose load balancing policies as a means to steer from the application. The load balancing policy can be supplied in the execution profiles or while configuring the driver cluster and session objects. Use the datacenter-aware policy to restrict queries to a specified datacenter.
Execution profiles
For the drivers that support execution profiles, define separate profiles for the different workloads used in the application.
For example, if there are two datacenters, one with DSE Search enabled and one with DSE Core only, use a SearchExecutionProfile
to direct the DSE Search queries to the DSE Search datacenter.
For the SearchExecutionProfile
, pass the DSE Search datacenter as the local datacenter in the DCAware
load balancing policy.
This profile can then be passed to all execution methods that use DSE Search indexes in the queries.
These queries will be directed to the datacenter that supports DSE Search workloads.
Driver instance per workload
For drivers that do not support execution profiles, use separate driver instances for the different workloads used in the application.
This is similar to the execution profile mechanics except that the local datacenter is passed to the load balancing policy when creating the driver instance.
For example, create a SearchSession
with the DSE Search datacenter configured as the local datacenter in the load balancing policy.
Use this SearchSession
in the application for all queries that use DSE Search indexes.
DSE Graph
DSE Graph queries are supported in the DataStax drivers through dedicated graph methods. We strongly recommend using the DSE Graph Fluent API (similar to TinkerPop’s ByteCode API) to execute graph queries. The String API is also available (similar to TinkerPop’s Script API) for the drivers that do not support the Fluent API.
DSE Analytics
DSE Analytics queries are supported by these drivers: