[
https://issues.apache.org/jira/browse/CASSANDRA-14436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569008#comment-16569008
]
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_r207697487
--- Diff: src/java/org/apache/cassandra/metrics/Sampler.java ---
@@ -0,0 +1,67 @@
+package org.apache.cassandra.metrics;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.cassandra.concurrent.JMXEnabledThreadPoolExecutor;
+import org.apache.cassandra.concurrent.NamedThreadFactory;
+
+import com.google.common.annotations.VisibleForTesting;
+
+public abstract class Sampler<T>
+{
+ public enum SamplerType
+ {
+ READS, WRITES, LOCAL_READ_TIME, WRITE_SIZE, CAS_CONTENTIONS
+ }
+
+ @VisibleForTesting
+ static final ThreadPoolExecutor samplerExecutor = new
JMXEnabledThreadPoolExecutor(1, 1,
+ TimeUnit.SECONDS,
+ new LinkedBlockingQueue<Runnable>(),
+ new NamedThreadFactory("Sampler"),
+ "internal");
+
+ public void addSample(final T item, final int value)
+ {
+ if (isEnabled())
+ samplerExecutor.execute(() -> insert(item, value));
+ }
+
+ protected abstract void insert(T item, long value);
+
+ public abstract boolean isEnabled();
+
+ public abstract void beginSampling(int capacity);
+
+ public abstract List<Sample<T>> finishSampling(int count);
+
+ public abstract String toString(T value);
+
+ /**
+ * Represents the ranked items collected during a sample period
+ */
+ public static class Sample<S> implements Serializable
+ {
+
--- End diff --
Extra white space?
> 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]