Poi*_*ess 2 c# cassandra batch-insert datastax
我正在构建应用程序以测量NoSQL数据库性能,我在Cassandra数据库中批量插入大量数据时遇到问题.
当我尝试批量插入超过1000条记录时,使用DataStax C#驱动程序,我得到一个AggregateException.
这是我的数据模型:
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; }
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
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();
}
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释我做错了什么吗?
| 归档时间: |
|
| 查看次数: |
2016 次 |
| 最近记录: |