2013-04-11 78 views
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() { } 
} 

回答