Upgrade AWD SDK to v2 #838
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request upgrades the AWS SDK used by the SQS backend from github.com/aws/aws-sdk-go (v1) to github.com/aws/aws-sdk-go-v2 (v2).
Motivation
The upgrade addresses a known issue with the v1 SDK’s credentials package that could cause goroutine starvation under load. The root of the problem lies in the synchronous and blocking nature of credential resolution in v1, particularly when multiple goroutines request credentials concurrently (e.g., under high task throughput). This can lead to system-wide delays, increased latency, and even deadlocks in extreme scenarios.
The AWS SDK for Go v2 introduces a redesigned credentials handling mechanism that is significantly more concurrency-friendly, non-blocking, and idiomatic. This change ensures more robust behavior in high-concurrency environments such as distributed task queues.
Changes
• Replaced all references to github.com/aws/aws-sdk-go/service/sqs with the v2 equivalent: github.com/aws/aws-sdk-go-v2/service/sqs.
• Updated config initialization to use the v2 style with config.LoadDefaultConfig.
• Modified request logic to match the new SDK’s API (e.g., sqs.NewFromConfig, updated input/output structs).
Impact
• Improved concurrency: The SQS backend is now more resilient under load due to improved internal handling of AWS credentials.
• Modernization: Keeps the project up to date with the latest AWS Go SDK developments.
• Backward compatibility: This change should remain backward compatible at the application level, though dependency updates are required.