Stack walking performance issue

Amir Hadadi amirhadadi at
Sun Mar 17 21:18:13 UTC 2019

Well, there's a different org.apache.logging.log4j.util.StackLocator class which is geared for Java 9:

That one is using Java 9 StackWalker API, is not deprecated and is the one actually used in my case.
log4j is working fine BTW.
From: Peter Booth <peter_booth at>
Sent: Sunday, March 17, 2019 10:46 PM
To: Amir Hadadi
Cc: zgc-dev at
Subject: Re: Stack walking performance issue

The comments within org.apache.logging.log4j.util.StackLocator say that the class is deprecated in java 8 and doesn’t work in java 9. Do you see *any* log4j output? If it were me, I’d disable log4j.

Sent from my iPhone

> On Mar 17, 2019, at 10:43 AM, Amir Hadadi <amirhadadi at> wrote:
> We've encountered the following performance issue which happens on an instance deployed in docker with ubuntu 16.04, Linux kernel 4.4.0-92-generic and OpenJDK 11.0.2.
> The issue shows up with zgc but does not show up with G1.
> During a period of 10 days after deployment, CPU usage goes up steadily at a rate of ~10% per day. Eventually we have to restart all instances.
> I profiled our app after 4 days of uptime using async-profiler and found that the following stack is the most frequent stack:
> I tried restarting the instance and waited 10 minutes before profiling, and stack walking shows up much less in sampling:
> This is how the stack walk looks when profiling an instance deployed with g1 after 3 days:
> Please help me figure this one out.

More information about the zgc-dev mailing list