1
votes

I have a single node Cassandra database running with all data stored using one table. In this table I have the data split up using partition keys and clustering keys. Can I query this table, using a Java based client, to read from each partition in parallel?

On my client I want to start four threads where each thread will query the single Cassandra table simultaneously with a simple query -> 'select * from tablename where column1 = partitionID'

I realise it is much better to implement a Cassandra cluster but at the moment it is essential to use a single node system.

1

1 Answers

1
votes

Use Java Driver to access Cassandra from your java clients.

As per Cassandra architecture, your single Cassandra table will be distributed among nodes in the cluster(cluster setup is obvious) with multiple partitions and partition's copies(replicas). Contacting to one of the replica for required data(upon running your query) will be handled by the java-driver itself and its configurable cluster policies.

Quoting from this tutorial doc, - " If a node receives a read or write owned on another node, it will coordinate that request for the client. We can use a load balancing policy to control that action. The TokenAwarePolicy ensures that the request will go to the node or replica responsible for the data indicated by the primary key. It is wrapped around DCAwareRoundRobinPolicy to make sure the requests stay in the local datacenter. "

Hope it will help !!