當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。