You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/11/05 00:32:42 UTC
[GitHub] [cassandra] yifan-c commented on a change in pull request #1289: [CASSANDRA-17065] Support settings for entire SSTable outbound streaming
yifan-c commented on a change in pull request #1289:
URL: https://github.com/apache/cassandra/pull/1289#discussion_r743310956
##########
File path: src/java/org/apache/cassandra/tools/nodetool/GetInterDCStreamThroughput.java
##########
@@ -18,16 +18,23 @@
package org.apache.cassandra.tools.nodetool;
import io.airlift.airline.Command;
-
+import io.airlift.airline.Option;
import org.apache.cassandra.tools.NodeProbe;
import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
-@Command(name = "getinterdcstreamthroughput", description = "Print the Mb/s throughput cap for inter-datacenter streaming in the system")
+@Command(name = "getinterdcstreamthroughput", description = "Print the Mb/s throughput cap for inter-datacenter streaming and entire SSTable inter-datacenter streaming in the system")
public class GetInterDCStreamThroughput extends NodeToolCmd
{
+ @SuppressWarnings("UnusedDeclaration")
+ @Option(name = { "-esst", "--print-entire-sstable-throughput" }, description = "Print entire SSTable streaming throughput")
+ private boolean printEntireSSTableThroughput;
+
@Override
public void execute(NodeProbe probe)
{
- probe.output().out.println("Current inter-datacenter stream throughput: " + probe.getInterDCStreamThroughput() + " Mb/s");
+ if (printEntireSSTableThroughput)
+ probe.output().out.println("Current entire SSTable inter-datacenter stream throughput: " + probe.getEntireSSTableInterDCStreamThroughput() + " Mb/s");
Review comment:
If throttling is disabled with negative values, `probe.getEntireSSTableInterDCStreamThroughput` returns the negative value too, which could be confusing. How about "Current entire SSTable inter-datacenter stream throughput: unlimited"?
##########
File path: conf/cassandra.yaml
##########
@@ -897,7 +897,9 @@ sstable_preemptive_open_interval_in_mb: 50
# When enabled, permits Cassandra to zero-copy stream entire eligible
# SSTables between nodes, including every component.
# This speeds up the network transfer significantly subject to
-# throttling specified by stream_throughput_outbound_megabits_per_sec.
+# throttling specified by entire_sstable_stream_throughput_outbound_megabits_per_sec,
Review comment:
nit: can you move this configuration `stream_entire_sstables` together with the new throttling configurations, as they are more logically related.
##########
File path: src/java/org/apache/cassandra/net/AsyncStreamingOutputPlus.java
##########
@@ -203,16 +204,39 @@ long writeFileToChannel(FileChannel fc, RateLimiter limiter, int batchSize) thro
@VisibleForTesting
long writeFileToChannelZeroCopy(FileChannel file, RateLimiter limiter, int batchSize, int lowWaterMark, int highWaterMark) throws IOException
+ {
+ if (!limiter.isRateLimited())
+ return writeFileToChannelZeroCopyUnthrottled(file);
+ else
+ return writeFileToChannelZeroCopyThrottled(file, limiter, batchSize, lowWaterMark, highWaterMark);
+ }
+
+ private long writeFileToChannelZeroCopyUnthrottled(FileChannel file) throws IOException
+ {
+ final long length = file.size();
+
+ if (logger.isTraceEnabled())
+ logger.trace("Writing {} bytes", length);
+
+ ChannelPromise promise = beginFlush(length, 0, length);
+ final DefaultFileRegion defaultFileRegion = new DefaultFileRegion(file, 0, length);
+ channel.writeAndFlush(defaultFileRegion, promise);
+
+ return length;
+ }
+
+ private long writeFileToChannelZeroCopyThrottled(FileChannel file, RateLimiter limiter, int batchSize, int lowWaterMark, int highWaterMark) throws IOException
{
final long length = file.size();
long bytesTransferred = 0;
final SharedFileChannel sharedFile = SharedDefaultFileRegion.share(file);
try
{
+ int toWrite;
Review comment:
nit: it does not seem necessary to move the `toWrite` out of the while loop.
##########
File path: src/java/org/apache/cassandra/service/StorageService.java
##########
@@ -1529,6 +1540,18 @@ public int getInterDCStreamThroughputMbPerSec()
return DatabaseDescriptor.getInterDCStreamThroughputOutboundMegabitsPerSec();
}
+ public void setEntireSSTableInterDCStreamThroughputMbPerSec(int value)
+ {
+ int oldValue = DatabaseDescriptor.getEntireSSTableInterDCStreamThroughputOutboundMegabitsPerSec();
+ DatabaseDescriptor.setEntireSSTableInterDCStreamThroughputOutboundMegabitsPerSec(value);
+ StreamManager.StreamRateLimiter.updateEntireSSTableInterDCThroughput();
+ logger.info("setinterdcstreamthroughput (entire SSTable): throttle set to {} Mb/s (was {} Mb/s)", value, oldValue);
Review comment:
The negative values are allowed to disable the rate limiter. The log message would be confusing if the `value` is negative.
##########
File path: src/java/org/apache/cassandra/tools/nodetool/GetInterDCStreamThroughput.java
##########
@@ -18,16 +18,23 @@
package org.apache.cassandra.tools.nodetool;
import io.airlift.airline.Command;
-
+import io.airlift.airline.Option;
import org.apache.cassandra.tools.NodeProbe;
import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
-@Command(name = "getinterdcstreamthroughput", description = "Print the Mb/s throughput cap for inter-datacenter streaming in the system")
+@Command(name = "getinterdcstreamthroughput", description = "Print the Mb/s throughput cap for inter-datacenter streaming and entire SSTable inter-datacenter streaming in the system")
public class GetInterDCStreamThroughput extends NodeToolCmd
{
+ @SuppressWarnings("UnusedDeclaration")
+ @Option(name = { "-esst", "--print-entire-sstable-throughput" }, description = "Print entire SSTable streaming throughput")
Review comment:
The short option names typically have single character. Maybe use `-e` here for the entire file.
For the long option name, `print` seems redundant because the command is already `getinterdcstreamthroughput`.
If you agree, please also update the other commands, `GetStreamThroughput`, `SetInterDCStreamThroughput` (set in the option name is redundant) and `SetStreamThroughput`.
--
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: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org