JGroupsFRAG

Definition

 

Fragments messages larger than  bytes. Unfragments at the receiver's side. Works for both unicast and multicast messages.

 

FRAG serializes each message in order to break it into smaller fragments. It does this even though the message's payload is already a byte{FOOTNOTE DEF  } because it wants to accurately account for the size of any message headers and any src or dest addresses in the fragmentation calculation. FRAG2 uses a slightly less accurate algorithm that avoids the overhead of this serialization; therefore it is generally recommended over FRAG.

 

Configuration Example

 

     <FRAG frag_size="8192" down_thread="false" up_thread="false"></FRAG>

 

Configuration Parameters


NameDescription
frag_sizeThe max number of bytes in a message. Larger messages will be fragmented. Default is 8192 bytes
idGive the protocol a different ID if needed so we can have multiple instances of it in the same stack
levelSets the logger level (see javadocs)
max_retained_bufferThe max size in bytes for the byte array output buffer
nameGive the protocol a different name if needed so we can have multiple instances of it in the same stack
statsDetermines whether to collect statistics (and expose them via JMX). Default is true

 

See also Protocol Configuration Common Parameters.

 

I sometimes see FRAG or FRAG2 in a TCP- or TCP_NIO-based config.  Why is it there? Doesn't TCP already provide fragmentation?

 

TCP does provide fragmentation, but a fragmentation protocol is still needed if FC is used. The reason for this is that if you send a message larger than FC.max_bytes, FC.down() would block! So FRAG2.frag_size needs to be set to always be less than FC.max_bytes.

 

For an explanation of why you'd have FC in a TCP- or TCP_NIO-based config, see the FC page.

 

Back To JGroups