java - How to load an FSdirectory index file as a RAMdirectory in Lucene? -


i have index file in hard fsdirectory size 2gb. want load in ram have better search speed. use code behind:

directory dic=new ramdirectory(fsdirectory.open(new file("file path")), iocontext.default); 

but i'm not sure if work. know work or not? other way better on?

i'll glad of suggestion.thanks.

yes can construct ramdirectory it's discouraged in case. ramdirectory not designed used large data set (more 100mb). gc intensive, long construct , consume precious java heap space.

if have perf issues please make sure follow guidelines descibed in this lucene faq

don't forget descent search speed os needs cache part of index memory. in order must let free mem available os. if have 16gb of physical ram , 8gb index should configure jvm xmx 8g. nice linux tool check mem htop, print ram used process green (your heap space) , ram used filecache yellow (the index data).

some developpers perform warm queries @ application startup prevent first user being stuck few seconds while index gets loaded os filecache.

then if still think can better perf can try tricks ramfs. doubt can better performances tuned os , jvm mmapdirectory.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -