Skip to content
Denis Sheahan edited this page Feb 29, 2012 · 4 revisions

Get

The simplest Cassandra Get fetches a single column from a row given a rowid and column name. As the screenshot shows we need to specify

  • ROW KEY the rowid to use for the get. This can be a random number, JMeter variable or constant

  • COLUMN NAME . The column within the row to return. This can be a random number, JMeter variable or constant

  • Key, Column and Value Serializers As with Put this can be one of AsciiSerializer, BooleanSerializer, DateSerializer, BytesSerializer, CharSerializer, StringSerializer, FloatSerializer, UUIDSerializer, IntegerSerializer, DoubleSerializer, ShortSerializer, LongSerializer, BigIntegerSerializer.

As an example lets use the simple schema we created at the start and change the data in the csv file (rowid, column_name, data) to give each row multiple columns

1,0,test_data_bbb
1,1,test_data_bbb
1,2,test_data_bbb
1,3,test_data_bbb
1,4,test_data_bbb
2,0,test_data_ccc
2,1,test_data_ccc
2,2,test_data_ccc
2,3,test_data_ccc
2,4,test_data_ccc
3,0,test_data_ddd
3,1,test_data_ddd

We then use a simple JMeter Put to load the data into a new Column Family, CustomerSimple. cassandra-cli shows that each row now has 5 columns

[default@MemberKeySp] list CustomerSimple;
Using default limit of 100
-------------------
RowKey: 3
=> (column=0, value=746573745f646174615f616161, timestamp=1330065401292000)
=> (column=1, value=746573745f646174615f626262, timestamp=1330065401402000)
=> (column=2, value=746573745f646174615f636363, timestamp=1330065401508000)
=> (column=3, value=746573745f646174615f646464, timestamp=1330065401620000)
=> (column=4, value=746573745f646174615f656565, timestamp=1330065401726000)
-------------------
RowKey: 6
=> (column=0, value=746573745f646174615f616161, timestamp=1330065402935000)
=> (column=1, value=746573745f646174615f626262, timestamp=1330065403040000)
=> (column=2, value=746573745f646174615f636363, timestamp=1330065403150000)
=> (column=3, value=746573745f646174615f646464, timestamp=1330065403259000)
=> (column=4, value=746573745f646174615f656565, timestamp=1330065403369000)
...

In our screenshot example we use the simple Get to extract random columns from the first 25 rows. The reults of the Get will be in the Response window of the View Response Tree Listener in this case the single column value

The jmx file for this simple Get example is here the csv file is here

Get Range Slice

If you want to retrieve more than one column from a row use the Get Range Slice Sampler. There are a number of ways to specify the range.

  • By leaving START COLUMN NAME and END COLUMN NAME blank and just specifying COUNT, you get the first COUNT columns. To get the entire range just set COUNT to be a large number

  • If you set the START to 2 and leave END blank you wil get columns 2, 3, 4

  • If you set START to 1 and END to 3 you will get columns 1,2,3. This example is shown in the screenshot.

One gotcha is the Reverse checkbox (highlighted in red). If this is set then data will be returned in reverse. When checked, however, the START column specified must be greater than END or you will get an error

The jmx for this simple Range Get experiment is here

Get Composite Column

The last Get option is Composite Column. This allows you to extract a single column from a row with a Composite Column name. The format of the Column name is part1:part2

Using our composite column csv file which has fields rowid,composite column name,value we can use the first two entries to extract the columns

0,1:comp111,ef3e0b
0,2:comp222,1de7c16
0,3:comp333,2cdba21
0,4:comp444,3bcf82c
0,5:comp555,4ac3637
1,0:comp666,59b7442
1,1:comp777,68ab24d
1,2:comp888,779f058
1,3:comp999,8692e63

The screenshot for the Composite Column Get is shown below

As usual ROW KEY and COLUMN NAME can be any JMeter variable or constant

The jmx file for the composite get experiment is here

Clone this wiki locally