Use ycsb to test cassandra Performance

Source: Internet
Author: User
Tags cassandra
For installation and configuration of java, maven, and ycsb, see this blog: blog. csdn. neths794262825articledetails17309845 this blog introduces how to install cassandra and how to use ycsb to test cassandra in cassandra. apache. orgdownload download the latest version

Java, maven, ycsb installation and configuration see this blog: http://blog.csdn.net/hs794502825/article/details/17309845 this blog mainly introduces the installation of cassandra, and the use of ycsb on cassandra basic test on the http://cassandra.apache.org/download/ download the latest version

For installation and configuration of java, maven, and ycsb, see this blog:
Http://blog.csdn.net/hs794502825/article/details/17309845

This blog introduces how to install cassandra and how to use ycsb to perform basic tests on cassandra.
Download the latest http://cassandra.apache.org/download/ on the apache-cassandra-2.0.3-bin.tar.gz and store it in the/home/hs/program directory.
cd /home/hs/programtar -zxvf apache-cassandra-2.0.3-bin.tar.gz
Then set the environment variable for cassandra
Sudo gedit/etc/profile
Add at the end of the file:
#set cassandra environmentexport CASSANDRA_HOME=/home/hs/program/apache-cassandra-2.0.3export PATH=$PATH:$CASSANDRA_HOME/bin:$CASSANDRA_HOME/lib
Then, I directly run cassandra-f as a common user (hs ).
Many errors are displayed, most of which are related to this:
Unable to generate Directory:/var/lib/cassandra/...... and/var/log/cassandra /......

The permissions of the var directory are as follows:
Drwxr-xr-x 13 root 4096
Only the owner root has the write permission on it.

The directory where cassandra needs to generate data and log information. The default value is
/Var/lib/cassandra/AND/var/log/cassandra/

Then, run the following command under the hs User:
Sudo mkdir/var/lib/cassandrasudo mkdir/var/log/cassandrachown-R hs: hs/var/lib/cassandrachown-R hs: hs/var/log/cassandra, hs has the permission to write/var/lib/cassandra/AND/var/log/cassandra/. Run cassandra: cassandra-f in Terminal 1 if Listening for thrift clients... then, cassandra is successfully started. Run cassandra-cli: cassandra-cli in Terminal 2:
Connected to: "Test Cluster" on 127.0.0.1/9160Welcome to Cassandra CLI version 2.0.3The CLI is deprecated and will be removed in Cassandra 3.0.  Consider migrating to cqlsh.CQL is fully backwards compatible with Thrift data; see http://www.datastax.com/dev/blog/thrift-to-cql3

As prompted, I terminated cassandra-cli and switched to cqlsh.
hs@hs-virtual-machine:~$ cqlshConnected to Test Cluster at localhost:9160.[cqlsh 4.1.0 | Cassandra 2.0.3 | CQL spec 3.1.1 | Thrift protocol 19.38.0]

The following error occurs during keyspace creation:
Cqlsh> create keyspace with strategy_class = 'simplestrategy' and strategy_options: replication_factor = '1 ';
Bad Request: line 1: 75 mismatched input ': 'pecting' ='
The command for creating keyspace in the above line is copied from the cqlsh official website, so I don't know how to solve it. The first time I came into contact with cqlsh

Use cassandra-cli later (note that all commands must end)
create keyspace usertable;use usertable;create column family data;

Run ycsb in Terminal 3:
./bin/ycsb load cassandra-10 -P workloads/workloada -p hosts=localhost -p columnfamily=data > ./my-results/load-cassandra-a

The following error is returned:
Loading workload...Starting test.InvalidRequestException(why:unconfigured columnfamily data)at org.apache.cassandra.thrift.Cassandra$batch_mutate_result.read(Cassandra.java:20833)at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78)at org.apache.cassandra.thrift.Cassandra$Client.recv_batch_mutate(Cassandra.java:964)at org.apache.cassandra.thrift.Cassandra$Client.batch_mutate(Cassandra.java:950)at com.yahoo.ycsb.db.CassandraClient10.insert(CassandraClient10.java:477)at com.yahoo.ycsb.DBWrapper.insert(DBWrapper.java:148)at com.yahoo.ycsb.workloads.CoreWorkload.doInsert(CoreWorkload.java:461)at com.yahoo.ycsb.ClientThread.run(Client.java:269)

A problem occurred while creating column family.
So I deleted the column family from Terminal 2 and rebuilt it.
drop column family data;create column family data with column_type = 'Standard' and comparator = 'UTF8Type';

Return to Terminal 3 and run ycsb again:
./bin/ycsb load cassandra-10 -P workloads/workloada -p hosts=localhost -p columnfamily=data > ./my-results/load-cassandra-a

The following result is displayed:
YCSB Client 0.1Command line: -db com.yahoo.ycsb.db.CassandraClient10 -P workloads/workloada -p hosts=localhost -p columnfamily=data -load[OVERALL], RunTime(ms), 2287.0[OVERALL], Throughput(ops/sec), 437.25404459991256[INSERT], Operations, 1000[INSERT], AverageLatency(us), 1670.687[INSERT], MinLatency(us), 476[INSERT], MaxLatency(us), 280228[INSERT], 95thPercentileLatency(ms), 3[INSERT], 99thPercentileLatency(ms), 12[INSERT], Return=0, 1000......

Run:
./bin/ycsb run cassandra-10 -P workloads/workloada -p hosts=localhost -p columnfamily=data > ./my-results/run-cassandra-a

The following result is displayed:
YCSB Client 0.1Command line: -db com.yahoo.ycsb.db.CassandraClient10 -P workloads/workloada -p hosts=localhost -p columnfamily=data -t[OVERALL], RunTime(ms), 5574.0[OVERALL], Throughput(ops/sec), 179.4043774668102[UPDATE], Operations, 475[UPDATE], AverageLatency(us), 2095.0547368421053[UPDATE], MinLatency(us), 327[UPDATE], MaxLatency(us), 143093[UPDATE], 95thPercentileLatency(ms), 9[UPDATE], 99thPercentileLatency(ms), 33[UPDATE], Return=0, 475......[READ], Operations, 525[READ], AverageLatency(us), 5054.5085714285715[READ], MinLatency(us), 492[READ], MaxLatency(us), 674167[READ], 95thPercentileLatency(ms), 11[READ], 99thPercentileLatency(ms), 85[READ], Return=0, 525

In the next stage, you must be familiar with cassandra operations and use cqlsh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.