RFR: 8207851 JEP Draft: Support ByteBuffer mapped over non-volatile memory

Andrew Dinn adinn at redhat.com
Wed Aug 15 11:08:00 UTC 2018


Hi Alan,

Just a quick follow-up regarding the BufferPoolMXBean.

On 14/08/18 12:34, Andrew Dinn wrote:
> On 06/08/18 10:29, Alan Bateman wrote:
> 
>> Are you familiar with BufferPoolMXBean which can be used by management
>> tools to monitor pool of buffers? I'm wondering if we should introduce a
>> new pool for NVM so that it doesn't show up in the "mapped" pool.

Ok, so I have worked through the code and can see that MappedByteBuffers
for file device-based mappings (as opposed to direct memory mappings)
are currently counted by class Unmapper local to  FileChannelImpl and
the counts are made visible via a BufferPoolMXBean with name "mapped"
which is present in the list exposed by method getBufferPoolMXBeans() of
class ManagementFactoryHelper.

So, it seems what you are asking for is to keep separate tallies for
persistent MappedByteBuffers and expose them in a new BufferPoolMXBean
also inserted in the list exposed by getBufferPoolMXBeans. That sounds
like quite a good idea. It will leave any current code that wants to see
file mappings counting the 'same' thing yet still makes it possible to
count persistent mappings on their own and also tally all mappings by
iterating over all BufferPoolMXBeans in the list. I suggest giving the
bean the name "mapped_persistent".

I would happily update the JEP to include this as an 'API change' of
sorts but I'm not quite sure how to document it. Is this ok

 the JEP requires exposing a new java.lang.management.BufferPoolMXBean
with name "mapped_persistent" as a platform managed bean which can be
accessed using the existing ManagementFactory.getPlatformMXBeans() API

  the "mapped_persistent" bean records the buffer count, total bytes and
total allocation count stats for persistent MappedByteBuffers (i.e.
those mapped using MapMode READ_ONLY_PERSISTENT or READ_WRITE_PERSISTENT)

  these stats are collected separately from those currently collected in
the "mapped" BufferPoolMXBean which records the equivalent counts for
non-persistent MappedByteBuffers (i.e. those mapped using MapMode
READ_ONLY, READ_WRITE or PRIVATE)

It seems straightforward to implement this behaviour. If you like I can
add it to the next webrev?

regards,


Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander


More information about the core-libs-dev mailing list