user1492051
user1492051

Reputation: 906

creating azure worker rules from a vm

is it possible to start Worker Role Instances dynamically from a c# application running on azure windows vm?

in azure i have a Medium virtual machine, on it there is a c# console application that runs automatically on 11:00PM daily and it keeps processing data until about 7:00AM, my data is getting bigger and thus needs more time to be processed and i need to finish processing all data before 5:00AM.

is it possible to use Worker rule to run an instance of the application an pass it a part of the data to process?

note that my process makes http requests to external websites and the processed data gets written to a mongodb.

i am not sure where to start, and i am not sure if using worker rules is better than creating couple vms.

in general how would you solve this problem with the tools available on azure?

Upvotes: 1

Views: 141

Answers (2)

flytzen
flytzen

Reputation: 7438

For your specific scenario you may want to look at the auto scale rules that are now available; In the configuration for the worker role, in the Azure Management Console, you can specify, for example, that you want at least two workers running between certain times each day.
The Service Management API gives you a lot more control, but the auto scale is quick and easy to start with.

Incidentally, if the work your worker has to do can be divided into atomic chunks, then you may want to use a storage queue to write all the tasks to and then have the worker role pull tasks off that queue. You can then configure the autoscale to monitor the length of the queue and start and stop workers as required.

Upvotes: 1

Gaurav Mantri
Gaurav Mantri

Reputation: 136196

Is it possible to start Worker Role Instances dynamically from a c# application running on azure windows vm?

Absolutely Yes. In order to do so, you would need to consume Service Management API. You could either write code yourself to consume this API or there's a Windows Azure Management Library available to do so which you can install from Nuget. To learn more about this API, you may find this blog post useful: http://www.bradygaster.com/post/getting-started-with-the-windows-azure-management-libraries.

Generally speaking Worker Roles are equivalent to Windows Services in the sense that both are used to perform background tasks. Since you're performing background tasks through your VM, I can't see any reason why you can't do the same though a Worker Role instance. My recommendation would be to go through tutorials available online or Windows Azure Platform Training Kit to become familiar with Worker Role concepts and how you could make use of them in your project.

Upvotes: 3

Related Questions