-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in 2.28.6: huge increase in exceptions thrown but caught #5933
Comments
Unfortunately I don't have the bandwidth to do that this month. I used all my spare cycles on bisecting to narrow down the regression to a single release (2.29.52..2.30.0) and it's no longer urgent for us as we pin the version to 2.29. Hopefully with the stack trace you can find somewhere to start? Apologies and thank you. |
The hint we get from the stacktrace is that the exception is coming from parsing the request canonical URI:
Are you overriding the request endpoint, or using the default configuration? |
First of all, apologies that I apparently got the bisecting wrong -- we are down to (2.27.4 .. 2.29.52) instead. I'll see if I can get a better/smaller reproduction to help with my own bisecting, too. And here's another stack trace with line numbers captured from a debugger in 2.29.52
Also, I got the error message: |
Also note that these exceptions are caught by SDK and the requests do succeed in the end |
Oh I think it's https://github.com/aws/aws-sdk-java-v2/releases/tag/2.28.6
And internally within the SDK we got That's really unfortunate. Is there a way for us to turn off account-based endpoint for DynamoDB? |
Hi @Hexcles, Thanks for sharing the insight. For turning off this feature, you may refer to below section from the announcement - #5628
Regards, |
@Hexcles the Java SDK Are you using aws endpoints directly, or using a third-party solution endpoint? |
@debora-ito Let me try to clarify. Everything "works fine"; there's no uncaught exception or any impact on functionalities. However, there is a non-zero impact on performance due to the sharply increased number of exceptions thrown (and caught) from within To repro, you don't even need the SDK; just run the following code in a debugger and set a breakpoint on any exception thrown (including caught): import java.net.URI;
public class Main {
public static void main(String[] args) {
var uri = URI.create("98765432101.ddb.us-east-1.amazonaws.com");
System.out.println(uri);
}
} There's no exception thrown for e.g. |
Oh I see now, thank you for the clarification.
Update: please disregard my strikethrough comment, we'll take a look. Thank you for raising this. |
Hi @Hexcles, Thanks for reporting this issue. I have spent a good amount of time benchmarking (using JMH) the actual impact caused by the account ID endpoint and the results were interesting. When testing URI.create() directly, I can indeed see a degradation in overall performance in terms of %, but the overall impact is still negligible when we are looking at the actual time. The benchmark results show that creating URIs with account IDs is significantly slower than standard URIs, with account ID URIs taking about 3-4 times longer on average (3.218 μs vs 0.830 μs) however translating these units to milliseconds you will have to make 1000 requests per/second to experience an addition of 1ms to the overall execution.
(Using nano seconds here please forgive the change in unit of measurment)
With regards to GC pressure, I used both JMH profiler and Java Flight Recorder to try and profile GC and I'm not seeing any difference in GC between the two scenarios. Are you able to provide us with the profiling setup you have to measure the excessive GC? I'm having a hard time reproducing it on my end. Thanks, |
@RanVaknin thanks for your detailed analysis! I agree with your results. I did some digging, too, and couldn't come up with a standalone repro that can show meaningful performance difference, either. My current best guess is it has something to do with our APM setup. We have a relatively high sample rate for exceptions (including caught ones) in our java agent, which would capture the exception, attach the full stacktrace and error message to the current span (it's a big JSON), and create a profiling event. We usually have <10 exceptions per second, but this pushed our exception rate to >>100 per second (aside: this made many of our internal exception metrics useless/noisy, too -- we otherwise have a good exception hygiene and only use them for truly exceptional cases, which is also why we can get away with a high exception sample rate). And we can't easily exclude this exception as the skip list is by type, and I guess one thing that's not clear to me is the advantage of using this account-specific endpoint. |
The JDK API URI.create can be expensive for some specific cases, this one is caused by the NumberFormatException, I fixed another one caused by URISyntaxException recently. Even w/o the exception URI.create is expensive(We found this in a project helping internal team to optimize service performance) because by default DefaultV4RequestSigner parses URI using URI.create for every single request to normalize URI path, I think URI path normalization can be disabled for DDB client to avoid the expensive URI parsing, just like this PR did for S3. |
Hi @Hexcles, Thanks for the follow up. I definitely agree that the increase in exception caught and thrown is an issue. I have contacted the Corretto team on Amazon to see if they can help with driving an improvement in this JDK's implementation of URI.create().
Unfortunately I was not able to find any public facing announcement from the Dynamodb team, and do not want to share incorrect information so I can't really speak to the why right now. I can only refer you to the official documentation but it doesn't provide the reasoning. Once there is an official public wording about it I will definitely share it here. @pengxiaolong Since we rely on the JDK's URI functionality, this is not actionable by the Java SDK team at the moment. Additionally, because this feature is opt-in, I'm going to downgrade the severity. I'll make sure to keep you posted with any new developments. Thanks, |
Thanks for the detailed response, Ran! Though I should note that this
feature (using account specific endpoint) is opt-out (on by default) not
opt-in.
---
Sent from my cellphone.
…On Sun, Mar 30, 2025, 17:04 Ran Vaknin ***@***.***> wrote:
Hi @Hexcles <https://github.com/Hexcles>,
Thanks for the follow up. I definitely agree that the increase in
exception caught and thrown is an issue. I have contacted the Corretto team
on Amazon to see if they can help with driving an improvement in this JDK's
implementation of URI.create().
I guess one thing that's not clear to me is the advantage of using this
account-specific endpoint.
Unfortunately I was not able to find any public facing announcement from
the Dynamodb team, and do not want to share incorrect information so I
can't really speak to the *why* right now. I can only refer you to the
official documentation but it doesn't provide the reasoning. Once there is
an official public wording about it I will definitely share it here.
@pengxiaolong <https://github.com/pengxiaolong>
Thanks for the additional context. I'll make sure to share it with the
Corretto team. I see there's an existing PR. I hope the JDK team can also
prioritize this work to help out.
Since we rely on the JDK's URI functionality, this is not currently
actionable by the Java SDK team at the moment. Additionally, because this
feature is opt-in, I'm going to downgrade the severity. I'll make sure to
keep you posted with any new developments.
Thanks,
Ran~
—
Reply to this email directly, view it on GitHub
<#5933 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK6ZDFUNCWUTRJ7FTSWG432XCA7DAVCNFSM6AAAAABYNJSDH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRUHAYTMOJQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: RanVaknin]*RanVaknin* left a comment (aws/aws-sdk-java-v2#5933)
<#5933 (comment)>
Hi @Hexcles <https://github.com/Hexcles>,
Thanks for the follow up. I definitely agree that the increase in
exception caught and thrown is an issue. I have contacted the Corretto team
on Amazon to see if they can help with driving an improvement in this JDK's
implementation of URI.create().
I guess one thing that's not clear to me is the advantage of using this
account-specific endpoint.
Unfortunately I was not able to find any public facing announcement from
the Dynamodb team, and do not want to share incorrect information so I
can't really speak to the *why* right now. I can only refer you to the
official documentation but it doesn't provide the reasoning. Once there is
an official public wording about it I will definitely share it here.
@pengxiaolong <https://github.com/pengxiaolong>
Thanks for the additional context. I'll make sure to share it with the
Corretto team. I see there's an existing PR. I hope the JDK team can also
prioritize this work to help out.
Since we rely on the JDK's URI functionality, this is not currently
actionable by the Java SDK team at the moment. Additionally, because this
feature is opt-in, I'm going to downgrade the severity. I'll make sure to
keep you posted with any new developments.
Thanks,
Ran~
—
Reply to this email directly, view it on GitHub
<#5933 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK6ZDFUNCWUTRJ7FTSWG432XCA7DAVCNFSM6AAAAABYNJSDH6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRUHAYTMOJQHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@Hexcles , You are right. I meant to say opt-out. Thanks, |
/### Describe the bug
After upgrading to 2.30.x (we tried both .0 and .25), we see a huge increase in the number of
NumberFormatException
thrown by the SDK from e.g. async DynamoDB request (and potentially others, too). Even though they are caught by the SDK, the sheer number of exceptions caused noticeable increased pressure on GC.Regression Issue
Expected Behavior
No
NumberFormatException
, which is the case in2.29.522.28.5.Current Behavior
Lots of
NumberFormatException
, which is the case in2.30.x2.28.6.Reproduction Steps
Send any async DynamoDB request and either set a breakpoint or use a profiler to observe the caught exceptions.
Possible Solution
No response
Additional Information/Context
A typical stack trace:
AWS Java SDK version used
2.28.6 (also reproduced on 2.29.52, 2.30.0 and 2.30.25)
JDK version used
Temurin OpenJDK 21
Operating System and version
Ubuntu Jammy
The text was updated successfully, but these errors were encountered: