Sunil Sharma
Sunil Sharma

Reputation: 21

Cassandra - "Batch is too large" exception

We are using Cassandra batch statement to persist data. We are getting "Batch too large" exception. I understand that data in batch size is exceeding the batch size fail threshold. I need help in calculating the size of the batch. Is there any way we can find out what is the exact size of data passed in batch?

Upvotes: 2

Views: 1195

Answers (1)

Erick Ramirez
Erick Ramirez

Reputation: 16293

There isn't a simple way for an end-user to calculate the size of a batch because it's based on the serialised size of all the mutations in the batch.

A complicating matter is that batch mutations could be any combination of INSERT, UPDATE, DELETE of any combination of columns, row or partition.

As a side note in case you're not already aware, CQL batches are not an optimisation compared to use of batches in RDBMS as I've discussed in https://community.datastax.com/questions/5246/. CQL batches should only be used to keep related partitions in sync across denormalised tables as I've explained in https://community.datastax.com/articles/2744/. Cheers!

Upvotes: 1

Related Questions