Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Custom Events in the Blocky World: Using JFR in Minecraft (mostlynerdless.de)
41 points by parttimenerd on Nov 28, 2023 | hide | past | favorite | 30 comments


JFR is... Java Flight Recorder? https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-g...

I find it both an interesting challenge to discover what people mean when they confidently toss out acronyms, while also an annoyance for randomly throw out acronyms.


It is explained in the first screenshot of the article.

> Commands/jfr

> Commands Starts and stops profiling with Java FlightRecorder (…)


Did you NOT read the article then _confidently toss out comments, while I also have an annoyance for people who comment without reading the article?_


It’s literally in the first sentence


Wow! Blast from the past. I helped implement the JFR events a few years ago in the Java Edition of Minecraft (and probably caused some of the metadata wonkyness, whoops). I work in the Bedrock version normally but hopped over to lend a hand.

There was a big push to determine the performance impact of enlarging the world height for the caves and cliffs update.

Really glad to see people playing with the events.


That's pretty cool. We could have a chat (me@<blog-url> is my mail address), if you like, I'm always interested in people using profilers in the real-world :)


"We could disassemble the Minecraft JAR and potentially get into legal trouble" Hehe, I wouldn't worry about that too much with minecraft.


I'm the author, ask me things.


Just some feedback. Maybe explain what JFR is for the random visitors that have no clue. If you did then I apologize for missing it.


Agreed. In the first picture, you can see it stands for "Java FlightRecorder," but there's no explanation of what that is or does. A profiler?


Second this. Even when someone said it was in screen shot, it took a minute to go back and refocus to find it.

But. No knock on this guy. I find all STEM writing could be helped a little with some up front what/why/how in introduction.

I want to dig this, but on first scan through, I have no idea what this is doing or why it is cool. So, for getting an article out, if I'm a casual that isn't a die hard user of JFR, then what makes me want to dig deeper? Of course, maybe the goal isn't a wider readership.


I linked now to articles that provide you with more information.


I did go look up JFR when I had no idea what it was. I was just trying to give them a gentle suggestion that explaining the tool, even in 1 sentence, would be helpful.


Thanks for the feedback, I added a small disclaimer at the beginning of the article, telling the reader what JFR is and where to find more information.


That's perfect, thanks!


The Minecraft Wiki community is moving away from Fandom to the self-hosted https://minecraft.wiki/. Could you update your article to reflect that, by any chance?

Edit: Wow! You've never played Minecraft before? That's crazy!


Thanks, I fixed it.

> Edit: Wow! You've never played Minecraft before? That's crazy!

I don't play computer games (the last game I played was "Thomas was alone"), but I know people that play it more often.

Edit: Link to the game https://de.wikipedia.org/wiki/Thomas_Was_Alone. Nowadays, I like to play whack-a-mole with bugs in the OpenJDK.


Thanks! And thank you for your work :)


I'm happy for any reader of my blog :)


Can you give some real world examples when to use JFR custom events? The Minecraft example is not helpful when I know nothing about Minecraft.


I've written about two applications of custom JFR events in the past:

* Monitoring invocations of a REST API: https://www.morling.dev/blog/rest-api-monitoring-with-custom...

* Tracking SQL queries issued by your ORM: https://www.javaadvent.com/2021/12/keep-your-sql-in-check-wi...

The latter is about injecting event-emitting code with a Java Agent rather than manually implementing custom events (latest Hibernate ORM version comes with JFR support OOTB, too).


Thank you Gunnar, I linked to your blog post (and even linked to it already in my previous blog post "Custom JFR Events: A Short Introduction" https://mostlynerdless.de/blog/2023/11/20/custom-jfr-events-...)


> Monitoring invocations of a REST API

Yep, we use custom JFR events to track API calls and correlate them to other built-in JFR events and statistics (garbage collection, memory use, allocations, CPU use, deadlocks, etc).


You might be interested in a proposal by Jaroslav Bachorik to add context into JFR. I wrote a short introduction on my blog "Putting JFR into Context" (https://mostlynerdless.de/blog/2023/10/19/putting-jfr-into-c...)


What's your recommendation about learning how to properly use JFR and Java mission control?


I collected some information here: https://mostlynerdless.de/profiling-talks/


Thanks!


People may dislike Java syntax in some areas (I argue this is the lack of IDE knowledge, but I digress), but the JVM itself is the friendliest thing the run in production. Between JMX, JFR, Java Agent[s] like Hawt.io, one can really drill down into problems; everything is visible.


Somehow when I read the title I thought article was going to describe how to use Minecraft to visualize JFR profiles which I thought could be pretty cool…


I'm not sure how much of the built in JFR a mod for Minecraft called Spark uses but it is a fairly common tool for debugging and visualising lag on modded servers https://spark.lucko.me/




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: