diff --git a/src/ruby/qps/server.rb b/src/ruby/qps/server.rb index 26f46a31409c6ad416f02fe08eab1171e9ecf36e..f05fbbdaaf9fe5eb72bfe86d87dac4f0562184c3 100644 --- a/src/ruby/qps/server.rb +++ b/src/ruby/qps/server.rb @@ -88,4 +88,7 @@ class BenchmarkServer def get_port @port end + def stop + @server.stop + end end diff --git a/src/ruby/qps/worker.rb b/src/ruby/qps/worker.rb index 7c29204cc2c2c7171793110e1fc95002ce566bb4..665fb863526ba722ab6d000f35f0b14a40e9fec5 100755 --- a/src/ruby/qps/worker.rb +++ b/src/ruby/qps/worker.rb @@ -55,12 +55,12 @@ class WorkerServiceImpl < Grpc::Testing::WorkerService::Service Thread.new { bms = '' gtss = Grpc::Testing::ServerStatus - reqs.each do |req| + reqs.each do |req| case req.argtype.to_s when 'setup' bms = BenchmarkServer.new(req.setup, @server_port) q.push(gtss.new(stats: bms.mark(false), port: bms.get_port)) - when 'mark' + when 'mark' q.push(gtss.new(stats: bms.mark(req.mark.reset), cores: cpu_cores)) end end diff --git a/tools/run_tests/performance/remote_host_prepare.sh b/tools/run_tests/performance/remote_host_prepare.sh index 18633d1420e487d82746f84c054228a6acd68972..f52cccd2e2494e8851d62dad82d4b14760a68d21 100755 --- a/tools/run_tests/performance/remote_host_prepare.sh +++ b/tools/run_tests/performance/remote_host_prepare.sh @@ -38,7 +38,7 @@ 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. -ssh "${USER_AT_HOST}" "killall qps_worker mono node || true" +ssh "${USER_AT_HOST}" "killall -9 qps_worker mono node ruby || true" # push the current sources to the slave and unpack it. scp ../grpc.tar "${USER_AT_HOST}:~/performance_workspace" diff --git a/tools/run_tests/performance/run_worker_ruby.sh b/tools/run_tests/performance/run_worker_ruby.sh new file mode 100755 index 0000000000000000000000000000000000000000..c9e8acb9e4716915fb0e5273fd6503e61b41d976 --- /dev/null +++ b/tools/run_tests/performance/run_worker_ruby.sh @@ -0,0 +1,35 @@ +#!/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 + +cd $(dirname $0)/../../.. + +ruby src/ruby/qps/worker.rb $@ diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py index bd10b6f0324d72866c8b56cca4addd8b520ea9c8..c7b997f4ff2dd4b8046cc0501b157bb361b3c4bf 100644 --- a/tools/run_tests/performance/scenario_config.py +++ b/tools/run_tests/performance/scenario_config.py @@ -429,8 +429,55 @@ class NodeLanguage: return 'node' +class RubyLanguage: + + def __init__(self): + pass + self.safename = str(self) + + def worker_cmdline(self): + return ['tools/run_tests/performance/run_worker_ruby.sh'] + + def worker_port_offset(self): + return 300 + + def scenarios(self): + # TODO(jtattermusch): add more scenarios + secargs = None + yield { + 'name': 'ruby_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': WARMUP_SECONDS, + 'benchmark_seconds': BENCHMARK_SECONDS + } + + def __str__(self): + return 'ruby' + + LANGUAGES = { 'c++' : CXXLanguage(), 'csharp' : CSharpLanguage(), 'node' : NodeLanguage(), + 'ruby' : RubyLanguage() } diff --git a/tools/run_tests/pre_build_ruby.sh b/tools/run_tests/pre_build_ruby.sh index 569a1d0333b8876dfca778bd3c1c90dad23d6c5d..e7074c45c2dc492ef20e423e837ed0cd091f6d3c 100755 --- a/tools/run_tests/pre_build_ruby.sh +++ b/tools/run_tests/pre_build_ruby.sh @@ -33,7 +33,7 @@ set -ex export GRPC_CONFIG=${CONFIG:-opt} -# change to grpc's ruby directory -cd $(dirname $0)/../../src/ruby +# change to grpc repo root +cd $(dirname $0)/../.. bundle install