7 ms·
Custom Events in the Blocky World: Using JFR in Minecraft
- parttimenerd 3y agoI'm the author, ask me things.
- znpy 3y agoWhat's your recommendation about learning how to properly use JFR and Java mission control?
- parttimenerd 3y agoI collected some information here: https://mostlynerdless.de/profiling-talks/ https://mostlynerdless.de/profiling-talks/
- znpy 3y agoThanks!
- TedDoesntTalk 3y agoCan you give some real world examples when to use JFR custom events? The Minecraft example is not helpful when I know nothing about Minecraft.
- gunnarmorling 3y agoI'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-jdk-flight-recorder-events/ 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-with-flight-recorder-jmc-agent-and-jfrunit.html 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).
- gred 3y ago> 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).
- parttimenerd 3y agoYou 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-context/ https://mostlynerdless.de/blog/2023/10/19/putting-jfr-into-c...)
- parttimenerd 3y agoThank 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-a-short-introduction/ https://mostlynerdless.de/blog/2023/11/20/custom-jfr-events-...)
- lsaferite 3y agoJust some feedback. Maybe explain what JFR is for the random visitors that have no clue. If you did then I apologize for missing it.
- elliotec 3y agoAgreed. 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?
- FrustratedMonky 3y agoSecond 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.
- parttimenerd 3y agoI linked now to articles that provide you with more information.
- lsaferite 3y agoI 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.
- parttimenerd 3y agoThanks 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.
- 3y ago
- xcdzvyn 3y agoThe Minecraft Wiki community is moving away from Fandom to the self-hosted https://minecraft.wiki/ 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!
- parttimenerd 3y agoThanks, 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 https://de.wikipedia.org/wiki/Thomas_Was_Alone. Nowadays, I like to play whack-a-mole with bugs in the OpenJDK.
- xcdzvyn 3y agoThanks! And thank you for your work :)
- parttimenerd 3y agoI'm happy for any reader of my blog :)
- darknavi 3y agoWow! 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.
- parttimenerd 3y agoThat'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 :)
- pugworthy 3y agoJFR is... Java Flight Recorder? https://docs.oracle.com/javacomponents/jmc-5-4/jfr-runtime-guide/about.htm 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.
- KolmogorovComp 3y agoIt is explained in the first screenshot of the article. > Commands/jfr > Commands Starts and stops profiling with Java FlightRecorder (…)
- chankstein38 3y agoDid you NOT read the article then _confidently toss out comments, while I also have an annoyance for people who comment without reading the article?_
- _lvbh 3y agoIt’s literally in the first sentence
- bradhe 3y agoSomehow 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…
- uberswe 3y agoI'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/ https://spark.lucko.me/
- skerit 3y ago"We could disassemble the Minecraft JAR and potentially get into legal trouble" Hehe, I wouldn't worry about that too much with minecraft.
- exabrial 3y agoPeople 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.