The number of byte[] instances and the total size shows that each byte[] is approx. 1024 bytes long. This is exactly the size used by RAMDirectory for allocated heap blocks.
So the important question: Do you use RAMDirectory to hold your index? This is not recommended, it is better to use MMapDirectory. RAMDirectory is a class made for testing lucene, not for production (does not scale well, is not GC-friendly, and is therefore slow in most cases for large indexes). Also the index is not persisted to disk. If you want an in-memory index, use a linux tmpfs filesystem (ramdisk) and write your index to it (and use MMapDirectory to access it).
Read full article from About lucene memory consumption - Grokbase
No comments:
Post a Comment