本文整理汇总了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;
}
}
}
}