locked
How does BatchSize works in host.json RRS feed

  • Question

  • I have created Azure functions to listen for eventhub and storage queues.

    • FuncQTrigger
    • FuncEventHubTrigger

    We can use Batchsize and MaxBatchSize setting in host.json for above functions respectively.

    Documentation has described these properties as given below:

    Property Default Description
    maxBatchSize 64 The maximum event count received per receive loop.
    batchSize 16 The number of queue messages that the Functions runtime retrieves simultaneously and processes in parallel.

    Question:
    How does this property work, out of given following cases? 

    1. N no. of function instances are created, to process 1 message, where N is BatchSize. OR
    2. Single function instance created to process N no. of messages , where N is BatchSize. 
    Monday, April 8, 2019 7:54 AM

Answers

  • Yes that is correct. The number of instances should multiple based on the size count

    Koushik

    Monday, April 8, 2019 9:55 AM

All replies

  • Hi,

    It is the second case. According to the documentation, trigger-concurrency.

    When the incomming messages are queued then the function instances will multiple based on the batch size mentioned in the hoist file.

    Cheers

    K


    Koushik

    Monday, April 8, 2019 8:07 AM
  • That link says: When there are multiple queue messages waiting, the queue trigger retrieves a batch of messages and invokes function instances concurrently to process them.

    If you want to minimize parallel execution for queue-triggered functions in a function app, you can set the batch size to 1.

    It implies that N no of message are processed using multiple concurrent instances.

    E.g. I have 1000 messages with batch size 50 then 
    1000 messages will be processed by 20 concurrent instances, each processing 50 messages.

    Is my understanding correct?

    Monday, April 8, 2019 9:47 AM
  • Yes that is correct. The number of instances should multiple based on the size count

    Koushik

    Monday, April 8, 2019 9:55 AM