Last active
June 30, 2016 11:36
-
-
Save daverigby/88580de480b5dd221928a4baa1ed8af7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| set -e | |
| # Ensure we kill all processes in our group on unclean failure | |
| trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM | |
| pillowfight_args="-U couchbase://127.0.0.1:12000/default --json --min-size 1000 --max-size 1000 --num-items 10000 --batch-size 1" | |
| # Remove ep_perfsutie from 'all' | |
| echo "set_target_properties(ep_perfsuite PROPERTIES EXCLUDE_FROM_ALL TRUE)" >> CMakeLists.txt | |
| # If we don't already have it, cherry-pick in time_sync patch | |
| if ! git merge-base --is-ancestor d23c7ea HEAD; then | |
| echo "* Cherry-picking time_sync patch (d23c7ea)" | |
| git cherry-pick -n d23c7ea | |
| fi | |
| # Adjust couchstore to C / C++ as necessary | |
| # 1) C++ API used in ep-engine from 7fb3c5de4b7f79658f9a23e900894802a1a546b8 | |
| # 2) Stopped using close_db in ep-engine from 14697e2ace529974d9bbb12fe8173a6d751a98bf | |
| if git merge-base --is-ancestor 14697e2ac HEAD; then | |
| echo "* Moving Couchstore to C++ API, without close_db (couchstore/master)" | |
| pushd ../couchstore | |
| git checkout couchbase/master | |
| popd | |
| elif git merge-base --is-ancestor 7fb3c5de4b HEAD; then | |
| echo "* Moving Couchstore to C++ API, with close_db (couchstore/ec270f4)" | |
| pushd ../couchstore | |
| git checkout ec270f4 | |
| popd | |
| else | |
| echo "* Moving Couchstore to C API (78c0c80)" | |
| pushd ../couchstore | |
| git checkout 78c0c80 | |
| popd | |
| fi | |
| # build | |
| echo "* Building" | |
| make -C .. -j32 >build.log || exit 125 | |
| # clear out ns_server's data | |
| make -C ../ns_server dataclean | |
| # Start cluster (in background) | |
| echo "* Starting cluster" | |
| pushd ../ns_server | |
| ./cluster_run 2> cluster_run.log & | |
| #cluster_pid=$! | |
| # initialise cluster | |
| rm -f cluster_connect.log | |
| while true; do | |
| if ./cluster_connect -n1 >>cluster_connect.log 2>&1; then | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| popd | |
| # Define view | |
| echo "* Defining view" | |
| while true; do | |
| if curl "http://localhost:9500/default/_design/dev_foo" -X PUT -H 'Content-Type: application/json' -d '{"views":{"bar":{"map":"function (doc, meta) {\n emit(meta.id, null);\n}"}}}'; then | |
| break | |
| fi | |
| sleep 1 | |
| done | |
| # populate with pillowfight (hardcoded sleep appears to be necessary otherwise get bad response from memcached :( | |
| sleep 10 | |
| echo "* Populating bucket" | |
| cbc-pillowfight ${pillowfight_args} --num-cycles 10000 | |
| # background workload with pillowfight (100 SET/s) | |
| echo "* Start background workload" | |
| cbc-pillowfight ${pillowfight_args} --no-population --rate-limit 100 --set-pct 100 > pillowfight.log & | |
| # Now the numbers - give everything 10s to stabilize | |
| sleep 10 | |
| echo "* Measuring latency" | |
| ab -q -e query.csv -n200 "http://localhost:9500/default/_design/dev_foo/_view/bar?stale=false&limit=10&full_set=true" >ab.log | |
| latency80=$(grep "80," query.csv | cut -d, -f 2) | |
| #Cleanup | |
| pkill -P $$ | |
| git reset --hard | |
| echo | |
| echo "Latency: $latency80" | |
| if (( $(echo "$latency80 < 150" |bc -l) )); then | |
| echo "good" | |
| exit 0 | |
| elif (( $(echo "$latency80 > 200" |bc -l) )); then | |
| echo "BAD" | |
| exit 1 | |
| else | |
| echo "unknown" | |
| exit 125 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment