moremore0812 / cqengine

Automatically exported from code.google.com/p/cqengine
0 stars 0 forks source link

Provide the way to determine how much memory used by index #38

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
As I can see here 
https://groups.google.com/forum/#!topic/cqengine-discuss/RX_ESsAKZqQ index can 
take a lot of memory. In provided example up to 40 times the size of the data.
It would be nice to have ability to detect how much memory gone where.
At least approximately.

Original issue reported on code.google.com by g...@inbox.ru on 15 Dec 2014 at 3:12

GoogleCodeExporter commented 9 years ago
This is an enhancement request, not a defect.

I can see how this would be useful. It's a tricky question though. I have some 
ideas on this, I'll think about how best to proceed.

In the meantime, in general, a helpful way to find which types of objects are 
using most memory is the command line:

jmap -histo:live <pid of jvm>

Original comment by ni...@npgall.com on 15 Dec 2014 at 3:21

GoogleCodeExporter commented 9 years ago
Done in CQEngine 2.0:

The size of the collection can roughly be determined by configuring it to use 
off-heap or disk persistence, and then calling: 
http://cqengine.googlecode.com/svn/cqengine/javadoc/apidocs/com/googlecode/cqeng
ine/persistence/Persistence.html#getBytesUsed()

The size of off-heap or disk indexes can roughly be determined in a similar 
way: determine the size of the collection as above, add the index, then 
determine bytes used again, and subtract.

Also, for most indexes including on-heap indexes, the number of buckets and the 
number of objects in each bucket can be determined via the following API which 
most indexes now implement: 
http://cqengine.googlecode.com/svn/cqengine/javadoc/apidocs/com/googlecode/cqeng
ine/index/support/KeyStatisticsIndex.html

Original comment by ni...@npgall.com on 20 Apr 2015 at 8:32