1

I've got a few Webjobs in place, each of which respond to a number of QueueTrigger, e.g.

public static void ProcessMessage([QueueTrigger("XXXXXXX")] string message, TextWriter log)
{
    //processing message
} 

public static void ProcessMessage([QueueTrigger("YYYYYY")] string message, TextWriter log)
{
    //processing message
} 

Should I be separating out each trigger to a separate job? Are there any reasons why continuing on this path is a bad idea, i.e. the more queues it can trigger the less functions get executed due to thread limits?

mathewc
  • 13,312
  • 2
  • 45
  • 53
Flexicoder
  • 8,251
  • 4
  • 42
  • 56
  • 1
    Have a look at this answer http://stackoverflow.com/questions/40273484/azure-ad-web-job-performance-impact-of-multiple-functions-in-the-same-web-job/40295414#40295414 – Thomas Nov 21 '16 at 18:46
  • @Thomas, thank you that was very useful and has made me think about splitting some of them out at least – Flexicoder Nov 22 '16 at 08:13

1 Answers1

3

What you are doing is the common approach - the WebJobs SDK JobHost is designed to handle many different job functions all within the same application. It is true that all the job functions within a single host will share the same process/memory space and limits, but for most scenarios this isn't a problem and is the recommended approach.

For QueueTrigger specifically, each of your functions will efficiently poll for new work, and when work is available each will pull messages in batches of 16 (configurable via JobHostConfiguration.Queues) and process them in parallel.

You can also scale out if needed by increasing the number of instances your WebJob runs on. Each instance will then work cooperatively with the others to handle more load.

mathewc
  • 13,312
  • 2
  • 45
  • 53
  • 1
    Do you have any plan to support `MaxDequeueCount` per trigger instead of the entire jobhost? In my case, this seems to make sense as multiple queues can have distinct dequeue count before poisoning in my pipeline depending on their purpose. – GGirard Jul 20 '17 at 20:57