JDK-8028534 : Stack trace building in G1 is more expensive than for Parallel
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: gc
  • Affected Version: hs25
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: linux
  • CPU: x86_64
  • Submitted: 2013-11-18
  • Updated: 2025-03-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Description
Refworkload wls_webapp_atomic JSP_HTTPS_POST_3 throws a lot of exceptions(45,549/s), which seems to be the cause for the slowdown of G1 vs. parallel gc in that benchmark.

According to Scott Oaks, the reason for these exceptions is that this code is checking to see if the client has a certificate or not during SSL setup, and the code that does that throws an exception to indicate that no certificate is present. It turns out that we cannot avoid making that call, so we will have to live with the exceptions. The alternative would be to start the long process to fix the public Java API.

G1 is more expensive generating stack trace since  java_lang_Throwable::fill_in_stack_trace(Handle, methodHandle, Thread*) ultimately calls the barrier methods (e.g. java_lang_Throwable::set_backtrace -> throwable->release_obj_field_put -> oop_store() and likely via other paths), which is slower in G1.

Not building the stack trace, i.e. specifying -XX:-StackTraceInThrowable, performance increases more with g1 than with parallel gc, by 1-2%.
Comments
The necessity of this change may need to be reconsidered after JDK-8342382
20-03-2025

ILW => LHM => P4 Impact: Low, normally not a big problem that creating stack-traces take time. Likelihood: High, occurs always when doing a stack-trace. Workaround: Medium, if it is a big problem it can be improved by -XX:-StackTraceInThrowable.
19-11-2013