You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Problem

Portable object serialization is first released in Apache Ignite 1.4 as an experimental feature and is not available form public API.

Some critical Ignite features like indexing/queries require object introspection without deserialization. To achieve this portable protocol writes object fields as follows:

[X  ..X+4] - Field 1 ID
[X+4..X+8] - Field 1 length
[X+8..Y  ] - Field 1 content
[Y  ..Y+4] - Field 2 ID

To read a field we get it's ID and search for it starting from the object head. This gives good performance and data locality for regular serialziation/deserialization cycles because normally fields are written in the same order as they are read. As a result usually we can find the field during read in O(1) time.

void writePortable(PortableWriter w) {
    w.write("A", a);
    w.write("B", b);
}
 
void readPortable(PortableReader r) {
    a = r.read("A");
    b = r.read("B");
}

To the contrast, indexing engine usually read fields in random order with O(N) complexity on average.

We need to change the protocol so that field position could be found in ~O(1) on average.

Protocol 

Implementation details

  • No labels