Re: [rvm-research] Runtime Exception when running JMX
Robin Garner <[email protected]> Wed, 20 Jun 2018 16:46:34 +1000
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <[email protected]> |
On 17/06/18 03:26, Khaled Z Mahmoud wrote: > Hi, > > Thanks. That now works and the exception is gone. > I realized that JMX operations in Jikes are very slow. Sometimes they > take 45 or 50 milliseconds and sometimes more. > > Are there any synchronized variables shared with the Jikes run-time > that could potentially slowdown jikes if I read JMX frequently ? > I have experience 10 fold increase in application execution time when > reading JMX information. > No mystery here, just read through the code > MemoryMXBean memMx = ManagementFactory.getMemoryMXBean(); > memMx.getHeapMemoryUsage().getCommitted(); > memMx.getHeapMemoryUsage().getUsed(); You can halve the runtime of this by saying MemoryMXBean memMx = ManagementFactory.getMemoryMXBean(); MemoryUsage usage = memMx.getHeapMemoryUsage(); usage.getCommitted(); usage.getUsed(); getHeapMemoryUsage() iterates over all the spaces in the heap adding up the memory usage, then allocates a MemoryUsage instance to hold the result. Not something I'd use for high frequency instrumentation. Take a look at the methods of org.mmtk.plan.Plan that are listed under 'VM Accounting'. These are the methods MMTk uses in its slow-path to decide whether a GC is required, so they should be several orders of magnitude faster than the JMX interface. You'll probably take a little time to adjust to how MMTk views memory usage: eg, used memory isn't exactly the sum of the sizes of the live objects, it's more complicated than that. cheers > > > > Regards, > Khaed Mahmoud > > On Sat, Jun 16, 2018 at 7:29 AM, Erik Brangs <[email protected] > <mailto:[email protected]>> wrote: > > Hi, > > On 16.06.2018 03:28, Khaled Z Mahmoud wrote: > > *I get the below exception:* > > Unexpected exception thrown in timer thread: java.lang.IllegalArgumentException: Maximum value of 0 is > below 42733568, the amount committed. > > java.lang.IllegalArgumentException: Maximum value of 0 is below > 42733568, the amount committed. > > at java.lang.management.MemoryUsage.<init>(MemoryUsage.java:141) > > at > org.jikesrvm.mm.mminterface.JMXSupport.getUsage(JMXSupport.java:159) > > at > gnu.java.lang.management.VMMemoryMXBeanImpl.getUsage(VMMemoryMXBeanImpl.java:79) > > at > gnu.java.lang.management.VMMemoryMXBeanImpl.getHeapMemoryUsage(VMMemoryMXBeanImpl.java:28) > > at > gnu.java.lang.management.MemoryMXBeanImpl.getHeapMemoryUsage(MemoryMXBeanImpl.java:149) > > at org.jikesrvm.scheduler.TimerThread.run(TimerThread.java:97) > > > > Any ideas ?? > > this was a bug in the Jikes RVM JMX implementation. It didn't > handle discontiguous spaces correctly. I've changed the > implementation to set the maximum value to undefined when > discontiguous spaces are used. The git commit id of the commit > with the fix is c065b7379b1db7c15e75b452b634ee0199ff7ce5 . > > > Kind regards, > > Erik Brangs > > > > > > -- > > Regards, > > Khaled Mahmoud > > > > > > > ------------------------------------------------------------------------------ > > Check out the vibrant tech community on one of the world's most > > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > > > > > > _______________________________________________ > > Jikesrvm-researchers mailing list > > [email protected] > <mailto:[email protected]> > > > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers > <https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers> > > > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Jikesrvm-researchers mailing list > [email protected] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers > <https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers> > > > > > -- > Regards, > Khaled Mahmoud > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > > > _______________________________________________ > Jikesrvm-researchers mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Jikesrvm-researchers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers