Jack
Jack

Reputation: 455

The fastest way to fill test data to cassandra unit?

I'm using cassandra unit for testing in my project (Java) and it's great but the problem is:loading test data takes quite a long time (100 secs for ~25 000 plain inserts).

I have some ideas but they don't seem to be feasible for cassandra unit:

Do you have other ideas? Thanks.

Upvotes: 1

Views: 695

Answers (1)

Alexis Wilke
Alexis Wilke

Reputation: 20790

The way to load up a lot of data all at once is to use the unlogged batch mechanism:

BEGIN UNLOGGED BATCH
INSERT INTO ...;
INSERT INTO ...;
INSERT INTO ...;
...
APPLY BATCH;

It may not be fast, but for test purposes it should not be a problem and you should avoid timeouts that a straight set of INSERT will likely generate (because you fill up the log file and Cassandra stops accepting data for a while after that.)

Upvotes: 1

Related Questions