visual studio 2010 - What is causing Thread Contentions with my Azure Queue code? -


I just ran a Visual Studio 2010 Thread Profiler against my Azer code and saw that I got a lot of controversy, my code was running More often than is blocked!

There is no custom threading argument in my worker. This is a simple while loop that asks different queues if they have work. I make an example of QueueRepositoryClass and then I invite the GetQuueueMessage function.

It seems that for some reason many threads are killing my GetQueueMessage method and are using the same Qi client instance. Maybe it's a result of me rusing the CloudStorageAccount object? Or is this the CreateCloudQueueClient extension method?

This is partly speculative, without seeing the calling code, but it will appear that you receive GetMessage () Are calling in a tight loop. GetMessage is a synchronous call, by doing so waiting for a response from the queue (continuing to run other threads) that specific thread will be blocked automatically in a profiler, this is actually a bad b / c rest loop logic so much Immediately executes (i.e. you spend an MS or two execution code and receive 50 MS messages, will look exactly the same way).

Another note, you need to inquire from the queue in tight corners for several reasons:

1) Although the cost per tax is small, it is not 0. I usually give some suggestions to stop the argument - that is, if the queue is empty, wait 100ms before checking again. Empty twice, go back to 500 mms, etc. Obviously, you have to balance the W / user experience that you are going for. 2) If you end up scaling the application - you can effectively damage a perf to a DoS attack queues 100 pounds of a queue pounding in a tight loop really.

Pat


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -