Javolution Struct optimizations/config tuning tips?

356 Views Asked by At

I'm using a Javolution Struct class for the events in a Disruptor ring buffer - it seemed the easiest way of making my messages more cache friendly. I have no previous experience with Javolution, though, and have found very little material regarding tutorials on tuning Javolution.

My questions are:

  1. What are the drawbacks I should be aware of with this approach (i.e., with using Javolution Structs as event classes)?
  2. Are there any Javolution-specific optimizations I should be aware of? The only tuning parameter I've found and used so far is:

    @Override public boolean isPacked() { return true; }

Thanks in advance

-- EDIT --

Give or take, the class looks like this:

public class DisruptorEvent extends Struct {
    Signed8 field1 = new Signed8();
    Signed32 field2 = new Signed32();
    Signed64 field3 = new Signed64();
    Signed64 field4 = new Signed64();
    Signed64 field5 = new Signed64();
    Signed32 field6 = new Signed32();

    @Override
    public boolean isPacked() {
        return true;
    }
}
1

There are 1 best solutions below

0
On

In addition to packaing, you should also take care of byteOrder(), return big/little endian.

Note that javolution Struct use ByteBuffer and not byte[]. Its not very clear to me whether you need serialization or not, but if you do, make sure you work on ByteBuffers that's been "rewinded"