quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Remove use of `-H:-ParseOnce` in GraalVM 22.2

Open galderz opened this issue 3 years ago • 1 comments

When ParseOnce was first introduced, we discovered that the overall memory consumption went up. In my most recent testing with 22.1, ParseOnce still added extra memory, but during the Native Image Committer Community Meeting 2022-06-02 meeting Christian mentioned that memory improvements have gone in 22.2 which should solve the problem of extra memory usage.

I will carry out tests with 22.2 to verify this.

galderz avatar Jun 03 '22 06:06 galderz

Related mandrel issue: https://github.com/graalvm/mandrel/issues/316

jerboaa avatar Aug 08 '22 12:08 jerboaa

Quote from https://github.com/quarkusio/quarkus/issues/25943#issuecomment-1216176613

Re: ParseOnce. At the end of June I carried some tests to verify its effects on 22.2 and indeed the memory usage had improved, so it no longer resulted in a max RSS penalty. So I think it's safe to remove disabling it.

I performed some more extensive testing which shows that this is still not always true. What seems to hold though is that -H:+ParseOnce no longer results in requiring more than 8GB of memory which was causing issues in github actions, so we could disable it and leave the option of using -H:-ParseOnce or not to the users. WDYT?

zakkak avatar Aug 17 '22 09:08 zakkak

@zakkak Thanks for the exhaustive testing. It's important not to forget that there's some variability in the native build memory usage. In my local testing I've found that memory usage varies between different runs with the same configuration. E.g. for the Hibernate ORM quickstart:

  • With ParseOnce disabled, max RSS can be as low as 6.5GB and as high as 8.1GB, that's a 24% difference between the lowest and the highest.
  • With ParseOnce enabled, max RSS can be as low as 6.7GB and as high as 8.1GB, with a difference of 20%.

What I'm trying to say with this is that your ranges of -12% and +19% fall within the variability I see above. So, which ones take more or less max RSS might not be ParseOnce related.

galderz avatar Aug 18 '22 10:08 galderz

Note that in my testing I don't pass in -Xmx into the native image build processes, so that's why the max RSS numbers can look higher than the ones found in the testsuite runs.

galderz avatar Aug 18 '22 10:08 galderz

What I'm trying to say with this is that your ranges of -12% and +19% fall within the variability I see above. So, which ones take more or less max RSS might not be ParseOnce related.

True, my comparison is not that solid, but the fact that I am reproducing more or less the same results (in terms of RSS usage increase) with the last two times I ran similar tests (a couple of releases before 22.2) make me feel confident about this numbers.

In any case, I am OK with enabling ParseOnce (given that the CI is now happy with it) and letting the users disable it on demand if they really need to. Please see https://github.com/quarkusio/quarkus/pull/27462

zakkak avatar Aug 23 '22 20:08 zakkak

In any case, I am OK with enabling ParseOnce (given that the CI is now happy with it) and letting the users disable it on demand if they really need to. Please see #27462

That sounds good. Having an option to disable it in case it becomes a problem would be a good escape hatch if someone encounters memory issues with this.

galderz avatar Aug 24 '22 03:08 galderz

In any case, I am OK with enabling ParseOnce (given that the CI is now happy with it) and letting the users disable it on demand if they really need to. Please see #27462

That sounds good. Having an option to disable it in case it becomes a problem would be a good escape hatch if someone encounters memory issues with this.

Wouldn't that be covered by passing -Dquarkus.native.additional-build-args="-H:-ParseOnce"?

jerboaa avatar Aug 24 '22 10:08 jerboaa

@jerboaa Yes it is, I realised that after posting the comment.

galderz avatar Aug 25 '22 11:08 galderz