7

I'm currently using the class org.apache.lucene.store.RAMDirectory for a fast RAM-based index without the requirement of hard disk write permissions. RAM size & persistence is not a limiting factor. However, RAMDirectory is marked as deprecated and also seems to be problematic for large indexes according to its API.

So my question is, what is a RAM-only alternative for the deprecated RAMDirectory?

Anything writing on hard disk is out of the question for me (read only) & also seems to be quite a bit slower on my own systems. I was thinking about using FSDDirectory with a RAMDisk but couldn't find a way to create said RAMDisk using java / the jar only (again requires changing the system).

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
ptstone
  • 478
  • 7
  • 17

2 Answers2

14

ByteBuffersDirectory is the replacement for RAMDirectory.

The chart below makes it crystal clear why RAMDiretory was depreciated and then removed. BBDIR is ByteBuffersDirectory and RAMDIR is RAMDirectory.

enter image description here Chart by Dawid Weiss. Source: LUCENE-8438 and shown under Apache 2.0 License. .

RonC
  • 31,330
  • 19
  • 94
  • 139
  • 2
    I'm wasn't arguing for RAMDirectory, quite the opposite i was looking for a replacement and unable to find one without disk write access. So thank you very much, this is exactly what i was looking for! – ptstone Jul 08 '21 at 20:58
0

You could also just create a ramdisk

Rob Audenaerde
  • 19,195
  • 10
  • 76
  • 121
  • 1
    If you have a way to create a ramdisk from within the java program i run, i'm all ears. If its about creating a ramdisk with extra installations and system access, i already mentioned specifically thats not an option. – ptstone Jul 08 '21 at 20:50
  • 1
    Oh. I was too quick. But there seems to be: https://stackoverflow.com/questions/4428217/can-a-java-ram-disk-be-created-to-be-used-with-the-java-io-api – Rob Audenaerde Jul 09 '21 at 07:53
  • Thank you, the link is very helpful - seems like there is no way (as in, no way without very extensive own additions) for a java-only ramdisk. – ptstone Jul 10 '21 at 11:57