I have Azure Worker Role and Web Role with ExtraSmall Instance.
I m passing Service Bus BrokeredMessage to update entity from Azure Web Role.
I just tested with updating entity, It took 5 seconds to reflect in the database for first three times.
after that it took more than 30 seconds for each updates. I don’t know why the performance is not consistent in Azure Worker Role? If Anybody knows Please share your thoughts.
I m sending and receiving messages synchronously.
Note: Worker role, I m connecting the database for each updates
Code sample WorkerRole class
public override void Run()
{
while (true)
{
receivedmsg = CUDClient.Receive();
UpdateProjectEntity(receivedmsg);
Thread.Sleep(1000);
}
}
private void UpdateProjectEntity (BrokeredMessage msg)
{
ProjectModel model = msg.GetBody<ProjectModel>();
//connect federation database
CrmEntities _db = Azure.ConnectCustomerEntity(model.ShardId);
//update entities
....
}
This is basically Synchronous receive message, thats why slow. I converted in to Aynchronous Receive message, The performance is excellent. See the post here
Azure Worker Role Asynchronous Receive message: how long I should put the sleep for? (milliseconds)