JOL reports:
org.jgroups.protocols.UnicastHeader3 object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 4 (object header) 01 00 00 00 (00000001 00000000 00000000 00000000) (1) 4 4 (object header) 00 00 00 00 (00000000 00000000 00000000 00000000) (0) 8 4 (object header) 9d 11 01 f8 (10011101 00010001 00000001 11111000) (-134147683) 12 2 short Header.prot_id 0 14 2 (alignment/padding gap) N/A 16 8 long UnicastHeader3.seqno 0 24 8 long UnicastHeader3.timestamp 0 32 2 short UnicastHeader3.conn_id 0 34 1 byte UnicastHeader3.type 0 35 1 boolean UnicastHeader3.first false 36 4 (loss due to the next object alignment) Instance size: 40 bytes Space losses: 2 bytes internal + 4 bytes external = 6 bytes total
We could reduce the size to 32 by making timestamp an int. This field is used for comparison against previous timestamps, and since the comparison takes numeric overflow into account, wrap-around is not a problem.
After the change of timestamp from long -> int:
org.jgroups.protocols.UnicastHeader3 object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 4 (object header) 01 00 00 00 (00000001 00000000 00000000 00000000) (1) 4 4 (object header) 00 00 00 00 (00000000 00000000 00000000 00000000) (0) 8 4 (object header) 9d 11 01 f8 (10011101 00010001 00000001 11111000) (-134147683) 12 2 short Header.prot_id 0 14 2 (alignment/padding gap) N/A 16 8 long UnicastHeader3.seqno 0 24 4 int UnicastHeader3.timestamp 0 28 2 short UnicastHeader3.conn_id 0 30 1 byte UnicastHeader3.type 0 31 1 boolean UnicastHeader3.first false Instance size: 32 bytes Space losses: 2 bytes internal + 0 bytes external = 2 bytes total