내용으로 건너뛰기

ProvisionedThroughputExceededException on deleteFaces

0

Hi in ap-southeast-1 I'm trying to call deleteFaces for 1000 faces 1 call in 2 seconds from NodeJS. After 3-th call I get ProvisionedThroughputExceededException exception. but I see that all regions supports 5 requests per second. Even more in documentation i found that i can delete 4096 faces per call. but unfortunately when I'm trying to delete 4096 at ones i get the same exception. could you suggest what i must do to solve the issue. below is the code:

this.deleteFacesFromCollection = async function ({ collectionName, faceIds }) { for (let i = 0; i < faceIds.length; i += 1000) { const chunk = faceIds.slice(i, i + 1000); try { await rekognition.deleteFaces({ FaceIds: chunk, CollectionId: collectionName }).promise(); logger.info( deleteFacesFromCollection: ${chunk.length} faces deleted from ${collectionName} , ); await util.sleep(2000); } catch (error) { if (error.name === 'ProvisionedThroughputExceededException') { await util.sleep(2000); try { await rekognition.deleteFaces({ FaceIds: chunk, CollectionId: collectionName }).promise(); logger.info( deleteFacesFromCollection: ${chunk.length} faces deleted from ${collectionName} , ); } catch (error1) { logger.warn( deleteFacesFromCollection failed to delete faces from collection ${collectionName}. ERROR: ${error1}, ); } } else { logger.warn( deleteFacesFromCollection failed to delete faces from collection ${collectionName}. ERROR: ${error}, ); } } } };

질문됨 5달 전73회 조회
1개 답변
1

When you encounter a ProvisionedThroughputExceededException while using Amazon Rekognition's DeleteFaces operation, it means you've exceeded the throughput limits for your account in that region.

Looking at your code, I can see you're already implementing some best practices like chunking your requests (1000 faces per call) and adding sleep intervals between calls (2 seconds). However, you're still hitting throughput limits.

Here are some suggestions to solve this issue:

  1. Increase the sleep time: Try increasing your sleep interval between calls from 2 seconds to 5 or even 10 seconds to reduce your request rate further.

  2. Implement exponential backoff: Instead of a fixed sleep time, implement an exponential backoff strategy where you progressively increase the wait time between retries.

  3. Reduce batch size: Try reducing your batch size from 1000 faces to a smaller number, such as 500 or 250 faces per request.

  4. Contact Amazon Rekognition: The error message specifically mentions "If you want to increase this limit, contact Amazon Rekognition." You can request a service limit increase through AWS Support if you need higher throughput.

  5. Implement more robust error handling: Your current retry logic only attempts once after a throughput exception. Consider implementing multiple retries with increasing backoff periods.

While the documentation may indicate that you can delete up to 4096 faces per call and make 5 requests per second, these limits might vary based on your specific account settings, region, or other factors. The actual throughput you can achieve might be lower than the documented maximum.
Sources
DeleteFaces - Amazon Rekognition
Amazon Rekognition examples using SDK for .NET - AWS SDK Code Examples
Use DeleteFaces with an AWS SDK or CLI - Amazon Rekognition

답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠