I am currently working on integrating Carbon Metrics with Product CEP. For
reporting purposes of memory statistics of CEP (as well as in Siddhi), It
is required to periodically measure how much memory (in bytes) an object
consumes. Even though, it can be achieved through Java Instrumentation. It
is required that;

   - It does not use Java Instrumentation (since it requires a
   Premain-Class and an external agent).
   - Memory measuring algorithm itself is not memory/time consuming.
   - A qualitative measurement is acceptable, but it should consider the
   deep-size of an object.

Having above constraints, I came across two solutions;
1. Dimitris Andreou's ObjectExplorer [1].
2. Attila Szegedi's ObjectSizeCalculator [2].

However, [1] uses a reflection-based object-traversing to calculate
deep-size of an object. Therefore, it takes a considerable amount of time
and memory when it comes to measuring objects that are around 80MB
(deep-size). Though, [2] doesn't consume that much time and memory; it only
works with Hotspot JVMs. Therefore, it will not function accurately when it
comes to IBM JDK.

Is there a better way to achieve this, with above constraints?

[1] https://github.com/DimitrisAndreou/memory-measurer
[2]
https://github.com/twitter/commons/blob/master/src/java/com/twitter/common/objectsize/ObjectSizeCalculator.java

Thanks,
Grainier.
-- 
Grainier Perera
Software Engineer
Mobile : +94716122384
WSO2 Inc. | http://wso2.com
lean.enterprise.middleware
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to