
Explanation:
Why Option B is correct:
Adaptive retry strategy with exponential backoff and jitter: This addresses transient service errors during peak usage periods by gradually increasing wait times between retries, preventing overwhelming Amazon Bedrock with immediate retries.
Circuit breaker pattern: This adapts to changing service availability by temporarily disabling retries when error rates exceed thresholds, preventing cascading failures and allowing the service to recover.
Streaming response handler with intelligent resume: This specifically handles broken response chunks by buffering successfully received chunks and resuming from the last received chunk, ensuring complete responses even with intermittent timeouts.
Comprehensive approach: The solution addresses all requirements: transient error handling, prevention of service overload, adaptation to changing availability, and support for response streaming.
Why Option A is incorrect:
Why Option C is incorrect:
Key AWS Best Practices Applied:
Ultimate access to all questions.
No comments yet.
A company is building a generative AI (GenAI) application that uses Amazon Bedrock APIs to process complex customer inquiries. During peak usage periods, the application experiences intermittent API timeouts that cause issues such as broken response chunks and delayed data delivery. The application struggles to ensure that prompts remain within token limits when handling complex customer inquiries of varying lengths. Users have reported truncated inputs and incomplete responses. The company has also observed foundation model (FM) invocation failures.
The company needs a retry strategy that automatically handles transient service errors and prevents overwhelming Amazon Bedrock during peak usage periods. The strategy must also adapt to changing service availability and support response streaming and token-aware request handling.
Which solution will meet these requirements?
A
Implement a standard retry strategy that uses a 1-second fixed delay between attempts and a 3-retry maximum for all errors. Handle streaming response timeouts by restarting streams. Cap token usage for each session.
B
Implement an adaptive retry strategy that uses exponential backoff with jitter and a circuit breaker pattern that temporarily disables retries when error rates exceed a predefined threshold. Implement a streaming response handler that monitors for chunk delivery timeouts. Configure the handler to buffer successfully received chunks and intelligently resume streaming from the last received chunk when connections are re-established.
C
Use the AWS SDK to configure a retry strategy in standard mode. Wrap Amazon Bedrock API calls in try-catch blocks that handle timeout exceptions. Return cached completions for failed streaming requests. Enforce a global token limit for all users. Add jitter-based retry logic and lightweight token management.
D
Set Amazon Bedrock client request timeouts to 30 seconds. Implement client-side load shedding. Buffer partial results and stop new requests when application performance degrades. Set static token usage caps for all requests. Configure exponential backoff retries, dynamic chunk sizing, and context-aware token limits.