0

Let's say I have a methodA which takes X ms in execution. And let's say application GC takes Y ms. Ideally my overall method time should be bound between [X,X+Y]. But in real life we are seeing the execution time to be way more than X+Y.

What other activities in JVM can contribute to this? We have looked at safepointing time, but did not find it to be a major contributor. What are the tools using which this additional time taken can be measured?

best wishes
  • 5,789
  • 1
  • 34
  • 59
  • 1
    How do you conclude that the method execution should take X ms? Are you assuming interpreted execution, C1 compiled execution or C2 compiled execution? – Holger Dec 15 '21 at 13:27
  • so, let's say GC is happening every 60secs, I am considering non GC execution time as X – best wishes Dec 16 '21 at 03:15
  • 1
    That does not answer the question, not even remotely. – Holger Dec 16 '21 at 08:03
  • in our tests jvm is running in server mode and we are hitting only 1 code path, so i assume it would be c2 compiled. – best wishes Dec 16 '21 at 08:24
  • 1
    When you are benchmarking, you should have multiple runs, getting an interval, rather than a single execution time. Then, if you have a recent JVM, do a run with sufficient RAM and [GC turned off](https://blogs.oracle.com/javamagazine/post/epsilon-the-jdks-do-nothing-garbage-collector) to rule out GC effects. Then, you can compare the results… – Holger Dec 16 '21 at 08:36
  • yes, X can not be a single number but can be better described as a range of values. I am considering the mean as X. lets say gc is happening every 60 sec and Gc duration is 20ms. We are considering 55 sec's avg duration as X here( basically ignoring the 5 sec values around GC) – best wishes Dec 16 '21 at 08:41
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/240195/discussion-between-best-wishes-and-holger). – best wishes Dec 16 '21 at 10:11

0 Answers0