kikocis/java-driver public
Changesets · Branches · Tags · Compare
| Changeset | 67cd1a324ee7a17eb8f05743cf2fef525195e99e1291b496672e91f22174c715 |
|---|---|
| Author | olim7t <omichallat+github@gmail.com> · 2016-03-18 11:10 +01:00 |
| Committer | olim7t <omichallat+github@gmail.com> · 2016-03-22 18:24 +01:00 |
| Parents | 2b94c90c68da |
2 files changed
modified manual/logging/README.md +3 −5
| @@ -176,11 +176,9 @@ | ||
| 176 | 176 | |
| 177 | 177 | Currently the `QueryLogger` can be configured to track slow queries using either |
| 178 | 178 | 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). | |
| 184 | 182 | |
| 185 | 183 | Refer to the `QueryLogger` [API docs][query_logger] for an example of usage. |
| 186 | 184 |
modified manual/speculative_execution/README.md +21 −21
| @@ -100,14 +100,11 @@ | ||
| 100 | 100 | |
| 101 | 101 | [csep]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/policies/ConstantSpeculativeExecutionPolicy.html |
| 102 | 102 | |
| 103 | -#### [PercentileSpeculativeExecutionPolicy][psep] | |
| 103 | +#### [PercentileSpeculativeExecutionPolicy] | |
| 104 | 104 | |
| 105 | 105 | This policy sets the threshold at a given latency percentile for the |
| 106 | 106 | current host, based on recent statistics. |
| 107 | 107 | |
| 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 | - | |
| 111 | 108 | First and foremost, make sure that the [HdrHistogram][hdr] library (used |
| 112 | 109 | under the hood to collect latencies) is in your classpath. It's defined |
| 113 | 110 | as an optional dependency in the driver's POM, so you'll need to |
| @@ -121,19 +118,26 @@ | ||
| 121 | 118 | </dependency> |
| 122 | 119 | ``` |
| 123 | 120 | |
| 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. | |
| 126 | 131 | |
| 127 | 132 | ```java |
| 128 | 133 | // There are more options than shown here, please refer to the API docs |
| 129 | 134 | // for more information |
| 130 | -PerHostPercentileTracker tracker = PerHostPercentileTracker | |
| 131 | - .builderWithHighestTrackableLatencyMillis(15000) | |
| 135 | +PercentileTracker tracker = ClusterWidePercentileTracker | |
| 136 | + .builder(15000) | |
| 132 | 137 | .build(); |
| 133 | 138 | ``` |
| 134 | 139 | |
| 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: | |
| 137 | 141 | |
| 138 | 142 | ```java |
| 139 | 143 | PercentileSpeculativeExecutionPolicy policy = |
| @@ -148,20 +152,16 @@ | ||
| 148 | 152 | .build(); |
| 149 | 153 | ``` |
| 150 | 154 | |
| 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 | |
| 160 | 157 | create a single tracker object and share it with both components. |
| 161 | 158 | |
| 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 | + | |
| 163 | 164 | [hdr]: http://hdrhistogram.github.io/HdrHistogram/ |
| 164 | -[phpt]: http://docs.datastax.com/en/drivers/java/2.1/com/datastax/driver/core/PerHostPercentileTracker.html | |
| 165 | 165 | |
| 166 | 166 | #### Using your own |
| 167 | 167 |