本文整理匯總了Java中org.apache.cassandra.service.PBSPredictionResult類的典型用法代碼示例。如果您正苦於以下問題:Java PBSPredictionResult類的具體用法?Java PBSPredictionResult怎麽用?Java PBSPredictionResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PBSPredictionResult類屬於org.apache.cassandra.service包,在下文中一共展示了PBSPredictionResult類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: predictConsistency
import org.apache.cassandra.service.PBSPredictionResult; //導入依賴的package包/類
public void predictConsistency(Integer replicationFactor,
Integer timeAfterWrite,
Integer numVersions,
Float percentileLatency,
PrintStream output)
{
PBSPredictorMBean predictorMBean = probe.getPBSPredictorMBean();
for(int r = 1; r <= replicationFactor; ++r) {
for(int w = 1; w <= replicationFactor; ++w) {
if(w+r > replicationFactor+1)
continue;
try {
PBSPredictionResult result = predictorMBean.doPrediction(replicationFactor,
r,
w,
timeAfterWrite,
numVersions,
percentileLatency);
if(r == 1 && w == 1) {
output.printf("%dms after a given write, with maximum version staleness of k=%d%n", timeAfterWrite, numVersions);
}
output.printf("N=%d, R=%d, W=%d%n", replicationFactor, r, w);
output.printf("Probability of consistent reads: %f%n", result.getConsistencyProbability());
output.printf("Average read latency: %fms (%.3fth %%ile %dms)%n", result.getAverageReadLatency(),
result.getPercentileReadLatencyPercentile()*100,
result.getPercentileReadLatencyValue());
output.printf("Average write latency: %fms (%.3fth %%ile %dms)%n%n", result.getAverageWriteLatency(),
result.getPercentileWriteLatencyPercentile()*100,
result.getPercentileWriteLatencyValue());
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
return;
}
}
}
}