I'm building app to measure NoSQL databases performance and I have a problem to batch insert a large amount of data, in the Cassandra database.
When I'm trying to batch insert more then 1000 records, using DataStax C# driver, I get an AggregateException.
This is my data model:
public Guid Id { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public int Year { get; set; }
public string Genres { get; set; }
public int Rating { get; set; }
public string OriginalLanguage { get; set; }
public string ProductionCountry { get; set; }
public int VotingsNumber { get; set; }
And this is my code:
private string InsertData(ISession session, List<Movie> moviesList)
{
var table = session.GetTable<Movie>();
table.CreateIfNotExists();
var batch = session.CreateBatch();
foreach (var record in moviesList)
{
batch.Append(table.Insert(record));
}
Stopwatch watch = new Stopwatch();
watch.Start();
batch.Execute();
watch.Stop();
return watch.ElapsedMilliseconds.ToString();
}
Can someone explain to me what I'm doing wrong?