Multiple Instances of Continuous Webjob in Azure, How is It Working?

Hello,

In this post I would like to explain the multiple instance of a continuous WebJob in Azure.

For this test, I made a simple WebJob which listens on a Storage Queue (pushqueue) and logs into another Queue (retrievequeue):

  • The hostname
  • The thread ID which process the message.

I created a WebApp with 3 instances and I deployed my WebJob on it. This is important to deploy with the new portal, because only the new portal of Azure allow you to deploy your job on all instances (https://portal.azure.com ).

I pushed 400 messages on the queue and I got the result below:

Hostname Thread ID
RD000D3A21F555
6
10
11
12
13
14
15
16
17
18
19
20
21
24
25
RD000D3A21F68F
6
10
11
12
13
14
16
17
18
19
20
21
22
23
24
RD000D3A21FCF7
6
9
11
12
13
14
15
16
17
19
20
21
22
23
24
25
26
28
29

Total of Thread / Hostname:

RD000D3A21F555: 15 threads

RD000D3A21F68F: 15 threads

RD000D3A21FCF7: 19 threads

A thread is processing only one message, meaning that an instance can process simultaneously a number of message corresponding of the number of thread.

When a thread finished to process the message, it will automatically take/process another message in the queue.

Azure will scale and dispatch your messages between your instances. You don’t have to take care about that.

Advertisements
This entry was posted in Azure and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s