Reduce max native frame size to 16MB

Patch by brandonwilliams; reviewed by blerer for CASSANDRA-16886
This commit is contained in:
Brandon Williams 2021-08-26 10:16:42 -05:00
parent b6b3be6d8a
commit 08444cbc3f
5 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,5 @@
4.1
* Reduce native transport max frame size to 16MB (CASSANDRA-16886)
* Add support for filtering using IN restrictions (CASSANDRA-14344)
* Provide a nodetool command to invalidate auth caches (CASSANDRA-16404)
* Catch read repair timeout exceptions and add metric (CASSANDRA-16880)

View File

@ -710,9 +710,9 @@ native_transport_port: 9042
# native_transport_max_threads: 128
#
# The maximum size of allowed frame. Frame (requests) larger than this will
# be rejected as invalid. The default is 256MB. If you're changing this parameter,
# be rejected as invalid. The default is 16MB. If you're changing this parameter,
# you may want to adjust max_value_size_in_mb accordingly. This should be positive and less than 2048.
# native_transport_max_frame_size_in_mb: 256
# native_transport_max_frame_size_in_mb: 16
# The maximum number of concurrent client connections.
# The default is -1, which means unlimited.

View File

@ -186,7 +186,7 @@ public class Config
public int native_transport_port = 9042;
public Integer native_transport_port_ssl = null;
public int native_transport_max_threads = 128;
public int native_transport_max_frame_size_in_mb = 256;
public int native_transport_max_frame_size_in_mb = 16;
public volatile long native_transport_max_concurrent_connections = -1L;
public volatile long native_transport_max_concurrent_connections_per_ip = -1L;
public boolean native_transport_flush_in_batches_legacy = false;

View File

@ -2257,6 +2257,11 @@ public class DatabaseDescriptor
return (int) ByteUnit.MEBI_BYTES.toBytes(conf.native_transport_max_frame_size_in_mb);
}
public static void setNativeTransportMaxFrameSize(int bytes)
{
conf.native_transport_max_frame_size_in_mb = (int) ByteUnit.MEBI_BYTES.fromBytes(bytes);
}
public static long getNativeTransportMaxConcurrentConnections()
{
return conf.native_transport_max_concurrent_connections;
@ -3298,6 +3303,11 @@ public class DatabaseDescriptor
{
return val * multiplier;
}
public long fromBytes(int val)
{
return val / multiplier;
}
}
/**

View File

@ -59,6 +59,7 @@ import org.apache.cassandra.utils.concurrent.SimpleCondition;
import org.apache.cassandra.utils.concurrent.NonBlockingRateLimiter;
import static org.apache.cassandra.config.EncryptionOptions.TlsEncryptionPolicy.UNENCRYPTED;
import static org.apache.cassandra.io.util.FileUtils.ONE_MB;
import static org.apache.cassandra.net.FramingTest.randomishBytes;
import static org.apache.cassandra.transport.Flusher.MAX_FRAMED_PAYLOAD_SIZE;
import static org.apache.cassandra.utils.concurrent.NonBlockingRateLimiter.NO_OP_LIMITER;
@ -104,6 +105,8 @@ public class CQLConnectionTest
alloc = GlobalBufferPoolAllocator.instance;
// set connection-local queue size to 0 so that all capacity is allocated from reserves
DatabaseDescriptor.setNativeTransportReceiveQueueCapacityInBytes(0);
// set transport to max frame size possible
DatabaseDescriptor.setNativeTransportMaxFrameSize(256 * (int) ONE_MB);
}
@Test