-1

Cassandra databaseを使用してデータを読み取ろうとしていますPelops client。私はそれをうまくやることができます。

これbenchmarkingは、Cassandra データベースからの読み取りにかかる時間を意味します。だから私benchmarking codeは以下のコードに私のものを追加しました。

使用benchmarking code中の読み取りレイテンシを測定するために正しい場所に追加したかどうかわかりませんか?Cassandra databasePelops client

以下は私のコードです-

public Map<String, String> getAttributes(final String rowKey, final Collection<String> attributeNames, final String columnFamily) {

    final Map<String, String> attributes = new ConcurrentHashMap<String, String>();

    try {
        final SlicePredicate myPredicate = Selector.newColumnsPredicate(attributeNames.toArray(new String[attributeNames.size()]));

        final Selector selector = Pelops.createSelector(CassandraPelopsConnection.getInstance().getPoolName());

        // this is the right place to start the timer?
        CassandraTimer timer = CassandraTimer.getInstance();

        final List<Column> columnList = selector.getColumnsFromRow(columnFamily, rowKey, myPredicate, ConsistencyLevel.ONE);

       // And this is the right place to end the timer incase of Pelops client?
        timer.getDuration();

        for (Column column : columnList) {
            attributes.put(new String(column.getName()), new String(column.getValue()));
        }       
    }  catch (Exception e) {

    }

    return attributes;
}

誰でも見て、私が正しいことをしているかどうかを教えてもらえますか?

4

1 に答える 1

2

はい、正解です。クエリの直前にタイマーを開始し、クエリの直後に停止する必要があります。

補足として、タイマーで何もしていません。変数に割り当てて、後で使用できるようにします。

于 2013-04-24T08:47:45.230 に答える