Skip to content
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

Quarkus native heap dump on OOME blog post #1942

Merged
merged 1 commit into from
Apr 19, 2024

Conversation

galderz
Copy link
Member

@galderz galderz commented Apr 15, 2024

Blog post on how to use heap dump on OOME option with Quarkus native which touches a few extra related topics:

  • How to configure epsilon GC.
  • How to inspect heap dumps with JOL.
  • Compare heap dumps with JVM mode.

@galderz galderz requested a review from zakkak April 15, 2024 04:45
@galderz
Copy link
Member Author

galderz commented Apr 15, 2024

Can we add @roberttoyonaga as reviewer?

Copy link

github-actions bot commented Apr 15, 2024

🙈 The PR is closed and the preview is expired.

Copy link
Contributor

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank @galderz

I added some suggestions, for your consideration, that IMHO might improve it a bit.

_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved
_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved
2024-04-12 09:58:00,855 INFO [io.quarkus] (main) Installed features: [cdi, rest, smallrye-context-propagation, vertx]
----

Next, apply some load to the HTTP endpoint exposed by the Quarkus application, for example using `wrk`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps a bash loop with a curl command would be better as most people won't have wrk installed. On the other hand that's a nice way to become aware of wrk.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, wrk is an overkill for this. Just used to quickly firing it up :)


Let’s start by producing a heap dump with a Quarkus native executable.
A good starting point would be a Quarkus application that simply responds to an HTTP endpoint request, e.g. the
https://github.com/quarkusio/quarkus-quickstarts/tree/main/getting-started-reactive[getting-started-reactive] Quarkus quickstart.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's simpler to use https://code.quarkus.io/

E.g. I can follow this post with:

wget "https://code.quarkus.io/d?S=io.quarkus.platform%3A3.8&cn=code.quarkus.io" -O code.zip
unzip code.zip
cd code-with-quarkus

Note I explicitly set the version to Quarkus 3.8 to hopefully keep the instructions working for some time.

_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved

Starting with GraalVM for JDK 21,
native executables can run with the `-XX:+HeapDumpOnOutOfMemoryError` option to generate a heap dump when a `java.lang.OutOfMemoryError` is thrown.
In this blog post we will explore how to use the flag, we will inspect what a native image heap dump looks like and how it compares with one produced by HotSpot.
Copy link
Contributor

@roberttoyonaga roberttoyonaga Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will inspect what a native image heap dump looks like

Maybe there's a chance readers get confused by the wording here and think dumping the Image Heap and "java heap" are different things (If they are aware that the image heap exists).

Maybe it would be good to specify that we're dumping both the read-only Image Heap as well as the native image's "Java heap". Whereas in Java mode we're just dumping the Java heap.

Copy link
Contributor

@roberttoyonaga roberttoyonaga Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the flip side, it could also be an opportunity to briefly inform readers who aren't aware that there is a special segmentation to the heap in native mode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both points sound good. I have not explored the differences in detail between the read-only and the read/write parts, but if you have feel free to propose a paragraph and add it as suggestion and we can just add it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I've added a suggestion below!

Copy link
Contributor

@roberttoyonaga roberttoyonaga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! I think this is clear and to-the-point.

@galderz
Copy link
Member Author

galderz commented Apr 17, 2024

@zakkak I've addressed all your comments. @roberttoyonaga I've integrated your suggestion and made some small changes to it, let me know if you're happy with it.

Copy link
Contributor

@zakkak zakkak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my comments Galder.

There seems to be a new typo introduced.

_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved
_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved
@roberttoyonaga
Copy link
Contributor

I've integrated your suggestion and made some small changes to it, let me know if you're happy with it.

Looks good to me!

@galderz galderz force-pushed the topic.1204.heapdump-oome-native branch from 2c39bee to 954dfdb Compare April 18, 2024 12:27
@galderz
Copy link
Member Author

galderz commented Apr 18, 2024

Squashed and pushed commits.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some minor comments. Let me know when you prefer it to be published, I'll make it happen.

layout: post
title: 'Obtaining heap dump on OutOfMemoryError with Quarkus native'
date: 2024-04-15
tags: native heapdump oome epsilongc jol
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's a good idea to add tags that are so precise. We already have too many tags. Let's only have native?

_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved
_posts/2024-04-15-heapdump-oome-native.adoc Outdated Show resolved Hide resolved
---
layout: post
title: 'Obtaining heap dump on OutOfMemoryError with Quarkus native'
date: 2024-04-15
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's target a publication on Tuesday? We can merge tomorrow and get it published automatically on Tuesday and tweet about it on Tuesday? Friday is a slow day for blog posts.

Note that if you want it published tomorrow, I'm around!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tuesday is fine, I'll ammend it.

Co-authored-by: Foivos <[email protected]>
Co-authored-by: Robert Toyonaga <[email protected]>
Co-authored-by: Guillaume Smet <[email protected]>
@galderz galderz force-pushed the topic.1204.heapdump-oome-native branch from 534133c to 0cb8ed9 Compare April 19, 2024 07:33
@galderz
Copy link
Member Author

galderz commented Apr 19, 2024

@gsmet Applied all suggested changes and changed date to next Tuesday.

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@gsmet gsmet merged commit 1f74508 into quarkusio:develop Apr 19, 2024
1 check passed
@gsmet
Copy link
Member

gsmet commented Apr 19, 2024

If you write me a tweet, I will be happy to post it on Tuesday.

@galderz
Copy link
Member Author

galderz commented Apr 19, 2024

If you write me a tweet, I will be happy to post it on Tuesday.

Sure, how about this?

Explore heap dumps and learn how to use HeapDumpOOME option in Quarkus native apps.

@gsmet
Copy link
Member

gsmet commented Apr 19, 2024

LGTM. Let me put a reminder for Tuesday.

@gsmet
Copy link
Member

gsmet commented Apr 19, 2024

@galderz What's your Twitter handle?

@galderz
Copy link
Member Author

galderz commented Apr 19, 2024

@galderz What's your Twitter handle?

@galderz :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants