SOLVED

ComputerVision throttling problem

%3CLINGO-SUB%20id%3D%22lingo-sub-334533%22%20slang%3D%22en-US%22%3EComputerVision%20throttling%20problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-334533%22%20slang%3D%22en-US%22%3E%3CP%3EHi!%3C%2FP%3E%3CP%3EI%20have%20a%20ComputerVision%20resource%20in%20Azure%2C%20which%20I%20use%20with%20my%20subscription%20credit%20for%20development.%20The%20maximum%20allowed%20plan%20is%20S1%2C%20which%20allows%20up%20to%2010%20calls%20per%20second.%3C%2FP%3E%3CP%3EI%20have%20a%20WebJob%20to%20analyze%20a%20picture%2C%20and%20when%20I%20run%20it%20locally%2C%20it%20works%20perfectly%20fine.%20But%20when%20I%20run%20it%20in%20Azure%2C%20I%20get%20a%20'TooManyRequests'%20Exception.%3C%2FP%3E%3CP%3EAnyway%2C%20I'm%20just%20running%20a%20single%20call%20at%20once%20for%20testing%20purposes%2C%20but%20still%20I%20run%20into%20throttling.%3C%2FP%3E%3CP%3EAny%20idea%20how%20I%20can%20analyze%20better%20what's%20happening%3F%20Or%20does%20anyone%20know%20if%20a%20single%20call%20to%20ComputerVisionClient.RecognizeTextAsync%20produces%20more%20than%20one%20call%20to%20the%20API%3F%20This%20could%20explain%20it%2C%20because%20running%20it%20locally%20means%20a%20much%20slower%20connection%20to%20the%20API.%26nbsp%3B%3C%2FP%3E%3CP%3EAh%2C%20there%20is%20a%20mayor%20difference.%20When%20running%20locally%20I%20send%20a%20stream.%20But%20when%20running%20in%20Azure%2C%20I%20send%20an%20AzureBlobStorage%20url%20with%20SAS.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-334533%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3ECognitive%20Services%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-355421%22%20slang%3D%22en-US%22%3ERe%3A%20ComputerVision%20throttling%20problem%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-355421%22%20slang%3D%22en-US%22%3ETo%20finally%20close%20this...%20I%20wasn't%20aware%20of%20the%20internals%20of%20the%20library%20I'm%20using.%20But%20to%20get%20the%20results%20from%20the%20cognitive%20service%2C%20we%20have%20to%20poll%2C%20which%20was%20happening%20much%20faster%20in%20Azure%2C%20so%20it%20didn't%20run%20into%20throttling%20locally.%20Not%20the%20most%20elegant%20solution%2C%20but%20it%20works.%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi!

I have a ComputerVision resource in Azure, which I use with my subscription credit for development. The maximum allowed plan is S1, which allows up to 10 calls per second.

I have a WebJob to analyze a picture, and when I run it locally, it works perfectly fine. But when I run it in Azure, I get a 'TooManyRequests' Exception.

Anyway, I'm just running a single call at once for testing purposes, but still I run into throttling.

Any idea how I can analyze better what's happening? Or does anyone know if a single call to ComputerVisionClient.RecognizeTextAsync produces more than one call to the API? This could explain it, because running it locally means a much slower connection to the API. 

Ah, there is a mayor difference. When running locally I send a stream. But when running in Azure, I send an AzureBlobStorage url with SAS. 

1 Reply
Highlighted
Best Response confirmed by Stefan81 (New Contributor)
Solution
To finally close this... I wasn't aware of the internals of the library I'm using. But to get the results from the cognitive service, we have to poll, which was happening much faster in Azure, so it didn't run into throttling locally. Not the most elegant solution, but it works.