hi,
Background: The purpose for the app is to find out ServiceBus event hub's max capacity for reading/writing messages.
environment: 2 senders which sending batch of data per 10 seconds to the event hub, while 2 receivers are receiving messages from the event hub, then either insert into table storage/ blob storage. (also the reading/writing capacity to storage will be found out.)
each sender: current environment settings: total devices =500, total tags=50000, sample rate=10 seconds
it means 500 commit per 10 seconds, each commit contains 100 columns which is 17482 bytes in total.
however, after almost 3 mins, the log shows below ServerBusyException.
My question is what the root cause for the throttled.
Here is the log
[2016-05-04 02:41:55,751] 1 -- INFO -- LogInfo [WriteLog] -- step 2: Launch agent instances to submit data.........
...............................
[2016-05-04 02:44:11,151] 3 -- ERROR -- LogError [WriteLog] -- Submit data failed.
Microsoft.ServiceBus.Messaging.ServerBusyException: The request was terminated because the entity is being throttled. Error code : 50002. Please wait 4 seconds and try again. TrackingId:a30dd90a000066430007ba7457296147_G18_B5, Reference:b315d19a-405a-49d9-b118-f72e820b8e2e,
Timestamp:5/4/2016 2:44:09 AM
at Microsoft.ServiceBus.Common.AsyncResult.End[TAsyncResult](IAsyncResult result)
at Microsoft.ServiceBus.Messaging.MessageSender.EndSendEventData(IAsyncResult result)
at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
Here is the C# code
EventHubClient client = EventHubClient.CreateFromConnectionString( ServiceBusSettings.ServiceBusConnectionString, ServiceBusSettings.DefaultTagvalueEventHubName); string dataStr = string.Empty; try { client.RetryPolicy = RetryPolicy.Default; dataStr = JsonConvert.SerializeObject(data); //LogHelper.WriteLog(string.Format("each message = {0} bytes", dataStr.Length)); var dataInByte = Encoding.UTF8.GetBytes(dataStr); var eventData = new EventData(dataInByte) { PartitionKey = data.CollectionGroupKey }; await client.SendAsync(eventData); await client.CloseAsync(); tagsCount.AddCount(data.Samples.Sum(s => s.TagValues.Count())); LogHelper.WriteLog(string.Format("Submitted total {0} tags.", tagsCount.TagsCount)); } catch (Exception ex) { if (!client.IsClosed) { client.Abort(); } LogHelper.WriteLog(string.Format("Submit data failed. current data size ={0} bytes.", dataStr.Length), ex); }