DataStax Astra – Setup Free Tier Account and Evaluate Performance using NoSQLBench on Linux

Name of Innovation

DataStax Astra – Setup Free Tier Account and Evaluate Performance using NoSQLBench on Linux

September 3, 2020 Uncategorized 1

In this post, we will describe how you can setup Data Stax Astra account, how to use it, various features on the Astra Web Console, and how we can measure the performance of the Astra account which we created. We will use a very powerful tool named nosql bench (nb /nosql Performance Benchmarks).

Astra uses DSE Cassandra behind the scene.

Account setup

Create a free account at astra.datastax.com .The free account comes with 10GB of free space

 

Database Setup

Login into your account and the console looks like this.

Login in to your account and the console looks like this.Fill out the relevant details and click on the launch  database.

Click on View Database

 

Download Secure Bundle

It is the key step if you want to access the Astra from your own clients ( e.g. from Azure, AWS, GCP/Google Cloud ) or even from your own laptop/personal computer. Download the Secure Connect Bundle and keep it safe for later uses.

Click on the Download secure connect bundle to download it.

 

CQLSH Tool

Cqlsh tool can be download from here .

  • Click on the Download to download the tool.

OR

On your Centos terminal you can use wget to download the tool.

  • sudo yum install wget -y
  • wget https://downloads.datastax.com/enterprise/cqlsh-astra.tar.gz

How to CQLSH to interact with the Database

  • After downloading the CQLSH tool
    • cd cqlsh-astra/bin
    • ./cqlsh -u <username of the database> -p <password of the database> -b <secure bundle path>

NoSqlBench setup here

Setting up nosqlbench we have found was a little trickier, we have created an article for the same.
Please follow the link to setup nosqlbench on your client machine.

Know More

Configuration file for running nosqlbench (nb ) on your newly created Astra account on DataStax

nosqlbench can be run with the inbuild configurations or using  YAML file as an input configuration file.

The below section talks about how we can use the custom YAML file. When you clone from here you get a few examples YAML file free along with it. In the example below one of the sample file has been used –

Sample YAML file –

# nb -v run driver=cql yaml=cql-keyvalue tags=phase:schema host=dsehost
scenarios:
 default:
 - run driver=cql tags==phase:schema threads==1 cycles==UNDEF
 - run driver=cql tags==phase:rampup cycles===TEMPLATE(rampup-cycles,100000) threads=auto
 - run driver=cql tags==phase:main cycles===TEMPLATE(main-cycles,1000000 threads=auto
bindings:
 seq_key: Mod(<<keycount:100000>>); ToString() -> String
 seq_value: HashedFileExtractToString('data/lorem_ipsum_full.txt',3800,3896)
 rw_key: <<keydist:Uniform(0,100000)->int>>; ToString() -> String
# rw_key: <<keydist:Uniform(0,100000)->int>>; ToString() -> String
 #rw_value: Hash(); <<valdist:Uniform(0,10000000)->int>>; ToString() -> String
 rw_value: HashedFileExtractToString('data/lorem_ipsum_full.txt',3800,3896)

blocks:
 - name: schema
 tags:
 phase: schema
 params:
 prepared: false
 statements:
 - create-keyspace: |
 create keyspace if not exists <<keyspace:samplerun>>
 WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '<<rf:1>>'}
 AND durable_writes = true;
 tags:
 name: create-keyspace
 - create-table: |
 create table if not exists <<keyspace:samplerun>>.<<table:keyvalue>> (
 key text,
 value text,
 PRIMARY KEY (key)
 ) 
 tags:
 name: create-table
 - name: rampup
 tags:
 phase: rampup
 params:
 cl: <<write_cl:LOCAL_QUORUM>>
 statements:
 - rampup-insert: |
 insert into <<keyspace:samplerun>>.<<table:keyvalue>>
 (key, value)
 values ({seq_key},{seq_value});
 tags:
 name: rampup-insert
 - name: verify
 tags:
 phase: verify
 type: read
 params:
 cl: <<read_cl:LOCAL_QUORUM>>
 statements:
 - verify-select: |
 select * from <<keyspace:samplerun>>.<<table:keyvalue>> where key={seq_key};
 verify-fields: key->seq_key, value->seq_value
 tags:
 name: verify
 - name: main-read
 tags:
 phase: main
 type: read
 params:
 ratio: 80
 cl: <<read_cl:LOCAL_QUORUM>>
 statements:
 - main-select: |
 select * from <<keyspace:samplerun>>.<<table:keyvalue>> where key={rw_key};
 tags:
 name: main-select
 - name: main-write
 tags:
 phase: main
 type: write
 params:
 ratio: 20
 cl: <<write_cl:LOCAL_QUORUM>>
 statements:
 - main-insert: |
 insert into <<keyspace:samplerun>>.<<table:keyvalue>>
 (key, value) values ({rw_key}, {rw_value});
 tags:
 name: main-insert

Evaluate Performance using NoSQLBench

Now assuming that the past steps you were able to execute them successfully let us understand what we want to achieve in this section. For sure, our goal is the get the performance numbers of Astra using nosqlbench.
Following are the typical steps which one needs to follow to measure the performance –
1. Data Preparation
2. Run read or mixed load to see the related (read and write ) numbers

Data Preparation

Following command creates table with the name and specs mention in the YAML file under consideration.

./nb run yaml=<yaml file path> tags=phase:schema,name=create-table secureconnectbundle=<secure bundle file path> username=<database username> password=<database user password> –show-stacktraces

Example- ./nb run yaml=/home/woir/Downloads/test/cql-keyvalue10m.yaml tags=phase:schema,name=create-table secureconnectbundle=/home/woir/Downloads/test/cql-keyvalue10m.yaml username=user password=dcba –show-stacktraces

Populating the table ( inserting data )

Load the table with benchmark data-

./nb run yaml=<yaml file path> tags=phase:rampup secureconnectbundle=<secure bundle file path> username=<database username> password=<database user password> –show-stacktraces cycles=10000 –progress console:1s threads=auto

Example- ./nb run yaml=/home/woir/Downloads/test/cql-keyvalue10m.yaml tags=phase:rampup secureconnectbundle=/home/woir/Downloads/secure-connect-test.zip username=user password=dcba –show-stacktraces cycles=10000 –progress console:1s threads=auto

Warming up the data (Sequential read)

./nb run yaml=<yaml file path> tags=phase:verify secureconnectbundle=<secure bundle file path> username=<database username> password=<database user password> –show-stacktraces cycles=10000 –progress console:1s threads=auto

Example- ./nb run yaml=/home/woir/Downloads/test/cql-keyvalue10m.yaml tags=phase:verify secureconnectbundle=/home/woir/Downloads/secure-connect-test.zip username=user password=dcba –show-stacktraces cycles=10000 –progress console:1s threads=auto

Reading the data 

./nb run yaml=<yaml file path> tags=phase:main,type=read secureconnectbundle=<secure bundle file path> username=<database username> password=<database user password> –show-stacktraces cycles=10000 –progress console:1s threads=auto

Example- ./nb run yaml=/home/woir/Downloads/test/cql-keyvalue10m.yaml tags=phase:main,type=read secureconnectbundle=/home/woir/Downloads/secure-connect-test.zip username=user password=dcba –show-stacktraces cycles=10000 –progress console:1s threads=auto

Running Mixed Read and Write 

./nb run yaml=<yaml file path> tags=phase:main secureconnectbundle=<secure bundle file path> username=<database username> password=<database user password> –show-stacktraces cycles=10000 –progress console:1s threads=auto

Example- ./nb run yaml=/home/woir/Downloads/test/cql-keyvalue10m.yaml tags=phase:main secureconnectbundle=/home/woir/Downloads/secure-connect-test.zip username=user password=dcba –show-stacktraces cycles=10000 –progress console:1s threads=auto

One Response

  1. Amar Sharma says:

    Very nice post.

Comments are closed.