Skip to content

Add serialization support for RAMDirectory [LUCENE-3516] #4590

@asfimport

Description

@asfimport

We are building Lucene indexes via Hadoop, and using byte[] for of RAMDirectory as intermediate storage. (we are using Hadoop's indexing contrib package)
Currently Java serialization is used, and seemed wasteful and not portable across languages.
Since RAMDirectory essentially is a collection of byte[], writing a serializer seemed easy.
Attached please find a utility class that does such. This includes a light performance comparison test comparing the java serialization:

Results: (input, number of files and avg file size, output, size percentage: our ser/java ser, time, serialization: percentage, our ser/java ser, deserialization: percentage, our ser/java ser

test 1:(3, 1k)
size: 66.93%
ser time: 1.89%
deser time: 4.48%

test 2: (100,100)
size: 95.16%
ser time: 4.01%
deser time: 13.36%

test 3: (3,50k)
size: 98.42%
ser time: 3.09%
deser time: 8.10%

test 4: (1,1k)
size: 41.70%
ser time: 1.85%
dser time: 3.85%

The implementation is very elementary, yet still much better than java ser. Esp on the time (avg 50x faster)


Migrated from LUCENE-3516 by John Wang
Attachments: RAMDirectorySerializer.java

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions