spring-projects / spring-projects/spring-ai

AWS Bedrock, Increased Latency with Large Requests Exceeds Default Timeouts

Open
#3,835 3 comments 0 reactions 1 assignee View on GitHub

@cmiles74 is already working on this.

Since Sep 10, 2025.

bedrock
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
1d 10h
Merged PRs (30d)
5

Description

Expected Behavior

When submitting large requests to Amazon Bedrock or when reading large responses, or when Amazon Bedrock is experiencing issues and is not serving from a region close to me I will experience latency that exceeds the default settings.

Current Behavior

When this occurs, the AWS SDK retries my connection four times and then returns an error which then causes an exception to be thrown.

Presently there are no mechanisms for increasing these timeout values. It would be very helpful if we could set the AWS SDK timeout values through the Spring AI Bedrock configuration (spring.ai.bedrock.aws).

Context

My project used Claude Sonnet 3.5 and we submit requests that are decently sized. On several occasions latency exceeds the 30 second "socket timeout". One hint that this is the issue is that requests are retried four times and it takes about two minutes for the request to throw an exception (4 attempts + 30s = 120s or 2m).

More information on this issue may be found on the AWS website:

https://repost.aws/articles/AR_A_6aqweQYOR5FCgvM2vdA/solving-read-timed-out-error-and-high-latencies-in-amazon-bedrock-with-aws-java-sdk-client

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.