* Since we're buffering network reads to the heap and then deserializing them it makes no sense to buffer a message that is 90% of the heap size since we couldn't deserialize it anyway * I think `30%` is a more reasonable guess here given that we can reasonably assume that the deserialized message will be larger than the serialized message itself and processing it will take additional heap as well
This commit is contained in:
parent
da03a5d8d1
commit
d6a9edea16
|
@ -100,7 +100,7 @@ public abstract class TcpTransport extends AbstractLifecycleComponent implements
|
|||
|
||||
// This is the number of bytes necessary to read the message size
|
||||
private static final int BYTES_NEEDED_FOR_MESSAGE_SIZE = TcpHeader.MARKER_BYTES_SIZE + TcpHeader.MESSAGE_LENGTH_SIZE;
|
||||
private static final long NINETY_PER_HEAP_SIZE = (long) (JvmInfo.jvmInfo().getMem().getHeapMax().getBytes() * 0.9);
|
||||
private static final long THIRTY_PER_HEAP_SIZE = (long) (JvmInfo.jvmInfo().getMem().getHeapMax().getBytes() * 0.3);
|
||||
private static final BytesReference EMPTY_BYTES_REFERENCE = new BytesArray(new byte[0]);
|
||||
|
||||
// this limit is per-address
|
||||
|
@ -755,9 +755,9 @@ public abstract class TcpTransport extends AbstractLifecycleComponent implements
|
|||
throw new StreamCorruptedException("invalid data length: " + messageLength);
|
||||
}
|
||||
|
||||
if (messageLength > NINETY_PER_HEAP_SIZE) {
|
||||
if (messageLength > THIRTY_PER_HEAP_SIZE) {
|
||||
throw new IllegalArgumentException("transport content length received [" + new ByteSizeValue(messageLength) + "] exceeded ["
|
||||
+ new ByteSizeValue(NINETY_PER_HEAP_SIZE) + "]");
|
||||
+ new ByteSizeValue(THIRTY_PER_HEAP_SIZE) + "]");
|
||||
}
|
||||
|
||||
return messageLength;
|
||||
|
|
Loading…
Reference in New Issue