scylladb / cassandra-test-and-deploy

Apache License 2.0
30 stars 9 forks source link

Ansible Scylla and Cassandra Cluster Stress

A framework for running and automating Scylla/Cassandra stress tests on Amazon EC2.

This repository contains Ansible playbooks and scripts for running Scylla/Cassandra multi region performance tests on EC2 with multiple DB servers and multiple cassandra-stress loaders, as well as adding, stopping and starting nodes.

Introduction

The following will compare Scylla cluster to Cassandra cluster performance on EC2, using 6 loader servers

./ec2-setup-scylla.sh -e "cluster_nodes=2"
./ec2-setup-cassandra.sh -e "cluster_nodes=2"
./ec2-setup-loadgen.sh -e "load_nodes=6"
./ec2-stress.sh 1 -e "load_name=cassandra.v1" -e "server=Cassandra" -e "stress_options='-errors ignore'"
./ec2-stress.sh 1 -e "load_name=scylla.v1" -e "server=Scylla" -e "stress_options='-errors ignore'"

Note you will need more load nodes to stress Scylla.

Starting from Scylla 1.4, Scylla expose by default Prometheus metrics. More on monitoring Scylla

Which Scylla version is running?

Prerequisites

install

Make sure you installed the following:

config

export AWS_ACCESS_KEY_ID=<...>
export AWS_SECRET_ACCESS_KEY=<...>
eval `ssh-agent -s`

make sure permission are correct:

chmod 700 ~/.ssh
chmod 700 ~/.ssh/id_rsa.pub

Create security group

Do this only if you do not already have a security group you can use The following will create a EC2 security group called "cassandra-security-group", which is later used for all EC2 servers.

ansible-playbook -i inventories/ec2/ configure-security-group.yaml -e "security_group=cassandra-security-group" -e "region=your-ec2-region" -e "vpc_id=your-vpc"

Make sure to set one of the VPC subnet IDs on inventories/ec2/group_vars/all.yaml

You only need to run this once. Once security group exists, there is no need to repeat this step. You can use a different security group by adding -e "security_group=your_group_name" option to all ec2-setup-* scripts below.

Launch Scylla cluster

Scylla servers launch from Scylla AMI, base on CentOS 7 (login centos)

./ec2-setup-scylla.sh <options>

options

Server are created with EC2 name DB, and tag "server=Scylla"

Launch Cassandra cluster

Cassandra servers launch from AMI, base on Ubuntu 14 (login ubuntu)

./ec2-setup-cassandra.sh <options>

options

Server are created with EC2 name DB, and tag "server=Cassandra"

Launch Loaders

Loaders are launch from Scylla AMI, base on CentOS 7 (login centos), including a version of cassandra-stress which only use CQL, not thrift.

./ec2-setup-loadgen.sh <options>

options

Add nodes to existing cluster

./ec2-add-node-to-cluster.sh -e "server=Cassandra"

options

Add node only works for Cassandra clusters

Start stopped nodes (one by one)

./ec2-start-server.sh

Run Cassandra Stress Load

./ec2-stress.sh <iterations> -e "load_name=late_night" -e "server=Scylla" <more options>

for multi region (update the regions and replication for your needs)

./ec2-stress.sh 1 -e "load_name=cassandra.multi.v1" -e "server=Cassandra" -e "stress_options='-schema \"replication(strategy=NetworkTopologyStrategy,us-east_test=1,us-west-2_test=1)\" keyspace=\"mykeyspace\"'" 

Options All parameters are available at group_vars/all

To override each of the parameter, use the ``-e "param=value" notation. Examples below:

Make sure load name is unique so the new results will not override an old run in the same day.

Load name can not not include - (dash)

Run YCSB Load

(make to sure to create YCSB loaders in advance)

./ec2-stress-ycsb.sh <iterations> -e "load_name=late_night" -e "server=Scylla" <more options>

To override each of the parameter, use the ``-e "param=value" notation. Examples below:

Results

The results are automatically collected and copy to your local /tmp/cassandra-results/ directory, including summary files per load.

Stop and start nodes

Stop a server in the cluster

./ec2-stop-server.sh external_ip(s)

Stop and clean node data

./ec2-stop-server.sh external_ip -e "clean_data=true"

This will stop Cassandra service on this server, while keeping it in the cluster.

Use ./ec2-start-server.sh to start stopped servers, or just update the stopped tag back to false. The next stress test will restart the Cassandra service.

Terminate Servers

./ec2-terminate.sh

License

The Scylla/Cassandra Cluster Stress is distributed under the Apache License. See LICENSE.TXT for more.