Kannaiyan
Kannaiyan

Reputation: 13025

EventHub Trigger to Functions cardinality with one causing higher timeouts

When I select many with "cardinality" in function bindings, it works fine.

{
  "bindings": [
    {
      "type": "eventHubTrigger",
      "name": "eventHubMessages",
      "direction": "in",
      "path": "sessions",
      "connection": "connectionstring",
      "cardinality": "many",
      "consumerGroup": "group1"
    }
  ],
  "disabled": false
}

when I select "one" in function bindings, getting higher timeouts.

   "cardinality": "one",

When I look at console, I could see there are multiple functions started,

2017-09-12T19:37:49.645 Function started (Id=f0ef1cd5-8331-448e-86c6-84c745bbab13)
2017-09-12T19:37:49.956 Function started (Id=26629395-54b8-4f83-9852-b3d55307318b)

Is cardinality "many" single threaded, and "one" is getting processed parallely. While I have no problem with parallel processing, it brings higher timeouts. or this is a core issue with Functions App?

The total "Function Started", I could see is close to 250. Is scalability manager having issue here?

Upvotes: 3

Views: 2310

Answers (1)

Mike S
Mike S

Reputation: 3169

Cardinality 'one' means that you get one function invocation per EventData payload. 'Many' means that you get a whole batch of EventData[] per invocation. There's some more detail on the wiki at https://github.com/Azure/azure-webjobs-sdk/wiki/EventHub-support

When reasoning about the correctness of your code, you should that function invocations could run in parallel and that batch sizes are random (unless you're very explicitly configuring that). A single batch will likely still run serially.

Upvotes: 2

Related Questions