Skip to content

Commit

Permalink
Make benchmark/ycsb.js work with PerfkitBenchmarker. (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
haihuang-ml authored and stephenplusplus committed Feb 8, 2018
1 parent ea081c9 commit e5d47d8
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
43 changes: 43 additions & 0 deletions benchmark/bin/ycsb
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Copyright 2018 Google LLC
#
# 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

# A YCSB-like executable that can be integrated into PerfKitBenchmarker.
#
# It is intended to be run in a VM that is brought up by PerfKitBenchmarker
# with node.js, npm, and google-cloud for nodejs installed. The environment can
# be configured as follows:
#
# curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh \
# | bash
# export NVM_DIR="$HOME/.nvm"
# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
# nvm install stable'
# nvm alias default stable')
# npm install --save express @google-cloud/storage @google-cloud/common-grpc \
# binary-search-bounds dedent fs path stats-lite yargs checkpoint-stream
# lodash.chunk merge-stream google-gax lodash.flatten delay p-queue \
# stack-trace lodash.snakecase lodash.random time-span
# sudo sudo apt-get -y install git
# git clone https://github.com/googleapis/nodejs-spanner.git

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

ln -s ${HOME}/nodejs-spanner/src ${DIR}/../../src
ln -s ${HOME}/node_modules ${DIR}/../node_modules

node ${DIR}/../ycsb.js run "${@:4}"
4 changes: 2 additions & 2 deletions benchmark/ycsb.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ function printMetrics(workload) {
const opName = `[${operation.toUpperCase()}]`;

console.log(
dedent`${opName}, Operations ${ops}
dedent`${opName}, Operations, ${ops}
${opName}, AverageLatency(us), ${stats.mean(lats)}
${opName}, LatencyVariance(us), ${stats.stdev(lats)}
${opName}, MinLatency(us), ${lats[0]}
${opName}, MaxLatency(us), ${lats[lats.length - 1]}
${opName}, 95thPercentileLatency(us), ${stats.percentile(lats, 0.95)}
${opName}, 99thPercentileLatency(us), ${stats.percentile(lats, 0.99)}
${opName}, 99.9thPercentileLatency(us), ${stats.percentile(lats, 0.999)}
${opName}, Return=OK ${ops}`
${opName}, Return=OK, ${ops}`
);

for (let i = 0; i < numBucket; i++) {
Expand Down

0 comments on commit e5d47d8

Please sign in to comment.