Skip to content

High CPU Usage in S3 Java SDK Due to Excessive URL Parsing and Exception Stack Trace Generation During getObject Requests #5846

@jasonstack

Description

@jasonstack

Describe the bug

We are using software.amazon.awssdk:S3:2.29.21: DefaultS3AuthSchemeProvider#resolveAuthScheme seems to parse the String endpoint on every request and catching exceptions when some endpoint rule is mismatched in DefaultS3EndpointProvider#endpointRule64.

This is how we configure the client.

        S3CrtAsyncClient.builder()
                .credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create(accessKey, secretKey))
                .retryConfiguration(b -> b.numRetries(3))
                .checksumValidationEnabled(true)
                .forcePathStyle(true)
                .endpointOverride(URI.create(endpoint));

Attached CPU profile:

Image

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Avoid parsing URL and filing stacktrace on endpoint rule mismatch per request

Current Behavior

Parsing URL on every request and filling stacktrace when endpoint rule mismatches

Reproduction Steps

Run getObjects request

Possible Solution

No response

Additional Information/Context

No response

AWS Java SDK version used

2.29.21

JDK version used

21

Operating System and version

Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.needs-triageThis issue or PR still needs to be triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions