2
我实现了How to use the Table Storage Service中描述的一些代码。我围绕insert操作创建了一个循环来插入多条记录,我不想做批量插入。我发现插入操作非常慢,不超过6个记录。第二个插入。该代码在包含存储服务的相同订阅中以azure虚拟机运行。有谁知道更快的方式插入记录?我们会定期在我们的系统中持续保存至少100条记录。第二。我的代码如何加速插入Azure表存储?
部分是在这里:
public void InsertCustomer(string tableName, CustomerEntity customer)
{
// Create the table client.
CloudTableClient tableClient = _azureQueueStorageAccount.CreateCloudTableClient();
//Get table reference
CloudTable table = tableClient.GetTableReference(tableName);
// Create the TableOperation that inserts the customer entity.
TableOperation insertOperation = TableOperation.Insert(customer);
// Execute the insert operation.
table.Execute(insertOperation);
}
感谢帕斯卡。但由于某些原因,这里没有描述,我不想做批量插入。你知道我的代码中描述的普通插入应该是这么慢吗?插入的Customer对象是很简单的:
public class CustomerEntity : TableEntity
{
public string Email { get; set; }
public string PhoneNumber { get; set; }
public CustomerEntity(string lastName, string firstName)
{
this.PartitionKey = lastName;
this.RowKey = firstName;
}
public CustomerEntity() { }
}