当前位置: 首页>>代码示例>>Java>>正文


Java PBSPredictionResult类代码示例

本文整理汇总了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;
            }
        }
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:42,代码来源:NodeCmd.java


注:本文中的org.apache.cassandra.service.PBSPredictionResult类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。