Skip to content

Commit

Permalink
Merge pull request grpc#6210 from jtattermusch/benchmarking_add_java
Browse files Browse the repository at this point in the history
Support Java performance worker in run_performance_tests.py
  • Loading branch information
jtattermusch committed Apr 19, 2016
2 parents ffc522b + de874a1 commit 1773590
Show file tree
Hide file tree
Showing 5 changed files with 110 additions and 9 deletions.
13 changes: 10 additions & 3 deletions tools/run_tests/performance/build_performance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,15 @@ make CONFIG=${CONFIG} EMBED_OPENSSL=true EMBED_ZLIB=true qps_worker qps_driver q

for language in $@
do
if [ "$language" != "c++" ]
then
case "$language" in
"c++")
;; # C++ has already been built.
"java")
(cd ../grpc-java/ &&
./gradlew -PskipCodegen=true :grpc-benchmarks:installDist)
;;
*)
tools/run_tests/run_tests.py -l $language -c $CONFIG --build_only -j 8
fi
;;
esac
done
2 changes: 2 additions & 0 deletions tools/run_tests/performance/remote_host_prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ ssh "${USER_AT_HOST}" "rm -rf ~/performance_workspace && mkdir -p ~/performance_
# TODO(jtattermusch): To be sure there are no running processes that would
# mess with the results, be rough and reboot the slave here
# and wait for it to come back online.
# TODO(jtattermusch): Kill all java QpsWorkers, but killall java
# could also kill jenkins.
ssh "${USER_AT_HOST}" "killall -9 qps_worker mono node ruby || true"

# push the current sources to the slave and unpack it.
Expand Down
39 changes: 39 additions & 0 deletions tools/run_tests/performance/run_worker_java.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

set -ex

# Enter repo root
cd $(dirname $0)/../../..

# Enter the grpc-java repo root (expected to be next to grpc repo root)
cd ../grpc-java

benchmarks/build/install/grpc-benchmarks/bin/benchmark_worker $@
50 changes: 49 additions & 1 deletion tools/run_tests/performance/scenario_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

SINGLE_MACHINE_CORES=8
WARMUP_SECONDS=5
JAVA_WARMUP_SECONDS=15 # Java needs more warmup time for JIT to kick in.
BENCHMARK_SECONDS=30

HISTOGRAM_PARAMS = {
Expand Down Expand Up @@ -475,9 +476,56 @@ def __str__(self):
return 'ruby'


class JavaLanguage:

def __init__(self):
pass
self.safename = str(self)

def worker_cmdline(self):
return ['tools/run_tests/performance/run_worker_java.sh']

def worker_port_offset(self):
return 400

def scenarios(self):
# TODO(jtattermusch): add more scenarios
secargs = None
yield {
'name': 'java_protobuf_unary_ping_pong',
'num_servers': 1,
'num_clients': 1,
'client_config': {
'client_type': 'SYNC_CLIENT',
'security_params': secargs,
'outstanding_rpcs_per_channel': 1,
'client_channels': 1,
'async_client_threads': 1,
'rpc_type': 'UNARY',
'load_params': {
'closed_loop': {}
},
'payload_config': EMPTY_PROTO_PAYLOAD,
'histogram_params': HISTOGRAM_PARAMS,
},
'server_config': {
'server_type': 'SYNC_SERVER',
'security_params': secargs,
'core_limit': 0,
'async_server_threads': 1,
},
'warmup_seconds': JAVA_WARMUP_SECONDS,
'benchmark_seconds': BENCHMARK_SECONDS
}

def __str__(self):
return 'java'


LANGUAGES = {
'c++' : CXXLanguage(),
'csharp' : CSharpLanguage(),
'node' : NodeLanguage(),
'ruby' : RubyLanguage()
'ruby' : RubyLanguage(),
'java' : JavaLanguage(),
}
15 changes: 10 additions & 5 deletions tools/run_tests/run_performance_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,16 @@ def create_quit_jobspec(workers, remote_host=None):
verbose_success=True)


def archive_repo():
def archive_repo(languages):
"""Archives local version of repo including submodules."""
# TODO: also archive grpc-go and grpc-java repos
cmdline=['tar', '-cf', '../grpc.tar', '../grpc/']
if 'java' in languages:
cmdline.append('../grpc-java')
if 'go' in languages:
cmdline.append('../grpc-go')

archive_job = jobset.JobSpec(
cmdline=['tar', '-cf', '../grpc.tar', '../grpc/'],
cmdline=cmdline,
shortname='archive_repo',
timeout_seconds=3*60)

Expand All @@ -144,7 +149,7 @@ def archive_repo():
[archive_job], newline_on_success=True, maxjobs=1)
if num_failures == 0:
jobset.message('SUCCESS',
'Archive with local repository create successfully.',
'Archive with local repository created successfully.',
do_newline=True)
else:
jobset.message('FAILED', 'Failed to archive local repository.',
Expand Down Expand Up @@ -316,7 +321,7 @@ def finish_qps_workers(jobs):
remote_hosts.add(args.remote_driver_host)

if remote_hosts:
archive_repo()
archive_repo(languages=[str(l) for l in languages])
prepare_remote_hosts(remote_hosts)

build_local = False
Expand Down

0 comments on commit 1773590

Please sign in to comment.