Created
March 4, 2012 09:05
-
-
Save janl/1971611 to your computer and use it in GitHub Desktop.
This file contains 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/sh -e | |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | |
# use this file except in compliance with the License. You may obtain a copy of | |
# the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | |
# License for the specific language governing permissions and limitations under | |
# the License. | |
# | |
# usage: time benchbulk.sh | |
# it takes about 30 seconds to run on my old MacBook with bulksize 1000 | |
curl -sX PUT http://127.0.0.1:5984/_config/log/level -d '"none"' > /dev/null 2>&1 | |
BULKSIZE=100 | |
DOCSIZE=$1 | |
INSERTS=100 | |
ROUNDS=100 | |
DBURL="http://127.0.0.1:5984/benchbulk" | |
POSTURL="$DBURL/_bulk_docs" | |
function make_bulk_docs() { | |
ROW=0 | |
SIZE=$(($1-1)) | |
START=$2 | |
BODYSIZE=$3 | |
BODY=$(printf "%0${BODYSIZE}d") | |
echo '{"docs":[' | |
while [ $ROW -lt $SIZE ]; do | |
printf '{"_id":"%020d", "body":"'$BODY'"},' $(($ROW + $START)) | |
let ROW=ROW+1 | |
done | |
printf '{"_id":"%020d", "body":"'$BODY'"}' $(($ROW + $START)) | |
echo ']}' | |
} | |
#echo "Making $INSERTS bulk inserts of $BULKSIZE docs each" | |
#echo "Attempt to delete db at $DBURL" | |
curl -sX DELETE $DBURL > /dev/null 2>&1 | |
#echo "Attempt to create db at $DBURL" | |
curl -sX PUT $DBURL > /dev/null 2>&1 | |
#echo "Running $ROUNDS rounds of $INSERTS concurrent inserts to $POSTURL" | |
RUN=0 | |
while [ $RUN -lt $ROUNDS ]; do | |
POSTS=0 | |
while [ $POSTS -lt $INSERTS ]; do | |
STARTKEY=$[ POSTS * BULKSIZE + RUN * BULKSIZE * INSERTS ] | |
#echo "startkey $STARTKEY bulksize $BULKSIZE" | |
DOCS=$(make_bulk_docs $BULKSIZE $STARTKEY $DOCSIZE) | |
# echo $DOCS | |
echo $DOCS | curl -T - -H Content-Type:application/json -X POST $POSTURL -w%{http_code}\ %{time_total}\ sec\\n >/dev/null 2>&1 & | |
let POSTS=POSTS+1 | |
done | |
#echo "waiting" | |
wait | |
let RUN=RUN+1 | |
done | |
#curl $DBURL |
This file contains 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/sh -e | |
URL=http://127.0.0.1:5984/benchbulk | |
DDOC='{"views":{' | |
DDOC="${DDOC}\"by_body\":{\"map\":\"function(doc) {emit(doc._id, parseInt(doc._id));}\", \"reduce\":\"_sum\"}" | |
DDOC="${DDOC}}}" | |
curl -s $URL/_design/foo -X PUT -d "$DDOC" > /dev/null | |
echo "Building views." | |
time curl -s $URL/_design/foo/_view/by_body?limit=1 > /dev/null |
This file contains 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/sh -e | |
BB=`pwd` | |
cd /Volumes/Rust/couches | |
for couch in *; do | |
cd $couch | |
./bin/couchdb -b | |
sleep 3 | |
for docsize in 10 100 1000; do | |
for run in 1 2 3; do | |
echo "Start Run $run with doc size $docsize on $couch" | |
$BB/benchbulk.sh $docsize && $BB/benchview.sh | |
echo "End Run $run with doc size $docsize on $couch" | |
done | |
done | |
./bin/couchdb -d | |
sleep 3 | |
cd .. | |
done | |
echo "EOD"; |
This file contains 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
Start Run 1 with doc size 10 on 1.1.1-R15B | |
Building views. | |
real 1m45.342s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 1 with doc size 10 on 1.1.1-R15B | |
Start Run 2 with doc size 10 on 1.1.1-R15B | |
Building views. | |
real 1m45.986s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 2 with doc size 10 on 1.1.1-R15B | |
Start Run 3 with doc size 10 on 1.1.1-R15B | |
Building views. | |
real 1m46.125s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 3 with doc size 10 on 1.1.1-R15B | |
Start Run 1 with doc size 100 on 1.1.1-R15B | |
Building views. | |
real 1m59.339s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 1 with doc size 100 on 1.1.1-R15B | |
Start Run 2 with doc size 100 on 1.1.1-R15B | |
Building views. | |
real 1m59.495s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 2 with doc size 100 on 1.1.1-R15B | |
Start Run 3 with doc size 100 on 1.1.1-R15B | |
Building views. | |
real 1m59.499s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 3 with doc size 100 on 1.1.1-R15B | |
Start Run 1 with doc size 1000 on 1.1.1-R15B | |
Building views. | |
real 3m39.640s | |
user 0m0.006s | |
sys 0m0.006s | |
End Run 1 with doc size 1000 on 1.1.1-R15B | |
Start Run 2 with doc size 1000 on 1.1.1-R15B | |
Building views. | |
real 3m37.692s | |
user 0m0.006s | |
sys 0m0.006s | |
End Run 2 with doc size 1000 on 1.1.1-R15B | |
Start Run 3 with doc size 1000 on 1.1.1-R15B | |
Building views. | |
real 3m38.056s | |
user 0m0.006s | |
sys 0m0.007s | |
End Run 3 with doc size 1000 on 1.1.1-R15B | |
Start Run 1 with doc size 10 on 1.2.x-R15B | |
Building views. | |
real 2m20.839s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 1 with doc size 10 on 1.2.x-R15B | |
Start Run 2 with doc size 10 on 1.2.x-R15B | |
Building views. | |
real 2m20.878s | |
user 0m0.005s | |
sys 0m0.006s | |
End Run 2 with doc size 10 on 1.2.x-R15B | |
Start Run 3 with doc size 10 on 1.2.x-R15B | |
Building views. | |
real 2m20.753s | |
user 0m0.006s | |
sys 0m0.006s | |
End Run 3 with doc size 10 on 1.2.x-R15B | |
Start Run 1 with doc size 100 on 1.2.x-R15B | |
Building views. | |
real 2m30.956s | |
user 0m0.005s | |
sys 0m0.006s | |
End Run 1 with doc size 100 on 1.2.x-R15B | |
Start Run 2 with doc size 100 on 1.2.x-R15B | |
Building views. | |
real 2m30.508s | |
user 0m0.005s | |
sys 0m0.006s | |
End Run 2 with doc size 100 on 1.2.x-R15B | |
Start Run 3 with doc size 100 on 1.2.x-R15B | |
Building views. | |
real 2m27.685s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 3 with doc size 100 on 1.2.x-R15B | |
Start Run 1 with doc size 1000 on 1.2.x-R15B | |
Building views. | |
real 3m44.097s | |
user 0m0.006s | |
sys 0m0.007s | |
End Run 1 with doc size 1000 on 1.2.x-R15B | |
Start Run 2 with doc size 1000 on 1.2.x-R15B | |
Building views. | |
real 3m53.618s | |
user 0m0.006s | |
sys 0m0.007s | |
End Run 2 with doc size 1000 on 1.2.x-R15B | |
Start Run 3 with doc size 1000 on 1.2.x-R15B | |
Building views. | |
real 3m43.803s | |
user 0m0.006s | |
sys 0m0.007s | |
End Run 3 with doc size 1000 on 1.2.x-R15B | |
real 1m38.128s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 1 with doc size 10 on 1.2.x-filipe-R15B | |
Start Run 2 with doc size 10 on 1.2.x-filipe-R15B | |
Building views. | |
real 1m38.067s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 2 with doc size 10 on 1.2.x-filipe-R15B | |
Start Run 3 with doc size 10 on 1.2.x-filipe-R15B | |
Building views. | |
real 1m38.154s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 3 with doc size 10 on 1.2.x-filipe-R15B | |
Start Run 1 with doc size 100 on 1.2.x-filipe-R15B | |
Building views. | |
real 1m45.980s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 1 with doc size 100 on 1.2.x-filipe-R15B | |
Start Run 2 with doc size 100 on 1.2.x-filipe-R15B | |
Building views. | |
real 1m45.418s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 2 with doc size 100 on 1.2.x-filipe-R15B | |
Start Run 3 with doc size 100 on 1.2.x-filipe-R15B | |
Building views. | |
real 1m44.932s | |
user 0m0.005s | |
sys 0m0.005s | |
End Run 3 with doc size 100 on 1.2.x-filipe-R15B | |
Start Run 1 with doc size 1000 on 1.2.x-filipe-R15B | |
Building views. | |
real 2m34.975s | |
user 0m0.005s | |
sys 0m0.006s | |
End Run 1 with doc size 1000 on 1.2.x-filipe-R15B | |
Start Run 2 with doc size 1000 on 1.2.x-filipe-R15B | |
Building views. | |
real 2m35.001s | |
user 0m0.005s | |
sys 0m0.006s | |
End Run 2 with doc size 1000 on 1.2.x-filipe-R15B | |
Start Run 3 with doc size 1000 on 1.2.x-filipe-R15B | |
Building views. | |
real 2m35.142s | |
user 0m0.005s | |
sys 0m0.006s | |
End Run 3 with doc size 1000 on 1.2.x-filipe-R15B | |
Apache CouchDB has been shutdown. | |
EOD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment