lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erick Erickson" <>
Subject Re: RAMDirectory issue
Date Sat, 26 May 2007 12:14:35 GMT
Unless you have hard evidence that FSDirectories are too slow,
you shouldn't IMO. The only place I've found RAMDirectories
useful (so far) is in unit tests where I'm creating a very small
in-memory index, running a few tests, and throwing it away.

My first question for this is "why are you using a RAMDirectory in
the first place?" Lucene does it's own caching etc, so it tries to
use RAM efficiently for you. Do you have any evidence that using
the normal FSDirectory is inadequate? If not, I recommend that
you simply go back to FSDirectory and worry about refinements
if and only if the performance is demonstrably inadequate.

Do be aware, when getting performance numbers, that the first
few queries of an FS-based index will take extra time to
build up the cache. Particularly the first few sorts you do.

If you have hard evidence, perhaps you could post some data
that would give us a clue what the size of your problem is. How big
is your index? How is it structured? What performance numbers
are you seeing? For what kind of queries?


On 5/26/07, Walter Ferrara <> wrote:
> I have an index on the disk. I'm using RAMDirectory( String ) to load
> index in RAM.
> I need from time to time to reload the index (when it is not current
> anymore), but I keep getting Out Of memory exception. Making the jvm
> heap bigger  helps, but only allow more reloading, eventually it will
> throw the exception.
> I just make a IndexSearcher. I've noticed that when I use that searcher
> I get the exception, instead while I do not search on the searcher I get
> no exception.
> The exception in throw while istancing the RAMDirectory. I do not make
> any sort. I do close the searcher. I do even close
> searcher.getIndexReader().directory().close(). It is like that, when
> indexserver is used, some references still survive and ram directory is
> not freed.
> How should I use the RAMDirectory? It is something related to the
> SingleInstanceLockFactory
> <../../../../org/apache/lucene/store/SingleInstanceLockFactory.html>?
> Can I have 2 ramdirectory, or try to use the same one by putting in it,
> with copy maybe, the index I have on disk?
> thanks,
> -- Walter
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message