0

We have an azure function node which listens to Eventhub something like below. It seems we have loads of eventHubMessages in production where we are seeing a big lag in time as in we are seeing the logs after 7-8 hours. We are thinking of below options.

->gzip compression on serialized object.

->Have the copy of same node 3-4 times with different function name.

also thinking of below option.

->Is there any maximum limit on string array in below case string[] EventHubMessages

Not sure how much above will be feasible. Any suggestions would be highly appreciated. Thanks in advance.

private static HttpClient httpClient = new HttpClient();

public async static Task Run([EventHubTrigger("EventHubName", Connection = "....", ConsumerGroup =  "...")] string[] EventHubMessages, TraceWriter log)
{

using (var request = new HttpRequestMessage(HttpMethod.Post, string.Format($"NewRelicUrl")))
{
var customObjectList = new List<CustomObject>();

converting each message in to some Object from EventHubMessages and adding them to the customObjectList.

var customObjectListJson = JsonConvert.SerializeObject(customObjectList);

request.Content = new StringContent(json, Encoding.UTF8, "application/json");

var httpResponse = await httpClient.SendAsync(request);
}

}
Vicky
  • 624
  • 2
  • 12
  • 35
  • @Mikhail Shilkov any idea about the above? – Vicky Feb 08 '19 at 21:27
  • Your function is probably not keeping up with the data ingress - i.e. there is more data coming in to your hub that going out, so you fall further behind the latest events and see lag in the downstream systems. Q: How many partitions are in your hub? Q: What are your batch and checkpoint sizes for the function? – Dylan Morley Feb 13 '19 at 16:23
  • we had two partitions in our event hub which we are thinking to increase it to and trying to determine the maximum we can go up to with in 32. batch size was 64 i.e. default one which we are increasing to 256. There is only one consumer group. I have not evaluated how the checkpoint works/use though i know there will be 2 check point with our existing stuff. – Vicky Feb 13 '19 at 16:52
  • Having more than 2 partitions will allow you to scale out your function and increase parallel processing, so try with 16 or 32. 256 sounds sensible for batch size & set prefetch count to 512 (batchSize * 2). Make sure you disable web jobs dashboard, as this has a perf overhead - a good article on this here - https://blogs.msdn.microsoft.com/appserviceteam/2017/09/19/processing-100000-events-per-second-on-azure-functions/. Checkpoints require the function to update blob storage with a new offset value, which again has an overhead - SO answer here - https://stackoverflow.com/a/35470672/1538039 – Dylan Morley Feb 13 '19 at 17:04
  • Few questions. Sorry to trouble you. what happens if we dont do anything with checkpoint and have only one consumerGroup in event hub with partitions as 16/32 and batch count as 256? Also, will there be any effect on throughput with more partitions? We are subscribed to standard tier with 1 MB throughput. – Vicky Feb 13 '19 at 21:04
  • @MikhailShilkov - any idea about the above? – Vicky Feb 13 '19 at 22:54
  • @Dylan Morley Thanks for all the help. Since I am pretty new to event hub and azure, any help would be greatly appreciated. – Vicky Feb 13 '19 at 22:55

0 Answers0