clohfink commented on code in PR #3683:
URL: https://github.com/apache/cassandra/pull/3683#discussion_r2291940195
##########
src/java/org/apache/cassandra/streaming/StreamManager.java:
##########
@@ -94,13 +94,49 @@ public static StreamRateLimiter
getEntireSSTableRateLimiter(InetAddressAndPort p
DatabaseDescriptor.getEntireSSTableInterDCStreamThroughputOutboundBytesPerSec());
}
- public static class StreamRateLimiter implements
StreamingDataOutputPlus.RateLimiter
+ /**
+ * Get incoming streaming rate limiter for stream operations.
+ * When {@code stream_throughput_inbound}
+ * is less than or equal ot {@code 0}, this returns rate limiter with the
+ * rate of {@link Double.MAX_VALUE} bytes per second.
+ * Rate unit is bytes per sec.
+ *
+ * @return {@link StreamRateLimiter}
+ */
+ public static StreamRateLimiter getInboundRateLimiter()
+ {
+ return new StreamRateLimiter(StreamRateLimiter.INBOUND_LIMITTER,
+ null,
+
DatabaseDescriptor.getStreamThroughputInboundBytesPerSec(),
+ 0);
+ }
+
+ /**
+ * Get incoming streaming rate limiter for entire sstable stream
operations.
+ * When {@code entire_sstable_stream_throughput_inbound}
+ * is less than or equal ot {@code 0}, this returns rate limiter with the
+ * rate of {@link Double.MAX_VALUE} bytes per second.
+ * Rate unit is bytes per sec.
+ *
+ * @return {@link StreamRateLimiter
+ */
+ public static StreamRateLimiter getEntireSSTableInboundRateLimiter()
+ {
+ return new
StreamRateLimiter(StreamRateLimiter.ENTIRE_SSTABLE_INBOUND_LIMITTER,
+ null,
+
DatabaseDescriptor.getEntireSSTableStreamThroughputInboundBytesPerSec(),
+ 0);
+ }
+
+ public static class StreamRateLimiter implements
org.apache.cassandra.streaming.RateLimiter
{
public static final double BYTES_PER_MEBIBYTE = 1024.0 * 1024.0;
private static final RateLimiter LIMITER =
RateLimiter.create(calculateRateInBytes());
private static final RateLimiter INTER_DC_LIMITER =
RateLimiter.create(calculateInterDCRateInBytes());
private static final RateLimiter ENTIRE_SSTABLE_LIMITER =
RateLimiter.create(calculateEntireSSTableRateInBytes());
private static final RateLimiter ENTIRE_SSTABLE_INTER_DC_LIMITER =
RateLimiter.create(calculateEntireSSTableInterDCRateInBytes());
+ private static final RateLimiter INBOUND_LIMITTER =
RateLimiter.create(calculateInboundRateInBytes());
+ private static final RateLimiter ENTIRE_SSTABLE_INBOUND_LIMITTER =
RateLimiter.create(calculateEntireSSTableInboundRateInBytes());
Review Comment:
typo: LIMITER for both
##########
src/java/org/apache/cassandra/db/streaming/CassandraCompressedStreamReader.java:
##########
@@ -73,7 +73,7 @@ public SSTableMultiWriter read(DataInputPlus inputPlus)
throws Throwable
SSTableMultiWriter writer = null;
try (CompressedInputStream cis = new CompressedInputStream(inputPlus,
compressionInfo, ChecksumType.CRC32, cfs::getCrcCheckChance))
{
- TrackedDataInputPlus in = new TrackedDataInputPlus(cis);
+ RateLimitedTrackedDataInputPlus in = new
RateLimitedTrackedDataInputPlus(cis, -1, limiter, totalSize, 1 << 16);
Review Comment:
the 64kb is kinda hard coded in all places using this right? maybe make it a
constant and overridable with yaml or system property
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]