Elffuss BraidHub

kikocis/java-driver public

Document PercentileTracker changes.
Changeset67cd1a324ee7a17eb8f05743cf2fef525195e99e1291b496672e91f22174c715
Authorolim7t <omichallat+github@gmail.com> · 2016-03-18 11:10 +01:00
Committerolim7t <omichallat+github@gmail.com> · 2016-03-22 18:24 +01:00
Parents2b94c90c68da

Browse the files at this changeset

2 files changed

modified manual/logging/README.md +3 −5
@@ -176,11 +176,9 @@
176176
177177 Currently the `QueryLogger` can be configured to track slow queries using either
178178 a constant threshold in milliseconds (which is the default behavior), or
179-a dynamic threshold based on per-host latency percentiles, as computed by `PerHostPercentileTracker`.
180-
181-**Dynamic thresholds are still a beta feature as of version 2.1.6: they
182-haven't been extensively tested yet, and the API is still subject to
183-change.**
179+a dynamic threshold based on latency percentiles, as computed by a `PercentileTracker` (see the
180+[speculative executions](../speculative_execution/#percentile-speculative-execution-policy) section for more information
181+about percentile trackers).
184182
185183 Refer to the `QueryLogger` [API docs][query_logger] for an example of usage.
186184
modified manual/speculative_execution/README.md +21 −21
@@ -100,14 +100,11 @@
100100
101101 [csep]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/policies/ConstantSpeculativeExecutionPolicy.html
102102
103-#### [PercentileSpeculativeExecutionPolicy][psep]
103+#### [PercentileSpeculativeExecutionPolicy]
104104
105105 This policy sets the threshold at a given latency percentile for the
106106 current host, based on recent statistics.
107107
108-**As of 2.1.6, this class is provided as a beta preview: it hasn't been
109-extensively tested yet, and the API is still subject to change.**
110-
111108 First and foremost, make sure that the [HdrHistogram][hdr] library (used
112109 under the hood to collect latencies) is in your classpath. It's defined
113110 as an optional dependency in the driver's POM, so you'll need to
@@ -121,19 +118,26 @@
121118 </dependency>
122119 ```
123120
124-Then create an instance of [PerHostPercentileTracker][phpt] that will collect
125-latency statistics for your `Cluster`:
121+Then create a [PercentileTracker] that will collect latency statistics for your `Cluster`. Two implementations are
122+provided with the driver:
123+
124+* [PerHostPercentileTracker]: maintains one histogram per host. A given host is only compared to itself, so its
125+ latencies will rank in the higher percentiles only if it's slower than its usual performance;
126+* [ClusterWidePercentileTracker]: maintains a single histogram for the whole cluster. Hosts are compared against each
127+ other, so a host that is consistently slower than the rest of the cluster will get bad rankings.
128+
129+We recommend trying `ClusterWidePercentileTracker` first, as it has produced the best results in our tests. You may also
130+extend `PercentileTracker` with your own implementation.
126131
127132 ```java
128133 // There are more options than shown here, please refer to the API docs
129134 // for more information
130-PerHostPercentileTracker tracker = PerHostPercentileTracker
131- .builderWithHighestTrackableLatencyMillis(15000)
135+PercentileTracker tracker = ClusterWidePercentileTracker
136+ .builder(15000)
132137 .build();
133138 ```
134139
135-Create an instance of the policy with the tracker, and pass it to your
136-cluster:
140+Next, create an instance of the policy with the tracker, and pass it to your cluster:
137141
138142 ```java
139143 PercentileSpeculativeExecutionPolicy policy =
@@ -148,20 +152,16 @@
148152 .build();
149153 ```
150154
151-Finally, don't forget to register your tracker with the cluster (the
152-policy does not do this itself):
153-
154-```java
155-cluster.register(tracker);
156-```
157-
158-Note that `PerHostPercentileTracker` may also be used with a slow query
159-logger (see the [Logging](../logging/) section). In that case, you would
155+Note that `PercentileTracker` may also be used with a slow query
156+logger (see the [Logging](../logging/#constant-vs-dynamic-thresholds) section). In that case, you would
160157 create a single tracker object and share it with both components.
161158
162-[psep]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/policies/PercentileSpeculativeExecutionPolicy.html
159+[PercentileSpeculativeExecutionPolicy]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/policies/PercentileSpeculativeExecutionPolicy.html
160+[PercentileTracker]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/PercentileTracker.html
161+[PerHostPercentileTracker]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/PerHostPercentileTracker.html
162+[ClusterWidePercentileTracker]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/ClusterWidePercentileTracker.html
163+
163164 [hdr]: http://hdrhistogram.github.io/HdrHistogram/
164-[phpt]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/PerHostPercentileTracker.html
165165
166166 #### Using your own
167167