Cassandra batch query vs single insert performance

I am using Cassandra java driver

.

I am getting 150k queries per second which I insert into 8 tables that have different partition keys.

My question is the best way:

  • batch insert into these tables
  • insert one at a time .

I am asking this question because given the size of my query (150k), burst sound looks like the best option, but since all tables have different partition keys, the package looks expensive.

+3


source to share


1 answer


Please check my answer below:

Cassandra batch query performance for tables with different partition keys

Packages are not designed to improve performance. They are used to provide atomicity and isolation.



Batch processing can be efficient for single section writes. But batches are often misused in an attempt to optimize performance. Performance may degrade depending on the batch operation.

https://docs.datastax.com/en/cql/3.3/cql/cql_using/useBatch.html

If these tables do not require data consistency, use a single insert. Individual requests are distributed or propagated as expected (depending on the load balancing policy) between the nodes. If you are concerned about request handling and batch usage, batches will load so many extra work on coordinator nodes that will not be efficient I guess :)

+5


source







All Articles