Skip to content
Snippets Groups Projects
Commit 5f3f81ed authored by CK Phani Datta's avatar CK Phani Datta
Browse files

added dynamo db changes

parent b17c9efe
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,9 @@ parser.add_argument('--load', type=int, help='load on the system', required=True
parser.add_argument('--db', type=str, help='name of the database', required=True)
parser.add_argument('--endpoint', type=str, help='db endpoint', required=True)
parser.add_argument('--workload', type=str, help='workload a or b or c', required=True)
parser.add_argument('--pk', type=str, help='primary key for dynamodb', required=False)
parser.add_argument('--tablename', type=str, help='table name for dynamodb', required=False)
parser.add_argument('--region', type=str, help='region', required=False)
args = parser.parse_args()
max_vms = args.max_vms
......@@ -15,30 +18,41 @@ load = args.load
db = args.db
endpoint = args.endpoint
workload = args.workload
pk = args.pk
tablename = args.tablename
region = args.region
def get_load_command(db, load, vm):
ret =[]
if db=="redis":
for thread in [10, 50, 100, 500]:
for thread in [10,50,100,500]:
threads=thread//vm
ret.append("./bin/ycsb load redis -p recordcount={} -p redis.host='{}' -p redis.port=6379 -P workloads/workload{} -p redis.cluster=true > /tmp/redis_load_out_{}_{}.txt".format(load//vm, endpoint, workload, threads, vm))
elif db=="memcached":
for thread in [10, 50, 100, 500]:
for thread in [10,50,100,500]:
threads=thread//vm
ret.append("./bin/ycsb load memcached -p recordcount={} -P workloads/workload{} -p memcached.hosts={}:11211> /tmp/memcached_load_out_{}_{}.txt".format(load//vm, workload, endpoint, threads, vm))
elif db=="dynamodb":
for thread in [10,50,100,500]:
threads=thread//vm
ret.append("./bin/ycsb load dynamodb -s -p recordcount={} -p dynamodb.endpoint='{}' -P workloads/workload{} -p dynamodb.primaryKey={} -p dynamodb.tablename={} -p dynamodb.region={} > /tmp/dynamodb_load_out_{}_{}.txt".format(load//vm, endpoint, workload, pk, tablename, region, threads, vm))
return ret[0]
def get_run_command(db, load, vm):
ret =[]
if db=="redis":
for thread in [10, 50, 100, 500]:
for thread in [10,50,100,500]:
threads=thread//vm
ret.append("./bin/ycsb run redis -p operationcount={} -p redis.host='{}' -p redis.port=6379 -P workloads/workload{} -p redis.cluster=true> /tmp/redis_run_out_{}_{}.txt".format(load//vm, endpoint, workload, threads, vm))
elif db=="memcached":
for thread in [10, 50, 100, 500]:
for thread in [10,50,100,500]:
threads=thread//vm
ret.append("./bin/ycsb run memcached -p operationcount={} -P workloads/workload{} -p memcached.hosts={}:11211> /tmp/memcached_run_out_{}_{}.txt".format(load//vm, workload, endpoint, threads, vm))
elif db=="dynamodb":
for thread in [10,50,100,500]:
threads=thread//vm
ret.append("./bin/ycsb run dynamodb -p operationcount={} -p dynamodb.endpoint='{}' -P workloads/workload{} -p dynamodb.primaryKey={} -p dynamodb.tablename={} -p dynamodb.region={} > /tmp/dynamodb_run_out_{}_{}.txt".format(load//vm, endpoint, workload, pk, tablename, region, threads, vm))
return ret
......@@ -48,14 +62,13 @@ for vm in range(1,max_vms+1):
ips = []
with open("terraform.tfstate") as tf:
data=json.load(tf)
print("data ---->",data)
ips = json.loads(data["outputs"]["ec2_public_ip"]["value"])
for thread in [10, 50, 100, 500]:
threads=thread//vm
for ip in ips:
rep_ip = ip.replace(".","_")
if thread==10//vm:
os.system("sudo scp -o StrictHostKeyChecking=no -i cca.pem ec2-user@{}:/tmp/{}_load_out_{}_{}.txt ./{}_load_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm))
os.system("sudo scp -o StrictHostKeyChecking=no -i cca.pem ec2-user@{}:/tmp/{}_run_out_{}_{}.txt ./{}_run_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm))
os.system("sudo terraform destroy -var='instance_count={}' -var='runcmd1={}' -var='runcmd2={}' -var='runcmd3={}' -var='runcmd4={}' -var='loadcmd={}' -auto-approve".format(vm, run_commands[0], run_commands[1], run_commands[2], run_commands[3], get_load_command(db, load, vm)))
os.system("sudo python3 Graphs.py")
\ No newline at end of file
os.system("sudo scp -o StrictHostKeyChecking=no -i ycsb-key-pair.pem ec2-user@{}:/tmp/{}_load_out_{}_{}.txt ./{}_load_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm))
os.system("sudo scp -o StrictHostKeyChecking=no -i ycsb-key-pair.pem ec2-user@{}:/tmp/{}_run_out_{}_{}.txt ./{}_run_out_{}_{}_{}.txt".format(ip, db, threads, vm, db, rep_ip, threads, vm))
os.system("sudo terraform destroy -var='instance_count={}' -var='runcmd1={}' -var='runcmd2={}' -var='runcmd3={}' -var='runcmd4={}' -var='loadcmd={}' -auto-approve".format(vm, run_commands[0], run_commands[1], run_commands[2], run_commands[3], get_load_command(db, load, vm)))
\ No newline at end of file
......@@ -25,60 +25,42 @@ variable "loadcmd" {
provider "aws" {
access_key = ""
secret_key = ""
region = "us-east-2"
access_key = "AKIAYJPIDJWHZID2HUUK"
secret_key = "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"
region = "us-east-1"
}
# resource "aws_security_group" "allowallfts" {
# name_prefix = "allowallfts"
# ingress {
# from_port = 0
# to_port = 65535
# protocol = "tcp"
# cidr_blocks = ["0.0.0.0/0"]
# }
# egress {
# from_port = 0
# to_port = 65535
# protocol = "tcp"
# cidr_blocks = ["0.0.0.0/0"]
# }
# }
resource "aws_instance" "test_master" {
count = var.instance_count
ami = "ami-06d5c50c30a35fb88"
ami = "ami-06a0cd9728546d178"
instance_type = "t2.medium"
key_name = "cca"
key_name = "ycsb-key-pair"
vpc_security_group_ids = [
"sg-0c8877cfa1f19cd8a"
"sg-0b48727ff340e3719"
]
connection {
type = "ssh"
user = "ec2-user"
private_key = file("cca.pem")
private_key = file("ycsb-key-pair.pem")
host = self.public_ip
}
provisioner "remote-exec" {
inline = [
"set -e",
"sudo yum install -y telnet python37 maven",
"sudo amazon-linux-extras install java-openjdk11 -y",
"sudo curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.17.0/ycsb-0.17.0.tar.gz",
"sudo tar xfvz ycsb-0.17.0.tar.gz",
"cd ycsb-0.17.0",
"${var.loadcmd}",
"${var.runcmd1}",
"${var.runcmd2}",
"${var.runcmd3}",
"${var.runcmd4}"
]
}
inline = [
"set -e",
"sudo yum install -y telnet python3 maven",
"sudo amazon-linux-extras install java-openjdk11 -y",
"sudo curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.17.0/ycsb-0.17.0.tar.gz",
"sudo tar xfvz ycsb-0.17.0.tar.gz",
"cd ycsb-0.17.0",
"${var.loadcmd}",
"${var.runcmd1}",
"${var.runcmd2}",
"${var.runcmd3}",
"${var.runcmd4}"
]
}
}
output "ec2_public_ip" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment