Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Massive Amount of Event Hub Usage - Errors & Implementation Problems

$
0
0

i've a web api that has to deal with nearly 200 request in a second. The main job of the web api application is:

  • Get the request
  • Go and find the answer from cache system (redis or whatever)
  • Return the result
  • Send that request to azure event hub (for making some hourly calculations)

The last step needs to be done without blocking the answer. The app needs to answer fast but in the mean time it also has to send the request information to azure event hub.

Im now doing this with:

public HttpResponseMessage Post(OurDataModel dataModel)
{
    //1 - Get answer from cache
    var resultData = companyFactory.GetData(dataModel);

    //2 - sending data to Azure Event Hub
    var asyncResult = Task.Run(() => new AzureEventHub().SendData(resultData));
    .....

    //3 return result
    return Request.CreateResponse((HttpStatusCode)responseType.Ok, Json(resultData ).Content);
}

Azure Sender Method:

public async Task<int> SendData(MainModel data)
{
   //Create event list --> result is List<EventData> events
   ...
   EventHubClient eventHubClient = EventHubClient.CreateFromConnectionString(connString);

   client.SendBatch(events);

   client.Close();

   return 1;//I dont know what im doing code :)
}

This implementation does well but not very well actually. It does what is supposed to do that is, answering so many results without delay but, lately im getting so many errors from event hubs. It says;

First Error Message Type:

The operation did not complete within the allocated time 00:00:00 for object tls0. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101

Description: .. 

Exception Details: System.TimeoutException: The operation did not complete within the allocated time 00:00:00 for object tls0. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[TimeoutException: The operation did not complete within the allocated time 00:00:00 for object tls0. For more information on exception types and proper exception handling, please refer to http://go.microsoft.com/fwlink/?LinkId=761101]
   Microsoft.ServiceBus.Common.AsyncResult.End(IAsyncResult result) +371
   Microsoft.ServiceBus.Messaging.AsyncWaiter.End(IAsyncResult asyncResult, TSingleton& result) +49
   Microsoft.ServiceBus.Messaging.SingletonManager`1.EndGetInstance(IAsyncResult asyncResult) +188
   Microsoft.ServiceBus.Messaging.Amqp.<>c.<GetAsyncSteps>b__35_3(OpenLinkAsyncResult thisPtr, IAsyncResult r) +19
   Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) +191

[MessagingCommunicationException: An error occurred during communication with 'events4b.servicebus.windows.net:-1'. Check the connection information, then retry.]
   Microsoft.ServiceBus.Common.AsyncResult.End(IAsyncResult result) +371
   Microsoft.ServiceBus.Messaging.EventHubClient.SendBatch(IEnumerable`1 eventDataList) +121
   Utilities.EventHub.Sender.SendBatchMessages(EventHubClient client, List`1 messages) +178
   Utilities.EventHub.Sender.SendEvents(List`1 messages, String connString) +49

Second Error Message Type:

The operation has timed out.

Description: .. 

Exception Details: System.TimeoutException: The operation has timed out.

Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 
[TimeoutException: The operation has timed out.]
   Microsoft.ServiceBus.Messaging.SingletonManager`1.EndGetInstance(IAsyncResult asyncResult) +354
   Microsoft.ServiceBus.Messaging.Amqp.<>c.<GetAsyncSteps>b__35_3(OpenLinkAsyncResult thisPtr, IAsyncResult r) +19
   Microsoft.ServiceBus.Messaging.IteratorAsyncResult`1.StepCallback(IAsyncResult result) +191

[MessagingCommunicationException: An error occurred during communication with 'events4b.servicebus.windows.net:-1'. Check the connection information, then retry.]
   Microsoft.ServiceBus.Common.AsyncResult.End(IAsyncResult result) +371
   Microsoft.ServiceBus.Messaging.EventHubClient.SendBatch(IEnumerable`1 eventDataList) +121
   Utilities.EventHub.Sender.SendBatchMessages(EventHubClient client, List`1 messages) +178
   Utilities.EventHub.Sender.SendEvents(List`1 messages, String connString) +49

Strangely, it happens every 2-3 days and lasts about 10-15 mins then it goes fine again. These errors by the way 

I have two questions:

  1. Do i need to improve this implementation (Probably yes because it's like fire&forget)? Why? How?

  2. Why im getting these errors?

I hope i made myself clear. Thank you.



Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>