Hi Cheng, It seems that you use a RAMDirectory for *caching*, otherwise it makes no sense to write changes back. In recent Lucene versions, this is not a good idea, especially for large indexes (RAMDirectory eats your heap space, allocates millions of small byte[] arrays,...). If you need something like a caching Directory and you are working on a 64bit platform, you can use MMapDirectory (where the operating system kernel manages the read/write between disk an memory). MMapDirectory is returned by default for FSDirectory.open() on most 64 bit platforms. The good thing: the "caching" space is outside your JVM heap, so does not slowdown the garbage collector. So be sure to *not* allocate too much heap space (-Xmx) to your search app, only the minimum needed to execute it and leave the rest of your RAM available for the OS kernel to manage FS cache.
Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Cheng [mailto:zhoucheng2...@gmail.com] > Sent: Sunday, February 05, 2012 7:56 AM > To: java-user@lucene.apache.org > Subject: Configure writer to write to FSDirectory? > > Hi, > > I build an RAMDirectory on a FSDirectory, and would like the writer associated > with the RAMDirectory to periodically write to hard drive. > > Is this achievable? > > Thanks. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org