Cassandra database
を使用してデータを読み取ろうとしていますPelops client
。私はそれをうまくやることができます。
これbenchmarking
は、Cassandra データベースからの読み取りにかかる時間を意味します。だから私benchmarking code
は以下のコードに私のものを追加しました。
使用benchmarking code
中の読み取りレイテンシを測定するために正しい場所に追加したかどうかわかりませんか?Cassandra database
Pelops 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;
}
誰でも見て、私が正しいことをしているかどうかを教えてもらえますか?