[
https://issues.apache.org/jira/browse/CASSANDRA-14436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569006#comment-16569006
]
ASF GitHub Bot commented on CASSANDRA-14436:
--------------------------------------------
Github user dineshjoshi commented on a diff in the pull request:
https://github.com/apache/cassandra/pull/244#discussion_r207697651
--- Diff: src/java/org/apache/cassandra/tools/nodetool/ProfileLoad.java ---
@@ -0,0 +1,178 @@
+package org.apache.cassandra.tools.nodetool;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.apache.commons.lang3.StringUtils.join;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.stream.Collectors;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.OpenDataException;
+
+import org.apache.cassandra.metrics.Sampler.SamplerType;
+import org.apache.cassandra.tools.NodeProbe;
+import org.apache.cassandra.tools.NodeTool.NodeToolCmd;
+import org.apache.cassandra.tools.nodetool.formatter.TableBuilder;
+import org.apache.cassandra.utils.Pair;
+
+import com.google.common.collect.Lists;
+
+import io.airlift.airline.Arguments;
+import io.airlift.airline.Command;
+import io.airlift.airline.Option;
+
+@Command(name = "profileload", description = "Low footprint profiling of
activity for a period of time")
+public class ProfileLoad extends NodeToolCmd
+{
+ @Arguments(usage = "<keyspace> <cfname> <duration>", description =
"The keyspace, column family name, and duration in milliseconds")
+ private List<String> args = new ArrayList<>();
+
+ @Option(name = "-s", description = "Capacity of the sampler, higher
for more accuracy (Default: 256)")
+ private int capacity = 256;
+
+ @Option(name = "-k", description = "Number of the top samples to list
(Default: 10)")
+ private int topCount = 10;
+
+ @Option(name = "-a", description = "Comma separated list of samplers
to use (Default: all)")
+ private String samplers = join(SamplerType.values(), ',');
+
+ @Override
+ public void execute(NodeProbe probe)
+ {
+ checkArgument(args.size() == 3 || args.size() == 1 || args.size()
== 0, "Invalid arguments, either [keyspace table duration] or [duration] or no
args");
+ checkArgument(topCount < capacity, "TopK count (-k) option must be
smaller then the summary capacity (-s)");
+ String keyspace = null;
+ String table = null;
+ Integer duration = 10000;
+ if(args.size() == 3)
+ {
+ keyspace = args.get(0);
+ table = args.get(1);
+ duration = Integer.valueOf(args.get(2));
+ }
+ else if (args.size() == 1)
+ {
+ duration = Integer.valueOf(args.get(0));
+ }
+ // generate the list of samplers
+ List<String> targets = Lists.newArrayList();
+ List<String> available =
Arrays.stream(SamplerType.values()).map(Enum::toString).collect(Collectors.toList());
+ for (String s : samplers.split(","))
+ {
+ String sampler = s.trim().toUpperCase();
+ checkArgument(available.contains(sampler), String.format("'%s'
sampler is not available from: %s", s, Arrays.toString(SamplerType.values())));
+ targets.add(sampler);
+ }
+
+ Map<String, List<CompositeData>> results;
+ try
+ {
+ if (keyspace == null)
+ {
--- End diff --
Braces are unnecessary.
> Add sampler for query time and expose with nodetool
> ---------------------------------------------------
>
> Key: CASSANDRA-14436
> URL: https://issues.apache.org/jira/browse/CASSANDRA-14436
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Chris Lohfink
> Assignee: Chris Lohfink
> Priority: Major
>
> Create a new {{nodetool profileload}} that functions just like toppartitions
> but with more data, returning the slowest local reads and writes on the host
> during a given duration and highest frequency touched partitions (same as
> {{nodetool toppartitions}}). Refactor included to extend use of the sampler
> for uses outside of top frequency (max instead of total sample values).
> Future work to this is to include top cpu and allocations by query and
> possibly tasks/cpu/allocations by stage during time window.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]