quickperf icon indicating copy to clipboard operation
quickperf copied to clipboard

Add @MeasureOffHeapAllocation, @ExpectedOffHeapAllocation, @MaxExpectedOffHeapAllocation

Open jeanbisutti opened this issue 5 years ago • 4 comments

Off-heap allocation has to be understand as direct memory allocation. It can be measured with the help of a MBean. Undersatand the implemementations of @MeasureHeapAllocation, @ExpectedHeapAllocation and @MaxExpectedHeapAllocation can help you.

jeanbisutti avatar Jun 23 '19 10:06 jeanbisutti

OffHeap is a complex area as there is a lot of different offheap memory pool:

  • metaspace
  • code space
  • direct memory
  • thread stack
  • ... (I'm pretty sure I forget one or two)

I think that offheap should means direct memory. I also think that metaspace related annotations should be a good addition (maybe on a separate issue). I aslo think that a naive approach to memory consuption can be done around the concept of resident set size (so the total memory usage of your application process on the OS). This can be easily retrived on linux reading some system file (or launching ps -aux). An annotation that read the RSS of the process before and after the test can be very usefull (again, may be a separate issue)

loicmathieu avatar Sep 27 '19 09:09 loicmathieu

@loicmathieu Yes, in Java world, "Off-heap" is generally undestood as direct memory (see EhCache for example). If you are interested, you can create an "Add @MeasureLinuxRSS"" issue, develop it and explore its interest from a use case!

jeanbisutti avatar Sep 27 '19 10:09 jeanbisutti

OK, so byte allocations on off-heap is a good thing. And don't forget about the @ExpectedOffHeapAllocation annotation :)

And I think also that Metaspace and RSS measurement should be good additions. I'll create separate issues, I'll work on it in a few weeks if nobody do it before :)

loicmathieu avatar Sep 27 '19 11:09 loicmathieu

@loicmathieu Great!

jeanbisutti avatar Sep 27 '19 11:09 jeanbisutti