|
|
|
Back to newsletter 137 contents
Java7 u4 was released a few days ago. Normally I don't bother mentioning updates, but this one has a few items of interest to us in the performance community: G1 becomes official; a new jcmd command-line diagnostic tool; and finally we can get notified of garbage collections! (I meant to discuss your replies to last month's question about initial heap size, but that will have to wait).
Of course you want specifics - so did I. So, firstly, the G1 garbage collector is now a fully supported garbage collector, which means - to me at least - that it's now expected to be usable and relatively stable. That's good news, my initial testing on one of the more problematic JVMs I'm dealing with at the moment showed it to provide a nice improvement in GC handling.
Next, there is a new jcmd command-line diagnostics framework - with
a basic set of commands. jcmd
with no args works like jps
;
then jcmd PID help
will list available commands for the
jvm running with process ID PID, jcmd PID help COMMAND
prints
help for the particular COMMAND and, consistently, jcmd PID
COMMAND COMMANDARGS
will execute the COMMAND using the COMMANDARGS
arguments. I've not yet used this, and initially I'm not sure there's
going to be anything new that you don't already get from the other
already existing command-line tools, but this puts it all together
in one command framework. I suspect it's easily extensible, and very
likely you can install your own handlers easily enough, so we're
likely moving into a world of standardised customised command line
capability for JVMs.
Finally, and we've waited for this for so long I'd given up hope of it ever coming, you can get notifications from the GarbageCollectorMXBean of GC events when they occur. At last, we can actually have GC analysis and display tools that don't require access to the GC logs and aren't sampler based. To get your notifs, access the GarbageCollectorMXBean and addNotificationListener on it to get your callbacks (I think it needs to be cast to the sun mxbean). Your callback should check that the notification type is a GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION, then retrieve the GC data by calling GarbageCollectionNotificationInfo.from(notif.getUserData()).
Now on to all our usual links to Java performance tools, news, articles, and the extracted tips from all of this month's referenced articles.
Java performance tuning related news.
Java performance tuning related tools.
Back to newsletter 137 contents