Hello everyone.
How do I know real size of a stored data in the IgniteCache? For example: I created new cache and put one object, and I want to know real size of one object in cache. try (Ignite ignite = Ignition.start("cache-config.xml")) { IgniteCache<Long, MyObject> cache = ignite.getOrCreateCache("myCache"); MyObject obj = new MyObject() cache.put(obj.getLongId(), obj); } I looked at ClusterMetrics and CacheMetrics, but I'am not sure wich method is real needed to me. p.s. I haven't found the answer in search. -- Best Regards, Vyacheslav |
Vyacheslav,
Will JVisualVM + heap dump + analyzing objects count and sizes in heap dump works in your case? On Thu, Mar 30, 2017 at 8:26 PM, Vyacheslav Daradur <[hidden email]> wrote: > Hello everyone. > > How do I know real size of a stored data in the IgniteCache? > > For example: I created new cache and put one object, and I want to know > real size of one object in cache. > > try (Ignite ignite = Ignition.start("cache-config.xml")) { > > IgniteCache<Long, MyObject> cache = ignite.getOrCreateCache(" > myCache"); > > MyObject obj = new MyObject() > > cache.put(obj.getLongId(), obj); > } > > I looked at ClusterMetrics and CacheMetrics, but I'am not sure wich method > is real needed to me. > > p.s. I haven't found the answer in search. > > -- > Best Regards, Vyacheslav > -- Alexey Kuznetsov |
Alexey,
Yes, it works in my case. Does Ignite provide any methods for my case? 2017-03-30 17:04 GMT+03:00 Alexey Kuznetsov <[hidden email]>: > Vyacheslav, > > Will JVisualVM + heap dump + analyzing objects count and sizes in heap > dump works in your case? > > > > On Thu, Mar 30, 2017 at 8:26 PM, Vyacheslav Daradur <[hidden email]> > wrote: > > > Hello everyone. > > > > How do I know real size of a stored data in the IgniteCache? > > > > For example: I created new cache and put one object, and I want to know > > real size of one object in cache. > > > > try (Ignite ignite = Ignition.start("cache-config.xml")) { > > > > IgniteCache<Long, MyObject> cache = ignite.getOrCreateCache(" > > myCache"); > > > > MyObject obj = new MyObject() > > > > cache.put(obj.getLongId(), obj); > > } > > > > I looked at ClusterMetrics and CacheMetrics, but I'am not sure wich > method > > is real needed to me. > > > > p.s. I haven't found the answer in search. > > > > -- > > Best Regards, Vyacheslav > > > > > > -- > Alexey Kuznetsov > -- Best Regards, Vyacheslav |
Hi Vyacheslav,
No, Ignite doesn't provide such methods. However, you can see how it is overcome in one of EvictionPolicy implementations and make a proposal how it could be implemented. On Thu, Mar 30, 2017 at 5:20 PM, Vyacheslav Daradur <[hidden email]> wrote: > Alexey, > > Yes, it works in my case. > > Does Ignite provide any methods for my case? > > > 2017-03-30 17:04 GMT+03:00 Alexey Kuznetsov <[hidden email]>: > > > Vyacheslav, > > > > Will JVisualVM + heap dump + analyzing objects count and sizes in heap > > dump works in your case? > > > > > > > > On Thu, Mar 30, 2017 at 8:26 PM, Vyacheslav Daradur <[hidden email] > > > > wrote: > > > > > Hello everyone. > > > > > > How do I know real size of a stored data in the IgniteCache? > > > > > > For example: I created new cache and put one object, and I want to know > > > real size of one object in cache. > > > > > > try (Ignite ignite = Ignition.start("cache-config.xml")) { > > > > > > IgniteCache<Long, MyObject> cache = ignite.getOrCreateCache(" > > > myCache"); > > > > > > MyObject obj = new MyObject() > > > > > > cache.put(obj.getLongId(), obj); > > > } > > > > > > I looked at ClusterMetrics and CacheMetrics, but I'am not sure wich > > method > > > is real needed to me. > > > > > > p.s. I haven't found the answer in search. > > > > > > -- > > > Best Regards, Vyacheslav > > > > > > > > > > > -- > > Alexey Kuznetsov > > > > > > -- > Best Regards, Vyacheslav > -- Best regards, Andrey V. Mashenkov |
Would it help if you had the total data size for a cache and a number of
entries, which I believe Ignite provides? In this case, you can divide one by another and have your average object size. D. On Thu, Mar 30, 2017 at 7:42 AM, Andrey Mashenkov < [hidden email]> wrote: > Hi Vyacheslav, > > No, Ignite doesn't provide such methods. > However, you can see how it is overcome in one of EvictionPolicy > implementations and make a proposal how it could be implemented. > > On Thu, Mar 30, 2017 at 5:20 PM, Vyacheslav Daradur <[hidden email]> > wrote: > > > Alexey, > > > > Yes, it works in my case. > > > > Does Ignite provide any methods for my case? > > > > > > 2017-03-30 17:04 GMT+03:00 Alexey Kuznetsov <[hidden email]>: > > > > > Vyacheslav, > > > > > > Will JVisualVM + heap dump + analyzing objects count and sizes in heap > > > dump works in your case? > > > > > > > > > > > > On Thu, Mar 30, 2017 at 8:26 PM, Vyacheslav Daradur < > [hidden email] > > > > > > wrote: > > > > > > > Hello everyone. > > > > > > > > How do I know real size of a stored data in the IgniteCache? > > > > > > > > For example: I created new cache and put one object, and I want to > know > > > > real size of one object in cache. > > > > > > > > try (Ignite ignite = Ignition.start("cache-config.xml")) { > > > > > > > > IgniteCache<Long, MyObject> cache = ignite.getOrCreateCache(" > > > > myCache"); > > > > > > > > MyObject obj = new MyObject() > > > > > > > > cache.put(obj.getLongId(), obj); > > > > } > > > > > > > > I looked at ClusterMetrics and CacheMetrics, but I'am not sure wich > > > method > > > > is real needed to me. > > > > > > > > p.s. I haven't found the answer in search. > > > > > > > > -- > > > > Best Regards, Vyacheslav > > > > > > > > > > > > > > > > -- > > > Alexey Kuznetsov > > > > > > > > > > > -- > > Best Regards, Vyacheslav > > > > > > -- > Best regards, > Andrey V. Mashenkov > |
Dmitry, as I understand Ignite doesn't provide a possibility to show real
total size of objects in a IgniteCache. чт, 30 марта 2017 г. в 19:03, Dmitriy Setrakyan <[hidden email]>: > Would it help if you had the total data size for a cache and a number of > entries, which I believe Ignite provides? In this case, you can divide one > by another and have your average object size. > > D. > > On Thu, Mar 30, 2017 at 7:42 AM, Andrey Mashenkov < > [hidden email]> wrote: > > > Hi Vyacheslav, > > > > No, Ignite doesn't provide such methods. > > However, you can see how it is overcome in one of EvictionPolicy > > implementations and make a proposal how it could be implemented. > > > > On Thu, Mar 30, 2017 at 5:20 PM, Vyacheslav Daradur <[hidden email] > > > > wrote: > > > > > Alexey, > > > > > > Yes, it works in my case. > > > > > > Does Ignite provide any methods for my case? > > > > > > > > > 2017-03-30 17:04 GMT+03:00 Alexey Kuznetsov <[hidden email]>: > > > > > > > Vyacheslav, > > > > > > > > Will JVisualVM + heap dump + analyzing objects count and sizes in > heap > > > > dump works in your case? > > > > > > > > > > > > > > > > On Thu, Mar 30, 2017 at 8:26 PM, Vyacheslav Daradur < > > [hidden email] > > > > > > > > wrote: > > > > > > > > > Hello everyone. > > > > > > > > > > How do I know real size of a stored data in the IgniteCache? > > > > > > > > > > For example: I created new cache and put one object, and I want to > > know > > > > > real size of one object in cache. > > > > > > > > > > try (Ignite ignite = Ignition.start("cache-config.xml")) { > > > > > > > > > > IgniteCache<Long, MyObject> cache = ignite.getOrCreateCache(" > > > > > myCache"); > > > > > > > > > > MyObject obj = new MyObject() > > > > > > > > > > cache.put(obj.getLongId(), obj); > > > > > } > > > > > > > > > > I looked at ClusterMetrics and CacheMetrics, but I'am not sure wich > > > > method > > > > > is real needed to me. > > > > > > > > > > p.s. I haven't found the answer in search. > > > > > > > > > > -- > > > > > Best Regards, Vyacheslav > > > > > > > > > > > > > > > > > > > > > -- > > > > Alexey Kuznetsov > > > > > > > > > > > > > > > > -- > > > Best Regards, Vyacheslav > > > > > > > > > > > -- > > Best regards, > > Andrey V. Mashenkov > > > Best Regards, Vyacheslav |
On Thu, Mar 30, 2017 at 9:30 AM, Vyacheslav Daradur <[hidden email]>
wrote: > Dmitry, as I understand Ignite doesn't provide a possibility to show real > total size of objects in a IgniteCache. > Currently no, but the 2.0 release, which is fully off-heap, will provide a precise cache size. |
Vyacheslav,
Objects have different size in different runtime (x86 or Power, compress pointer on or off and so on). So only one possible way to see real size is do it in runtime. You can see how many bytes was allocated in one thread by using import *com.sun.management*.ThreadMXBean; .... ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean(); //it return java.*lang*.management.ThreadMXBean System.out.println(bean. *getThreadAllocatedBytes(Thread.currentThread().getId())*); Or you can use JMH with args *-prof gc.* But please note it shows all the allocated bytes including temp objects, not only the remaining. If you know exactly which object contains your data, you can use *Java Object Layout *( http://openjdk.java.net/projects/code-tools/jol/ ) which show you everything even alignment. In this video (in Russian, but i know it's not problem for you) you can see how to use it: https://www.youtube.com/watch?v=r_bnfv-nlcs 2017-03-30 19:45 GMT+03:00 Dmitriy Setrakyan <[hidden email]>: > On Thu, Mar 30, 2017 at 9:30 AM, Vyacheslav Daradur <[hidden email]> > wrote: > > > Dmitry, as I understand Ignite doesn't provide a possibility to show real > > total size of objects in a IgniteCache. > > > > Currently no, but the 2.0 release, which is fully off-heap, will provide a > precise cache size. > |
Free forum by Nabble | Edit this page |