11#! /bin/bash
22
3+ BPLOG_ROOT=" $GOPATH /src/github.com/bluemedora/bplogagent"
4+
5+ PROJECT=" bindplane-agent-dev-0"
6+ ZONE=" us-central1-a"
7+ INSTANCE=" rhel6"
8+
9+ if ! [ -x " $( command -v gcloud) " ]; then
10+ echo ' Error: gcloud is not installed.' >&2
11+ exit 1
12+ fi
13+
14+ if ! [ -x " $( command -v dot) " ]; then
15+ echo ' Error: dot is not installed.' >&2
16+ exit 1
17+ fi
18+
319echo " Building log agent"
4- GOOS=linux go build -o /tmp/bplogagent .. /cmd
20+ GOOS=linux go build -o /tmp/bplogagent $BPLOG_ROOT /cmd
521
6- echo " Copying log agent"
7- gcloud beta compute --project " ***REMOVED***" ssh --zone " us-east1-b" ' instance-1' -- ' rm -rf /tmp/benchmark && mkdir /tmp/benchmark'
8- gcloud beta compute --project " ***REMOVED***" scp --zone " us-east1-b" /tmp/bplogagent ' instance-1:/tmp/benchmark'
22+ echo " Building benchmark tool"
23+ GOOS=linux go build -o /tmp/logbench github.com/awslabs/amazon-log-agent-benchmark-tool/cmd/logbench/
924
10- echo " Downloading dependencies"
11- gcloud beta compute --project " ***REMOVED***" ssh --zone " us-east1-b" ' instance-1' -- \
12- ' gsutil cp gs://bplogagent-logbench/LogBench /tmp/benchmark/LogBench && chmod +x /tmp/benchmark/LogBench'
13- gcloud beta compute --project " ***REMOVED***" ssh --zone " us-east1-b" ' instance-1' -- \
14- ' gsutil cp gs://bplogagent-logbench/config.yaml /tmp/benchmark/config.yaml'
25+ echo " Setting up benchmark run on $PROJECT $ZONE $INSTANCE "
26+ gcloud beta compute --project " $PROJECT " ssh --zone " $ZONE " " $INSTANCE " -- ' rm -rf ~/benchmark && mkdir ~/benchmark'
27+ gcloud beta compute --project " $PROJECT " scp --zone " $ZONE " /tmp/bplogagent " $INSTANCE :~/benchmark"
28+ gcloud beta compute --project " $PROJECT " scp --zone " $ZONE " /tmp/logbench " $INSTANCE :~/benchmark/LogBench"
29+ gcloud beta compute --project " $PROJECT " scp --zone " $ZONE " $BPLOG_ROOT /scripts/benchmark/config.yaml " $INSTANCE :~/benchmark/config.yaml"
30+ gcloud beta compute --project " $PROJECT " ssh --zone " $ZONE " " $INSTANCE " -- ' chmod -R 777 ~/benchmark'
1531
1632echo " Running single-file benchmark"
17- gcloud beta compute --project " ***REMOVED***" ssh --zone " us-east1-b" ' instance-1' -- \
18- ' set -m ;
19- cd /tmp/benchmark ;
20- /tmp/benchmark/LogBench -log stream.log -rate 100 -t 60s -r 30s -f 2s /tmp/benchmark/bplogagent --config /tmp/benchmark/config.yaml > output1 &
33+ gcloud beta compute --project " $PROJECT " ssh --zone " $ZONE " " $INSTANCE " -- \
34+ ' set -m
35+ ~/benchmark/LogBench -log stream.log -rate 100 -t 60s -r 30s -f 2s ~/benchmark/bplogagent --config ~/benchmark/config.yaml > ~/benchmark/output1 2>&1 &
2136 sleep 10;
22- curl http://localhost:6060/debug/pprof/profile?seconds=30 > /tmp/ benchmark/profile1 ;
37+ curl http://localhost:6060/debug/pprof/profile?seconds=30 > ~/ benchmark/profile1 ;
2338 fg ; '
2439
2540echo " Running 20-file benchmark"
26- gcloud beta compute --project " ***REMOVED***" ssh --zone " us-east1-b" ' instance-1' -- \
27- ' set -m ;
28- cd /tmp/benchmark ;
29- /tmp/benchmark/LogBench -log $(echo stream{1..20}.log | tr " " ,) -rate 100 -t 60s -r 30s -f 2s /tmp/benchmark/bplogagent --config /tmp/benchmark/config.yaml > output20 &
41+ gcloud beta compute --project " $PROJECT " ssh --zone " $ZONE " " $INSTANCE " -- \
42+ ' set -m
43+ ~/benchmark/LogBench -log $(echo stream{1..20}.log | tr " " ,) -rate 100 -t 60s -r 30s -f 2s ~/benchmark/bplogagent --config ~/benchmark/config.yaml > ~/benchmark/output20 2>&1 &
3044 sleep 10;
31- curl http://localhost:6060/debug/pprof/profile?seconds=30 > /tmp/ benchmark/profile20 ;
45+ curl http://localhost:6060/debug/pprof/profile?seconds=30 > ~/ benchmark/profile20 ;
3246 fg ; '
3347
34- echo " Retrieving results"
35- output_dir=" /tmp/benchmark/$( date +%Y-%m-%d_%H-%M-%S) "
48+ output_dir=" $BPLOG_ROOT /tmp/$( date +%Y-%m-%d_%H-%M-%S) "
3649mkdir -p $output_dir
37- gcloud beta compute --project " ***REMOVED***" scp --zone " us-east1-b" ' instance-1:/tmp/benchmark/output*' " $output_dir "
38- gcloud beta compute --project " ***REMOVED***" scp --zone " us-east1-b" ' instance-1:/tmp/benchmark/profile*' " $output_dir "
39- echo " Results are located in $output_dir "
50+ echo " Results will be located in $output_dir "
51+
52+ echo " Retrieving results"
53+ gcloud beta compute --project " $PROJECT " scp --zone " $ZONE " " $INSTANCE :~/benchmark/output*" " $output_dir "
54+ gcloud beta compute --project " $PROJECT " scp --zone " $ZONE " " $INSTANCE :~/benchmark/profile*" " $output_dir "
55+
56+ echo " Opening profiles"
57+ go tool pprof -http localhost:6001 $output_dir /profile1 &
58+ go tool pprof -http localhost:6020 $output_dir /profile20 &
0 commit comments