Improve log readability & polish scenario parameters

pull/21904/head
Lidi Zheng 5 years ago
parent 03e1bf1071
commit 68be8a7742
  1. 19
      src/python/grpcio_tests/tests_aio/benchmark/worker_servicer.py
  2. 19
      tools/run_tests/performance/scenario_config.py

@ -34,12 +34,24 @@ from tests.unit.framework.common import get_socket
_NUM_CORES = multiprocessing.cpu_count() _NUM_CORES = multiprocessing.cpu_count()
_NUM_CORE_PYTHON_CAN_USE = 1 _NUM_CORE_PYTHON_CAN_USE = 1
_WORKER_ENTRY_FILE = os.path.split(os.path.abspath(__file__))[0] + '/worker.py' _WORKER_ENTRY_FILE = os.path.split(os.path.abspath(__file__))[0] + '/worker.py'
_SubWorker = collections.namedtuple('_SubWorker',
['process', 'port', 'channel', 'stub'])
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
class _SubWorker(
collections.namedtuple('_SubWorker',
['process', 'port', 'channel', 'stub'])):
def _repr(self):
return f'<_SubWorker pid={self.process.pid} port={self.port}>'
def __repr__(self):
return self._repr()
def __str__(self):
return self._repr()
def _get_server_status(start_time: float, end_time: float, def _get_server_status(start_time: float, end_time: float,
port: int) -> control_pb2.ServerStatus: port: int) -> control_pb2.ServerStatus:
end_time = time.time() end_time = time.time()
@ -231,9 +243,8 @@ class WorkerServicer(worker_service_pb2_grpc.WorkerServiceServicer):
for worker in sub_workers: for worker in sub_workers:
await worker.stub.QuitWorker(control_pb2.Void()) await worker.stub.QuitWorker(control_pb2.Void())
await worker.channel.close() await worker.channel.close()
_LOGGER.info('Waiting for sub worker [%s] to quit...', worker) _LOGGER.info('Waiting for [%s] to quit...', worker)
await worker.process.wait() await worker.process.wait()
_LOGGER.info('Sub worker [%s] quit', worker)
async def _run_single_client(self, config, request_iterator, context): async def _run_single_client(self, config, request_iterator, context):
running_tasks = [] running_tasks = []

@ -829,22 +829,29 @@ class PythonAsyncIOLanguage:
return 1200 return 1200
def scenarios(self): def scenarios(self):
yield _ping_pong_scenario( for outstanding in [32, 64, 128, 256]:
'python_asyncio_protobuf_async_unary_ping_pong_64_max', for channels in [1, 5]:
yield _ping_pong_scenario(
'python_asyncio_protobuf_async_unary_ping_pong_%dx%d_max' %
(
outstanding,
channels,
),
rpc_type='UNARY', rpc_type='UNARY',
client_type='ASYNC_CLIENT', client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER', server_type='ASYNC_SERVER',
outstanding=64, outstanding=outstanding,
channels=1, channels=channels,
unconstrained_client='async', unconstrained_client='async',
categories=[SMOKETEST, SCALABLE]) categories=[SMOKETEST, SCALABLE])
yield _ping_pong_scenario( yield _ping_pong_scenario(
'python_asyncio_protobuf_async_unary_ping_pong_128_1thread', 'python_asyncio_protobuf_async_unary_ping_pong_%d_1thread' %
outstanding,
rpc_type='UNARY', rpc_type='UNARY',
client_type='ASYNC_CLIENT', client_type='ASYNC_CLIENT',
server_type='ASYNC_SERVER', server_type='ASYNC_SERVER',
outstanding=128, outstanding=outstanding,
channels=1, channels=1,
async_client_threads=1, async_client_threads=1,
async_server_threads=1, async_server_threads=1,

Loading…
Cancel
Save